Chapter 23

Claude Code: Configure CLAUDE.md, Rules, and Skills

CLAUDE.md holds short persistent instructions, the .claude/rules directory gives path-scoped guidance, and skills load domain knowledge and workflows as needed. These surfaces complement rather than duplicate each other.

Here's the companion project's CLAUDE.md - only what can't be derived from the code.

# Companion project guidance

- Runtime: Node.js 24 or later, ESM, strict TypeScript.
- Install with `npm ci` and verify with `npm run check`.
- Keep runtime dependencies at zero unless the task explicitly requires one.
- Use exact command allowlists and `spawn` with `shell: false`.
- Keep changes inside the repository root and reject symbolic-link traversal.
- A task is complete only when typecheck, tests, and the end-to-end demo pass.

Claude Code looks for instructions in several places: ~/.claude/CLAUDE.md for personal defaults, ./CLAUDE.md or ./.claude/CLAUDE.md for shared project guidance, ./CLAUDE.local.md for personal notes, parent files for a monorepo, and child CLAUDE.md that load when the matching directory is read. The /init command analyzes the repository and creates a starter; the docs recommend keeping it human-readable and short, and /context helps check that the file is loaded.

A repeatable workflow is packaged as a project skill in .claude/skills/<name>/SKILL.md.

---
name: verified-change
description: Implement a small repository change through explicit scope, plan, patch, tests, and independent evidence review. Use for bug fixes and focused refactors.
---

# Verified change

1. Restate the goal, allowed write paths, constraints, and acceptance checks.
2. Read the relevant implementation, tests, and repository instructions before editing.
3. Write a short plan naming files, symbols, risks, and verification commands.
4. Make the smallest coherent patch. Do not change generated output or unrelated files.
5. Run the narrowest relevant test first, then `npm run check`.
6. Inspect the final diff and report changed files, commands, exit codes, and residual risks.

Stop and ask for direction if the requested change requires credentials, a destructive operation, or writes outside the declared scope.

What goes where is convenient to decide by a table.

Content · Where

  • The full-check command - CLAUDE.md
  • React conventions only for *.tsx - .claude/rules/ with a path scope
  • A seven-step release review - Skill
  • A mandatory ban on a risky command - Permission or a PreToolUse hook
  • A merge condition - CI
CLAUDE.md is advisory. The official best-practices guide explicitly contrasts advisory instructions and deterministic hooks. For an action that must happen without exception, use a hook or an external gate, not a stricter wording in the text.

The knowledge surfaces are configured. What remains is the most important thing for autonomy - permissions, sandbox, hooks, and automation.

Links