Skip to main content

CODITECT CLAUDE.md Standard

Purpose

This standard defines requirements for CLAUDE.md files - the AI agent context files that help Claude Code understand project structure, conventions, and workflows.

Scope

Applies to:

  • Root CLAUDE.md in every CODITECT repository
  • Directory CLAUDE.md files for hierarchical context
  • Customer projects using CODITECT framework

1. Core Principles

1.1 CLAUDE.md Philosophy

PrincipleDescription
ConciseKeep under 150 lines (project) or 200 lines (submodule)
ActionableFocus on what Claude needs to DO
HierarchicalUse subdirectory CLAUDE.md for deep context
Token-efficientEvery token should provide value

1.2 What Goes in CLAUDE.md

IncludeExclude
Project structure overviewDetailed documentation
Critical directivesFull API references
Quick reference commandsHistorical information
Safety warningsMarketing content
Key file locationsExhaustive file lists
Common task patternsRarely-used information

2. Required Sections

2.1 Minimum Structure

# Project Name

## Overview

Brief description (2-3 sentences).

## Quick Reference

Key commands and actions.

## Project Structure

Essential directory layout.

## Common Tasks

How to do frequent operations.
# Project Name

## Quick Reference

Table of common actions.

## Critical Directives

Safety warnings, required approvals.

## Project Structure

Directory layout with key paths.

## Key Files

Important files and their purposes.

## Common Tasks

Step-by-step for frequent operations.

## Conventions

Naming, coding, commit standards.

## Troubleshooting

Common issues and solutions.

3. Section Guidelines

3.1 Quick Reference

Use a compact table format:

## Quick Reference

| Action | Command |
|--------|---------|
| Start dev | `npm run dev` |
| Run tests | `npm test` |
| Build | `npm run build` |
| Deploy | `./deploy.sh` |

3.2 Critical Directives

Use blockquotes for emphasis:

## Critical Directives

> **NEVER delete files without explicit user permission.**

> **Always commit in submodule FIRST, then update pointer in master.**

3.3 Project Structure

Show essential structure only:

## Project Structure

project/ ├── src/ # Source code ├── tests/ # Test files ├── docs/ # Documentation ├── scripts/ # Automation └── config/ # Configuration

3.4 Common Tasks

Provide copy-paste commands:

## Common Tasks

### Run Tests

```bash
npm test

Deploy to Production

./scripts/deploy.sh --env production

---

## 4. Length Guidelines

### 4.1 By Repository Type

| Type | Max Lines | Rationale |
|------|-----------|-----------|
| Project root | 150 | Quick context loading |
| Submodule root | 200 | More domain-specific context |
| Directory CLAUDE.md | 50 | Focused scope |
| Standards/Framework | 250 | Reference documentation |

### 4.2 Token Budget

Estimate ~4 characters per token:

| Lines | Approx Tokens | Grade |
|-------|---------------|-------|
| <100 | ~400 | Excellent |
| 100-150 | ~600 | Good |
| 150-200 | ~800 | Acceptable |
| >200 | >800 | Review for reduction |

---

## 5. Hierarchical Context

### 5.1 Directory Inheritance

Claude reads CLAUDE.md files hierarchically:

project/ ├── CLAUDE.md # Project-wide context (read first) ├── src/ │ └── CLAUDE.md # Source code context (adds to above) ├── docs/ │ └── CLAUDE.md # Documentation context └── scripts/ └── CLAUDE.md # Script-specific context


### 5.2 When to Create Directory CLAUDE.md

Create if directory has:
- Unique conventions different from parent
- Complex workflows specific to that directory
- Frequently accessed by Claude for tasks
- Domain-specific knowledge needed

---

## 6. Templates

### 6.1 Minimal Template

```markdown
# Project Name

## Overview

Brief description of the project.

## Quick Reference

| Action | Command |
|--------|---------|
| Setup | `npm install` |
| Run | `npm start` |
| Test | `npm test` |

## Key Files

- `src/index.ts` - Main entry point
- `config/` - Configuration files

6.2 Standard Template

# Project Name

## Quick Reference

| Action | Command |
|--------|---------|
| Setup | `npm install` |
| Dev | `npm run dev` |
| Build | `npm run build` |
| Test | `npm test` |
| Deploy | `./scripts/deploy.sh` |

## Critical Directives

> **Always run tests before committing.**

> **Never commit secrets or .env files.**

## Project Structure

project/ ├── src/ # Source code ├── tests/ # Tests ├── docs/ # Documentation └── scripts/ # Automation


## Key Files

| File | Purpose |
|------|---------|
| `src/index.ts` | Application entry |
| `config/app.json` | App configuration |
| `scripts/deploy.sh` | Deployment script |

## Common Tasks

### Add New Feature

1. Create branch: `git checkout -b feature/name`
2. Implement in `src/features/`
3. Add tests in `tests/`
4. Run tests: `npm test`
5. Create PR

### Fix Bug

1. Reproduce issue
2. Write failing test
3. Fix code
4. Verify test passes
5. Commit with `fix:` prefix

## Conventions

- **Commits:** Conventional commits (`feat:`, `fix:`, `docs:`)
- **Branches:** `feature/`, `fix/`, `docs/` prefixes
- **Code:** ESLint + Prettier enforced

---

**Last Updated:** YYYY-MM-DD

6.3 Framework Template

See templates/CLAUDE-MD-TEMPLATE.md for comprehensive framework template.


7. Anti-Patterns

7.1 Avoid These

Anti-PatternProblemSolution
>200 linesToken waste, slow contextSplit to hierarchy
Full file listingsUnnecessary detailShow structure only
Duplicate infoRedundant tokensSingle source of truth
No quick referenceHard to find actionsAdd table at top
Missing directivesSafety risksAdd critical warnings
Outdated commandsBroken workflowsKeep synchronized

7.2 Examples

❌ WRONG - Too verbose
## Files
- src/index.ts - The main entry point that initializes the application
- src/config.ts - Configuration loading and validation module
- src/utils/helpers.ts - Utility helper functions
[... 50 more lines of files ...]

✅ CORRECT - Concise
## Key Files
| File | Purpose |
|------|---------|
| `src/index.ts` | Main entry |
| `src/config.ts` | Configuration |
| `src/utils/` | Utility functions |

8. Validation

8.1 Checklist

  • Under line limit (150/200)
  • Has Quick Reference section
  • Has Project Structure
  • Critical directives marked clearly
  • Commands are copy-paste ready
  • No redundant information
  • Updated date present

8.2 Automated Validation

# Check CLAUDE.md compliance
/claude-md-check path/to/CLAUDE.md

# Show line count and token estimate
wc -l CLAUDE.md

9. Quality Grades

GradeLinesContentDescription
A<100CompleteExemplary, minimal tokens
B100-150CompleteProduction-ready
C150-200CompleteAcceptable, review for reduction
D>200CompleteToo long, needs splitting
FAnyIncompleteMissing critical sections

References


Version: 1.0.0 Status: Active Owner: CODITECT Core Team Last Updated: 2026-01-02