skills/init-deep/SKILL.md
Deep initialization of project AGENTS.md hierarchy and control plane for AI coding agents. Use this skill whenever the user wants to set up, initialize, bootstrap, or create AGENTS.md / CLAUDE.md files for their project, or when they mention "init-deep", "harness setup", "control plane", "agent context", "project initialization for agents", or want to make their codebase agent-ready. Also trigger when a user says things like "set up my repo for Claude Code", "make this project work better with agents", "create agent instructions", "bootstrap harness", or "initialize agent docs". This skill handles both existing large codebases (where hierarchical, module-scoped AGENTS.md files are needed) and new/small projects (where brainstorming with the user comes first). Do NOT use this skill for routine code changes, bug fixes, or general documentation — it is specifically for creating the structured agent control plane.
npx skillsauth add Refinex-Space/Refinex-Skills init-deepInstall 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 deeply initializes a project's agent control plane — the structured hierarchy of AGENTS.md files and supporting documentation that enables AI coding agents to work effectively across the codebase. The philosophy draws from three converging insights in the harness engineering discipline:
AGENTS.md is a table of contents, not an encyclopedia. A single monolithic file becomes stale, unverifiable, and bloated. The root AGENTS.md should be ~80–120 lines and function as a map with pointers to deeper sources of truth (OpenAI's harness engineering finding).
Hierarchical, scope-local context injection. Each module or subdirectory gets its own lean AGENTS.md containing only what an agent working in that scope needs to know. Agents auto-read the relevant files for their working directory without loading the entire repo into context (oh-my-openagent's /init-deep design).
Progressive disclosure with mechanical enforcement. The harness should guide agents through layered information: metadata first, then module-specific rules, then deep references. Constraints should be enforceable, not aspirational (Anthropic's harness design principles).
Before starting any work, read the appropriate reference files:
references/agents-md-patterns.md — canonical patterns, anti-patterns, and structural templates for AGENTS.md filesreferences/codebase-analysis.md — the systematic approach to analyzing a codebase for control plane generationThese references contain hard-won patterns. Do not skip them.
Determine which path to follow based on the project's maturity:
Indicators: the repo has multiple directories, established patterns, significant code, existing README, package configs, CI setup, etc. Proceed to Phase 2A.
Indicators: empty or near-empty repo, only a README or skeleton, the user is still deciding architecture. Proceed to Phase 2B.
Indicators: existing AGENTS.md files that are bloated, monolithic, outdated, or poorly structured. Recommend the user run the companion drift-doctor skill instead, which is purpose-built for recalibrating an existing control plane. If the user insists on starting fresh, treat as Path A.
This is the most common and most valuable path. The goal is to understand the project deeply enough to generate a hierarchical AGENTS.md structure that accurately reflects the codebase's real architecture, conventions, and boundaries.
Systematically explore the project structure. Do this methodically — rushing leads to generic, useless AGENTS.md files.
package.json, pyproject.toml, Cargo.toml, go.mod, pom.xml, etc. Identify the tech stack, dependencies, and build tools..github/workflows/, Jenkinsfile, .gitlab-ci.yml, etc. Understand the test, lint, and deploy pipeline.From the reconnaissance, extract:
internal/ outside the package", "all API responses use the Result<T> wrapper")Decide where AGENTS.md files should be placed. The principle: place an AGENTS.md wherever an agent might start working and need scope-specific context that differs from the parent.
Typical placement for a medium-to-large project:
project/
├── AGENTS.md ← Root: project-wide map, ~80-120 lines
├── docs/
│ ├── architecture.md ← Deep architectural reference (linked from root)
│ └── conventions.md ← Coding conventions reference (linked from root)
├── src/
│ ├── AGENTS.md ← Source-level: common patterns across all source
│ ├── api/
│ │ └── AGENTS.md ← API module: routes, middleware, response format
│ ├── core/
│ │ └── AGENTS.md ← Core domain: business logic rules, model invariants
│ ├── infrastructure/
│ │ └── AGENTS.md ← Infra: database, caching, external service patterns
│ └── frontend/
│ └── AGENTS.md ← Frontend: component patterns, state management, styling
├── tests/
│ └── AGENTS.md ← Testing: test conventions, fixture patterns, coverage rules
└── scripts/
└── AGENTS.md ← Scripts: deployment, migration, utility script conventions
Rules for placement:
Generate each file following the templates in references/agents-md-patterns.md. Key principles for every file:
Root AGENTS.md must contain:
Module-level AGENTS.md must contain:
Present the proposed AGENTS.md hierarchy to the user. Show:
Ask for confirmation before writing files. The user may know things about the project that the analysis missed. Be open to feedback — the goal is accuracy, not speed.
For new projects, the codebase itself can't tell us much. Instead, engage the user in a structured brainstorming session to understand their intent, then scaffold a lightweight initial control plane that will grow with the project.
Read everything available: README, any skeleton code, config files, design docs. Even a sparse README reveals architectural intent.
Engage the user with focused questions. Do not ask all at once — this is a conversation, not a form. Group questions by theme and ask 2–3 at a time:
Project Identity:
Architecture Intent:
Conventions and Principles:
Growth Direction:
Based on the brainstorm, propose an initial AGENTS.md structure. For a new project, this is typically just:
project/
├── AGENTS.md ← Root: project identity, stack, principles, conventions
└── docs/
└── architecture.md ← Initial architecture decisions (even if brief)
The root AGENTS.md for a new project is shorter (40–80 lines) and more principle-focused than convention-focused, since conventions haven't solidified yet. It should capture:
Present the proposed content to the user. For new projects, be explicit that this is a living foundation — it will need updating as the codebase grows. Recommend running the drift-doctor skill periodically as the project matures.
After user confirmation, write all AGENTS.md files and any supporting documentation. Use the create_file tool for each file.
After writing, provide a concise summary:
drift-doctor after the next significant architectural changeThese are the most common failure modes. Internalize them:
The Encyclopedia — A single 500+ line AGENTS.md that tries to document everything. Agents can't use this effectively; context windows fill with irrelevant information. Break it up hierarchically.
The Aspirational Doc — Rules that describe how the code should work rather than how it does work. Every statement in AGENTS.md must be true right now. Aspirational rules go in a separate "roadmap" or "principles" doc.
The Copy-Paste — Multiple AGENTS.md files that repeat the same content. Each file should only contain what's unique to its scope. Shared context belongs in the nearest common ancestor.
The Stale Map — An AGENTS.md that was accurate when written but hasn't been updated. This is actively worse than no file, because agents will follow outdated instructions confidently. This is why the drift-doctor companion skill exists.
The Vague Guide — Instructions like "follow best practices" or "write clean code". These add no value. Be specific: "All API handlers must return ApiResponse<T> with proper error codes" is actionable; "handle errors properly" is not.
The Style Police — Over-specifying formatting, naming, or style when a linter/formatter already enforces it. If prettier handles formatting, don't repeat those rules in AGENTS.md. Instead, say "run npx prettier --write before committing" and link to the config.
development
Detect and fix drift in project AGENTS.md files and agent control plane. Use this skill whenever the user wants to audit, recalibrate, refresh, update, or fix their existing AGENTS.md files, or when they mention "drift", "stale AGENTS.md", "outdated agent instructions", "recalibrate", "sync agents", "audit control plane", "AGENTS.md is wrong/old/broken", or when they suspect their agent harness has fallen out of sync with the codebase. Also trigger when a user says things like "my agents keep making wrong assumptions", "Claude doesn't understand the new structure", "we refactored but the AGENTS.md is old", "check if my AGENTS.md is still accurate", or "update my agent docs". This skill is the companion to init-deep — init-deep creates the control plane from scratch, drift-doctor maintains it over time. Do NOT use for initial creation of AGENTS.md (use init-deep instead). Do NOT use for general code review or documentation updates unrelated to agent context.
development
Use when adding, fixing, reviewing, or generating code comments, docstrings, Javadoc, JSDoc/TSDoc, rustdoc, SQL comments, or documentation comments for source, markup, configuration, or database files.
development
Enforce production-grade Java development standards when writing, reviewing, or architecting Java code. Covers commenting, core Java idioms (Stream, collections, concurrency, generics), 23 GoF design patterns, SonarQube/Alibaba p3c/Lombok rules, Spring Boot MVC structure, Spring Cloud DDD microservices, MyBatis/JPA/transaction management, exception handling, logging, REST API design, testing, and security. Trigger whenever the user writes Java code, reviews Java code, designs a Spring Boot or Spring Cloud project, implements a design pattern, fixes code smells, discusses architecture, or asks about Java best practices. Also trigger when Java code is pasted for feedback or the user asks about package structure, DTO/VO/PO conventions, or coding standards.
development
Use when starting Harness implementation work that needs an isolated git worktree, especially before executing an approved plan or beginning a scoped feature/fix branch. Select the repository's worktree directory, verify ignored project-local directories, create a `codex/`-prefixed branch by default, run setup and baseline checks, and prevent plan execution on main/master unless the user explicitly allows it.