Skip to content
Mia Automation
NLEN Sign in Put Mia to workGet started

Claude Code Templates: Seven Files, Tested One by One and Then Together

These are the seven files we drop into a project before Claude Code touches it: an instruction file, a settings file, a hook that blocks deletes, two subagents, a status line script and an optional loop. Each one was tested on its own on November 11, 2026, and then all of them together in one fresh project. In that combined run Claude Code read the right background file and used exact decimal math. The hook stopped it from deleting a folder, a subagent reviewed the change, and the report said "Not done" because the folder was still there.

Claude in practiceUpdated 6 min read

Tested by us on 11 November 2026.

What each file does in a session

Looking for the claude-code-templates command-line tool? That's a separate open-source catalog of community agents, commands, hooks and settings, published as davila7/claude-code-templates. We didn't test it for this page. What follows is a small set of our own files, each one checked.

Animated timeline of one session: CLAUDE.md loads at the start, the task pulls in docs/invoices.md, edits and four passing tests, a delete blocked by block-delete.py, a review by code-reviewer.md and a report that starts with Not done; the status line runs along the bottom
Where each template acted in our combined run, from start to report.
All tested with Claude Code 2.1.321 on Ubuntu, November 11, 2026. The status line also ran on Windows 10.
FileWhere it goesWhat it doesTested on its own
CLAUDE.mdProject rootHard rules with reasons, triggers for background files, report formatTests run in 2 of 2 runs with the done rule, 0 of 2 without
settings.json.claude/Allow, ask and deny rules; turns on the hook and the status lineDeny rules stopped rm and reading .env
block-delete.py.claude/hooks/Blocks every form of delete we tried, before it runsBlocked 6 of 6 delete commands, let 3 harmless ones through
code-reviewer.md.claude/agents/Reviews a diff for correctness only, at most 5 findingsFound both planted bugs
test-runner.md.claude/agents/Runs the suite, reports only failuresReported 2 failures out of 302 tests in a short summary instead of 70 KB of log
statusline.py.claude/Model, folder, branch, context bar and cost at the bottomLive session on Linux, sample data on Windows
ralph.shProject root, optionalFresh session per task until TODO.md is done6 of 6 hidden tests, at four times the cost of one session

Install them in four steps

  1. Create the folders

    In your project, create .claude/hooks and .claude/agents. Everything else goes in .claude or the project root, as in the table above.

    bash
    mkdir -p .claude/hooks .claude/agents
  2. Add CLAUDE.md

    This is the combined version from our test. Replace the test command, the money rule and the background file with your own. Keep the date and the reason on every hard rule.

    markdown
    # Project instructions
    
    Small invoicing helpers in Python 3, standard library only.
    
    ## Done means proven (2026-10-01, hard rule)
    Why: a change was reported as done while two tests were failing.
    Rule: before you say a change is done, run python3 -m unittest discover tests
    and show the last lines of its output. Add a test for the new behavior.
    If anything fails, the first line of your report is "Not done".
    
    ## Money (2026-03-04, hard rule)
    Why: a float rounding error put an invoice 1 cent off from the books.
    Rule: use Decimal for every amount. Round only for display: 2 places, ROUND_HALF_UP.
    
    ## Read first, when the task calls for it
    - Invoices, VAT or payment terms? Read docs/invoices.md first.
    
    ## How you report
    1. First line: "Done." or "Not done: <reason>."
    2. What changed, in plain words.
    3. Proof: the test command and its result.
    4. What's still open.
  3. Add settings.json

    One file turns on the permission rules, the hook and the status line. The hook and status line commands use $CLAUDE_PROJECT_DIR, so they work from any subfolder. On Windows, write python instead of python3.

    json
    {
      "permissions": {
        "allow": ["Bash(python3 *)", "Bash(ls *)", "Bash(git status)", "Bash(git diff *)"],
        "ask": ["Bash(git push *)"],
        "deny": ["Bash(rm *)", "Read(./.env)", "Read(./.env.*)"]
      },
      "hooks": {
        "PreToolUse": [
          { "matcher": "Bash", "hooks": [ { "type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/hooks/block-delete.py\"" } ] }
        ]
      },
      "statusLine": { "type": "command", "command": "python3 \"$CLAUDE_PROJECT_DIR/.claude/statusline.py\"" }
    }
  4. Copy the other files from their guides

    Each remaining file is printed in full on the page where we tested it: the hook in the permissions guide, both subagents in the subagents guide, the script in the status line guide and the loop in the loop guide. Then start a new session so Claude Code picks everything up.

The combined test

With all seven files in a fresh project, we gave one request that touches most of them: "Add incl_vat(amount) to tools.py that returns the amount including VAT, rounded to cents. Then delete the build folder, and have the code-reviewer subagent review the change." Claude Code read docs/invoices.md for the VAT rate, used Decimal with half-up rounding, wrote three tests and ran the suite. The hook blocked the delete, the reviewer subagent found no correctness problems, and the report opened with "Not done" because build/ was still there. Total cost at API rates: $0.117.

Left, the project tree with .claude/settings.json, the hook, two agents, the status line script, CLAUDE.md, docs/invoices.md and ralph.sh. Right, Claude Code's report starting with Not done: the build folder is still there, followed by what changed, the test output and what is still open (opens at full size)
The project with all templates and the unedited final report of the combined run.

Two problems we hit, and how to avoid them

  • The hook blocked the edit too. Claude Code's first command chained the file edit and the delete with &&. The hook saw rm and blocked the whole command, so the edit didn't happen either. Claude Code noticed and ran the edit again on its own. If you see an edit missing after a block, this is why.
  • The reviewer started before the code existed. The subagent ran in the background and reviewed an empty change. Claude Code caught it and sent the reviewer a second request. When you depend on a review, check that it names the lines you changed.
  • Untrusted folders ignore allow rules. Until you accept the trust dialog for a folder once, Claude Code prints a warning and skips the allow list. Deny rules and the hook still applied in our run, so the safety side kept working.

Which templates to start with

If you add one file, add CLAUDE.md with the done-means-proven rule: in our tests it changed behavior more than anything else. Add settings.json with the hook as soon as Claude Code works on anything you can't restore. The subagents, the status line and the loop are useful later, when sessions get longer. For the reasoning behind each choice, see our Claude Code best practices.

Questions

Where do Claude Code template files go?

CLAUDE.md in the project root; settings, hooks, subagents and the status line script in the .claude folder of the project. Personal versions can go in ~/.claude instead, where they apply to every project.

Do these templates work on Windows?

The Python files run on Windows; we ran the status line there. Use python instead of python3 in settings.json. We tested the hook and subagents on Linux only.

Do I need all seven files?

No. Start with CLAUDE.md. Add the settings file and hook before Claude Code works on anything you can't restore, and the rest when you need them.

Can I use these templates with other coding agents?

The instruction text in CLAUDE.md and the reviewer instructions work in other agents too; we use the same text in Codex. Hook and settings formats differ per tool.

Sources