Generate hierarchical AGENTS.md structure for codebases to optimize AI agent token usage. Use when creating AGENTS.md files, documenting codebase structure, setting up agent guidance, organizing project documentation for AI tools, implementing JIT indexing, or working with monorepos that need lightweight root guidance with detailed sub-folder documentation. Covers repository analysis, root AGENTS.md generation, sub-folder AGENTS.md creation, and token-efficient documentation patterns.
/plugin marketplace add majesticlabs-dev/majestic-marketplace/plugin install majestic-engineer@majestic-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/generation-process.mdCreate a hierarchical AGENTS.md system for codebases that enables AI coding agents to work efficiently with minimal token usage. This skill generates lightweight root documentation with detailed sub-folder guidance following the "nearest-wins" principle.
Use this skill when:
Why this matters: Claude Code's system prompt includes ~50 instructions, leaving ~100 usable slots from Claude's ~150 instruction capacity. The system also tells Claude that AGENTS.md context "may or may not be relevant" - so non-universal instructions get ignored uniformly. Manual crafting beats auto-generation for leverage.
Follow these phases in order. See GENERATION_PROCESS.md for complete details.
Analyze the codebase structure:
Output: Structured map of the repository before generating any files.
Tools to Use:
# Get directory structure
find . -type d -maxdepth 3 -not -path '*/node_modules/*' -not -path '*/.git/*'
# Find package.json files
find . -name "package.json" -not -path '*/node_modules/*'
# Identify technology
rg -l "react|vue|angular|svelte" --type ts --type tsx --type js
rg -l "prisma|drizzle|typeorm" --type ts
rg -l "jest|vitest|playwright" --type json
Create lightweight root file with these sections:
Project Snapshot (3-5 lines)
Root Setup Commands (5-10 lines)
Universal Conventions (5-10 lines)
Implementation Rules (2-3 lines)
Security & Secrets (3-5 lines)
JIT Index - Directory Map (10-20 lines)
Acceptance Criteria (3-5 lines)
Example JIT Index:
## JIT Index (what to open, not what to paste)
### Package Structure
- Web UI: `apps/web/` → [see apps/web/AGENTS.md](apps/web/AGENTS.md)
- API: `apps/api/` → [see apps/api/AGENTS.md](apps/api/AGENTS.md)
- Shared packages: `packages/**/` → [see packages/README.md]
### Quick Find Commands
- Search function: `rg -n "functionName" apps/** packages/**`
- Find component: `rg -n "export.*ComponentName" apps/web/src`
- Find API routes: `rg -n "export const (GET|POST)" apps/api`
Example Implementation Rules:
## Implementation Rules
Before adding ANY external dependency (gems, npm packages, GitHub Actions, Docker images, APIs, CDN links):
- Use WebSearch to verify the latest stable version BEFORE implementation
- Never trust training data for version numbers
For EACH major package/directory, create detailed AGENTS.md:
Key: Section 3 (Patterns & Conventions) must include:
Adapt templates for specific package types:
See GENERATION_PROCESS.md for specialized templates.
Before finalizing, verify:
Present files in this order:
Format each file:
---
File: `AGENTS.md` (root)
---
[full content]
---
File: `apps/web/AGENTS.md`
---
[full content]
AGENTS.md # Root (lightweight)
apps/
web/AGENTS.md # Frontend details
api/AGENTS.md # Backend details
mobile/AGENTS.md # Mobile details
packages/
ui/AGENTS.md # Design system details
shared/AGENTS.md # Shared code details
services/
auth/AGENTS.md # Auth service details
AGENTS.md # Root (can be more detailed)
src/
components/AGENTS.md # Component patterns
services/AGENTS.md # Service patterns
utils/AGENTS.md # Utility patterns
❌ Don't: Include full file content in AGENTS.md ✅ Do: Reference file paths and provide search commands
❌ Don't: Duplicate guidance in root and sub-files ✅ Do: Keep root minimal, detail in sub-files
❌ Don't: Write vague examples ("use best practices")
✅ Do: Point to specific files ("copy pattern from src/components/Button.tsx")
❌ Don't: Create AGENTS.md for every directory ✅ Do: Only create for major packages/domains
❌ Don't: Use placeholder paths ✅ Do: Verify all paths exist in codebase
# 1. Start analysis
rg -l "package.json" --max-depth 3
# 2. Identify structure
tree -L 2 -d
# 3. Check for existing patterns
rg -n "export.*Component" apps/web/src --max-count 5
# 4. Generate root AGENTS.md
# (Use Phase 2 template)
# 5. Generate sub-folder AGENTS.md
# (Use Phase 3 template for each major package)
# 6. Verify all paths
find . -name "AGENTS.md"
After generation, validate:
Path accuracy: All referenced files exist
# Extract file paths from AGENTS.md and verify
rg -o '\`[^`]+\.(ts|tsx|js|jsx|md)\`' AGENTS.md | while read path; do
[[ -f $path ]] || echo "Missing: $path"
done
Command validity: All search commands work
# Test each rg/find command from AGENTS.md
Link validity: All AGENTS.md links resolve
find . -name "AGENTS.md" -type f
AI agents should:
Update AGENTS.md when:
Keep documentation synchronized with codebase evolution.
Skill Status: ACTIVE ✅ Line Count: < 500 (following 500-line rule) ✅ Progressive Disclosure: Reference file for detailed process ✅
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.
Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.