skills/agentmd-generator/SKILL.md
Generate hierarchical AGENTS.md knowledge base for any repository. Analyzes codebase structure, discovers skills, asks adaptive questions, and generates optimized root + local AGENTS.md files that minimize context consumption while maximizing AI effectiveness. Trigger: When user says "generate agents", "setup AGENTS.md", "configure AI knowledge base", "agentmd", or wants to create/rebuild the AGENTS.md hierarchy for a project.
npx skillsauth add agustinalbonico/ai-customizations agentmd-generatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill implements a 6-phase workflow that produces a hierarchical AGENTS.md system. It does NOT dump everything into one file. It analyzes, asks, discovers, designs, and generates — in that order.
The goal: each AI session loads ONLY the context it needs, nothing more.
Inspect the codebase systematically. Read directories, config files, and structure markers.
| Signal | Type | Example |
|--------|------|---------|
| Single package.json/go.mod at root, no nested projects | simple | Standard API or SPA |
| Workspaces field in package.json, pnpm-workspace.yaml, nx.json, turbo.json, lerna.json | monorepo | Turborepo, Nx workspace |
| Multiple independent projects in subdirs, each with own package manager config | multi-project | Docker-compose based microservices |
| apps/ + packages/ or services/ + libs/ pattern | monorepo | Typical monorepo layout |
Read config files to identify:
Present to user as structured summary:
## Repository Diagnostic
**Type**: monorepo | simple | multi-project
**Root**: /path/to/repo
### Structure
- apps/web (Next.js 15, React 19, Tailwind 4)
- apps/api (NestJS, Prisma, PostgreSQL)
- packages/ui (Shared components)
- packages/config (Shared configs)
### Detected Stack
| Layer | Technology | Version |
|-------|-----------|---------|
| Frontend | Next.js | 15.x |
| Backend | NestJS | 10.x |
| Database | PostgreSQL | via Prisma |
| Testing | Vitest + Playwright | - |
### Natural Boundaries
1. apps/web → frontend context
2. apps/api → backend context
3. packages/ui → design system context
### Existing AI Config
- AGENTS.md: none | root only | hierarchical
- Skills: [list found]
- Conventions: [list found]
Ask the MINIMUM needed. If the codebase already reveals the answer, SKIP the question. Group by priority. STOP after asking and WAIT for the user to respond before continuing.
[multi-select])← detected)Use the question tool if available. Otherwise present questions with lettered options. For each question, present it individually, wait for the response, then continue to the next.
Q1: What types of tasks do you primarily use AI for in this repo? [multi-select]
| Option | Description | |--------|-------------| | a) Feature development | Writing new code and features | | b) Bug fixing | Debugging and fixing issues | | c) Refactoring | Improving existing code structure | | d) Testing | Writing and improving tests | | e) Code review | Reviewing PRs and code quality | | f) Documentation | Writing docs and comments | | g) All of the above | Full-spectrum usage | | h) Other | Write your answer |
If code has test configs → pre-mark (d). If CI/CD → pre-mark (e). Default to (g) if unclear.
Q2: What critical rules must the AI ALWAYS follow? [multi-select + free text]
| Option | Example |
|--------|---------|
| a) Strict typing | Never use any, always explicit types |
| b) Tests required | Always write tests for new code |
| c) Specific architecture | Follow hexagonal/clean/screaming architecture |
| d) No direct DB access | Always go through repository/service layer |
| e) Specific linter rules | Never disable ESLint/Prettier rules |
| f) Conventional commits | Follow conventional commits format |
| g) None in particular | No special rules |
| h) Other | Write your own rules |
Pre-select based on detected config: tsconfig strict → (a), jest/vitest config → (b), eslint config → (e), commitlint → (f).
Q3: Which of these areas need their own specialized AI context? [multi-select]
This question is auto-populated from Phase 1 detected boundaries. Only ask if 2+ boundaries found.
| Option | Detected Area | |--------|--------------| | a) {area1} | {stack info} | | b) {area2} | {stack info} | | c) {area3} | {stack info} | | d) All of the above | Each area gets its own AGENTS.md | | e) None | Root AGENTS.md is enough |
Default: if areas use different tech stacks → pre-select (d). If same stack → pre-select (e).
Q4: Does this project follow specific patterns the AI should know? [multi-select + free text]
| Option | Pattern | |--------|---------| | a) Container-presentational | Separation of smart/dumb components | | b) Feature-based structure | Organized by feature, not by type | | c) Barrel exports | index.ts re-exports in every module | | d) Specific state management | Custom state patterns | | e) Specific naming conventions | Prefixes, suffixes, casing rules | | f) No special patterns | Follow standard conventions | | g) Other | Describe your patterns |
Pre-select based on code: if detected feature folders → (b), if index.ts files prevalent → (c).
Q5: There are existing AI config files. What should we do? [single-select]
Only ask if existing AGENTS.md, .cursor/rules, or copilot-instructions found.
| Option | Action | |--------|--------| | a) Keep and extend | Preserve existing rules, add new structure | | b) Replace entirely | Start fresh with new hierarchical structure | | c) Review together | Show me what exists so I can decide per section |
Q6: What level of detail do you want in the generated AGENTS.md? [single-select]
| Option | Level | Description | |--------|-------|-------------| | a) Minimal | Root only | One AGENTS.md, lean and focused | | b) Standard | Root + local | Root + one AGENTS.md per distinct component | | c) Detailed | Full system | Root + local + auto-invoke tables + QA checklists |
Default: simple repo → (a), monorepo 2-3 components → (b), monorepo 4+ → (c).
| Condition | Action | |-----------|--------| | Simple repo, single stack | Skip Q3, default Q6 to (a) Minimal | | Existing AGENTS.md found | Add Q5 to queue | | Monorepo with clear boundaries | Pre-fill Q3 options with detected boundaries | | Only 1-2 technologies detected | Skip Q4 options related to patterns not found in code | | User picks "All of the above" on Q1 | Skip follow-up about task types | | User says "just do it" / "dale" | Use smart defaults for all, show plan for approval only |
After each answer:
Check all known skill locations:
.agents/skills/, skills/~/.agents/skills/, ~/.config/opencode/skills/.cursor/rules/, .github/copilot-instructions.mdUse find-skills skill to search for skills matching the detected stack.
Map detected technologies to skill search queries:
| Detected Tech | Search Query | |--------------|-------------| | React/Next.js | "react", "nextjs", "frontend" | | Angular | "angular", "frontend" | | NestJS | "nestjs", "backend", "node" | | Django | "django", "python", "backend" | | Go | "go", "golang" | | PostgreSQL | "postgresql", "database" | | Prisma | "prisma", "orm", "database" | | Playwright | "playwright", "e2e", "testing" | | Jest/Vitest | "jest", "vitest", "testing" | | Tailwind | "tailwind", "css", "styling" | | Docker | "docker", "deployment" | | TypeScript | "typescript" |
Organize into three categories:
### Skill Map
#### Global Skills (apply everywhere)
| Skill | Source | Purpose |
|-------|--------|---------|
| typescript | user-level | Type patterns |
| git-master | user-level | Git operations |
#### Scoped Skills (apply to specific areas)
| Skill | Scope | Purpose |
|-------|-------|---------|
| nestjs-best-practices | apps/api | NestJS patterns |
| vercel-react-best-practices | apps/web | React patterns |
#### Missing Skills (recommended to create)
| Skill | Justification |
|-------|--------------|
| myapp-api | Project-specific API conventions |
ALWAYS prefer existing skills. Only recommend creating new skills when:
Is it a simple repo with one tech stack?
YES → Root AGENTS.md only
NO →
Does it have 2+ distinct technology contexts?
YES → Root + one AGENTS.md per context
NO →
Does it have 2+ independent deployable units?
YES → Root + one AGENTS.md per unit
NO → Root AGENTS.md only
Every root AGENTS.md MUST have:
What it must NOT have:
Each local AGENTS.md MUST have:
Override rule: Local AGENTS.md overrides root when guidance conflicts.
| Content | Max Size | |---------|----------| | Root AGENTS.md | ~4-8 KB | | Local AGENTS.md | ~3-6 KB | | Total across all AGENTS.md | ~20 KB max |
If content exceeds these limits, it belongs in a SKILL.md, not in AGENTS.md.
ALWAYS show the user:
skills/{name}/SKILL.mdapps/api/AGENTS.mdAfter generating, verify:
The ENTIRE point of this skill is to REDUCE context consumption. Every decision must be evaluated through this lens:
User-level AGENTS.md (personality, global rules)
└── Root AGENTS.md (project overview, global skills, cross-cutting rules)
├── Local AGENTS.md (component-specific context)
│ └── Skills (detailed patterns, loaded on demand)
└── Skills (detailed patterns, loaded on demand)
Each level adds specificity. No level repeats what a parent already provides.
| Anti-pattern | Why it's bad | What to do instead | |-------------|-------------|-------------------| | Everything in root AGENTS.md | Bloats every session | Split into local + skills | | Duplicating skill content in AGENTS.md | Double maintenance, wasted context | Reference skill, don't copy | | Personality/tone in project AGENTS.md | Not project-specific | Keep in user-level config | | Vague rules ("write good code") | Not actionable | Specific: "Always use zod for validation" | | AGENTS.md > 10KB | Too much context consumed | Split into local files or skills | | Local AGENTS.md for simple repos | Unnecessary indirection | Root-only for simple repos | | Framework tutorials in AGENTS.md | That's what skills are for | Reference the skill |
See assets/root-agents-template.md for the root AGENTS.md template. See assets/local-agents-template.md for the local AGENTS.md template.
# Typical invocation
/agentmd
# Re-run analysis only (no generation)
/agentmd --analyze
# Regenerate from existing analysis
/agentmd --regenerate
development
Migrar aplicaciones React + NestJS + Postgres desde web a desktop con Tauri en entornos LAN. Usar cuando se necesite planificar, implementar, verificar y preparar release con backend local en 127.0.0.1, base remota por IP fija, sidecar estable y diagnostico de logs de arranque.
development
Alias corto para migracion Web a Desktop con Tauri en stack React + NestJS + Postgres en LAN. Usar para aplicar flujo de planificacion, implementacion, verificacion y release con sidecar y reglas de red.
development
Playbook iterativo para llevar proyectos Node y TypeScript (NestJS + React en monorepo) a cumplir Quality Gates de SonarQube sin romper build ni pipelines. Usar cuando se necesite subir cobertura priorizando New Code, eliminar issues nuevos (Bugs, Vulnerabilities, Code Smells), revisar Security Hotspots y controlar duplicacion y deuda tecnica.
testing
Alias corto para ejecutar pruebas E2E y QA manual. Usar cuando quieras probar la ultima funcionalidad implementada con /qa.