A doc structure that stops Claude Code from grepping blindly in big codebases
On a large production app built with Svelte and Express/Knex, ported from Oracle to Postgres, with about 150 Cypress test specs and roughly 30 functional modules, using Claude Code daily led to a recurring problem: every session started with Claude grepping around, re-discovering the , and repeating the same mistakes. The fix was a Markdown 'context pack' that Claude reads before touching any code. It consists of a CLAUDE.md file, auto-loaded every session, containing the rules of rather than the itself.
Alongside it sits a docs/claude/ folder holding AI-facing only: an INDEX.md that acts as an entry point with a decision table mapping tasks to the right file, a one-page .md giving the big picture, a MAP.md linking each feature to its files, routes, and , a GLOSSARY.md translating domain acronyms into database fields, a CONVENTIONS.md covering reusable patterns like async jobs and internationalization, a PATTERNS.md with gold-standard and a checklist, a GOTCHAS.md limited to traps that cross multiple areas, a flows/ folder with roughly 30 files (one per functional area), a reports/ folder for one-off audits, and a baselines/ folder tracking known error counts. The key rule in CLAUDE.md: before any Grep, Glob, or Read investigation, Claude must read the relevant first.
Key points
- Validated on a large production app: Svelte + Express/Knex, Oracle-to-Postgres migration, ~150 Cypress specs, ~30 functional modules
- CLAUDE.md auto-loads every session and holds rules of , not the content itself
- docs/claude/ splits by role: INDEX, , MAP, GLOSSARY, CONVENTIONS, PATTERNS, GOTCHAS
- Core rule: read the relevant doc before any Grep/Glob/Read code investigation
- A flows/ folder holds roughly 30 files, one per functional area, for detailed context