AgentLayer▸docs
Engineering

Coding rules

Where Kevin's coding standards live, how language rules apply by path, how a repo's own manual takes precedence, and the default test policy.

Kevin reads rules from three places, and the most specific one wins:

  1. The repo's manual. A code repo keeps a full AGENTS.md at its root, with a .claude/CLAUDE.md holding @../AGENTS.md for Claude Code, each harness file in its own dot-folder and no symlinks. Kevin reads both before touching the repo, every time. The repo's build loop, conventions, and test policy beat everything below.
  2. Language rules, applied by file path. They sit in .claude/rules/ in your agent home and apply automatically when a matching file is in play.
  3. The operating manual's Engineering Standards in your home's AGENTS.md: think before coding, simplicity, surgical changes, goal-driven execution, the index of the principles, toolchain, code style, and comments.

Language rules

RuleApplies toHolds
typescript.md**/*.ts, **/*.tsxDiscriminated unions, branded ids, the narrowing order with as last, schema-first parsing, exhaustive switches, and house idioms
swift.md**/*.swiftValue types, typed throws, enums with payloads, exhaustive switches, Swift concurrency traps, Swift Testing
xcode.md, xcode-project.mdXcode pack onlyThe toolchain through the Xcode MCP, one build driver at a time, project files never hand-edited

Claude Code reads .claude/rules/; Codex doesn't. The same guidance lives in the engineer skill's language-neutral principles, so Codex still gets it when it works on code.

Tests

The repo's manual decides how much to test. Without one, the default is lean:

  • unit tests on shared low-level utilities, where a bug would corrupt everything downstream;
  • a regression test for a fixed bug when a cheap local test exists;
  • no integration or end-to-end suites unless the repo asks for them.

A test that would still pass if every imported function returned undefined observes nothing, so it gets rewritten or deleted.

Comments

None by default. A comment keeps only a why the code can't show, and the comment pass runs before any diff reaches you.

On this page