From majestic-engineer
Generates 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/majestic-engineer:hierarchical-agentsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create a **hierarchical AGENTS.md system** for codebases that enables AI coding agents to work efficiently with minimal token usage. Generates lightweight root documentation with detailed sub-folder guidance following the "nearest-wins" principle.
Create a hierarchical AGENTS.md system for codebases that enables AI coding agents to work efficiently with minimal token usage. Generates lightweight root documentation with detailed sub-folder guidance following the "nearest-wins" principle.
Follow these phases in order. See references/generation-process.md for complete details.
Analyze the codebase:
Output: Structured map of the repository before generating any files.
Root must be lightweight: ~100-200 lines maximum, universal guidance only. Acts as index and navigation hub. Agents read the closest AGENTS.md to the file being edited — sub-folder files override root (nearest-wins).
Create root file with these sections:
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
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 Development Workflow:
## Development Workflow
- Before coding -> describe approach -> wait for approval
- Ambiguous requirements -> ask first
- If task touches >3 files -> decompose first
- After coding -> list breakage risks + suggest tests
- Bug fix -> write failing test -> fix until green
- When corrected -> add lesson to .agents/lessons/
Sub-folders have MORE detail than root — specific patterns, technology-specific conventions, real file examples from the codebase.
For EACH major package/directory, create detailed AGENTS.md:
Key: Patterns & Conventions must include real file paths with DO/DON'T examples.
Adapt templates for specific package types (Design System, Database, API, Testing). See references/generation-process.md for specialized templates.
AGENTS.md # Root (lightweight)
apps/
web/AGENTS.md # Frontend details
api/AGENTS.md # Backend details
packages/
ui/AGENTS.md # Design system details
shared/AGENTS.md # Shared code details
AGENTS.md # Root (can be more detailed)
src/
components/AGENTS.md # Component patterns
services/AGENTS.md # Service patterns
Update AGENTS.md when:
npx claudepluginhub majesticlabs-dev/majestic-marketplace --plugin majestic-engineerAnalyzes repository structure to generate or update AGENTS.md contributor guides for AI agents. Supports single-repo and monorepo layouts with update mode that preserves custom sections.
Analyzes a project and generates a root AGENTS.md with operational commands, golden rules, and nested AGENTS.md files for high-context zones. Invoke via "AGENTS.md 만들어줘", "에이전트 규칙 만들어줘", or "/agents-md".
Creates and maintains concise AGENTS.md / CLAUDE.md files for projects. Analyzes toolchain, linters, and conventions to produce minimal agent-facing documentation under 100 lines.