Skip to content

Commit ce85b9a

Browse files
committed
chore: update CLAUDE.md with agent protocols
1 parent cb728d0 commit ce85b9a

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

CLAUDE.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,55 @@
1111
- **Example**: If git shows "John-David Dalton <jdalton@example.com>", refer to them as "John-David"
1212
- **Other contributors**: Use their actual names from commit history/context
1313

14+
## PRE-ACTION PROTOCOL
15+
16+
- Before ANY structural refactor on a file >300 LOC: remove dead code, unused exports, unused imports first — commit that cleanup separately before the real work
17+
- Multi-file changes: break into phases (≤5 files each), verify each phase before the next
18+
- When pointed to existing code as a reference: study it before building — working code is a better spec than any description
19+
- Work from raw error data, not theories — if a bug report has no error output, ask for it
20+
- On "yes", "do it", or "go": execute immediately, no plan recap
21+
22+
## VERIFICATION PROTOCOL
23+
24+
**MANDATORY**: Before claiming any task is complete:
25+
26+
1. Run the actual command — execute the script, run the test, check the output
27+
2. State what you verified, not just "looks good"
28+
3. **FORBIDDEN**: Claiming "Done" when any test output shows failures, or characterizing incomplete/broken work as complete
29+
4. If type-check or lint is configured, run it and fix ALL errors before reporting done
30+
5. Re-read every file modified; confirm nothing references something that no longer exists
31+
32+
## CONTEXT & EDIT SAFETY
33+
34+
- After 10+ messages: re-read any file before editing it — do not trust remembered contents
35+
- Read files >500 LOC in chunks using offset/limit; never assume one read captured the whole file
36+
- Before every edit: re-read the file. After every edit: re-read to confirm the change applied correctly
37+
- When renaming anything, search separately for: direct calls, type references, string literals, dynamic imports, re-exports, test files — one grep is not enough
38+
39+
## JUDGMENT PROTOCOL
40+
41+
- If the user's request is based on a misconception, say so before executing
42+
- If you spot a bug adjacent to what was asked, flag it: "I also noticed X — want me to fix it?"
43+
- You are a collaborator, not just an executor
44+
45+
## SCOPE PROTOCOL
46+
47+
- Do not add features, refactor, or make improvements beyond what was asked
48+
- Try the simplest approach first; if architecture is actually flawed, flag it and wait for approval before restructuring
49+
- When asked to "make a plan," output only the plan — no code until given the go-ahead
50+
51+
## SELF-EVALUATION
52+
53+
- Before calling anything done: present two views — what a perfectionist would reject vs. what a pragmatist would ship
54+
- After fixing a bug: explain why it happened
55+
- If a fix doesn't work after two attempts: stop, re-read the relevant section top-down, state where the mental model was wrong, propose something fundamentally different
56+
- If asked to "step back" or "going in circles": drop everything, rethink from scratch
57+
58+
## HOUSEKEEPING
59+
60+
- Before risky changes: offer to checkpoint — "want me to commit before this?"
61+
- If a file is getting unwieldy (>400 LOC): flag it — "this is big enough to cause pain — want me to split it?"
62+
1463
## 📚 SHARED STANDARDS
1564

1665
**Quick references**:
@@ -138,6 +187,10 @@ All `logger.error()` and `logger.log()` calls include empty string:
138187
-`logger.error('')`, `logger.log('')`
139188
-`logger.error()`, `logger.log()`
140189

190+
#### Comments
191+
192+
Default to NO comments. Only add one when the WHY is non-obvious to a senior engineer reading the code cold.
193+
141194
#### File Structure
142195

143196
- **Extensions**: `.mts` for TypeScript modules

0 commit comments

Comments
 (0)