From tech-snacks
Sets up hierarchical AGENTS.md files so Claude navigates codebases like a senior engineer. Use when initializing projects or adding AI-friendly context infrastructure.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tech-snacks:intent-layerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Hierarchical AGENTS.md infrastructure so agents navigate codebases like senior engineers.
Hierarchical AGENTS.md infrastructure so agents navigate codebases like senior engineers.
Only ONE root context file. CLAUDE.md and AGENTS.md should NOT coexist at project root. Child AGENTS.md in subdirectories are encouraged for complex subsystems.
1. Detect state
scripts/detect_state.sh /path/to/project
→ Returns: none | partial | complete
2. Route
none/partial → Initial setup (steps 3-5)
complete → Maintenance (step 6)
3. Measure [gate - show table first]
scripts/analyze_structure.sh /path/to/project
scripts/estimate_tokens.sh /path/to/each/source/dir
4. Decide
No root file → Ask: CLAUDE.md or AGENTS.md?
Has root file → Add Intent Layer section + child nodes if needed
5. Execute
Use references/templates.md for structure
Use references/node-examples.md for real-world patterns
Validate: one root, READ-FIRST directive, <4k tokens per node
6. Maintenance mode (when state=complete)
Ask user:
a) Audit nodes → Use references/capture-protocol.md for SME questions
b) Find candidates → Re-measure tokens, suggest new nodes
c) Both
| Signal | Action |
|---|---|
| >20k tokens in directory | Create AGENTS.md |
| Responsibility shift | Create AGENTS.md |
| Hidden contracts/invariants | Document in nearest ancestor |
| Cross-cutting concern | Place at LCA |
Do NOT create for: every directory, simple utilities, test folders (unless complex).
When documenting existing code, ask:
Scripts:
scripts/detect_state.sh - Check Intent Layer state (none/partial/complete)scripts/analyze_structure.sh - Find semantic boundariesscripts/estimate_tokens.sh - Measure directory complexityReferences:
references/templates.md - Root and child node templatesreferences/node-examples.md - Real-world examplesreferences/capture-protocol.md - SME interview protocolThis skill is vendored from crafter-station/skills (MIT, © 2026 Crafter Station). See LICENSE in this directory.
Built by Railly Hugo for Crafter Station, based on The Intent Layer by Tyler Brandt.
npx claudepluginhub ragnar-pwninskjold/tech-snacks --plugin tech-snacksGenerates hierarchical AGENTS.md structures for codebases to optimize AI agent token usage. Use for repo analysis, monorepos, JIT indexing, and token-efficient root/sub-folder docs.
Generates hierarchical AGENTS.md files for every directory, enabling AI agents to navigate and understand codebase structure, relationships, and conventions.
Guides codebase exploration and documentation using AGENTS.md and .context/CONTEXT.md files. Covers principles for writing hierarchical summaries and progressive disclosure.