plugins/harness-powers/skills/harness-worktree/SKILL.md
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.
npx skillsauth add Refinex-Space/Refinex-Skills harness-worktreeInstall 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.
Create an isolated workspace for Harness implementation work before changing code.
This is a low-freedom skill. Isolation and baseline evidence are mandatory.
Announce at start: I'm using harness-worktree to create an isolated implementation workspace.
main or master unless the user explicitly says to work there.Choose the worktree parent directory in this exact order:
.worktrees/
.worktrees/ and worktrees/ exist, .worktrees/ wins.worktrees/
.worktrees/ does not exist and worktrees/ exists, use worktrees/.Explicit user preference
AGENTS.md, nearby AGENTS.md, or project docs.Prompt when needed:
No worktree directory preference was found. Where should I create the worktree?
1. .worktrees/ (project-local, hidden)
2. worktrees/ (project-local, visible)
3. A path you specify
For project-local directories, verify the exact parent directory is ignored before creating the worktree:
git check-ignore -q .worktrees/
git check-ignore -q worktrees/
Use the command that matches the selected directory.
If the selected directory is not ignored:
git status..gitignore or for an alternate location.External absolute paths outside the repository do not need repository ignore verification, but still require a clear user or repository preference.
Use a codex/ branch prefix by default unless the user gives a different branch name or repository rules require another prefix.
Examples:
git worktree add .worktrees/codex-task-8 -b codex/task-8-harness-worktree-finish
git worktree add worktrees/codex-login-fix -b codex/login-fix
Prefer short, lowercase, hyphenated names that identify the task.
Run these discovery commands from the repository root:
git rev-parse --show-toplevel
git branch --show-current
git status --short
git worktree list
If the current branch is main or master, create or switch into a worktree before executing any plan unless the user explicitly allowed direct work there.
Create the worktree:
git worktree add <worktree-path> -b <branch-name>
cd <worktree-path>
Run one project setup command per ecosystem, using the repository's documented command when it exists in AGENTS.md, README, package scripts, Makefiles, or project docs.
For Node.js projects, select exactly one package manager from lockfiles before installing:
| Evidence | Setup command |
| --- | --- |
| pnpm-lock.yaml | pnpm install |
| yarn.lock | yarn install |
| package-lock.json | npm ci |
| package.json only | ask or use the documented command; if none exists, npm install is the fallback |
Do not run npm install before checking for pnpm-lock.yaml or yarn.lock; that can create the wrong lockfile and invalidate the baseline.
Common non-Node setup commands:
test -f requirements.txt && python3 -m pip install -r requirements.txt
test -f pyproject.toml && python3 -m pip install -e .
test -f Cargo.toml && cargo build
test -f go.mod && go mod download
Run a baseline command before implementation so later failures can be compared against a known starting state.
Prefer repository-specific commands. Common fallbacks:
npm test
pnpm test
yarn test
python3 -m unittest
pytest
cargo test
go test ./...
make test
If baseline fails:
If baseline passes, report the worktree path, branch name, setup commands run, and verification command result.
When ready, report:
Worktree: <absolute-path>
Branch: <branch-name>
Base branch: <base-branch>
Setup: <commands run or skipped with reason>
Baseline: <command and result>
Ready for: <plan or task name>
Stop if you are about to:
main or master without explicit user permission.worktrees/ or worktrees/codex/ prefix when no alternate was requesteddevelopment
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.