Skip to content

docs: correct and restructure the AI agent configuration guide - #1224

Open
rsdmike wants to merge 3 commits into
mainfrom
docs/fix-claude-md-config-smells
Open

docs: correct and restructure the AI agent configuration guide#1224
rsdmike wants to merge 3 commits into
mainfrom
docs/fix-claude-md-config-smells

Conversation

@rsdmike

@rsdmike rsdmike commented Aug 26, 2026

Copy link
Copy Markdown
Member

What this is

I checked CLAUDE.md against a recent paper on common mistakes in agent
config 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.md said:

Run go run ./cmd/openapi-gen and commit the regenerated doc/openapi.json

But doc/openapi.json is in .gitignore (line 39) and has never been tracked.
git add doc/openapi.json fails with "paths are ignored by .gitignore".

CI already handles this. In release.yml, on a release build it checks if
anything under internal/controller/openapi/ changed, and if yes it runs
go run ./cmd/openapi-gen and uploads the result to SwaggerHub. So editing the
Fuego declaration is the only thing you need to commit.

Fixed in CLAUDE.md and in .github/copilot-instructions.md, which said the
same thing.

2. Two different line limits for commit messages

The old text was:

Subject + body lines ≤72 chars (commitlint enforces body-max-line-length: 200)

This reads like the limit is 72 and also 200. The real rule (and what
CONTRIBUTING.md says) is: 72 is a preference, 200 is the hard limit that
fails 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:

  • Change only the files needed for the issue you are working on.
  • Target roughly 50–300 changed lines.
  • If your PR changes more than about 300 lines, or fixes more than one
    problem, split it into two or more PRs.

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.md saying when to read each one:

File Read when
.github/agents/mocks.md You changed an interface and need make mock
.github/agents/openapi.md You changed a route
.github/agents/databases.md You need Postgres/Mongo, or a migration
.github/agents/building.md You need a release binary or cross-compile
.github/agents/fuzzing.md You are working on a fuzz target

Each 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.md had one commit in its whole history, while 66 commits landed on
top 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) and README.md still tell you to commit
doc/openapi.json. Same bug, but those are contributor docs rather than agent
docs, so I left them out to keep this PR focused. Happy to do a follow-up.

Testing

No code changed — git diff --stat is markdown only. I checked that every
make target and every file path mentioned in CLAUDE.md actually exists, and
that all five new links resolve.

@rsdmike
rsdmike requested a review from a team as a code owner August 26, 2026 18:16
Copilot AI lite review requested due to automatic review settings August 26, 2026 18:16
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 50.82%. Comparing base (76d223b) to head (0f7c99b).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md to 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.md with the corrected OpenAPI workflow guidance (do not commit doc/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.

Comment thread .github/agents/fuzzing.md Outdated
Comment thread .github/agents/mocks.md Outdated
Comment thread .github/agents/databases.md Outdated
Comment thread .github/agents/databases.md Outdated
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.
@rsdmike
rsdmike force-pushed the docs/fix-claude-md-config-smells branch from 0e2075c to a0897f0 Compare August 26, 2026 19:59
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.
@rsdmike
rsdmike enabled auto-merge (rebase) August 27, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants