nest/SKILL.md
LLM-optimized folder structure design. Audits and restructures directories for context efficiency, progressive disclosure, and prompt cache performance. Don't use for general repo structure (Grove), config audit (Hone), or skill generation (Sigil).
npx skillsauth add simota/agent-skills nestInstall 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.
Design and apply folder structures optimized for LLM agent navigation. Nest bridges the gap between human-readable project organization and LLM-efficient context loading.
Use Nest when:
Route elsewhere when:
GroveHoneSigilAtlasreferences/naming-guide.md.@import splitting. For CLAUDE.md density management, hand off to Hone.git mv for all file moves during APPLY phase. Verify build passes after each batch of moves before proceeding.AUDIT → DIAGNOSE → DESIGN → APPLY → VERIFY
| Phase | Purpose | Key Activities | Read |
|-------|---------|----------------|------|
| AUDIT | Measure current state | Tree analysis, token estimation, discovery test, cache topology scan | references/audit-checklist.md |
| DIAGNOSE | Identify inefficiencies | Navigation bottlenecks, bloated context files, naming blind spots | — |
| DESIGN | Plan optimized structure | Progressive disclosure layout, CLAUDE.md hierarchy, naming scheme | references/layout-patterns.md |
| APPLY | Execute restructuring | git mv file moves, CLAUDE.md creation, naming fixes | — |
| VERIFY | Validate improvement | Before/after token cost, discovery test, build path verification | references/audit-checklist.md |
| Recipe | Subcommand | Default? | When to Use | Read First |
|--------|-----------|---------|-------------|------------|
| Structure Audit | audit | ✓ | LLM navigation efficiency audit of existing folder structure | references/audit-checklist.md |
| Restructure | restructure | | Restructuring for LLM optimization (includes git mv execution) | references/layout-patterns.md |
| Progressive Disclosure | progressive | | L1/L2/L3 progressive disclosure hierarchy design | references/layout-patterns.md |
| Prompt Cache | cache | | Prompt cache topology optimization and static-file-first ordering | references/audit-checklist.md |
| Naming | naming | | File and folder naming audit for LLM grep/glob discoverability — bias-correction for generic names (utils, helpers), domain-vs-type grouping, suffix conventions (.config, .test, .spec), case strategy (kebab/camel/Pascal), rename-impact analysis | references/naming-guide.md |
| Sharding | sharding | | Large file sharding strategy — split CLAUDE.md / reference docs via @import, choose split axis (by domain / by phase / by frequency), preserve cache prefixes, design include manifest, validate cycle-free imports | references/sharding-strategy.md |
| Monorepo | monorepo | | Monorepo workspace topology for LLM efficiency — package boundaries (apps/, packages/, libs/), per-workspace CLAUDE.md cascade, turborepo / nx / pnpm-workspace path optimization, shared rule deduplication | references/monorepo-topology.md |
Parse the first token of user input.
audit = Structure Audit). Apply normal AUDIT → DIAGNOSE → DESIGN → APPLY → VERIFY workflow.Behavior notes per Recipe:
audit: AUDIT + DIAGNOSE phases only. Report scores (discovery/token_budget/cache_topology/naming). No changes.restructure: Full AUDIT → DESIGN → APPLY → VERIFY. Execute git mv in batches. Build-path preservation check required.progressive: Three-tier design L1 (always-loaded) / L2 (on-demand) / L3 (deep reference) and CLAUDE.md hierarchy plan.cache: Group files by change frequency → static content first → stabilize cache prefixes.naming: AUDIT 命名のみ。glob/grep ヒット率を測定し、ジェネリック名 (utils.ts / helpers.ts / common.ts) を ドメイン由来名 (string-helpers.ts / date-formatters.ts) に置換する rename plan を提示。kebab-case ディレクトリ + ドメイングループ化 + サフィックス規約 (.config / .test / .spec) を適用。git mv バッチで実行、import path 影響を事前列挙。sharding: 単一 CLAUDE.md / reference が 300 行超 / 1200 token 超の場合、@import で分割。分割軸を 3 種から選定 (by domain / by lifecycle phase / by change frequency)。cache prefix を破壊しない順序で並べ替え、include manifest を生成、循環参照チェック必須。Hone と協調 (Hone = density audit, Nest = split topology)。monorepo: turborepo / nx / pnpm-workspace を検出し、apps/ packages/ libs/ の境界に CLAUDE.md cascade を設計。ルートに共通ルール、各ワークスペースに override のみ配置。重複ルールは root に巻き上げ。tsconfig path alias と CLAUDE.md の整合性も検証。| Signal | Approach | Primary Output | Read next |
|--------|----------|----------------|-----------|
| audit, evaluate folder structure | AUDIT only | Structure report with scores and recommendations | references/audit-checklist.md |
| optimize, restructure for LLM | Full workflow | Restructured directories + migration script | references/layout-patterns.md |
| CLAUDE.md hierarchy, rules placement | CLAUDE.md focus | Hierarchical rules design with placement plan | references/layout-patterns.md |
| naming, discoverability | Naming focus | Rename plan with glob/grep validation | references/naming-guide.md |
| new project, scaffold for LLM | Greenfield design | Complete LLM-optimized directory template | references/layout-patterns.md |
Every deliverable must include:
Simulate 5 common LLM navigation queries against the project and score hit rate:
| Query Type | Test Pattern | Pass Criteria |
|-----------|-------------|--------------|
| Find config files | glob: **/*.config.*, **/config/** | All configs found in ≤2 glob patterns |
| Find test files | glob: **/*.test.*, **/*.spec.* | All tests found in ≤2 glob patterns |
| Find API routes | grep: "router\|endpoint\|handler" | 80%+ route files in results |
| Find documentation | glob: **/*.md, **/docs/** | All docs found in ≤2 glob patterns |
| Find CLAUDE.md rules | glob: **/CLAUDE.md, **/.claude/** | Hierarchical chain discoverable |
| File Type | Max Lines | Max Tokens (est.) | Action if Exceeded |
|-----------|-----------|-------------------|-------------------|
| CLAUDE.md | 200 (ideal), 300 (max) | ~1,200 | Hand off to Hone for @import split design |
| Reference file | 500 | ~2,000 | Split by domain or move detail to sub-references |
| Context file (any) | 300 | ~1,200 | Extract sections to dedicated files |
Evaluate how well the file structure supports prompt caching:
| Factor | Weight | Score Criteria | |--------|--------|---------------| | Static-first ordering | 30% | System prompts, configs before dynamic content | | Change frequency grouping | 30% | Rarely-changed files co-located, frequently-changed separate | | CLAUDE.md stability | 20% | Root CLAUDE.md changes <1x/week | | Tool definition locality | 20% | MCP configs and tool schemas in stable, predictable paths |
project/
├── CLAUDE.md # L1: Project-wide rules (always loaded)
├── .claude/
│ ├── rules/ # L1.5: @imported rule modules
│ │ ├── coding-standards.md
│ │ ├── testing-policy.md
│ │ └── security-rules.md
│ ├── settings.json # Tool configs (stable, cached)
│ └── skills/ # L2: On-demand skills
├── docs/
│ ├── architecture.md # L2: Read when relevant
│ ├── api/ # L3: Deep reference
│ └── decisions/ # L3: ADRs, read on demand
├── src/ # Application code
│ ├── {module}/
│ │ ├── CLAUDE.md # L1: Module-specific overrides
│ │ └── ...
└── scripts/ # Utilities
| Convention | Example | Rationale |
|-----------|---------|-----------|
| Kebab-case directories | user-auth/, data-pipeline/ | Consistent glob matching |
| Descriptive file names | api-routes.ts, auth-middleware.ts | grep hits on domain terms |
| Avoid generic names | utils.ts → string-helpers.ts | LLM can infer file content from name |
| Group by domain, not type | user/{model,routes,tests} vs models/user | Co-located context reduces navigation |
| Suffix conventions | .config., .test., .spec. | Reliable glob filtering |
For detailed naming rules, anti-patterns, and validation tests → references/naming-guide.md
| Level | File | Content | Token Budget |
|-------|------|---------|-------------|
| Global | ~/.claude/CLAUDE.md | Personal preferences, universal rules | 100-200 |
| Project | project/CLAUDE.md | Project conventions, stack-specific rules | 150-300 |
| Package | packages/api/CLAUDE.md | Package-specific overrides | 50-150 |
| Module | src/auth/CLAUDE.md | Module-specific context (rare) | 30-80 |
When CLAUDE.md exceeds 200 lines or density issues are detected, hand off to Hone for @import split design and density optimization.
Receives: Grove (base structure for LLM optimization), Hone (config audit findings needing structural fixes), Sigil (skill placement requirements), User (direct structure audit requests) Sends: Grove (structural conventions needed before LLM layer), Hone (CLAUDE.md density issues found during audit), Sigil (folder hierarchy ready for skill placement)
Overlap boundaries:
| Direction | Handoff | Purpose |
|-----------|---------|---------|
| Grove → Nest | GROVE_TO_NEST_HANDOFF | Base structure ready, apply LLM optimization |
| Hone → Nest | HONE_TO_NEST_HANDOFF | Config audit findings need structural fixes |
| Nest → Grove | NEST_TO_GROVE_HANDOFF | Structural conventions needed before LLM layer |
| Nest → Hone | NEST_TO_HONE_HANDOFF | CLAUDE.md density issues found during audit (>200 lines) |
| Nest → Sigil | NEST_TO_SIGIL_HANDOFF | Folder hierarchy ready for skill placement |
_STEP_COMPLETE:
Agent: Nest
Task_Type: AUDIT | RESTRUCTURE | CLAUDE_HIERARCHY | NAMING | GREENFIELD
Status: SUCCESS | PARTIAL | BLOCKED | FAILED
Output: <summary of deliverables>
Metrics:
token_cost_before: <estimated tokens>
token_cost_after: <estimated tokens>
discovery_score: <0-100>
cache_topology_score: <0-100>
Handoff: <next agent if applicable>
Next: <suggested follow-up action>
Reason: <why this outcome>
When input contains ## NEXUS_ROUTING, return results via:
## NEXUS_HANDOFF
- Step: <current step number>
- Agent: Nest
- Summary: <what was accomplished>
- Key findings / decisions: <list>
- Artifacts: <files created or modified>
- Metrics: token_cost_delta, discovery_score, cache_topology_score
- Risks / trade-offs: <identified concerns>
- Open questions: <unresolved items>
- Pending Confirmations: <items needing approval>
- User Confirmations: <items confirmed by user>
- Suggested next agent: <Grove | Hone | Sigil>
- Next action: CONTINUE | VERIFY | DONE
| Reference | Read this when |
|-----------|----------------|
| references/audit-checklist.md | Running AUDIT or VERIFY phase, need scoring criteria and test patterns |
| references/layout-patterns.md | Designing new structure, need standard LLM-optimized templates |
| references/naming-guide.md | Evaluating or fixing file/folder naming for LLM discoverability |
| references/sharding-strategy.md | Splitting large CLAUDE.md/reference docs via @import while preserving cache prefixes |
| references/monorepo-topology.md | Designing per-workspace CLAUDE.md cascade for turborepo / nx / pnpm-workspace |
| _common/OPUS_47_AUTHORING.md | Sizing the structure proposal, deciding adaptive thinking depth at DESIGN, or front-loading LLM target/token budget at AUDIT. Critical for Nest: P3, P5 |
.agents/nest.md..agents/PROJECT.md after task completion._common/OPERATIONAL.md and _common/GIT_GUIDELINES.md.development
Migration and upgrade orchestrator for frameworks, libraries, APIs, databases, and infrastructure. Provides codemod generation, incremental strategies (Strangler Fig/Branch by Abstraction), before/after verification, and rollback plans.
documentation
Workflow guide that decomposes complex tasks (Epics) into Atomic Steps under 15 minutes each. Manages progress tracking, drift prevention, risk assessment, and timely commit proposals. Use when complex task decomposition is needed.
content-media
Multi-tenant architecture design. Tenant isolation strategies, RLS, routing, and scale design for SaaS.
development
Static security analysis agent. Hardcoded secret detection, SQL injection prevention, input validation, security headers, and dependency CVE scanning. Don't use for runtime exploit verification (Probe), general code review (Judge), CI/CD management (Gear), or detection rule authoring (Vigil).