No. 055 Instruction files
pnpm install, test, and typecheck
Use when later sessions should inherit a written instruction
- Claude Code
- Codex
- Cursor
- Instruction files
# Commands - Install: pnpm install - Run one test file: pnpm vitest run path/to/file.test.ts - Typecheck: pnpm tsc --noEmit # Conventions - Use the error helpers in src/lib/errors.ts, never throw raw strings - src/legacy/ is still live but don't copy its patterns into new code # Gotchas - Integration tests need DATABASE_URL set, see .env.example
When to use
“pnpm install, test, and typecheck” fits when later sessions should inherit a written instruction, because it says “Commands”, and it is written to stay in force on later turns rather than to finish one task.
With “pnpm install, test, and typecheck” loaded, the user message can be as small as “fix the empty-cart total in src/cart.js and do not touch the test runner”, because “Commands” is already in force.
When not to use
Leave “pnpm install, test, and typecheck” unused when you are fixing one bug tonight and you do not want tomorrow's session to inherit the words, because “Commands” points the other way
How to run it
Claude Code
Claude Code loads “pnpm install, test, and typecheck” from .claude/rules on later sessions, so “Commands” survives a new chat, which a one-off paste does not.
Codex
Codex keeps “pnpm install, test, and typecheck” only if you put “Commands” in AGENTS.md, or in AGENTS.override.md beside the directory that should inherit it. A paste that is not saved is gone next thread.
Cursor
Cursor keeps “pnpm install, test, and typecheck” by saving “Commands” as .cursor/rules. The chat transcript alone will not reload it tomorrow.
Comparison
对比待补
This before-and-after was not run on this machine.
Related
- Stage: Instruction files
- Same stage: ~/.codex/AGENTS.md
来源:Anthropic · https://code.claude.com/docs/en/best-practices · 2026-12-01