Add CLAUDE.md, AGENTS.md, docs (context, ADR, runbooks, handoffs), coordination docs and Gitea issue/PR templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
511 lines
14 KiB
Markdown
511 lines
14 KiB
Markdown
Sì: ti preparo un setup concreto, con una struttura pensata per **Gitea Issues come board**, `CLAUDE.md` per Claude Code, `AGENTS.md` per compatibilità cross-agent e documentazione minima ma rigorosa in repo. `CLAUDE.md` è il punto giusto per istruire Claude Code a livello progetto, mentre `AGENTS.md` è ormai il formato consigliato per dare istruzioni repository-level a Codex e ad altri coding agent. [agents](https://agents.md)
|
||
|
||
Ti propongo un setup **pragmatico e leggero**, così puoi introdurlo subito nella codebase attuale senza stravolgere tutto. Gitea supporta template per issue e PR direttamente nel branch di default, quindi possiamo anche preparare una struttura che funziona bene con i tuoi repository self-hosted. [docs.gitea](https://docs.gitea.com/usage/issue-pull-request-templates)
|
||
|
||
## Struttura repo
|
||
Questa è la struttura che ti consiglio di aggiungere in root: [developers.openai](https://developers.openai.com/codex/guides/agents-md)
|
||
|
||
```text
|
||
/
|
||
├─ CLAUDE.md
|
||
├─ AGENTS.md
|
||
├─ README.md
|
||
├─ docs/
|
||
│ ├─ adr/
|
||
│ │ ├─ README.md
|
||
│ │ └─ 0001-record-architecture-decisions.md
|
||
│ ├─ handoffs/
|
||
│ │ ├─ README.md
|
||
│ │ └─ TEMPLATE.md
|
||
│ ├─ runbooks/
|
||
│ │ ├─ README.md
|
||
│ │ ├─ local-dev.md
|
||
│ │ ├─ testing.md
|
||
│ │ └─ deploy.md
|
||
│ └─ context/
|
||
│ ├─ product-scope.md
|
||
│ ├─ module-map.md
|
||
│ └─ known-constraints.md
|
||
├─ coordination/
|
||
│ ├─ README.md
|
||
│ ├─ workflow.md
|
||
│ ├─ labels.md
|
||
│ └─ issue-lifecycle.md
|
||
└─ .gitea/
|
||
├─ ISSUE_TEMPLATE/
|
||
│ ├─ feature.md
|
||
│ ├─ bug.md
|
||
│ ├─ refactor.md
|
||
│ └─ chore.md
|
||
└─ PULL_REQUEST_TEMPLATE.md
|
||
```
|
||
|
||
## Logica dei file
|
||
- `CLAUDE.md`: onboarding e regole per Claude Code; Claude Code lo carica automaticamente come memoria/instruction file di progetto. [builder](https://www.builder.io/blog/claude-md-guide)
|
||
- `AGENTS.md`: contratto operativo comune per Codex e altri agenti; OpenAI raccomanda esplicitamente di aggiungerlo in root per far rispettare aspettative di repo e workflow. [github](https://github.com/agentsmd/agents.md)
|
||
- `docs/adr/`: decisioni permanenti; serve a non lasciare scelte architetturali solo nelle chat o nei commenti issue. [humanlayer](https://www.humanlayer.dev/blog/writing-a-good-claude-md)
|
||
- `.gitea/ISSUE_TEMPLATE/`: Gitea supporta più template issue e PR nel branch di default, quindi qui possiamo standardizzare bene il task intake. [docs.gitea](https://docs.gitea.com/usage/issue-pull-request-templates)
|
||
|
||
## CLAUDE.md
|
||
Ti propongo una prima versione molto concreta: [reddit](https://www.reddit.com/r/ClaudeAI/comments/1r66oo0/how_i_structure_claude_code_projects_claudemd/)
|
||
|
||
```md
|
||
# CLAUDE.md
|
||
|
||
## Project purpose
|
||
This repository contains the source code for [NOME PROGETTO].
|
||
Primary goal: [obiettivo sintetico del progetto].
|
||
Secondary goals: [vincoli o obiettivi secondari].
|
||
|
||
## Working model
|
||
This repository uses a repo-first agent workflow.
|
||
The repository is the source of truth.
|
||
Do not rely on chat memory as the authoritative project memory.
|
||
|
||
Before starting work:
|
||
1. Read `AGENTS.md`
|
||
2. Read relevant files in `docs/context/`
|
||
3. Read related ADRs in `docs/adr/`
|
||
4. Check the active Gitea issue and its acceptance criteria
|
||
5. Read the latest relevant file in `docs/handoffs/`
|
||
|
||
## Rules
|
||
- Do not start work without an issue or explicit user instruction
|
||
- Do not change unrelated files
|
||
- Prefer minimal, reversible changes
|
||
- Preserve existing architecture unless the issue explicitly asks for refactor
|
||
- Record durable architectural decisions in `docs/adr/`
|
||
- Record end-of-session handoff in `docs/handoffs/`
|
||
- If a task changes developer workflow, update `docs/runbooks/`
|
||
- If a task changes project structure, update `docs/context/module-map.md`
|
||
|
||
## Quality gate
|
||
Before considering work complete:
|
||
- Run relevant tests
|
||
- Run lint/format checks where available
|
||
- Verify no accidental file changes are included
|
||
- Update docs if behavior or workflow changed
|
||
- Write a concise handoff
|
||
|
||
## Commands
|
||
Add the real commands for this repo here, for example:
|
||
- Install: `...`
|
||
- Dev: `...`
|
||
- Test: `...`
|
||
- Lint: `...`
|
||
- Build: `...`
|
||
- Typecheck: `...`
|
||
|
||
## Architecture notes
|
||
Add only high-value orientation notes here, not full documentation.
|
||
Keep this file concise.
|
||
For details, link to:
|
||
- `docs/context/module-map.md`
|
||
- `docs/context/known-constraints.md`
|
||
- `docs/runbooks/*.md`
|
||
```
|
||
|
||
## AGENTS.md
|
||
Questo file deve essere ancora più neutro e cross-tool: [agents](https://agents.md)
|
||
|
||
```md
|
||
# AGENTS.md
|
||
|
||
## Repository expectations
|
||
This repository is designed to be worked on by multiple coding agents and humans.
|
||
All agents must follow the same repo-first workflow.
|
||
|
||
## Source of truth
|
||
- Codebase and versioned docs are authoritative
|
||
- Gitea Issues are the official task board
|
||
- ADRs are authoritative for architectural decisions
|
||
- Handoffs summarize session state, but do not replace ADRs
|
||
- External shared memory is operational only, not the final source of truth
|
||
|
||
## Required reading order
|
||
1. Current Gitea issue
|
||
2. This file
|
||
3. `CLAUDE.md` if using Claude Code
|
||
4. Relevant files in `docs/context/`
|
||
5. Relevant ADRs in `docs/adr/`
|
||
6. Latest relevant handoff in `docs/handoffs/`
|
||
|
||
## Work rules
|
||
- Work on one issue at a time
|
||
- Respect issue scope
|
||
- If scope changes, update the issue before proceeding
|
||
- Do not silently introduce architecture changes
|
||
- Prefer explicit, reviewable diffs
|
||
- Avoid hidden assumptions; document them
|
||
- If uncertain, leave a note in the issue and handoff
|
||
|
||
## Required outputs per task
|
||
- Code changes linked to the issue
|
||
- Tests or clear explanation why tests were not added/run
|
||
- Updated docs when needed
|
||
- Handoff file for non-trivial tasks
|
||
|
||
## Handoff minimum content
|
||
Each handoff should include:
|
||
- Issue reference
|
||
- Goal
|
||
- What was changed
|
||
- Files touched
|
||
- Tests run
|
||
- Open risks
|
||
- Recommended next step
|
||
|
||
## File ownership convention
|
||
When a task has an active owner, avoid unrelated edits in the same area.
|
||
If multiple tasks overlap, coordinate through the Gitea issue.
|
||
|
||
## Commit guidance
|
||
Use small, focused commits.
|
||
Reference the issue number in commit messages and PRs when applicable.
|
||
```
|
||
|
||
## README docs contestuali
|
||
Per non caricare troppo `CLAUDE.md`, ti consiglio di spostare il contesto in file separati, seguendo il principio di progressive disclosure raccomandato per questo tipo di setup. [builder](https://www.builder.io/blog/claude-md-guide)
|
||
Crea almeno questi:
|
||
|
||
### `docs/context/product-scope.md`
|
||
```md
|
||
# Product scope
|
||
|
||
## What this project does
|
||
...
|
||
|
||
## Who it serves
|
||
...
|
||
|
||
## What is out of scope
|
||
...
|
||
```
|
||
|
||
### `docs/context/module-map.md`
|
||
```md
|
||
# Module map
|
||
|
||
## Top-level areas
|
||
- `/app` → ...
|
||
- `/packages/...` → ...
|
||
- `/infra/...` → ...
|
||
- `/scripts/...` → ...
|
||
|
||
## Important flows
|
||
- Auth flow: ...
|
||
- Data sync flow: ...
|
||
- Background jobs: ...
|
||
```
|
||
|
||
### `docs/context/known-constraints.md`
|
||
```md
|
||
# Known constraints
|
||
|
||
- Constraint 1: ...
|
||
- Constraint 2: ...
|
||
- Constraint 3: ...
|
||
```
|
||
|
||
## ADR setup
|
||
Le ADR servono a fissare le decisioni durevoli. [humanlayer](https://www.humanlayer.dev/blog/writing-a-good-claude-md)
|
||
|
||
### `docs/adr/README.md`
|
||
```md
|
||
# ADRs
|
||
|
||
This directory stores Architecture Decision Records.
|
||
|
||
Rules:
|
||
- One decision per file
|
||
- Immutable history: do not rewrite old decisions, supersede them with a new ADR
|
||
- Use sequential numbering
|
||
- Link related issues where relevant
|
||
```
|
||
|
||
### `docs/adr/0001-record-architecture-decisions.md`
|
||
```md
|
||
# ADR 0001: Use ADRs to record architecture decisions
|
||
|
||
## Status
|
||
Accepted
|
||
|
||
## Context
|
||
This project is developed by humans and coding agents across multiple sessions.
|
||
Important decisions were at risk of being lost in chat history or issue comments.
|
||
|
||
## Decision
|
||
We will store durable architectural decisions in `docs/adr/`.
|
||
|
||
## Consequences
|
||
- Decisions become reviewable and versioned
|
||
- New contributors and agents can reconstruct project intent
|
||
- Chat memory is no longer required to understand architecture
|
||
```
|
||
|
||
## Handoff setup
|
||
L’handoff serve per passare il lavoro tra Claude Code, Codex e te in modo leggibile. [dev](https://dev.to/laynepenney/what-happens-when-4-ai-agents-share-a-memory-pool-k58)
|
||
|
||
### `docs/handoffs/README.md`
|
||
```md
|
||
# Handoffs
|
||
|
||
Use this directory for non-trivial task handoffs between sessions, humans, and coding agents.
|
||
|
||
Naming convention:
|
||
`YYYY-MM-DD-issue-<number>-short-title.md`
|
||
|
||
Write a handoff when:
|
||
- the task spans multiple sessions
|
||
- the task is blocked
|
||
- another agent or human may continue the work
|
||
- there are open risks or partial changes
|
||
```
|
||
|
||
### `docs/handoffs/TEMPLATE.md`
|
||
```md
|
||
# Handoff
|
||
|
||
## Issue
|
||
#<issue-number> - <title>
|
||
|
||
## Goal
|
||
...
|
||
|
||
## Status
|
||
todo / in-progress / blocked / ready-for-review / done
|
||
|
||
## What changed
|
||
- ...
|
||
|
||
## Files touched
|
||
- ...
|
||
|
||
## Tests
|
||
- Run:
|
||
- Not run:
|
||
- Result:
|
||
|
||
## Risks / open questions
|
||
- ...
|
||
|
||
## Suggested next step
|
||
- ...
|
||
```
|
||
|
||
## Gitea labels
|
||
Gitea supporta labels e milestones in modo nativo, quindi puoi standardizzare il flusso senza introdurre altri strumenti. [docs.gitea](https://docs.gitea.com/usage/labels)
|
||
|
||
Ti suggerisco questo set iniziale:
|
||
|
||
### Tipo
|
||
- `type/feature`
|
||
- `type/bug`
|
||
- `type/refactor`
|
||
- `type/docs`
|
||
- `type/chore` [docs.gitea](https://docs.gitea.com/usage/labels)
|
||
|
||
### Stato
|
||
- `status/todo`
|
||
- `status/in-progress`
|
||
- `status/blocked`
|
||
- `status/review`
|
||
- `status/done` [github](https://github.com/go-gitea/gitea/issues/26704)
|
||
|
||
### Priorità
|
||
- `priority/p0`
|
||
- `priority/p1`
|
||
- `priority/p2`
|
||
- `priority/p3` [docs.gitea](https://docs.gitea.com/usage/labels)
|
||
|
||
### Owner logico
|
||
- `agent/claude`
|
||
- `agent/codex`
|
||
- `agent/human` [docs.gitea](https://docs.gitea.com/usage/labels)
|
||
|
||
### Area opzionale
|
||
- `area/frontend`
|
||
- `area/backend`
|
||
- `area/infra`
|
||
- `area/docs`
|
||
- `area/automation`
|
||
|
||
## Lifecycle issue
|
||
Ti consiglio questo lifecycle semplice: [go-gitea-gitea.mintlify](https://go-gitea-gitea.mintlify.app/features/issues)
|
||
|
||
1. L’issue nasce con `type/*` + `status/todo` + priorità. [go-gitea-gitea.mintlify](https://go-gitea-gitea.mintlify.app/features/issues)
|
||
2. Quando un agente inizia, aggiungi assignee + `status/in-progress`. [docs.gitea](https://docs.gitea.com/usage/labels)
|
||
3. Se emerge un impedimento reale, passa a `status/blocked`. [docs.gitea](https://docs.gitea.com/usage/labels)
|
||
4. Quando il codice è pronto ma richiede controllo umano o altro agente, usa `status/review`. [github](https://github.com/go-gitea/gitea/issues/26704)
|
||
5. Quando è integrato e verificato, chiudi issue o marca `status/done`. [go-gitea-gitea.mintlify](https://go-gitea-gitea.mintlify.app/features/issues)
|
||
|
||
## Template issue Gitea
|
||
Gitea supporta template multipli dentro `.gitea/ISSUE_TEMPLATE/`, quindi puoi far comparire modelli dedicati alla creazione issue. [docs.gitea](https://docs.gitea.com/usage/issue-pull-request-templates)
|
||
|
||
### `.gitea/ISSUE_TEMPLATE/feature.md`
|
||
```md
|
||
---
|
||
name: Feature
|
||
about: New feature or enhancement
|
||
---
|
||
|
||
## Summary
|
||
Describe the feature in one paragraph.
|
||
|
||
## Problem
|
||
What user or system problem does this solve?
|
||
|
||
## Scope
|
||
What is included?
|
||
What is explicitly out of scope?
|
||
|
||
## Acceptance criteria
|
||
- [ ]
|
||
|
||
## Affected areas
|
||
- [ ]
|
||
|
||
## Tests expected
|
||
- [ ]
|
||
|
||
## Notes
|
||
...
|
||
```
|
||
|
||
### `.gitea/ISSUE_TEMPLATE/bug.md`
|
||
```md
|
||
---
|
||
name: Bug
|
||
about: Bug report
|
||
---
|
||
|
||
## Summary
|
||
Describe the bug.
|
||
|
||
## Expected behavior
|
||
...
|
||
|
||
## Actual behavior
|
||
...
|
||
|
||
## Steps to reproduce
|
||
1.
|
||
2.
|
||
3.
|
||
|
||
## Affected areas
|
||
- [ ]
|
||
|
||
## Suspected cause
|
||
...
|
||
|
||
## Tests expected
|
||
- [ ]
|
||
```
|
||
|
||
### `.gitea/ISSUE_TEMPLATE/refactor.md`
|
||
```md
|
||
---
|
||
name: Refactor
|
||
about: Structural or code quality improvement
|
||
---
|
||
|
||
## Summary
|
||
...
|
||
|
||
## Motivation
|
||
Why is this refactor needed?
|
||
|
||
## Scope
|
||
...
|
||
|
||
## Risks
|
||
...
|
||
|
||
## Acceptance criteria
|
||
- [ ]
|
||
|
||
## Tests expected
|
||
- [ ]
|
||
```
|
||
|
||
### `.gitea/PULL_REQUEST_TEMPLATE.md`
|
||
```md
|
||
## Related issue
|
||
Closes #
|
||
|
||
## Summary
|
||
...
|
||
|
||
## What changed
|
||
- ...
|
||
|
||
## Tests
|
||
- [ ] Lint
|
||
- [ ] Tests
|
||
- [ ] Manual verification
|
||
|
||
## Docs updated
|
||
- [ ] Yes
|
||
- [ ] Not needed
|
||
|
||
## Risks
|
||
...
|
||
```
|
||
|
||
## Coordination docs
|
||
Ti consiglio anche due file minimi per allineare il team umano/agentico:
|
||
|
||
### `coordination/workflow.md`
|
||
```md
|
||
# Workflow
|
||
|
||
## Core rule
|
||
No non-trivial work starts without a Gitea issue.
|
||
|
||
## Sequence
|
||
1. Pick issue
|
||
2. Read repo instructions and relevant docs
|
||
3. Implement within scope
|
||
4. Run checks
|
||
5. Update docs if needed
|
||
6. Write handoff if task is not trivial
|
||
7. Open/update PR
|
||
```
|
||
|
||
### `coordination/labels.md`
|
||
```md
|
||
# Labels
|
||
|
||
## type/*
|
||
Feature classification
|
||
|
||
## status/*
|
||
Workflow state
|
||
|
||
## priority/*
|
||
Business/technical urgency
|
||
|
||
## agent/*
|
||
Who is currently leading the task
|
||
```
|
||
|
||
## Come fare la migrazione dal setup attuale
|
||
Hai detto che hai iniziato con Claude Code + Ruflo ma vuoi cambiare approccio. In pratica farei così: [institute.sfeir](https://institute.sfeir.com/en/claude-code/claude-code-memory-system-claude-md/deep-dive/)
|
||
|
||
- Mantieni Ruflo solo se ti serve come strato operativo, ma **non farlo diventare la memoria primaria del progetto**. [github](https://github.com/haasonsaas/shared-memory-mcp)
|
||
- Sposta dentro la repo tutte le convenzioni, i comandi, le decisioni e il contesto che oggi sono “sparsi” o solo impliciti. [reddit](https://www.reddit.com/r/ClaudeAI/comments/1r66oo0/how_i_structure_claude_code_projects_claudemd/)
|
||
- Da oggi in poi, ogni attività nuova passa da Gitea Issue + docs + handoff. [docs.gitea](https://docs.gitea.com/usage/issue-pull-request-templates)
|
||
- La memoria esterna, se la tieni, deve contenere solo stato operativo e contesto breve di sessione. [ideas-net-studio.github](https://ideas-net-studio.github.io/mcp-shared-memory/)
|
||
|
||
## Ordine pratico di implementazione
|
||
Farei questi passi, in quest’ordine:
|
||
1. Crea i file e le cartelle sopra. [institute.sfeir](https://institute.sfeir.com/en/claude-code/claude-code-memory-system-claude-md/deep-dive/)
|
||
2. Compila `CLAUDE.md` con i comandi reali del progetto. [builder](https://www.builder.io/blog/claude-md-guide)
|
||
3. Compila `AGENTS.md` con regole neutrali cross-agent. [developers.openai](https://developers.openai.com/codex/guides/agents-md)
|
||
4. Crea labels e template issue in Gitea. [docs.gitea](https://docs.gitea.com/usage/issue-pull-request-templates)
|
||
5. Scrivi `module-map.md` e `known-constraints.md`. [humanlayer](https://www.humanlayer.dev/blog/writing-a-good-claude-md)
|
||
6. Registra la prima ADR. [humanlayer](https://www.humanlayer.dev/blog/writing-a-good-claude-md)
|
||
7. Crea una prima issue di migrazione: “Adopt repo-first agent workflow”. [go-gitea-gitea.mintlify](https://go-gitea-gitea.mintlify.app/features/issues)
|
||
|
||
Se vuoi, nel prossimo messaggio posso fare il passo successivo e scriverti **i file già personalizzati** per il tuo progetto, se mi dici almeno: stack principale, struttura repo attuale e comandi reali di dev/test/build/lint. |