plugins/harness-powers/skills/harness-bootstrap/SKILL.md
Bootstrap or complete a repository's Harness Engineering control plane for agent-first development. Use when initializing or upgrading a new or existing frontend, backend, full-stack, monorepo, or library repository with root and local AGENTS.md, docs/ routing docs, docs/OBSERVABILITY.md, docs/exec-plans/tech-debt-tracker.md, execution-plan directories, generated Harness manifest files, and a repo-local `python3 scripts/check_harness.py` entrypoint. Especially relevant for prompts such as `初始化 Harness`, `为这个项目落地 Harness Engineering`, `搭建 AGENTS/docs/PLANS`, `给这个仓库建立 agent-first 控制面`, or `$harness-bootstrap`.
npx skillsauth add Refinex-Space/Refinex-Skills harness-bootstrapInstall 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.
Initialize the Harness Engineering control plane for a repository so that coding agents can work in it reliably — with cross-session continuity, verifiable progress, and mechanical drift detection.
This is a low-freedom skill. Harness initialization must be precise, deterministic, and mechanically verifiable. Follow the three phases below in order. Do not skip phases. Do not start creating files until Phase 1 (Reconnaissance) is complete.
Announce at start: I'm using harness-bootstrap to establish the repository control plane.
Without a control plane, every agent session starts from scratch. The agent re-discovers the build system, re-invents conventions, and has no record of past decisions. Work drifts, gets duplicated, or contradicts earlier choices. The Harness Engineering control plane solves this by encoding everything an agent needs into the repository itself — versioned, auditable, and always current.
The primary risk this skill fights is cargo cult scaffolding: generating a docs/ structure and AGENTS.md that looks like the patterns from OpenAI and Anthropic but contains no real substance. A docs/ARCHITECTURE.md that says "This project uses a modular architecture" is worse than no file — it teaches agents to trust documentation that means nothing. Every generated file must be grounded in the actual repository's code, architecture, and conventions.
A secondary risk is overwrite violence: blindly replacing existing documentation the team already maintains. The bootstrap must DETECT what already exists and augment, not destroy.
All four Harness skills (harness-bootstrap, harness-garden, harness-feat, harness-fix) use these terms consistently:
| Term | Definition | | ------------------ | ------------------------------------------------------------------------------------------ | | Control plane | The set of AGENTS.md, docs/, scripts/, and manifest that guide agent work | | Execution plan | A versioned, checkpointed plan in docs/exec-plans/ | | Managed doc | A doc created and maintained under harness lifecycle | | Unmanaged doc | An existing team doc the harness must NOT overwrite | | Manifest | Machine-readable inventory of control plane artifacts (docs/generated/harness-manifest.md) | | Preflight | Verification check run before starting any task (scripts/check_harness.py) | | Drift | When control plane artifacts no longer reflect repo reality |
Before creating ANY file, survey the repo. This phase produces a mental model that grounds everything in Phase 2. Do not create files during this phase.
Scan for and read these files if they exist:
README.md / README.rst / READMECONTRIBUTING.md / CONTRIBUTING.editorconfig, LICENSE / LICENSE.mdCHANGELOG.mdAGENTS.md files (root and nested)docs/ directory and its contentsRecord which of these exist. They are unmanaged docs — the harness will link to them but never overwrite them.
Read configuration files to identify the tech stack. See references/reconnaissance-heuristics.md for the full detection matrix. Summary:
| File | Indicates |
| -------------------------------------------------- | --------------------------------------------------------------------------- |
| package.json | Node.js ecosystem (check for framework: React, Vue, Next.js, Express, etc.) |
| pom.xml / build.gradle(.kts) | Java / Maven / Gradle |
| Cargo.toml | Rust / Cargo |
| pyproject.toml / setup.py / requirements.txt | Python ecosystem |
| go.mod | Go modules |
| *.csproj / *.sln | C# / .NET |
Also detect:
.github/workflows/, .gitlab-ci.yml, Jenkinsfile, .circleci/package-lock.json, yarn.lock, pnpm-lock.yaml, Cargo.lock, poetry.lock, uv.lock)Dockerfile, docker-compose.yml, compose.ymlRun find . -maxdepth 2 -type d (excluding .git, node_modules, target, build, dist, __pycache__, .venv, vendor) to map the top-level structure. Identify:
src/, lib/, app/, pkg/, cmd/, internal/)test/, tests/, __tests__/, spec/)config/, .config/)docs/, doc/, documentation/)For monorepos, identify package/module boundaries (each entry with its own build config).
A "module" warrants its own AGENTS.md when ANY of these is true:
package.json, pom.xml, Cargo.toml, etc.)For single-package repos with clear internal domains (e.g., src/auth/, src/orders/), create module AGENTS.md only if each domain has >15 source files and distinct patterns.
Small utility repos (<500 LOC) typically need zero module AGENTS.md files.
If tests exist, run them before making any changes:
# Record the green/red state BEFORE any harness changes
<detected-test-command>
If tests fail: record the failures but proceed. The bootstrap does not fix pre-existing test failures — note them in docs/exec-plans/tech-debt-tracker.md instead.
If no tests exist: note this. It is a data point, not a blocker.
Create the control plane artifacts below, in this order. Each file must be grounded in Phase 1 findings — never use placeholder content that doesn't reflect the actual repo.
If no AGENTS.md exists, create one. If one exists, evaluate it:
The root AGENTS.md must be a table of contents, not an encyclopedia (~100 lines max). Read references/agents-md-guide.md for the complete template and examples.
Required sections:
<!-- Generated by harness-bootstrap. Safe to edit. Audited by harness-garden. -->docs/ARCHITECTURE.mdOnly create these for modules identified in Phase 1.4. Each is ~30-50 lines. Read references/module-agents-md-guide.md for the template.
Contents:
Create the docs/ structure. Read references/docs-structure.md for the complete specification.
docs/
├── PLANS.md # Active plans index
├── ARCHITECTURE.md # Top-level architecture map
├── OBSERVABILITY.md # Build/test/lint commands + CI config
├── exec-plans/
│ ├── specs/ # Approved design specs from harness-brainstorm
│ │ └── .gitkeep
│ ├── active/ # Active execution plans
│ │ └── .gitkeep
│ ├── completed/ # Archived completed plans
│ │ └── .gitkeep
│ └── tech-debt-tracker.md # Known technical debt registry
├── generated/
│ └── harness-manifest.md # Control plane inventory
└── references/ # External references for agents
└── .gitkeep
If a docs/ directory already exists with team-maintained content, merge — create the missing structure alongside existing files. Never move or overwrite existing documentation.
<!-- Generated by harness-bootstrap. Safe to edit. Audited by harness-garden. -->
# Plans
Active and planned work for this repository.
Harness Powers lifecycle:
- Use `harness-using` to route repository work.
- Store approved design specs in `docs/exec-plans/specs/`.
- Store active execution plans in `docs/exec-plans/active/`.
- Archive completed plans in `docs/exec-plans/completed/`.
- Use `harness-verify` before completion claims.
## Active Plans
_No active execution plans._
## Completed Plans
_No completed plans yet._
Ground this in the actual repo structure from Phase 1. Include:
This is NOT a repeat of the README. It is the structural map an agent needs to understand where code lives and how it connects. Every path mentioned must exist in the repo.
This captures the commands and configs an agent needs to build, test, and verify the project. It serves as the repository's "init.sh" equivalent from Anthropic's long-running agent harness pattern — the first thing any agent reads to orient itself.
<!-- Generated by harness-bootstrap. Safe to edit. Audited by harness-garden. -->
# Observability
## Build & Run
| Task | Command | Expected |
| -------------------- | ---------------- | ---------------------- |
| Install dependencies | `<from Phase 1>` | Exit 0 |
| Build | `<from Phase 1>` | Exit 0 |
| Run tests | `<from Phase 1>` | Exit 0, all tests pass |
| Lint / format check | `<from Phase 1>` | Exit 0, no violations |
| Start dev server | `<from Phase 1>` | Server on port XXXX |
## CI Configuration
- CI system: <detected system>
- Config path: `<path to CI config>`
- Key jobs: <list main CI jobs and what they check>
## Environment Setup
<Required SDK versions, environment variables, system dependencies>
## Verify Before Building
Before starting any feature or fix work, run this baseline check:
<test-command>
If this fails, investigate BEFORE making additional changes.
Before declaring work complete, use `harness-verify` with the command that proves the claim.
<!-- Generated by harness-bootstrap. Safe to edit. Audited by harness-garden. -->
# Technical Debt Tracker
Known technical debt items. Each entry has an ID, severity, and description.
| ID | Severity | Area | Description | Detected |
| --- | -------- | ---- | ----------- | -------- |
If pre-existing test failures were found in Phase 1.5, add entries here.
Create docs/generated/harness-manifest.md — the machine-readable inventory of all control plane artifacts. Read references/manifest-schema.md for the complete format specification.
The manifest lists every managed artifact with its path, type, creation date, and last verification date. This is the verification target for scripts/check_harness.py and the harness-garden skill.
Copy the bundled validation script to the target repo:
mkdir -p scripts
cp <this-skill-path>/scripts/check_harness.py scripts/check_harness.py
chmod +x scripts/check_harness.py
The <this-skill-path> is the directory containing this SKILL.md file. The script validates:
Run it immediately after copying to verify: python3 scripts/check_harness.py
After creating all artifacts:
python3 scripts/check_harness.py
Fix any issues it reports. The script must pass cleanly before bootstrap is complete.
If tests existed in Phase 1.5, run them again. Compare exit code with the Phase 1 baseline. If tests that previously passed now fail, investigate and fix — the bootstrap must not break existing functionality.
Print a summary to the user:
=== Harness Bootstrap Report ===
Repository: <repo name>
Date: <today>
Created:
✓ AGENTS.md (root)
✓ docs/PLANS.md
✓ docs/ARCHITECTURE.md
✓ docs/OBSERVABILITY.md
✓ docs/exec-plans/active/
✓ docs/exec-plans/completed/
✓ docs/exec-plans/tech-debt-tracker.md
✓ docs/generated/harness-manifest.md
✓ scripts/check_harness.py
Preserved (unmanaged):
→ README.md
→ CONTRIBUTING.md
Validation: scripts/check_harness.py PASSED
Test baseline: <PASS/FAIL/NO TESTS>
Next steps:
- Run `harness-garden` periodically to detect and repair drift
- Use `harness-feat` for new feature work with execution plans
- Use `harness-fix` for evidence-driven bug fixes
Bootstrap can be safely re-run on a repo that already has partial harness artifacts. The behavior:
When re-running, Phase 1 still executes fully — the repo may have changed since the last bootstrap.
These are load-bearing rules. Violating them produces cargo cult scaffolding.
Never overwrite unmanaged docs. README, CONTRIBUTING, architecture docs the team already maintains — link to them from AGENTS.md, don't replace them.
AGENTS.md is a map, not a manual. Keep it under 100 lines. If content is growing past that, it belongs in docs/.
Every generated doc references actual code paths. "The auth module handles authentication" is cargo cult. "The auth module (src/main/java/com/example/auth/) implements JWT-based authentication via AuthService and exposes /api/auth/* endpoints" is grounded. If you cannot name a real file path, do not make a claim about the code.
The docs/ structure reflects what actually exists. Don't create product-specs/ for a library with no product specs. Don't create design-docs/ for a 200-line utility. Scale the control plane to the repo.
Module AGENTS.md files earn their existence. A module gets its own AGENTS.md only when it has enough complexity to warrant one (see Phase 1.4 criteria). A utils/ directory with 3 files does not need an AGENTS.md.
All managed files carry a header comment. <!-- Generated by harness-bootstrap. Safe to edit. Audited by harness-garden. --> This tells future agents and humans that the file is part of the control plane.
The manifest is the source of truth. If a file is not in the manifest, it is not managed by the harness. If it IS in the manifest, check_harness.py will verify it exists and track its freshness.
Commit atomically. All bootstrap artifacts should be committed in a single commit with message: chore: initialize Harness Engineering control plane. This makes the bootstrap a single reviewable, revertable unit of work.
Not every repo needs the full control plane. Scale to what's appropriate:
| Repo type | What to create | What to skip | | ------------------------------ | --------------------------------------------------------------- | ---------------------------------------------- | | Small utility (<500 LOC) | Root AGENTS.md, docs/OBSERVABILITY.md, scripts/check_harness.py | Module AGENTS.md, exec-plans/, ARCHITECTURE.md | | Standard project (500-50k LOC) | Full control plane | Unnecessary module AGENTS.md files | | Large monorepo (>50k LOC) | Full control plane + module AGENTS.md for major packages | Nothing — large repos need everything |
The validation script (scripts/check_harness.py) is always created regardless of repo size, because any repository benefits from mechanical verification of its control plane.
| File | When to read |
| ----------------------------------------- | ----------------------------------------- |
| references/docs-structure.md | Creating or verifying the docs/ layout |
| references/agents-md-guide.md | Writing the root AGENTS.md |
| references/module-agents-md-guide.md | Writing module-level AGENTS.md files |
| references/manifest-schema.md | Creating or updating the harness manifest |
| references/reconnaissance-heuristics.md | During Phase 1 tech stack detection |
development
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.
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.