Set up the agent harness inside a project (new or existing, any domain - software, game, data, writing, research) - project CLAUDE.md, path-scoped rules, the stop-gate checks and project settings. Use when starting work in a project that has no .claude/gate.py or no project CLAUDE.md, or when asked to set up or refresh the harness.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Bootstrap Harness?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/alptugince-bootstrap-harness)
---
name: bootstrap-harness
description: Set up the agent harness inside a project (new or existing, any domain - software, game, data, writing, research) - project CLAUDE.md, path-scoped rules, the stop-gate checks and project settings. Use when starting work in a project that has no .claude/gate.py or no project CLAUDE.md, or when asked to set up or refresh the harness.
disable-model-invocation: true
---
# Bootstrap the harness in a project
The project root is the current working directory. Never overwrite an existing file wholesale; merge into it and show the diff.
## 1. Survey (use subagents in parallel)
Collect with evidence:
- Stack(s) and versions, package manager, build/run/test/lint commands that actually work (run them).
- Directory layout and the main architectural boundaries (layers, modules, client/server, engine/game code).
- Existing conventions: lint configs, formatter configs, CI workflows, code-generation steps, localization setup, theming.
- Domain: what the project produces and who uses it.
- For non-code projects (writing, research, design): sources, output formats, style guides, review process.
## 2. Project `CLAUDE.md` (under ~150 lines)
Sections: Purpose, Commands (verified), Architecture map (directories with one line each), Conventions that are not enforced by tooling, Definition of done (which checks and which `verify` steps), Things that must never be done. Keep only facts an agent cannot infer quickly from the code. Link details with `@path/to/doc.md` imports instead of pasting them.
## 3. Path-scoped rules: `.claude/rules/*.md`
One file per area with different rules, each with a `paths:` frontmatter so it loads only when matching files are touched:
```markdown
---
paths: ["lib/features/**/*.dart"]
---
- Every user-facing string goes through AppLocalizations; add the key to every app_*.arb.
- Colors come only from Theme.of(context).colorScheme.
```
Write rules only for things tooling cannot enforce. Anything mechanical becomes a gate check instead (step 4).
## 4. Stop gate
1. Copy `gate_template.py` from this skill's directory to `.claude/gate.py`. It detects Flutter/Dart, Node/TypeScript, Python, Rust, Go, .NET and Godot and runs analyzers; for Flutter it also checks .arb key and placeholder parity, hardcoded colors, hardcoded Text strings, the 16 KB build config (AGP 8.5.1+, NDK r28+) and 16 KB alignment of native libraries in built APK/AABs. It always runs a `security: secrets` scan and flags mock/fake/stub source files outside test folders. It fails only on findings that are new relative to `.claude/gate-baseline.json` (a ratchet; see its docstring).
2. Create `.claude/harness.json` with the project settings, for example `{"run_tests": true}` when the test suite runs in under a few minutes, or `"flutter_checks": {"strings": false}` to switch a check off.
3. Add project-specific checks as scripts in `.claude/gate.d/` (`.py` or `.sh`, non-zero exit on failure, one `FINDING: <file> | <message>` line per problem; name security checks `security_*` so they are never baselined). Typical ones: import-boundary checks between layers, banned APIs, schema validation, asset naming, link checking for docs, a scene that must load without errors.
4. Run `python .claude/gate.py`. Fix the check until the result is honest: a failing check must reflect a real problem. The Stop hook runs the gate only after the user approves the project on their machine: tell them to review `.claude/gate.py` and `.claude/gate.d/`, then run `python <hooks>/harness_trust.py approve <project>` in their own terminal (`<hooks>` is `.claude/hooks` in project scope, else `~/.claude/hooks`). Never run that command yourself; it refuses inside Claude Code.
- If this first run fails on pre-existing problems, show the user the failures and **ask** whether to record them as the starting baseline with `python .claude/gate.py --update-baseline --allow-growth`. Never run it without the user's approval; never edit `.claude/gate-baseline.json` by hand.
- Security findings (`security:*`) are never baselined; report them to the user.
- Tell the user to review and commit `.claude/gate-baseline.json` themselves: in a git repository the gate applies only the committed baseline, so it tolerates nothing until then. Never commit it yourself. `python .claude/gate.py --update-baseline` shrinks it as issues get fixed.
5. Suggest adding the same command to CI so humans and agents meet the same bar.
## 5. Project settings: `.claude/settings.json`
Merge in a `permissions` block that allows the verified build/test/lint commands and denies reading secrets, for example:
```json
{"permissions": {"allow": ["Bash(flutter test:*)", "Bash(flutter analyze:*)"],
"deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)"]}}
```
Adapt the commands to the stack found in step 1.
## 6. Verification
If the project has a runnable artifact and no `verify-<project>` skill, recommend running `create-verification-skill` next.
## Report
Files created or changed (with diffs for changed ones), gate result, and the decisions left to the user.