// TL;DR

A CLAUDE.md isn't a wiki page — it's a contract between you and your AI assistant. This one defines eleven disciplines: keep code minimal, trace every change directly to the request, always run a build, write handoffs, audit external packages as a gate, log them as a trail, and version-control the .claude/ folder itself. Together they make AI-assisted work traceable, peer-reviewable, and safe.

// What you'll find here

This article is the consolidated walk-through of all ten rules. Each rule has its own detail page with examples — links throughout and at the bottom.

Why have a CLAUDE.md at all

AI assistants are fast, but they aren't automatically careful. Where a human colleague has implicit understanding of "what we usually do here," an agent has only what's in the prompt. CLAUDE.md is the file-visible contract that makes the implicit explicit: coding rules, process templates, security checks, and notification flow.

Once CLAUDE.md is written down, two things become possible: the agent can follow it every session, and you yourself can review your own rules — spot contradictions, update them when something turns out to work poorly, and share them with others. It's a contract that matures with the project.

Codewire's rules were developed across a series of projects: an event platform, a booking app for wellness practitioners, a B2B marketplace with 879 passing tests, a cross-platform desktop tool sidebar, and a multi-tenant chat platform. The rules below are the result of mistakes we kept seeing — and what worked to avoid them.

Discipline: keep the code minimal and scope-true

1. Simplicity First

Write only the code that solves the problem. No speculative features, no abstractions for single-use code, no "flexibility" that wasn't requested, and no error handling for impossible scenarios. Trust language and framework guarantees. Validate only at system boundaries: HTTP input, file parsing, external API responses, user forms.

The simple test before you commit: "Would a senior engineer call this overcomplicated?" If the answer is "maybe" or "it depends" — yes, rewrite.

The rule isn't aesthetic. It's preparedness. The less there is to maintain, the faster you can pivot when the user changes their mind — and they will.

→ Read the full Simplicity First article

2. Surgical Changes

Touch only what you must. When editing existing code, change only what the task requires. Don't "improve" adjacent code, comments, or formatting. Match existing style — even if you'd write it differently. Consistency wins over personal preference.

If your changes leave imports or variables unused, clean them up — but only after your changes, not after others'. A PR that fixes a bug and refactors 10 unrelated lines is impossible to peer-review and buries the actual change in noise.

If you spot dead code elsewhere, mention it. Don't delete it. It might be preparation for other work, or simply not verified as dead.

→ Read the full Surgical Changes article

3. The Test

Every changed line should trace directly to the user's request. Before you commit: point at a line you changed, point at the request you got. Can you explain why that particular line had to change to fulfil the request? If not, delete the line.

Scope creep is the most common reason AI-assisted code gets rejected in review. Not because the code is wrong — it's often fine — but because there's too much. The reviewer now has to decide: was this intentional, or did it slip in? "The test" catches 80% of the problem with one simple mechanical exercise.

→ Read the full The Test article

Workflow: predictable process from start to finish

4. Decisions and coordination

Always continue without asking. Asking-pauses cost more than a few wrong decisions. AI assistants that constantly stop with "should I?" or "just to be sure" lose momentum and frustrate the owner. The rule flips it: make the decision, document it, continue.

If the decision crosses projects — say, JWT token format, hosting structure, or a namespace convention — log it in DOCS/DECISIONS.md with the [CROSS-PROJECT] tag. The next agent or developer should be able to grep that tag and see what was decided and why.

The "continue" rule applies at the code level. Destructive ops, TLS/cert changes, deletion of shared infrastructure, or anything that can affect things outside the project in a way you can't roll back — always confirm with the owner first.

→ Read the full Decisions article

5. Build-check

Never "done" without a green build. Type errors, missing imports, and broken template references don't show up in a simple diff read. They surface only when the compiler runs. Hooks and CI catch them too — but by then it's too late: the owner already got a "done" message based on a false premise.

A local build takes 10–60 seconds. Skipping it costs far more when it means the owner has to discover the problem themselves.

Stack-specific commands:

Tests come after. If the build fails, tests fail for the wrong reasons — you're chasing a symptom instead of the cause.

→ Read the full Build-check article

6. Handoff

An AI session ends when the context window runs out, or when the owner switches projects. The next session — an hour or a week later — starts blank. The handoff file is the only way to give "future me" or a colleague the context they need to take over without repeating questions.

The trigger is the word "handoff." When the owner types it, the agent generates a file immediately — no "do you want me to…?", no confirmation. Filename: handoff-YYYY-MM-DD-HHMM.md. Read the last five handoff files first for continuity: find . -name "handoff-*.md" | sort | tail -5.

Every handoff has the same five sections:

  1. Status — where we are right now, in one sentence.
  2. Recent changes — what we touched this session, with file paths.
  3. Known issues — bugs, errors, suspicious behaviour.
  4. Next steps — first concrete action for the next session.
  5. Important context — decisions, traps, "we tried X, doesn't work because Y."

Important context is the section that most often saves the next session. Never skip it.

→ Read the full Handoff article

Traceability: don't let anything disappear

7. Git & Notifications

Commit at milestones and session end — never per file. A commit should be a logical unit that can be reverted meaningfully. Format: <feat|fix|chore>: <description max 72 chars> – Claude.

Always check that the directory is a git repo before committing: git rev-parse --git-dir 2>/dev/null || exit 0.

Send a Telegram message to the owner when a bounded feature/phase is done, the build passes after major changes, a bug is fixed and verified, or the session ends with uncommitted changes. Maximum one message per logical milestone — not per commit, not per file.

