datashaman/code-skills/harness
Claude Code and agent skill by datashaman/code-skills
- community
Checking that the SKILL.md file is still in the repository.
Control surface for a harness-engineering Claude Code setup at user or project scope. Handles install, uninstall, update, doctor, adopt, snapshot, status, audit, and memoize. Installs CLAUDE.md, guardrail hooks, /verify, /plan, /critique, memory seeds, and settings patches; can also retrofit an existing project with scripts/harness-check.sh, report install state, snapshot ~/.claude/, and run deterministic memory hygiene. All sub-actions are idempotent. Use when asked to "set up my Claude Code", "install harness", "uninstall harness", "update harness", "diagnose my setup", "adopt harness", "retrofit", "snapshot my setup", "audit my setup", "harden my Claude", "memoize", "consolidate memory", or "prune memory".
Install
npx vskill@latest install datashaman/code-skills/harnessSKILL.md
The same SKILL.md was published earlier as datashaman/code-skills/harness.
Harness
Control surface for the user-scope Claude Code "harness" — feedforward guides (CLAUDE.md, memory), feedback sensors (hooks), and an optional drift-detection loop (snapshot + monthly audit).
The vocabulary follows OpenAI's Harness engineering (https://openai.com/index/harness-engineering/) and Martin Fowler's writeup (https://martinfowler.com/articles/harness-engineering.html). Day-to-day patterns are convergent picks from Boris Cherny, Simon Willison, Jesse Vincent (Superpowers), Geoffrey Huntley (Ralph loop), Hamel Husain (eval skills), and Steve Yegge (Gas Town). See README.md for citations.
Sub-action dispatch
The user invokes this skill, optionally with an action word. Detect intent and run the matching sub-action. If the user says /harness without context, run status first (it's read-only and informative), then ask which action they want.
| Said by user | Sub-action | Script | |
|---|---|---|---|
| "install", "set up", "bootstrap" | install | scripts/install.sh | |
| "uninstall", "remove", "undo" | uninstall | scripts/uninstall.sh | |
| "update", "pull latest templates", "refresh" | update | scripts/update.sh | |
| "doctor", "diagnose", "is it working" | doctor | scripts/doctor.sh | |
| "adopt", "add to existing project", "retrofit" | adopt | scripts/adopt.sh | |
| "snapshot", "backup", "mirror to git" | snapshot | scripts/snapshot.sh | |
| "status", "what's installed", "audit local" | status | scripts/status.sh | |
| "audit", "schedule audit", "monthly check" | audit | (prep work — see below) | |
| "memoize", "consolidate memory", "prune memory" | memoize | scripts/memoize.sh |
Substitute the skill's absolute base directory for $SKILL_DIR in every command — it's announced at the top of this invocation.
install
Lays down the harness at the scope where the skill itself lives, derived from $SKILL_DIR:
- Skill at
<X>/.claude/skills/harness/(or under a plugin cache below<X>/.claude/) → install at<X>/.claude/. - If
<X>is$HOME, that's user scope; otherwise project scope. - Override with
--scope=user,--scope=project, or--target=PATH. - If the skill is being run from a checkout (no
.claude/ancestor), the script errors with a clear message asking for--scopeor--target.
What lands at user scope:
| Surface | Path | |
|---|---|---|
| Operating contract | ~/.claude/CLAUDE.md | |
| Hooks | ~/.claude/hooks/{block-force-push,format-on-edit,post-compact-reinject,verify-before-stop}.sh | |
| Slash commands | ~/.claude/commands/{verify,plan,critique}.md | |
| Auto-memory | ~/.claude/projects/<slug>/memory/{MEMORY.md, user_role, feedback_concise, feedback_plan_first, feedback_verification} | |
| settings.json | Adds env.CLAUDE_CODE_AUTO_COMPACT_WINDOW=400000 + 4 hook entries (uses ~/.claude/hooks/... form) |
What lands at project scope (<project>/.claude/):
| Surface | Path | |
|---|---|---|
| Operating contract | <project>/CLAUDE.md (skipped if it already exists — most projects have one. --force overrides) | |
| Hooks | <project>/.claude/hooks/*.sh | |
| Commands | <project>/.claude/commands/{verify,plan,critique}.md | |
| settings.json | <project>/.claude/settings.json — 4 hook entries with .claude/hooks/... (project-relative) form. No env var, no memory at project scope. | |
| Memory | (skipped — memory is per-user by design and lives under $HOME regardless of project scope) |
Common flags:
--dry-run— show the preflight + plan, change nothing.--force— overwrite existing files (including project CLAUDE.md).
Per-surface skip flags (escape hatch — pick & choose what to install):
--skip-claude-md,--skip-hooks,--skip-commands,--skip-memory,--skip-settings
Or a positive list (everything else is skipped):
--include=hooks,commands— install only those.--include=claude-md,settings— only the operating contract + settings patch.- Valid items:
claude-md,hooks,commands,memory,settings.
The script always prints a preflight banner showing scope, target, the per-surface plan (with SKIP markers reflecting the active flags), and a pointer to the uninstaller with --all warnings. Read it before proceeding.
After install, walk the user through the hand-edits printed under "Next steps":
- Fill in
## Stack signalsinCLAUDE.md(user scope:~/.claude/CLAUDE.md; project scope:<project>/CLAUDE.md). At install time the script tries to auto-fill this from manifests it finds — verify it picked up your stack correctly. If you need hints, look at~/.claude/projects/slugs andinstalled_plugins.json; ask if unclear. Don't auto-fill from guesswork. - (User scope only) Replace placeholders in
~/.claude/projects/<slug>/memory/user_role.mdwith the user's actual role / projects / stack. Ask, don't invent.
Tell them to restart Claude Code so hooks load.
uninstall
Same scope auto-detection as install. Conservative defaults:
- Removes hooks + commands only if their sha256 still matches the installed template. User-modified files are kept and reported as
keep (modified). - Strips the 4 hook entries from
settings.json; drops empty hook event arrays. Leaves all other settings untouched. - Keeps by default:
CLAUDE.md, memory files, theCLAUDE_CODE_AUTO_COMPACT_WINDOWenv var.
Flags:
--dry-run,--force(skip content-match)- Broaden the sweep:
--remove-claude-md,--remove-memory,--remove-env,--all - Escape hatch — keep specific surfaces that default would remove:
--keep-hooks,--keep-commands,--keep-settings
The script prints a preflight banner showing scope, target, what will be removed vs kept, and which --keep-* / --remove-* flags are active. Always run --dry-run first if unsure.
Tell the user to restart Claude Code so hook deregistration takes effect.
adopt
Retrofit the harness into an existing project (project scope only). Use when the user says "I have a project, how do I add this?", "adopt", "retrofit", or any variant that implies this isn't a greenfield install.
What it does:
- Detects the project root (
$CLAUDE_PROJECT_DIRor$PWD; refuses to write into$HOME). - Reports what's already there:
CLAUDE.md,.claude/,settings.json,scripts/harness-check.sh, plus stack signals. - Writes a stack-aware starter file to
scripts/harness-check.sh— the project-side pass/fail gate thatverify-before-stop.shand/verifyinvoke. The starter runs lint / types / tests for whichever ecosystem files are present (package.json,composer.json,pyproject.toml,go.mod,Cargo.toml,Gemfile). Skipped ifharness-check.shalready exists (--forceto overwrite). Empty-sensor case is treated as PASS so the script never strandsStop. - Prints the next-step
install.sh --scope=projectcommand. Does not run install itself — the user reviews the preflight banner there separately.
Walk-through for the agent:
- Run
adopt.sh. Read its preflight to the user. - If the user is happy, run
install.sh --scope=project(or with--include=hooks,commandsfor a minimum-viable retrofit that doesn't add a CLAUDE.md). - Tell the user to edit
scripts/harness-check.shto match their project's commands (the starter is intentionally generous; comment out or delete blocks that don't apply). - Tell them to restart Claude Code so hooks load.
- Suggest they run
/verifyonce to smoke-test the gate end-to-end. - Mention
datashaman/harness-templatefor the deeper project-scope layer (policy YAMLs, grades,.skipledger) when they've outgrown the starter.
Flags:
--target=PATH— explicit project root.--dry-run— show plan, don't write.--force— overwrite an existingscripts/harness-check.sh(you'll lose edits).
update
Smarter than install --force. For each surface compares installed vs current template via sha256 and:
- identical → re-install (no-op cosmetically)
- missing → install
- modified → print diff and SKIP, unless
--mergeor--force
Flags:
--dry-run— show plan only.--force— overwrite ALL files including modified ones (loses customisations).--merge— for modified files, write the new template to<file>.newalongside the original. The user can diff/merge interactively.
Default behaviour is non-destructive: you'll see diffs but no customised file is overwritten without consent.
doctor
End-to-end diagnostic. Combines status with sanity checks:
- sha256 tool present
- target dir writable
settings.jsonis valid JSON- all 4 hooks exist, are executable, and are wired in
settings.json - hook entries don't point at unexpected paths (foreign installs)
- smoke-test: invoke
block-force-push.shwith a known-bad command and verify exit code 2 - memory dir populated (user scope)
CLAUDE.mdpresent and## Stack signalsnot still placeholder- snapshot repo (if
$SNAPSHOT_REPOset) — last commit recency
Exits non-zero if any FAIL, zero on warnings. Run doctor after install and after each Claude Code upgrade.
snapshot
Mirrors ~/.claude/ into a target git repo, scrubs caches and secret patterns, commits + pushes only on diff. Idempotent.
If the user doesn't have a snapshot repo yet, prompt them to create one (PRIVATE — the snapshot has personal config):
Then run snapshot.sh against it. The first push lands; subsequent runs are no-ops if nothing changed.
Override sources via env: CLAUDE_DIR=..., USER_PROJECT_KEY=....
status
Read-only. Reports:
- For each hook + command + memory file + CLAUDE.md:
installed(matches template),modified(customised), ormissing. - For
settings.json: which of the 4 hook entries are wired, plus the env var. - For snapshot repo (if
SNAPSHOT_REPOenv is set): commits ahead of origin, last snapshot timestamp.
Use status first when the user says /harness without an action word, when they say "what's installed?", when they say "is this still set up?", or before any install to show the diff.
audit
The audit is a monthly remote routine — Claude Code's /schedule skill creates it. This skill prepares the prompt and suggests config; the user runs /schedule themselves.
Steps:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/harness/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/datashaman/code-skills/harness)