Skip to content

docs(agents): restructure AGENTS.md and add CODING_STANDARDS.md - #91

Open
m-murphy wants to merge 24 commits into
refactor/specimen-registrationfrom
docs/agents-md-restructure
Open

m-murphy wants to merge 24 commits into
refactor/specimen-registrationfrom
docs/agents-md-restructure

Conversation

@m-murphy

@m-murphy m-murphy commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

AGENTS.md becomes a short router. Rules for writing code move to CODING_STANDARDS.md, which the code-review skill reads as its standards source. ADR-derived rules are not in this PR; they are in #92, stacked on this one, so they can be reviewed on their own.

The first three commits each go further than the last, so a reviewer can stop at any one of them. The rest are follow-ups from review.

Commit What it does
6662a62 Conservative pass. Cuts no-ops from AGENTS.md and docs/agents/: generic gh usage and a triage table that mapped each role to itself. Starts CODING_STANDARDS.md.
3efb494 Moderate pass. Moves test and database rules out of the package READMEs into CODING_STANDARDS.md. Cuts stale counts, duplicated sections and the Vitest stack-overflow note.
bf1cbda Radical pass. Rewrites AGENTS.md as a router: Agent skills, running tests and checks, where to look. Deletes docs/agents/ and inlines what is still live.
d4a8e9a Takes the ADR-derived rules back out of CODING_STANDARDS.md; #92 adds them.
dd642a4 Cites ADRs as "ADR 0006" in the files this PR touches.
bfa8d40 Writes the coding standards as second-person imperatives.
bf9746b Lets read-only tools that must not migrate (check-integrity.ts, the snapshot test) skip openOperationalDatabase.
d2797d8 Says when hand-rolled session helpers (loginAndGetCookie) are acceptable.
08e081c Puts the reason for withWriteTransaction next to the rule.
85cb068 Restores test rules the README rewrite dropped: error cases, loading and error states, findBy/waitFor.
acb19ec Keeps the whole-*Api override rule in CODING_STANDARDS.md only.
8e96e89 Describes the pre-commit hook and ci:verify in README.md only.
be5a547 Names the five triage labels in AGENTS.md.
35f4f1d Renames the AGENTS.md "Checks" heading so it isn't confused with the Checks workflow.
c0f3e55 Says what CODING_STANDARDS.md holds in the AGENTS.md pointer.
063c188 Gives AGENTS.md an H1.
af31451 Makes the root README the one place for coverage targets.
d40df05 Restores the CURRENT_SCHEMA_VERSION bullet in the db README.
f51b352 Says which code may run DDL (evolution modules and test fixtures may; connection code, routes and lib/ may not), and scopes the web test rules (helper render, role/label queries, user-event) to new and changed tests.
c23c9f3 AGENTS.md: API tests run with NODE_ENV=test, contract tests and the root bun run test are listed, setup:hooks is back, and the lint note no longer claims lint is clean today.
2d7ce70 Makes the API README snippet compile (imports) and the web README example assert by role.

Line counts against the base branch:

 AGENTS.md                              52 → 23 lines (router: skills, tests and checks, pointers)
+CODING_STANDARDS.md                    43 lines (domain language, tests, API, web)
-docs/agents/domain.md
-docs/agents/issue-tracker.md
-docs/agents/triage-labels.md
 packages/api/src/__tests__/README.md  236 → 93
 packages/web/src/__tests__/README.md  223 → 76
 packages/api/src/db/README.md          71 → 69

Fixed along the way: the "431 tests" count; a 60% API coverage threshold that bunfig.toml does not set; ci:verify described as "typecheck + build"; an API route-handler example that matched no real route; stale better-sqlite3 and coverage comments in the vitest configs and bunfig.toml. Config values are unchanged.

Evidence

  • Before: the web README and vitest.config.ts warned about a RangeError stack overflow after test runs.
    After: a full web bun run test passes 909 tests in 155 files and exits cleanly with no RangeError, so the warning is gone.
  • bun run typecheck, the pre-commit hook and the docs stale-claims check pass.
  • A grep for docs/agents turns up no references left in the repo.
  • Each rule in CODING_STANDARDS.md either holds for the code at head or is scoped to new and changed code with the known exceptions named.

Merge Danger

Door: two-way

Docs and comments only. Reverting any one commit restores the earlier shape.

Blast Radius: agent-behaviour

code-review will enforce CODING_STANDARDS.md. Its rules restate what the package READMEs already said; the ADR-derived rules arrive in #92.

🤖 Generated with Claude Code