Always include the project folder and a concrete status, so the message is worth reading on a phone. "[restparti] Anti-sniping bug fixed after MySQL migration" is good. "Fixed typo" is noise.

Never: skip pre-commit hooks, force-push to main, change git config, or use interactive git commands.

→ Read the full Git & Notifications article

8. Documentation

When the owner types /doc or "documentation" alone — create or update HTML documentation under E:\DOCUMENTATION. Read readme.md in that folder first for context and contracts.

Write so a developer who has never seen the project can find their way in five minutes. Use short sentences, concrete examples, copy-pasteable command blocks, and status pills (✅ done · 🚧 in-progress · ⛔ blocked). The label "junior-friendly" is forbidden — write for everyone; the level is chosen by the problem.

Every project should have a subfolder with projekt-overblik.html, a card on index.html that links to the overview, and a .lnk shortcut to the project folder.

The operations registry projects.json has a strict contract that an admin UI reads live — don't break it. Write via the REST API when the server is running; only directly to the file as a fallback.

→ Read the full Documentation article

9. Security audit (gate before install)

Before anything external comes into a project — package, MCP server, plugin, binary, or third-party Claude skill — run the security-audit skill against it. It returns one of three verdicts: PASS (continue), WARN (present concrete concerns to the owner and require explicit approval), or FAIL (stop and propose an alternative).

The rule applies to "known" and "Microsoft-owned" packages too. A familiar name is not evidence that a particular version is safe — xz-utils in 2024 was an infrastructure cornerstone that had been maintained for over a decade before the compromise.

Pre-approved: @playwright/mcp@latest globally, plus items in ~/.codewire/security-audit/whitelist.json for project-specific approvals. Binaries also require a VirusTotal scan — set VIRUSTOTAL_API_KEY for an automated verdict, or generate a GUI link and ask the owner to verify manually.

Each audit result is appended to the session handoff in the format [security-audit] <artifact>@<version> — <verdict> — <risk>/100. The skill is open source: github.com/CODEWIRENET/security-audit.

→ Read the full Security audit article

10. External downloads & package log

Possibly the most important rule — flagged with IMPORTANT!! in the original, and rightly so. Every time a package, tool, CLI, or installer is pulled into a project — log it.

The file is E:\DOCUMENTATION\External-download.md. Each entry contains the project, date, what, why, and a risk assessment: low, medium, or high.

Risk assessment:

Supply chain attacks have hit npm (event-stream 2018), npm again (colors.js 2022), xz-utils (2024) and many others. Each time it landed because a package was installed without review. A log lets us react when one of the packages turns up on a CVE list — and a risk assessment before install means most attacks never get in to begin with.

Quick check before install: how many downloads, when last updated, who is the author, is the repo open, does the package have postinstall scripts, is it on OSV or the GitHub Advisory Database.

→ Read the full External downloads article

11. Claude history (version-control the .claude folder)

Your AI assistant's brain lives in ~/.claude/: CLAUDE.md, settings.json, hooks, skills, memory. Every change to those files affects every future session — and by default, none of it is tracked. The fix is the same fix software engineering reaches for everywhere: put it under git.

With history you can roll back a "small tweak" that turned out to slow the assistant down, diff a behavior change against config edits, share rules with a teammate, and audit how the discipline evolved over time. Without history, all four are guesswork.

The companion skill is open source — github.com/CODEWIRENET/claude-history. It runs git init against the folder, installs a sensible .gitignore, scans for committed secrets before every commit (refuses to commit if it finds API keys, OAuth tokens, or PEM blocks), and gives you commit / diff / log / revert sub-commands.

Default pattern is local-only — history stays on the machine. If you want backup or multi-machine sync, push to a private repo. The secret scanner is the only thing standing between your tokens and the remote.

→ Read the full Claude history article

How the rules fit together

The eleven rules aren't eleven isolated policies — they're one process taken from different angles.

A typical session flow looks like this: the owner asks for a change, the agent continues without asking (rule 4), keeps the change minimal and traceable (rules 1, 2, 3), builds the project after (rule 5), commits at the milestone (rule 7), sends Telegram if it's a phase end (rule 7), and if the owner types "handoff" — generates the file immediately (rule 6). If the session touched a new package, it was first audited as a gate (rule 9) and then logged with risk assessment (rule 10). When documentation has to be updated, it happens in HTML under E:\DOCUMENTATION (rule 8).

The rules reinforce each other. Build-check without commit discipline is useless, because a green build vanishes without a stable point to return to. Handoff without documentation discipline is a sticky note that blows away. A package log without notification discipline is a log nobody reads.

That's why it's one CLAUDE.md, not nine separate files.

What's not included

A few things from the original CLAUDE.md are deliberately left out of this wiki: chat IDs, password bootstrapping, a specific shutdown CLI, and infrastructure rules around TLS/Let's Encrypt. They are either owner-specific (chat ID), environment-specific (shutdown), or topics big enough to warrant their own treatment (TLS — that belongs in a security wiki, not a development wiki).

The rules here are the transferable ones: they work for anyone using an AI assistant, not just Codewire. They're the ones that make CLAUDE.md a contract worth borrowing from.

Update your own CLAUDE.md

This one is Codewire's. It isn't static — it matures with every project. Every time a rule gets broken in a way that costs time, the rule gets sharper. Every time a rule turns out to be unnecessary, it gets removed.

If you're writing or maintaining your own CLAUDE.md, start by looking at the actual mistakes you've run into. AI-assisted code that got rejected in review — why? Sessions that lost momentum — where? Packages that came in for no good reason — which?

Write the rule short. Explain why. Show an example. That's it.

Sources and further reading