# 3 CLAUDE.md examples and a starter template

Canonical: https://cwyn.com/pages/claude-code-guide-claude-md-template.html
Last updated: 2026-11-30T17:44:46-05:00

Claude Code project setup

Choose a [CLAUDE.md example](https://cwyn.com/pages/claude-code-guide-claude-md-template.html#claude-md-examples) for a TypeScript web app, a Python package or a monorepo. Save it as `CLAUDE.md` at the root of your repository. Replace the sample paths and test instructions with the ones your team uses. Keep the rules a teammate needs on their first change.

Last updated November 30, 2026 · Published November 22, 2026

By CWYN · Published Nov 22, 2026

## 1. Copy the starter template

CLAUDE.md · 23 lines

```
# [Project name]

## Project summary
[What does this repo produce, and who uses it?]

## Commands
Run from [working directory].
- Build with `[build command]`.
- Run tests with `[test command]`.
- Lint with `[lint command]`.

## Conventions
- Follow [reference file] when adding [kind of change].

## Hard rules
- Ask [owner] before [action that needs approval].

## Gotchas
- [Common mistake]. Use [correct command or path] because [reason].

## Where things live
- `[path]` holds [source files].
- `[path]` holds [tests or fixtures].
```

For the part about how you work, use the [CLAUDE.md generator](https://cwyn.com/tools/claude-md-generator/) and paste your working preferences below the project rules.

## 2. Three filled-in CLAUDE.md examples

CWYN wrote these examples for three fictional repositories. Each block is the full text of a root `CLAUDE.md`.

Checked against docs, not run. [Anthropic’s guide to CLAUDE.md files and imports](https://code.claude.com/docs/en/memory) (as of Nov 27, 2026).

### Node/TypeScript web app

```
# Market hours
This Node app shows which neighborhood markets are open now.

## Layout
- Edit weekly schedules in `src/markets.json`.
- Keep the opening-hours calculation in `src/hours.ts`.

## Time rules
- Interpret hours in each market's local time zone.
- A closing time earlier than opening falls on the following day.

## Tests
- Run `npm test` from the repository root.
- In `test/hours.test.ts`, cover a Friday market open from 22:00 to 02:00.
- It should be open at 01:59 on Saturday and closed at 02:00.
```

Use Layout to locate the schedule and the function that reads it. Under Time rules, spell out which day a closing time belongs to. Under Tests, give the command and the two times that catch a closing-time error.

### Python package

```
# Rainfall reader
This Python package reads station CSV files for rainfall reports.

## Public API
- Keep `read_station_csv` importable from `rainfall/__init__.py`.
- Put parsing logic in `rainfall/reader.py`.

## Missing readings
- Return `None` for a blank rainfall field.
- Return `0.0` for a measured zero. Values are in millimeters.

## Regression tests
- Store small station files in `tests/fixtures/`.
- In `tests/test_reader.py`, read a CSV with one blank and one zero.
- Assert that the two readings survive the public API as distinct values.
```

The Public API section names the import that downstream reports rely on. Use Missing readings to record a distinction the CSV header cannot explain. The Regression tests check that callers can still tell a missing observation from a dry day.

### Monorepo with two apps and a shared package

```
# Trail reports
Field crews record trail conditions offline. Editors review them on the web.

## Workspace map
- `apps/field/` writes reports and `apps/web/` reads them.
- Both apps use the parser in `packages/report/`.

## Shared format
@docs/report-format.md
- Add new fields to the shared parser before using them in either app.

## Compatibility check
- Keep a report saved by the previous field app in `packages/report/fixtures/`.
- After a format change, verify the web app can still open that report.
```

Workspace map shows who writes and reads a report. Shared format imports the field definitions from a path relative to this CLAUDE.md. Point it to an existing file in your repo. Compatibility check protects crews whose saved reports still use the older format.

## 3. Where the file goes

Choose a CLAUDE.md location by who needs the instructions.

| Who uses it | File and use |
| --- | --- |
| The project team | Commit `./CLAUDE.md` or `./.claude/CLAUDE.md` to share the project’s commands and conventions. |
| You, in this project | Use `./CLAUDE.local.md` for personal project notes. Add it to `.gitignore` . For parallel sessions, see [how to copy an ignored file into a worktree](https://cwyn.com/pages/claude-code-guide-worktrees.html) . |
| You, across projects | Use `~/.claude/CLAUDE.md` for instructions you want in every project. |
| The organization | Use the managed policy location for your operating system. Anthropic lists the OS-specific paths in the reference below. |

At the start of every session, Claude reads instruction files in the working directory and its ancestors. Files in subdirectories load on demand. Claude joins the discovered files together, so it sees both versions of a rule if a parent and child file disagree.

[Anthropic’s CLAUDE.md locations and loading rules](https://code.claude.com/docs/en/claude-md) (as of Nov 22, 2026).

## 4. What not to put in it

- A multi-step procedure. Put the release checklist in a [project skill](https://cwyn.com/pages/claude-code-guide-first-project-skill.html). A shared skill lives at `.claude/skills/<name>/SKILL.md`. [Anthropic’s guide to skills](https://code.claude.com/docs/en/skills) (as of Nov 19, 2026).
- A rule for just one directory. Put a convention that only applies to the docs tree in a [path-scoped rule](https://cwyn.com/pages/claude-code-guide-skills-vs-subagents-hooks.html) under `.claude/rules/`.
- A restriction that must always hold. CLAUDE.md gives Claude context. To block a tool action regardless of what Claude decides, use a [`PreToolUse` hook](https://cwyn.com/pages/claude-code-guide-hooks-examples.html). [Check that your hook fires](https://cwyn.com/pages/claude-code-guide-hooks-not-firing.html).

[Anthropic’s guidance on rules, skills and enforcement](https://code.claude.com/docs/en/claude-md) (as of Nov 22, 2026).

## 5. What repeated instructions cost on the API

CWYN’s Code review preset budgets 500 system tokens per turn. Suppose your project instructions use that many tokens and you send them on each of the 2 turns. Price that block at the regular API input rate for Claude Sonnet 4.6.

500 tokens × 2 turns = 1,000 input tokens.
1,000 × $3 ÷ 1,000,000 = $0.003. [Anthropic API pricing](https://platform.claude.com/docs/en/about-claude/pricing) (as of 2026-11-19).

### What changes the number?

- Instruction length. Replace the preset allowance with the tokens in your own instructions. A line can hold one word or a paragraph.
- Turns. Count how many requests actually include the block.
- Billing category. Use your model’s rate for regular input, cache reads or cache writes according to your usage record.

For a whole session, include the other input and the reply in the [AI cost calculator](https://cwyn.com/score/ai-cost-calculator/).

## 6. CLAUDE.md FAQ

### How long should CLAUDE.md be?

Aim for fewer than 200 lines per file. Longer files take up more context and make instructions harder to follow. An `@path/to/import` can organize the text, but the imported content still uses context. Imports can go up to four hops deep.

### Can Claude Code generate a starting file?

Run `/init` in the project. It generates a starting CLAUDE.md. If the file already exists, it suggests improvements and leaves the original in place.

### Can I use my repository’s AGENTS.md?

Yes. To include an existing `AGENTS.md` in the same directory, put `@AGENTS.md` on its own line in your `CLAUDE.md`. See the [AGENTS.md examples](https://cwyn.com/pages/claude-code-guide-agents-md-examples.html) for a root file and a package override. If your team maintains both files, [AI Instruction Builder Pro](https://cwyn.com/pages/pack-ai-instruction-builder-pro.html) generates them from the same questionnaire.

### When should I add a rule?

Add a rule when Claude makes the same mistake twice, when you find yourself repeating a correction, or when a reviewer catches something Claude should have known.

[Anthropic’s CLAUDE.md reference](https://code.claude.com/docs/en/memory) (as of Nov 27, 2026).

## Next steps

- [All 34 Claude Code guides](https://cwyn.com/guides/claude-code/)
- [Claude Code setup walkthrough](https://cwyn.com/setup/claude-code/)
- [Free AI instruction builder](https://cwyn.com/build/ai-instructions/)
- [AI Instruction Builder Pro ($14.95)](https://cwyn.com/pages/pack-ai-instruction-builder-pro.html)

### Write and check your project instructions

[Use the free AI instruction builder](https://cwyn.com/build/ai-instructions/) for one universal instructions file based on how you work.

Paste your edited template into the [CLAUDE.md setup-file checker](https://cwyn.com/score/setup-file-checker/?profile=claude) to check its length and structure.

## Email me the starter template

Get the editable starter as AGENTS.md.txt and a prompt for checking it. Save the starter as CLAUDE.md in your repository.

Email address

Email me this file. Also send up to 4 short follow-up emails with tips and one related CWYN product. Unsubscribe any time. [Privacy policy](https://cwyn.com/pages/privacy.html)

### Generate a matching CLAUDE.md and AGENTS.md

[AI Instruction Builder Pro ($14.95)](https://cwyn.com/pages/pack-ai-instruction-builder-pro.html) generates both files from the same questionnaire.

AI Instruction Builder Pro $14.95

Build a full-length AGENTS.md, longer ChatGPT instructions and files for seven other targets offline, including a dedicated Grok Bot description. Nine offline presets include the General professional default and the developer ready set. Includes six role add-ons, a printable trait report and a self-test guide.

For editable hooks and permission presets, see the [Claude Code Complete Setup Pack](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html).
