Subdirectory CLAUDE.md files provide scoped guidance.
The agent loads only the files relevant to its current working directory.
CLAUDE.md ← Root: project overview, architecture, shared rules
├── app/
│ ├── Http/
│ │ ├── Controllers/
│ │ │ ├── Api/CLAUDE.md ← API controller patterns (growth direction)
│ │ │ └── Web/CLAUDE.md ← Legacy controllers (bug fixes only)
│ │ └── Resources/CLAUDE.md ← API Resource conventions
│ ├── Actions/CLAUDE.md ← Action pattern, Result DTOs
│ ├── Services/CLAUDE.md ← Contract-first design, strategy pattern
│ └── Policies/CLAUDE.md ← Authorization patterns
├── database/
│ └── migrations/CLAUDE.md ← Migration naming, column types
├── tests/CLAUDE.md ← Test patterns, UserFactory, TDD
└── resources/
└── js/spa/CLAUDE.md ← SPA architecture, Interim wrappers
Subdirectory CLAUDE.md files provide detailed patterns and constraints
for each layer of the codebase. Read the relevant file before working
in that area.
| Area | Harness File | Summary |
|---|---|---|
| API Controllers | app/Http/Controllers/Api/CLAUDE.md |
QueryBuilder, Resources, thin controllers |
| Web Controllers | app/Http/Controllers/Web/CLAUDE.md |
Legacy. Bug fixes only, no new features. |
| React SPA | resources/js/spa/CLAUDE.md |
SPA source of truth; Interim wrappers |
| Services | app/Services/CLAUDE.md |
Contract-first, strategy pattern |
| Actions | app/Actions/CLAUDE.md |
Single execute(), Result DTOs |
| Tests | tests/CLAUDE.md |
UserFactory, ApiTestCase, TDD workflow |
| API Resources | app/Http/Resources/CLAUDE.md |
allowedIncludes(), casting conventions |
| Policies | app/Policies/CLAUDE.md |
Role helpers, scoping patterns |
| Migrations | database/migrations/CLAUDE.md |
Naming, nullability, soft deletes |
When building a new feature, the typical flow touches these harness files:
- Migrations — schema changes
- Actions/Services — business logic
- API Controllers + Resources — expose via API
- SPA — React page, API client, types
- Tests — PHP and JS tests throughout (TDD)
Before a change can be committed, complete these steps in order:
- Code quality:
make lint— all checks must pass - PHP tests:
make test— all PHPUnit tests must pass - JS tests:
make test-js— all Vitest tests must pass - Browser verification (UI changes only): Puppeteer MCP
- E2E tests: Ask before running. If approved,
make e2e.
Fix any failures before proceeding to the next step.
All feedback about code quality, patterns, or practices follows this loop:
- Update the appropriate
CLAUDE.mdharness file to capture the pattern - Reload that harness file into context
- Re-attempt the change using the updated guidance
This ensures the harness evolves with every review and the team benefits from accumulated decisions.