Make Claude Code maintain a structural map of your repo — for itself.
A drop-in skill + hook combo for Claude Code that keeps an agent-facing documentation tree (.claude-docs/) in sync with your codebase. Claude reads it before every task and updates it after every change.
Every new Claude Code session starts cold. It re-greps to find your modules, re-reads your conventions, re-discovers your patterns. On a real codebase this burns dozens of tool calls per task and slows everything down.
Project documentation written for humans (README, ADRs, wiki pages) doesn't help — it's narrative, long, and easy to skip. Claude needs something different: a map, written for agents, that says "if you want to do X, look in Y," with tables and one-liners instead of prose.
This repo gives you three things:
- A skill (
agentic-documentation) that tells Claude:- CHECK the map before any non-trivial task — replaces blind greping.
- UPDATE the map in the same commit as the code change — prevents drift.
- INIT the map from scratch on demand.
- A
SessionStarthook that injects a pointer to the map and the skill into every session, so Claude can't forget to check. - Starter templates for the
.claude-docs/tree, so you can bootstrap it on day one.
Together they create a feedback loop: Claude reads the map → ships the change → updates the map → the next session reads a slightly better map. The map gets better, not staler, with every commit.
A typical .claude-docs/ tree:
.claude-docs/
├── README.md Master index + read order
├── OVERVIEW.md Stack, layout, top-level architecture
├── LOOKUP.md "I want to X → look here" table
├── CONVENTIONS.md Naming, imports, formatting rules
├── PATTERNS.md Copy-paste skeletons for common code shapes
├── SECURITY.md Non-negotiable security rules
├── WORKFLOWS.md Step-by-step recipes for recurring tasks
├── TESTING.md Test runners, helpers, fixtures
└── <area>/ One subfolder per logical area of the repo
└── README.md Catalog of modules/features in that area
Every file is short, structural, agent-first. No "in this document we will explore…". Tables over prose. Every entry ≤ 5 lines or it links to source.
From inside the target project's root:
curl -fsSL https://raw.githubusercontent.com/Coding9GmbH/agentic-docs/main/install.sh | bashOr clone this repo and run:
/path/to/agentic-docs/install.sh /path/to/your/projectThe installer:
- Copies the skill to
.claude/skills/agentic-documentation/SKILL.md - Copies the hook to
.claude/hooks/session-start-claude-docs-pointer.sh(executable) - Merges the
SessionStarthook entry into.claude/settings.json(creates it if missing) - Copies starter templates to
.claude-docs/only if that directory does not already exist
Existing files are never overwritten without a prompt.
# From the root of your target project
mkdir -p .claude/skills/agentic-documentation .claude/hooks .claude-docs
# Copy the skill
cp /path/to/agentic-docs/skill/SKILL.md \
.claude/skills/agentic-documentation/SKILL.md
# Copy the hook
cp /path/to/agentic-docs/hook/session-start-claude-docs-pointer.sh \
.claude/hooks/
chmod +x .claude/hooks/session-start-claude-docs-pointer.sh
# Copy starter templates
cp -R /path/to/agentic-docs/templates/claude-docs/. .claude-docs/Then add the hook to .claude/settings.json:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": ".claude/hooks/session-start-claude-docs-pointer.sh",
"timeout": 5
}
]
}
]
}
}After install, ask Claude:
Init the .claude-docs tree for this project.
Claude will run the skill in INIT mode: snapshot the repo's shape, dispatch parallel Explore agents for heavy catalogs, and write the doc tree from scratch. Review the result, commit, and you're done.
If you'd rather hand-curate, edit the templates in .claude-docs/ directly. The templates ship with <placeholder> markers — fill them in and Claude will keep them current from there.
Claude reads .claude-docs/LOOKUP.md + the topic file for the area being touched before any grep. Typical cost: 1 minute of reading replaces 3–10 tool calls of exploration.
If a change adds/renames/deletes a module, model, endpoint, UI primitive, hook, event, queue, security rule, or workflow, Claude updates the affected docs in the same commit. The map and the code change together, or the change is incomplete.
rebuild .claude-docs from scratch
Used when the tree has drifted too far to patch, or on first install.
The skill is intentionally project-agnostic. Adapt it to your repo:
- Edit
templates/claude-docs/README.mdto describe your topic files and read order. - Drop docs you don't need. No frontend? Delete
DESIGN-SYSTEM.mdandweb/. Pure library? DropWORKFLOWS.md. - Add area subfolders mirroring your repo's logical layout (
api/,web/,worker/,infra/,docs/, …). - Tighten the trigger list in the skill's UPDATE section to match the artifacts that actually exist in your project (Prisma models? gRPC services? Helm charts?).
The only hard rule: every file is short, structural, agent-first.
The hook isn't strictly required — but without it, Claude has to "remember" to consult the skill, and skills compete for attention. The SessionStart hook injects a one-paragraph pointer into the context on every session start, so the skill stays top-of-mind without you having to remind Claude in each prompt.
The hook is silent (exit 0 with no output) when .claude-docs/ doesn't exist, so it's safe to leave installed on branches that haven't initialised the map yet.
agentic-docs/
├── README.md You are here
├── LICENSE MIT
├── install.sh Installer
├── skill/
│ └── SKILL.md The skill file
├── hook/
│ └── session-start-claude-docs-pointer.sh
├── templates/
│ └── claude-docs/ Starter templates with placeholders
│ ├── README.md
│ ├── OVERVIEW.md
│ ├── LOOKUP.md
│ ├── CONVENTIONS.md
│ ├── PATTERNS.md
│ ├── SECURITY.md
│ ├── WORKFLOWS.md
│ └── TESTING.md
├── examples/
│ └── README.md Example trees from real projects
└── docs/
├── installation.md
├── customization.md
└── faq.md
- Claude Code installed.
- A git repo (recommended — the skill is most valuable when changes are committed alongside doc updates).
bashand standard POSIX tools for the installer (cp,chmod,mkdir).
MIT — © 2026 Coding 9 GmbH
This pattern emerged from real production use on a NestJS + Next.js + Prisma codebase at Coding 9 GmbH where blind greping was burning ~30% of each session. The map paid for itself within a week.