m-murphy and others added 4 commits October 6, 2026 15:46
- issue-tracker.md: drop the generic gh command list and the git remote
  note; gh does both by default. Keep the skill-term mappings.
- triage-labels.md: the table mapped every role to itself. One line now
  says the labels match the role names.
- domain.md: rewrite as one trigger per doc. The glossary-vocabulary and
  ADR-conflict rules move to CODING_STANDARDS.md as checkable rules,
  so code review enforces them.
- AGENTS.md: drop the repo-root test row (package.json has it), the
  ~1s example run, and the CI step list (ci:verify has it). Keep the
  bun test hang, the clean lint baseline, and what pre-commit skips.
  Pointers now lead with when to read them; add one to the standards.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- CODING_STANDARDS.md gains Database, Tests, API tests, and Web tests
  sections: withWriteTransaction, DDL only in migrations, one database
  entry point, keep assertions strict, setupTestDatabase/factories/
  setupAuthenticatedRouteTest, checkInUse cases, awaited custom render,
  domain-module mocks, semantic queries, invalidation asserts. The
  READMEs keep the helpers and examples and point at the rules.
- Test READMEs: cut the stale counts (431 tests, a 60% threshold bunfig
  does not set), the directory listings, generic best practices, the
  repo-root and coverage sections that package.json already holds, and
  the route-handler example (no route has a default export). Fix the
  setupTestDatabase description (it opens through
  openOperationalDatabase), show render as async with all its
  providers, and note that API tests import 'vitest' under Bun.
- Web README and vitest.config.ts: drop the Vitest stack overflow
  note. A full run passes 909 tests and exits without it.
- AGENTS.md: the bun test hang lives only here; runner details move
  behind the README pointers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- AGENTS.md: three sections. Agent skills holds the tracker, label,
  and domain-doc facts inline; Checks holds what every task needs (the
  bun test hang, clean lint, ci:verify); Where to look has one pointer
  per branch. The UI-label trail stays as a pointer line, since that
  branch starts before the agent is in any package.
- docs/agents/: deleted. Each file was 3-7 lines, about the cost of the
  pointer to it.
- CODING_STANDARDS.md: grouped by package. Add one-line rules from ADRs
  0001, 0002, 0004-0010 that bind everyday code. Drop the synchronous
  transaction callback rule, which ESLint enforces, and fold the mock
  response shapes into the web rules.
- Package READMEs lead with what the branch needs first: the runner,
  the setup file, the schema recipe.
- Config comments: drop the better-sqlite3 stack overflow note, the
  ~55% baseline, and the api.ts and coverage-plan mentions.
- README.md: ci:verify runs more than typecheck and build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The rules pass 3 drew from ADRs 0001 and 0004-0010 will be enforced by
code review, so they move to a follow-up PR where each can be checked.
The web response-body rule stays: it replaced the web test README's
mock-shape note.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
m-murphy and others added 20 commits October 6, 2026 16:48
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The repo's docs spell it "behaviour" (7 uses in 4 files against 1
"behavior"), which CODING_STANDARDS.md already follows.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…onalDatabase.

check-integrity.ts opens a backup with new Database(..., { readonly: true })
on purpose, so the rule now names that exception and leaves room for others.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The API test README offered loginAndGetCookie and friends with no caveat,
against the rule to use setupAuthenticatedRouteTest. Logging in by hand is
now limited to tests of the login flow, and the client wrapper is shown on
top of the adapter's cookie, matching how the tests use them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The db README defers to CODING_STANDARDS.md for the transaction rule, but the
move dropped why: Drizzle's bun-sqlite transaction commits at the first await.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The old API and web test READMEs asked for edge-case tests, loading and
error state tests, and waitFor or findBy for async work. The rewrite cut
them instead of moving them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The web test README restated it; it now shows how createMockedDomainModule
works and points to the rule.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
AGENTS.md now points to the paragraph instead of restating it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… the Checks workflow.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The old pointer covered nearly every task, so it routed nowhere.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The 90% target and what each threshold does were spread across README.md,
packages/web/vitest.config.ts and the commented-out bunfig.toml threshold.
The configs now point to a Coverage section; no config values change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
It is the only place the README defines the CURRENT that the evolution table
compares against, and support needs it to read a schema_version value.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tructure

# Conflicts:
#	packages/api/src/__tests__/README.md
#	packages/api/src/db/README.md
#	packages/web/src/__tests__/README.md
…ules to new and changed tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd a durable lint note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tructure

# Conflicts:
#	AGENTS.md
#	packages/api/src/__tests__/README.md
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.

1 participant