skills/harness-feat/SKILL.md
Plan and execute new feature work, capability delivery, and structured refactors in repositories that already use Harness Engineering control plane artifacts such as `docs/PLANS.md`, `docs/exec-plans/active`, `docs/OBSERVABILITY.md`, `docs/generated/harness-manifest.md`, and repo-local `python3 scripts/check_harness.py`. Use when the user gives a rough implementation goal and the agent should rewrite the task, run harness preflight, create or update a live execution plan, execute in small validated slices, sync `docs/PLANS.md`, and archive the plan deterministically. Especially relevant for prompts such as `$harness-feat`, `任务:实现...`, `新增...`, `重构...`, or `做这个功能`.
npx skillsauth add Refinex-Space/Refinex-Skills harness-featInstall 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.
Implement features, deliver capabilities, and perform structured refactoring within a harnessed repository. The agent works WITHIN the control plane established by harness-bootstrap and maintained by harness-garden — reading it before coding, updating it during coding, and leaving it accurate after coding.
This is a medium-freedom skill. The five-step workflow is rigid (preflight → plan → implement → verify → archive) and must be followed in order. Within each step, the agent has latitude in HOW it accomplishes the work — choosing implementation strategies, test approaches, and refactoring patterns — but every decision must be recorded in the execution plan.
Announce at start: I'm using harness-feat to deliver this work inside the Harness control plane.
Without a structured workflow, the agent starts coding the moment it sees the user's request. It writes code that works in isolation but breaks architectural coherence, doesn't update the control plane, leaves no record of decisions, and produces a codebase where the next agent has to re-discover everything from scratch.
The primary risk this skill fights is cowboy coding: jumping straight to implementation without reading the control plane, creating a plan, or establishing verification evidence. OpenAI's team discovered that progress comes not from "trying harder" but from asking "what capability is missing, and how do we make it legible and enforceable?" The execution plan is what makes work legible; the preflight and verification steps are what make constraints enforceable.
A secondary risk is premature victory — one of the four failure modes Anthropic identified in long-running agents. The agent declares success after writing code that compiles, without verifying that it actually meets the acceptance criteria or that it doesn't break existing functionality. The verification step and sprint contract address this directly.
A third risk is scope drift: the agent discovers something interesting mid-implementation and pivots without updating the plan. This produces untracked changes that confuse future agents and humans. Every deviation from the plan must be recorded before acting on it.
Harness-feat absorbs a small set of high-signal behavior rules directly into the workflow instead of treating them as a separate layer:
These guardrails do not replace the five-step Harness workflow. They sharpen it.
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 writing any code, orient yourself within the control plane and establish a healthy baseline. This step exists because Anthropic found that "verify before building" is the single most effective pattern for preventing broken state carryover.
Read references/preflight-checklist.md for the complete checklist. Summary:
Read these files in order — each one adds context for the next:
python3 scripts/check_harness.py
If the check fails, the control plane is unhealthy. Do NOT proceed with feature work on a broken control plane — report the failures and suggest running harness-garden first to repair the drift.
If check_harness.py does not exist, the repo has no harness — suggest running harness-bootstrap first and stop.
Run the existing test suite before making any changes:
<test-command from docs/OBSERVABILITY.md>
Record the exit code and summary (number of tests, pass/fail). This is the green baseline. If tests are already failing, record which ones — you must not make failing tests worse, and you must not claim credit for fixing pre-existing failures.
Read docs/PLANS.md. If another agent or human has an active plan touching the same modules or files:
Before any code is written, establish exactly what "done" means. Anthropic's sprint contract pattern eliminates the premature victory failure mode by negotiating the definition of completion before work begins.
The user's request is usually informal and incomplete. Rewrite it into a precise task brief:
Present the rewritten task to the user. If a materially simpler path exists, say so before planning. Wait for confirmation before proceeding. If the user adjusts the scope, update the brief.
Create a new file in docs/exec-plans/active/ following the naming convention YYYY-MM-DD-short-description.md. Read references/exec-plan-template.md for the complete template.
The execution plan must include:
Each implementation step should be 2-5 minutes of focused agent work (aligned with the Superpowers task decomposition pattern). A well-sized step:
If a step seems bigger than that, break it down further. If a step seems trivially small (rename a variable), consider merging it with the next step.
Execution plans are audit artifacts, not wishful outlines. Do not write:
TODO, TBD, implement later, or other placeholdersdocs/superpowers/plans/Keep all plan state in docs/exec-plans/active/ and docs/PLANS.md.
Harness plans must be decision-complete, but they remain audit-oriented:
The goal is an executable plan without creating a second source of truth that competes with the code.
Before finalizing the plan, ask:
If the answer to any of these is "yes", simplify the plan before coding.
Add the plan to docs/PLANS.md under "Active Plans":
## Active Plans
- [Short description](exec-plans/active/YYYY-MM-DD-short-description.md) — started YYYY-MM-DD
git add docs/exec-plans/active/YYYY-MM-DD-short-description.md docs/PLANS.md
git commit -m "plan(harness): add execution plan for <short-description>"
The plan is now a versioned artifact. Its creation is separate from its implementation — this lets another agent pick up the plan if the current session is interrupted.
Execute the plan one step at a time. Resist the urge to batch multiple steps together — incremental progress with verification is slower per-step but faster overall because it catches mistakes early and creates clean rollback points.
If implementation is delegated to subagents or worker sessions, the controller keeps ownership of the plan and review loop:
Do not make delegated workers discover the plan on their own from some alternate file tree. The active execution plan remains the only planning source of truth.
Re-read the current step from the execution plan. Confirm you understand what it requires and what files it touches.
Before editing, restate the smallest possible change that would satisfy this step. If the step now appears larger than necessary, update the plan first.
TDD is preferred but not always mandatory. Read references/tdd-workflow.md for guidance on when TDD applies.
When it applies:
When TDD doesn't apply (infrastructure changes, configuration, documentation):
After implementing each step, run the relevant test suite:
<test-command from docs/OBSERVABILITY.md>
The test suite must stay green after every step. If tests break:
docs/exec-plans/tech-debt-tracker.mdRead references/commit-conventions.md for the full message format. Each commit should:
git add <changed-files>
git commit -m "<type>(<scope>): <description>
refs plan: <plan-filename> step <N>"
Mark the completed step in the plan. Record:
After each step, ask: "Am I still on plan?" Scope drift happens when:
If you need to deviate from the plan:
The execution plan is the source of truth. If it's not in the plan, it shouldn't be in the code.
After all plan steps are complete, verify the work holistically. Individual step verification confirms each piece works; this step confirms they work together.
<test-command from docs/OBSERVABILITY.md>
Compare the result with the baseline from Step 1.3. The test suite should pass with at least as many tests as before, plus any new tests you added.
Go through each acceptance criterion from the execution plan. For each one:
Apply harness-verify discipline here: no completion claim is valid until the proving commands have been run in the current turn and their output actually supports the claim.
<lint-command from docs/OBSERVABILITY.md>
Fix any violations introduced by your changes. Do not fix pre-existing violations unless they're in files you modified (and even then, consider whether that's in scope).
Review your own changes as if you were a code reviewer:
git diff <baseline-commit>..HEAD
Check for:
If your changes affected the repo structure or conventions:
docs/ARCHITECTURE.md to reflect the new structuredocs/OBSERVABILITY.mddocs/generated/harness-manifest.mdCommit control plane updates separately from code changes:
git commit -m "docs(harness): update control plane after <short-description>"
The task is done when the plan is archived, not when the code is written. This step ensures the repo is left in a state where another agent or human can understand exactly what happened.
Add a completion summary to the plan:
## Completion Summary
Completed: YYYY-MM-DD
Duration: <number of steps completed> steps
All acceptance criteria: PASS
Summary: <one paragraph describing what was built, key decisions made, and any
deviations from the original plan>
git mv docs/exec-plans/active/YYYY-MM-DD-short-description.md \
docs/exec-plans/completed/YYYY-MM-DD-short-description.md
Move the plan entry from "Active Plans" to "Completed Plans":
## Completed Plans
- [Short description](exec-plans/completed/YYYY-MM-DD-short-description.md) — completed YYYY-MM-DD
git add docs/exec-plans/ docs/PLANS.md
git commit -m "chore(harness): archive execution plan for <short-description>"
Report to the user:
=== Feature Complete ===
Task: <objective from plan>
Plan: docs/exec-plans/completed/YYYY-MM-DD-short-description.md
Steps completed: <N>
Acceptance criteria: <all PASS / N of M PASS>
Tests: <baseline count> → <new count> (added <diff>)
Control plane updates: <list of updated harness files>
Commits:
1. plan(harness): add execution plan for <short-description>
2. feat(<scope>): <step 1 description>
...
N. chore(harness): archive execution plan for <short-description>
When implementation goes wrong and you can't fix it within the current step:
If the problem is contained to the current step:
git stash or git checkout -- . to discard uncommitted changesIf committed changes broke things and you can't fix forward:
git revert <bad-commits> (never git reset --hard — preserve history)If the task itself is misconceived (wrong approach, missing prerequisites):
completed/ (completed plans include failed/aborted ones)For tasks that may exceed a single agent session (>20 steps or touching many modules):
After every 5 completed steps, do a mini-verification:
Every execution plan is a handoff artifact. If the current session ends mid-task, the next agent can:
This works because:
These rules prevent well-intentioned automation from producing architectural damage.
Always do preflight before any code changes. The control plane is the agent's map. Coding without reading it is navigating without a map — you might arrive somewhere, but probably not where you intended.
Never skip plan creation, even for "small" changes. A five-line bugfix still gets a lightweight plan (it just has fewer steps). The plan is the audit trail — without it, the change is invisible to future agents. The plan for a small change can be just a few lines, but it must exist.
Every code change must be accompanied by test evidence. "I looked at it and it seems fine" is not evidence. A test passing, a command succeeding, a log output showing correct behavior — that's evidence. Record it in the plan.
The execution plan is the source of truth. If it's not in the plan, it shouldn't be in the code. If you need to do something unplanned, update the plan first.
Delegated review order is fixed. When using delegated execution, review for spec compliance before reviewing for code quality. Quality review on the wrong spec is wasted work.
Respect architectural constraints from AGENTS.md. Key Patterns in AGENTS.md encode architectural decisions. If your implementation would violate a stated pattern, stop and discuss with the user rather than silently breaking the constraint.
Leave the repo in a state where another agent can pick up seamlessly. This means: all tests pass, the execution plan accurately reflects what was done, the control plane is updated, and there are no uncommitted changes.
Git commits are checkpoints, not afterthoughts. Each commit implements one plan step and references it. Avoid mega-commits that bundle many steps — they make rollback and understanding impossible.
Log deviations, don't hide them. When you deviate from the plan (and you will — plans never survive contact with implementation perfectly), record the deviation BEFORE acting on it. The deviation log is how future agents learn about the real complexity.
Not every task needs the same weight of process. Scale the ceremony to the change:
| Task size | Plan detail | Commit granularity | Verification | | --------------------- | ------------------------------------- | ------------------------ | ------------------------ | | Trivial (1-2 files) | 2-3 steps, inline acceptance criteria | 1-2 commits | Run affected tests | | Standard (3-10 files) | Full plan with all sections | 1 commit per step | Full test suite | | Large (>10 files) | Full plan + checkpoint schedule | 1 commit per step + tags | Full suite every 5 steps | | Refactor | Full plan + architectural impact doc | Atomic commits per move | Full suite + lint |
Even trivial tasks still get a plan file in docs/exec-plans/active/. The plan may be only 20 lines, but it creates the audit trail.
| File | When to read |
| ----------------------------------- | -------------------------------------------- |
| references/exec-plan-template.md | Step 2: creating the execution plan |
| references/preflight-checklist.md | Step 1: running harness preflight |
| references/commit-conventions.md | Step 3: writing commit messages |
| references/tdd-workflow.md | Step 3: deciding when and how to write tests |
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.