docs: correct and restructure the AI agent configuration guide - #1224
docs: correct and restructure the AI agent configuration guide#1224rsdmike wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1224 +/- ##
=======================================
Coverage 50.82% 50.82%
=======================================
Files 149 149
Lines 13873 13873
=======================================
Hits 7051 7051
Misses 6218 6218
Partials 604 604 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Updates the repository’s AI agent guidance to be clearer, more accurate, and easier to maintain, including splitting occasional-use guidance into dedicated doc/agents/* documents and correcting prior instructions around OpenAPI generation and commit message limits.
Changes:
- Refactors
CLAUDE.mdto add a maintenance rule, simplify language, and link out to task-specific guides. - Adds new task-specific agent docs under
doc/agents/(OpenAPI, mocks, databases, building, fuzzing). - Aligns
.github/copilot-instructions.mdwith the corrected OpenAPI workflow guidance (do not commitdoc/openapi.json).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| doc/agents/openapi.md | New guide explaining route/OpenAPI dual-source-of-truth and why doc/openapi.json is not committed. |
| doc/agents/mocks.md | New guide for regenerating mocks via make mock. |
| doc/agents/fuzzing.md | New guide describing fuzz target locations and make fuzz-* helpers. |
| doc/agents/databases.md | New guide for Postgres/Mongo dev, migrations, and repository method requirements. |
| doc/agents/building.md | New guide for release builds, cross-compilation, and build tags/targets. |
| CLAUDE.md | Restructures and clarifies agent guidance; moves occasional-use sections into doc/agents/*; fixes OpenAPI + commit message wording. |
| .github/copilot-instructions.md | Updates OpenAPI guidance to match CI behavior (generated + published; not committed). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Reviewed CLAUDE.md against the smell catalog in "Configuration Smells
in AGENTS.md Files" (arXiv 2606.15828) and fixed what was verifiably
wrong or ambiguous. Documentation only; no code or behaviour changes.
Wrong instructions fixed:
- CLAUDE.md told contributors to commit doc/openapi.json. That file is
ignored by git (.gitignore, **/doc/openapi.json) and has never been
tracked, so `git add` on it fails. CI generates it at release time in
release.yml and pushes it to SwaggerHub, keyed off changes under
internal/controller/openapi/. Corrected here and in
.github/copilot-instructions.md, which repeated the same instruction.
- Commit conventions said "Subject + body lines <=72 chars (commitlint
enforces body-max-line-length: 200)", which reads as two different
limits. Now states the 72 preference and the 200 hard limit
separately, matching CONTRIBUTING.md.
- The note about internal/controller/httpapi/ui/ being "empty" is true
for a fresh clone but confusing for anyone holding local build
output. Now explains both cases.
Readability:
Much of the guide relied on English idiom ("big bang", "hold it in
their head", "while I was in there", "ship invisibly", "lock-step").
The PR workflow rules in the non-negotiable section carried nine such
phrases in three lines. Rewritten as literal instructions with
explicit thresholds and tables. Several team members read English as
a second language, and these rules are the ones we least want
misread.
Structure:
Five task-specific sections moved to .github/agents/ and replaced with a
table saying when to read each, so occasional procedures are no longer
loaded into every session and can be more detailed than a summary
allowed: building.md, databases.md, fuzzing.md, mocks.md, openapi.md.
Added a short maintenance rule to the header. CLAUDE.md had exactly
one commit in its history while 66 commits landed on top of it, which
is how the wrong instructions above survived.
0e2075c to
a0897f0
Compare
Four factual errors caught in review, all verified against the code: - fuzzing.md said `make fuzz-smoke` is what CI runs. No workflow under .github/workflows/ invokes any fuzz target. Now states plainly that fuzzing does not run in CI. - mocks.md said mocks come from the `interfaces.go` of each use-case package. Four of the 13 sources are elsewhere: export/interface.go, ws/v1/interface.go, pkg/logger/logger.go and app/interface.go. Some are named interface.go, some interfaces.go. Listed them in a table. - databases.md said migrations are Postgres only. Wrong: migrate.go embeds internal/app/migrations/ and applies it to Postgres and SQLite both. Only Mongo skips it. This matters because a new migration has to work on both SQL backends. - databases.md said `make migrate-create` writes into internal/app/migrations/. The Makefile passes an absolute path (-dir /internal/app/migrations), so it does not. Documented adding migration files by hand, and flagged the Makefile bug in the file. The Makefile path bug is left for a separate PR so this one stays documentation only.
What this is
I checked
CLAUDE.mdagainst a recent paper on common mistakes in agentconfig files (arXiv 2606.15828) and fixed
the problems that were real. Docs only — no code changed.
1. We were telling people to do something impossible
CLAUDE.mdsaid:But
doc/openapi.jsonis in.gitignore(line 39) and has never been tracked.git add doc/openapi.jsonfails with "paths are ignored by .gitignore".CI already handles this. In
release.yml, on a release build it checks ifanything under
internal/controller/openapi/changed, and if yes it runsgo run ./cmd/openapi-genand uploads the result to SwaggerHub. So editing theFuego declaration is the only thing you need to commit.
Fixed in
CLAUDE.mdand in.github/copilot-instructions.md, which said thesame thing.
2. Two different line limits for commit messages
The old text was:
This reads like the limit is 72 and also 200. The real rule (and what
CONTRIBUTING.mdsays) is: 72 is a preference, 200 is the hard limit thatfails the build. Now written as two separate sentences.
3. Simpler English
A lot of the guide used English idioms — "big bang", "hold it in their head",
"while I was in there", "ship invisibly", "lock-step". The PR rules in the
"non-negotiable" section had nine of these in three lines.
Since several of us read English as a second language, and these are the rules
we least want people to get wrong, I rewrote them as plain instructions with
real numbers. For example, "do not scope-creep" is now:
The release-type rules are now a table instead of a paragraph.
4. Moved five sections into
.github/agents/These are things you only need sometimes. They are now separate files, with a
table in
CLAUDE.mdsaying when to read each one:.github/agents/mocks.mdmake mock.github/agents/openapi.md.github/agents/databases.md.github/agents/building.md.github/agents/fuzzing.mdEach file is now longer and more detailed than the old section was, because it
does not have to be short any more.
5. Added a rule about keeping the file updated
CLAUDE.mdhad one commit in its whole history, while 66 commits landed ontop of it. That is why the wrong instructions above stayed there. The header now
says to update it in the same PR when an instruction turns out to be wrong, or
when a reviewer explains something the file should have already covered.
Not in this PR
CONTRIBUTING.md(lines 137 and 152) andREADME.mdstill tell you to commitdoc/openapi.json. Same bug, but those are contributor docs rather than agentdocs, so I left them out to keep this PR focused. Happy to do a follow-up.
Testing
No code changed —
git diff --statis markdown only. I checked that everymaketarget and every file path mentioned inCLAUDE.mdactually exists, andthat all five new links resolve.