Authoring partials

Write contractor/partials/testing.md and contractor/partials/prepare.md so contractor knows how to run your repo.

Partials are short, repo-specific prose files that contractor inlines into agent prompts at run time. The two ids contractor wires today are:

  • testing — read on every implement-phase agent run. Names your default test command, subset variants, pre-test setup, flaky areas, and the scope of "verified".
  • prepare — read on every synthetic worktree-prepare run. Names your install command, a cheap readiness probe, and any post-install setup.

This guide is the long form of /contractor:setup. If you have Claude Code installed, run that slash command and it will probe your repo and walk you through the same recommendations interactively. If you'd rather author from scratch — or you want to understand what /contractor:setup is teaching — read on.

The mechanism (slot ids, block markers, the user → shipped → empty fallback) is documented in Partials. This page is about content: what to write, how short to keep it, and a concrete starting point for each file.

Why these two files matter

Without contractor/partials/testing.md, the implement agent guesses your test command from package.json scripts or framework conventions. That guess is usually right for greenfield repos and often wrong for monorepos, repos with multiple test runners, or repos where the obvious command is too slow to use as a default. Wrong guesses surface as wasted iterations: the agent runs the whole-monorepo suite when it could have run a single package, or commits without verifying because it picked a lint script over a test script.

Without contractor/partials/prepare.md, the prepare agent detects your stack from lockfiles and guesses an install command. The guess is right more often here — pnpm install --frozen-lockfile is hard to get wrong when pnpm-lock.yaml is sitting at the repo root — but the readiness probe is purely a guess, which means prepare runs in full on every HEAD change instead of fast-pathing when dependencies are already there.

Both partials are inlined into every relevant agent run, so brevity matters. Every line you add is paid for in tokens on every run. Aim for ~20–60 lines for testing.md and ~10–30 lines for prepare.md. If a partial grows past a page, something belongs elsewhere — the design doc, a code comment, or nowhere.

contractor/partials/testing.md

Recommended structure (in order):

  1. Default test command. The single command an agent should run before committing a task group when it has no reason to pick something narrower. Make it unambiguous. This is the "when in doubt, run this" command — the test the agent reaches for if the diff doesn't suggest a smaller scope.
  2. Subset variants. For monorepos: per-package, per-file, watch-mode. The agent picks based on the actual diff; your job is to name the options. Skip this section for single-package repos.
  3. Pre-test setup. Migrations, fixtures, environment variables, services, build steps that must run first. Anything implicit that a fresh clone would miss. Install-level setup belongs in prepare.md, not here.
  4. Known-flaky areas. Tests that flake under agentic runs. Name them. Suggest retry-once, skip, or exclude. Be specific — "the e2e suite is slow" is useless; "packages/cli/src/smoke.e2e.test.ts spawns real subprocesses; retry once on timeout before treating as a regression" is useful.
  5. Scope of "verified". What the verify loop is meant to catch (unit + integration) versus what it is NOT meant to catch (perf benchmarks, e2e suites, manual QA). Keep the loop tight; the agent shouldn't try to run hours-long suites between commits.
  6. Test layout and naming conventions. Where tests live, how they're named (*.test.ts, test_*.py, colocated vs. __tests__/), mocking conventions.

Frame this list as recommended, not mandatory. A repo with no flaky tests skips section 4. A single-package repo skips section 2. Adapt.

A critical rule for monorepos: the agent picks the subset based on the actual change, not on a declared blueprint scope. The guide names the options; it does NOT try to encode a {{scope}}-style substitution. Write prose like "for a change touching only packages/foo/**, use pnpm --filter foo test; for a cross-package change, run the full suite."

Example

For a TypeScript pnpm monorepo (keep yours this short or shorter):

For a single-package Python pytest repo with no flaky tests, the file might be ten lines: a default pytest invocation, a one-line note that fixtures live under tests/fixtures/, and a one-line scope statement. Match the size to the size of the truth.

contractor/partials/prepare.md

Recommended structure (in order):

  1. Install command. The exact one-line install or bootstrap command this repo uses. Match CI where possible (e.g. pnpm install --frozen-lockfile, npm ci, uv sync --frozen, poetry install --no-interaction, bundle install). Lockfile-respecting flags matter — reproducibility is the whole point.
  2. Readiness probe. A cheap command the agent can run FIRST to decide whether the environment is already prepared. If the probe passes, the agent skips the install step. Examples: typecheck, dry-run build, pnpm install --frozen-lockfile --dry-run, python -c 'import <pkg>', make check-deps. Must be fast.
  3. Post-install setup. Required code generation, env-file scaffolding, or migration steps. Only list steps that are BOTH required AND cheap to run every time.
  4. Guardrails. Repo-specific "do not do X" notes. The shipped prepare prompt already forbids editing source files, committing, or running tests; add anything specific to your repo (e.g. "do not run pnpm build here — it is slow and the implement step runs it").

Frame this list as recommended, not mandatory. A repo with no post-install setup skips section 3. A repo with no extra guardrails skips section 4.

Example

For a TypeScript pnpm monorepo:

For a Python uv project this might be three lines: install command, uv run python -c 'import <pkg>' as the readiness probe, nothing else.

Verifying

Once both files are in place, run contractor doctor from the repo root. The "Partials wiring" section reports each known partial id (testing, prepare) and whether your repo authors it, falls back to the shipped default, or returns empty:

You can also confirm the inlined content directly:

If you have Claude Code installed, /contractor:setup runs through this same checklist interactively, with repo-aware probes (which lockfile is present, which framework is wired up) and an offer to adapt the examples to your stack.

Editing later

Both files are read fresh on every relevant agent run, so edits take effect immediately — no contractor ai install rebuild required. The shipped slash commands embed the partials at install time, so if you want the on-disk slash command files in .claude/commands/blueprint/ to reflect a partial edit, you do need to re-run contractor ai install. The agent runtime itself reads the partials at render time, not the slash command files, so an edit to contractor/partials/testing.md is live on the next run regardless.

Legacy paths

Older repos may still carry:

  • contractor/VERIFY.md — the legacy path for the testing partial. Move it to contractor/partials/testing.md. Contractor no longer reads the old path.
  • A verify: field in contractor/config.yaml — removed. Delete the line; contractor emits a warning when it sees one.
  • A worktree.bootstrap field in contractor/config.yaml — removed. Author contractor/partials/prepare.md instead.

Doctor flags the first two when it sees them, so you don't have to remember.

See also

  • Partials — the slot/marker mechanism, the fallback chain.
  • Worktrees — what prepare.md actually configures.
  • Slash commands — the /contractor:setup interactive walk-through.