Rework agent context: gotcha-first CLAUDE.md, progressive disclosure via skills - #44
Merged
Merged
Conversation
…via skills Applies Anthropic's context engineering guidance for Claude 5 generation models to this repo's agent context. CLAUDE.md drops from 222 lines to 90 and now carries only what an agent cannot learn by reading the repo. Removed: the directory tree (duplicated and stale against README), the naming-conventions table, the step-by-step new-page walkthrough, the per-module testing strategies, and architecture prose restating what the code already shows. Also removed two inaccurate lint claims (`--max-warnings 0` is not a Biome flag; "no unsafe writes" described nothing). Added in its place, verified against the source: the two JSX runtimes and the absence of hydration, the mock-before-import ordering service tests depend on, why the test runner is a script rather than `bun test`, the central security-header and CSP wiring, `APP_URL` port sensitivity in CSRF origin checks, production-only asset fingerprinting, and the Biome and tsconfig exclusions. Overconstrained rules give way to judgement where no failure mode backed them — "use code comments sparingly" becomes "match the surrounding code's comment density, naming, and idiom". The absolutes that encode real environment failures (the dev server on port 3000, the test scripts) stay. Procedural detail moves into three progressively-disclosed skills, each split across reference files so only the relevant layer loads: adding-a-feature page.md, api-endpoint.md writing-tests controllers.md, services.md, client.md verifying-changes .gitignore previously excluded all of .claude, so the skills would not have been shared. It now tracks .claude/skills/ and keeps local settings ignored. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GXCNyaHcipkSVcLzHDERmA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies Anthropic's context engineering guidance for Claude 5 generation models to this repo's agent context.
The post's CLAUDE.md guidance is specific: "Keep your CLAUDE.md lightweight and briefly describe what your repo is for, but spend most of the tokens on gotchas inside of the codebase. Avoid stating 'the obvious' things Claude should know by looking at your file system or your repo." Measured against that, the old file was mostly obvious-restating.
CLAUDE.md: 222 → 90 lines
Removed — the directory tree (duplicated README's, and stale: it listed pages that don't exist and omitted
controllers/admin/,page-lifecycle.ts), the naming-conventions table, the step-by-step new-page walkthrough, the per-module testing strategies, and the architecture prose restating what the code already shows.Also removed two claims that were false:
--max-warnings 0is an ESLint flag, not a Biome one, and "no unsafe writes" described nothing inbiome.json.Added — gotchas found by reading the source, each verified against it:
react-dom/server, islands opt into Preact per-file, and the Preact version is pinned twice (package.jsonand the esm.sh import map inlayouts.tsx).mock.modulebefore importing the service — the odd-looking import ordering is load-bearing, and tidying it silently breaks the mock.bun test≠bun run test: the script applies migrations, isolates per file, and pinsSESSION_COOKIE_NAMEbecause a custom value in a developer's.envotherwise breaks auth tests for unrelated-looking reasons.APP_URLmust include the port; CSRF origin comparison is exact.tsconfigexclusion that putsresend.tsoutsidebun run check.Rules → judgement — "use code comments sparingly" was close to the exact example the post calls out, so it now uses the post's replacement framing: match the surrounding code's comment density, naming, and idiom. The absolutes that encode real environment failures (dev server on port 3000, use the test scripts) stay, since those have documented failure modes.
Skills
Procedural detail moves into three progressively-disclosed skills, the long ones split across reference files so only the relevant layer loads:
adding-a-featurepage.md,api-endpoint.mdwriting-testscontrollers.md,services.md,client.mdverifying-changesNote on
.gitignore.claudewas ignored wholesale, so the skills would never have been committed. It now tracks.claude/skills/and keeps local settings ignored. Easy to revert if you'd rather keep skills local.Verification
bun run checkpasses, and the pre-commit hook ran build + check clean. Tests were not run — no PostgreSQL in this environment. The changes are markdown-only plus one.gitignoreline, so there's no code risk, but the suite hasn't been executed.No application code was touched. The post's "examples → interface design" shift is about tool/API design for agent harnesses; applying it here would mean refactoring app code.
Generated by Claude Code