ready · diff
git:20260816.a197bdc to git:20260820.35b5e3e
82 added, 66 removed. Audit A to A.
---
name: ready
description: Make an unfamiliar repository agent-ready with a verify command, smoke tests, guardrails, and project notes. Use for repository setup, agentic engineering, verify commands, hooks, or allowlists; skip when verification and scope are already clear.
---
# Ready
- Goal: leave the repo with **one command that returns an exit code** and enough guardrails that future agent work self-verifies. Nothing here is language-specific — detect, don't assume.
-
- Bootstrapping is itself work: verify each artifact you add actually runs before reporting it.
+ Leave the repository with one unattended command that returns a meaningful exit
+ code, plus only the guardrails needed for future agents to self-verify. Detect
+ the stack; do not assume it. Run every artifact you add.
- ## Phase 1 — Detect (never assume)
+ ## 1. Detect
- Run the bundled evidence scan first — it replaces a dozen manual reads with one call:
+ Run the bundled scan first:
```
<this-skill-dir>/scripts/detect.sh <repo-root>
```
- (The skill directory is wherever this SKILL.md lives, e.g. `~/.claude/skills/ready/` or `~/.codex/skills/ready/`.) The script surfaces candidates — **you still decide**. It cannot parse CI matrices or exotic build systems; open anything it flags and read the CI config yourself.
-
- Sources, in order of trust:
-
- 1. CI config — the most honest source of truth: `.github/workflows/*`, `.gitlab-ci.yml`, `.circleci/`. **Whatever CI runs is the verify command.**
- 2. Manifests: `package.json` scripts, `pyproject.toml` / `tox.ini` / `noxfile.py`, `Makefile`, `justfile`, `Cargo.toml`, `go.mod`, `build.gradle`, `composer.json`
- 3. Repo docs: `README*`, `CONTRIBUTING*`, `AGENTS.md`, `CLAUDE.md`, `docs/` — docs go stale; cross-check any doc-claimed command against CI when CI exists. A docs/CI mismatch is itself a finding to record in Phase 5.
- 4. Existing test dirs: `tests/`, `test/`, `spec/`, `__tests__/`, `*_test.*`, `test_*.*`
-
- Report what was found as a short table: run / test / lint / typecheck / build / git repo — command or `MISSING`.
+ It finds candidates, not truth; open flagged files and interpret CI matrices or
+ unusual build systems yourself. Inspect in this order:
- **If the directory is not under version control**, propose `git init` early (ask first — some dirs are deliberately not repos): without git there is no smallest reversible step, no safe break-and-restore in Phase 6, and no bisect.
+ 1. CI config: use what CI runs.
+ 2. Manifests and runners: package scripts, pyproject/tox/nox, Make/just,
+ Cargo/go/Gradle/composer.
+ 3. README, CONTRIBUTING, CLAUDE.md, AGENTS.md, and docs; record docs/CI drift.
+ 4. Existing test directories and naming conventions.
- ## Phase 2 — Establish the verify command
+ Report run/test/lint/typecheck/build/git as command or `MISSING`. If this is not
+ a Git repository, propose `git init` but ask first.
- If a verify path exists, **use it** — do not invent a parallel one.
+ ## 2. Establish verification
- If none exists, create the smallest real one. Order of preference:
+ Reuse the existing verify path. If none exists, create the smallest entrypoint
+ in the repository's native convention.
- 1. The project's native runner, already installed (`pytest`, `vitest`, `go test`, `cargo test`, `dotnet test`)
- 2. A single entrypoint that chains them, matching the repo's existing convention (`Makefile` target, `package.json` script, `justfile` recipe) — e.g. `make verify` running lint then tests
+ The command must:
- Rules:
- - Must exit non-zero on failure. A script that always exits 0 is worse than nothing.
- - Must run to completion unattended: disable watch/interactive modes (e.g. `CI=1`, `--run`, `--watch=false`) — a command that waits for input or watches files hangs the loop.
- - Must run offline, with no credentials. Anything needing GPU/network/secrets belongs in a separate slow target.
- - Time the suite once (`time <cmd>`); the measurement, not a guess, decides one tier or two.
- - On success, output should be near-silent — prefer quiet flags in the fast tier so failures, not progress spam, fill the context.
- - Add it to the repo's own docs so humans find it too.
+ - exit non-zero on failure and run unattended;
+ - work offline without credentials, GPU, network, or secrets;
+ - use installed project tooling and avoid watch mode;
+ - stay quiet on success and be documented for humans.
- **Two tiers when the repo has slow checks.** One `verify` command forces a bad trade: either the loop crawls or coverage gets cut. Split it:
+ Time it once. Use one tier when the suite is already quick. When slow checks
+ would cripple the edit loop, define:
- - `verify` — fast (<~60s), offline: lint, typecheck, unit/smoke tests. Run on **every** loop iteration.
- - `verify-full` — everything else: full suite, integration, build, slow checks. Run **before declaring done** and before a PR — "done" means `verify-full` green, not just `verify`.
+ - `verify`: lint/typecheck/unit or smoke coverage, normally under ~60 seconds;
+ - `verify-full`: integration/build/slow coverage, required at closeout and PR.
- Name them by the repo's convention (`make verify` / `make verify-full`, npm scripts, just recipes). A small repo whose whole suite runs in seconds needs only the single tier — do not add ceremony it does not need.
+ Run `verify` on every edit loop; run `verify-full` at closeout and before a PR.
- **Monorepos:** detect the workspace layout (`package.json` `workspaces`, `pnpm-workspace.yaml`, turbo/nx config, `go.work`, Cargo `[workspace]`). Prefer a repo-owned `verify-changed` target backed by the workspace's native dependency graph; `verify-full` remains the root suite. Never make a global hook guess package mappings from path prefixes. Read [references/smart-verification.md](references/smart-verification.md) before creating the target, and record its base-revision/fallback contract in Phase 5 notes.
+ For monorepos, prefer a repo-owned `verify-changed` backed by the workspace
+ dependency graph, with the root full suite as fallback. Read
+ [references/smart-verification.md](references/smart-verification.md) before
+ creating it and document its base revision and fallback.
- **Enforcement pack users (Claude Code, ask first):** if the verify-tracking hooks are active — classic install: `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/hooks/luciazero-verify.sh` exists; plugin install: the `luciazero` plugin is enabled — offer to record the established command in the repo's *personal* settings so the tracker matches it exactly instead of by broad regex — `.claude/settings.local.json` (gitignored, never committed): `{"env": {"LUCIAZERO_VERIFY_CMD": "<the fast-tier command>"}}`. Derive it from CI (the honest source); it is a cache of that truth, so note it must be updated if CI changes. Never put this variable in committed `.claude/settings.json`: the hook cannot distinguish settings scopes, so a repository can control it; treat a repository that ships it as hostile. Show the exact JSON before writing anything.
+ For Claude Code enforcement-pack users, ask first before offering exact-match
+ tracking in the personal, gitignored `.claude/settings.local.json`:
- ## Phase 3 — Smoke tests, if there are none
+ ```json
+ {"env":{"LUCIAZERO_VERIFY_CMD":"<fast command derived from CI>"}}
+ ```
- Do **not** attempt coverage. Write 3–6 tests that would catch a catastrophic break. Pick by this heuristic:
+ Show the JSON before writing it. Never commit this variable in
+ `.claude/settings.json`; repository-controlled hook configuration is hostile.
+ This setting caches CI truth; update it whenever CI's verify command changes.
+ Skip hook setup on harnesses without hooks.
- - **Contract shape** — the core data structure in/out: dimensions, keys, types, no NaN/null where impossible
- - **Round trip** — serialize→deserialize, encode→decode, save→load returns equal
- - **Import/boot** — every package imports, the app answers one request, the CLI runs `--help`. Prefer the framework's test client over binding a real port; any test that starts a process needs a hard timeout and must kill what it started.
- - **Artifact loads** — trained model / migration / config parses and does one forward pass or one query
- - **The bug you were sent to fix** — a regression test reproducing it, written *before* the fix
+ ## 3. Add smoke tests only when absent
- Use fixtures small enough to commit. Never depend on the user's real data paths.
+ Add 3–6 small tests for catastrophic failures, not pretend coverage. Choose the
+ most relevant:
- State plainly that these are smoke tests, not a suite.
+ - core input/output shape and impossible null/NaN values;
+ - serialize/deserialize or save/load round trip;
+ - import, CLI `--help`, or one request through a framework test client;
+ - model/config/migration load plus one operation;
+ - the reported bug as a red-before-fix regression.
- ## Phase 4 — Guardrails (only ones that pay for themselves)
+ Use commit-sized fixtures, never the user's real data paths. Avoid real ports;
+ if a process is unavoidable, enforce a hard timeout and cleanup. Label these as
+ smoke tests.
- Hooks, `.claude/settings.json`, and `/fewer-permission-prompts` are **Claude Code mechanisms**. On a harness without them (Codex CLI), skip the hook items and encode the same guardrails as instructions in the project's `AGENTS.md` instead: which files are untouchable, which derived file must be regenerated after editing which source.
+ ## 4. Add only paying guardrails
- Prefer few and deterministic. Candidates, in value order:
+ Claude hooks/settings are not portable; on Codex or another harness, put
+ necessary constraints in AGENTS.md instead.
- - **Auto-format/lint on write** — `PostToolUse` hook matching `Edit|Write`, running the repo's own formatter. Only if the repo already has one configured.
- - **Regenerate derived files** — if editing source X requires regenerating Y (protobuf, OpenAPI clients, migrations, lockfiles), hook it, scoped inside the command to the relevant paths. This is the highest-value hook in most repos because humans forget it.
- - **Protect the untouchables** — `PreToolUse` deny on production config, secrets, live model/deploy pointers.
- - **Permission allowlist** — put the repo's read-only and verify commands into `.claude/settings.json` so the loop is not interrupted. `/fewer-permission-prompts` derives this from real transcripts.
+ Prefer existing deterministic tools:
- Put project-scoped settings in the repo's `.claude/settings.json` (shared) or `.claude/settings.local.json` (personal, gitignored) — **not** in global settings.
+ 1. formatter/linter after writes;
+ 2. source-to-derived regeneration;
+ 3. denial for secrets, production config, and live deploy/model pointers;
+ 4. allowlisting read-only and verify commands.
- Hooks execute automatically on the user's machine. Show the exact command before installing it, and never install one that pushes, deploys, deletes, or writes outside the repo.
+ Keep shared settings project-scoped and personal settings gitignored. Show the
+ exact hook command before installation. Never add a hook that deploys, pushes,
+ deletes, or writes outside the repository.
- ## Phase 5 — Project notes file (`CLAUDE.md` / `AGENTS.md`)
+ ## 5. Record project knowledge
- Extend the notes file the repo already uses; if neither exists, create the one matching the current harness and add a one-line pointer from the other name so both find it. Write only what reading the code cannot tell you:
+ Extend the notes file already used; if neither exists, create the current
+ harness's file and point the other name to it. Record only facts code search
+ cannot reveal:
- - How to run / test / verify — the commands from Phase 2
- - Architecture facts that are load-bearing and non-obvious (what serves what, which file is source of truth)
- - **Footguns and null results**: "X looks right but breaks Y", "tried A, measured no gain, do not retry", "always rebuild Z after W"
- - Where the real docs live
+ - verify commands and coverage;
+ - non-obvious source-of-truth or architecture constraints;
+ - footguns, measured null results, and required regeneration;
+ - the location of deeper documentation.
- Do not restate the directory tree, git history, or anything a `grep` answers. Keep it dense; every line costs context on every future session.
+ Do not duplicate the tree, history, or grep-able facts. Every line becomes
+ future context cost.
- ## Phase 6 — Prove it and report
+ ## 6. Prove the loop
- 1. **Flake check** — run the fast verify tier twice. A green that does not repeat is a flake, and a flaky verify makes every future red ambiguous; fixing or quarantining the flake comes before relying on the loop. (Skip the double run only when the repo has a single slow tier — say so.)
- 2. **Red check** — break a line a smoke test actually covers (flip an expected value or a return), confirm verify goes red, then restore. The break is one deliberate edit: **record file, line, and original text before making it, and restore by reverting exactly that edit.** Only use `git checkout -- <file>` if the file was committed before the break — on a file carrying uncommitted work it silently discards that work too, and it cannot restore the untracked test files this skill just wrote. Never use bare `git stash` here (it sweeps the whole tree and skips untracked files). Breaking an uncovered line and staying green proves nothing. A verify command that cannot fail is not a verify command.
+ - **Flake check:** run the fast tier twice. If only one slow tier exists, run it
+ once and state that limitation. A non-repeatable green is not trusted.
+ - **Red check:** record a covered file, line, and original text; make one
+ deliberate break, prove verify fails, then restore exactly that edit. Do not
+ use `git checkout` on a file with user changes, and never use broad
+ `git stash`. New untracked tests require explicit restoration too.
+ - Run the final full tier after restoration.
- Report:
- - The one command to run (both tiers if split)
- - What it does and does not cover
- - What was added, and what was deliberately left out
+ Report the command(s), what each covers and does not cover, files added, and
+ anything deliberately left out.