Agent init deep

From ravnhq/ai-toolkit · View interactive version

Agent init deep is an AI agent skill from the GitHub repository ravnhq/ai-toolkit. Initialize or migrate to nested CLAUDE.md structure for progressive disclosure. Claude auto-loads CLAUDE.md from any directory it enters, so nested files get discovered automatically. Use when setting up a new project''s agent config, refactoring a bloated CLAUDE.md, or adding progressive disclosure

How to use this skill

Skill file

Init Deep — Progressive Disclosure CLAUDE.md

Set up or migrate to a progressive disclosure CLAUDE.md structure using docs/agents/ for topic-specific guidance.

Context Model

Static (root CLAUDE.md)      — loaded every conversation, minimal, high-value
Semi-dynamic (docs/agents/)  — linked from root, loaded when the link is followed
Fully dynamic (skills)       — triggered by metadata match, loaded only when invoked

Root CLAUDE.md must be 40-50 lines maximum. Everything else belongs in docs/agents/ or skills.

Target Structure

CLAUDE.md                        # Root: identity, tech stack, key rules, workflow, links
docs/agents/
├── tooling.md                   # e.g. package manager, linting, formatting, hooks
├── commands.md                  # e.g. script execution, build filters, passing args
├── guardrails.md                # e.g. data isolation, secrets, library docs
├── definition-of-done.md       # e.g. coverage, lint, type-check, format requirements
└── [topic].md                   # Additional topic-specific files as needed

Workflow

Step 1: Detect State

Check for:
- CLAUDE.md exists?
- docs/agents/ exists?
- How many lines is CLAUDE.md?

If no CLAUDE.md → Greenfield path

If CLAUDE.md exists → Migration path

Step 2a: Greenfield Path

Ask the user:

  1. Project name and one-line description
  2. Tech stack (frontend, backend, database, etc.)
  3. Package manager (pnpm, npm, yarn, bun)
  4. Key guardrails (multi-tenancy, secrets, etc.)
  5. Definition of done (test coverage, lint, types, format)

Then generate:

Root CLAUDE.md with:

docs/agents/ files based on answers. Common files include:

Adjust filenames and topics to match the project's actual needs.

Step 2b: Migration Path

  1. Read existing CLAUDE.md
  2. Classify each section:
  1. Present proposed split to user:

```

ROOT CLAUDE.md:

docs/agents/tooling.md:

docs/agents/commands.md:

... etc

```

  1. Ask user to confirm or adjust
  2. Create docs/agents/ files
  3. Rewrite root CLAUDE.md

Step 3: Post-Setup

After creating the structure:

  1. List all created files
  2. Show the root CLAUDE.md
  3. Suggest additional improvements:

Root CLAUDE.md Template

# Project Context

[One-line project description]

## Tech Stack

- [list technologies]

## Key Rules

- [3-5 rules the agent consistently gets wrong without being told]

## Workflow

Every task follows four stages. Identify which stage you're in and follow its rules.

Plan → Execute → Validate → Commit
↑                               |
└── fix ────────────────────────┘

1. **Plan** — Understand the task, research code, design approach. Be concise; list unresolved questions.
2. **Execute** — Implement changes AND write tests together. No implementation is complete without tests.
3. **Validate** — ALL checks must pass with zero errors before moving on:
   - [list validation commands]
     If ANY check fails → return to Execute, fix, re-validate. Pre-existing errors are NOT exempt.
4. **Commit** — Only after Validate passes completely. Never commit with failing checks.

## Detailed Guidance

When working on tasks involving these topics, read the linked doc:

- Topic (`docs/agents/file.md`) — brief routing signal describing when to read this
- Run `/skills` to see available patterns and workflows

Classification Heuristic

When deciding what stays in root vs moves to docs/agents/:

| Criteria | Root | docs/agents/ |

| ---------------------------- | --------------------- | ----------------------- |

| Agent gets wrong without it? | YES | Sometimes |

| Applies to every task? | YES | NO |

| Under 2 lines? | YES | Any length |

| Detailed reference? | NO | YES |

| Procedural/workflow? | only the 4-stage loop | YES (multi-step) |

Principles

Examples

Positive Trigger

User: "Refactor our bloated CLAUDE.md into progressive disclosure with docs/agents."

Expected behavior: Use agent-init-deep guidance, follow its workflow, and return actionable output.

Non-Trigger

User: "Review this React component for unnecessary re-renders."

Expected behavior: Do not prioritize agent-init-deep; choose a more relevant skill or proceed without it.

Troubleshooting

Skill Does Not Trigger

Guidance Conflicts With Another Skill

Output Is Too Generic

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.