verify · anthropics/defending-code-reference-harness — Claude Code skill: test harness without Docker
verify — a skill for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode that tests harness changes end-to-end without Docker.
Apache-2.0 257 installs ★ 7,771 updated 2026-08-06
npx skills add anthropics/defending-code-reference-harness --skill verify -a claude-codeWhat verify does
Inside: a five-step recipe. Download the pinned CLI version via npm install @anthropic-ai/claude-code@<pin>, spin up a stub server that writes request headers to JSONL and returns 400, build the agent env exactly as the pipeline does using resolve_auth_env(), unset variables like ANTHROPIC_CUSTOM_HEADERS from the session (containers never see them), run the CLI with timeout and read the log.
The command calls the CLI with --model, --max-turns and a prompt. Without Docker, you cannot exercise the -e injection leg in docker run — it uses the same mechanism as ANTHROPIC_API_KEY in production. For the interactive-skills surface, copy .claude/settings.json into a fresh temp directory and run the host claude from there, with ambient ANTHROPIC_CUSTOM_HEADERS unset. Tests in test_patch.py and test_patch_grade.py require Docker and fail on docker-less hosts — pre-existing, unrelated to your changes.
What it helps with
- test harness changes without spinning up Docker
- capture outbound headers from the agent CLI
- reproduce container env on a bare host
- spot the difference between session and container variables
- verify interactive skills with a clean
settings.json
Example prompts for the agent
- Run the harness test without Docker following the
verifyrecipe. - Build the CLI env using
resolve_auth_env()and dump it to an export file. - Spin up a stub server that logs headers to JSONL and drive the CLI through it.
How to install verify
1Skills CLI (Vercel)
npx skills add anthropics/defending-code-reference-harness --skill verify -a claude-code2Manually: put the files in place
~/.claude/skills/verify/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/verify/
1Skills CLI (Vercel)
npx skills add anthropics/defending-code-reference-harness --skill verify -a codex2Manually: put the files in place
.agents/skills/verify/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add anthropics/defending-code-reference-harness --skill verify -a cursor2Manually: put the files in place
.cursor/skills/verify/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install anthropics/defending-code-reference-harness .claude/skills/verify2Manually: put the files in place
.github/skills/verify/SKILL.md1Skills CLI (Vercel)
npx skills add anthropics/defending-code-reference-harness --skill verify -a gemini-cli2Platform CLI
gemini skills install https://github.com/anthropics/defending-code-reference-harness --path .claude/skills/verifyManually: put the files in place
.devin/skills/verify/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add anthropics/defending-code-reference-harness --skill verify -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about verify
How to install verify in Claude Code?
Run npx skills add anthropics/defending-code-reference-harness --skill verify -a claude-code, then open ~/.claude/skills/verify/SKILL.md.
What does the verify skill do?
Runs the pinned Claude CLI binary against a stub server with the env dict resolve_auth_env() builds for containers. Lets you verify harness changes on a host without Docker.
Why do test_patch.py tests fail without Docker?
They require Docker and do not run on bare hosts — unrelated to your harness changes, the issue existed before them.
Source text
SKILL.md · Apache-2.0
--- name: verify description: Verify harness changes end-to-end without docker — drive the real pinned CLI against a header-capturing stub server with the exact env resolve_auth_env() produces. --- # Verifying harness changes on a docker-less host The pipeline's real surface is the in-container `claude -p` process and its outbound API requests. Without docker, drive the same pinned CLI binary directly with the env dict the harness would inject via `docker -e`. ## Recipe 1. **Get the pinned CLI** (version from `harness/agent_image.py:CLAUDE_CODE_VERSION`): `npm install --no-save @anthropic-ai/claude-code@<pin>` in a temp dir → binary at `node_modules/@anthropic-ai/claude-code/bin/claude.exe` (the `.exe` name is the real native-binary entry on Linux too, filled in by the package's postinstall — not a Windows leftover). 2. **Stub API server**: a tiny HTTP server that appends each request's headers to a JSONL file and returns a 400 `invalid_request_error` (non-retryable, so the CLI exits fast; exit=1 is expected). 3. **Build the agent env exactly as the pipeline does**: `python3 -c "from harness.auth import resolve_auth_env; ..."` and dump to an `export`-lines file with `shlex.quote` (values contain newlines — NEVER pass via `env $(...)`, word-splitting mangles them; `source` the file). 4. **Emulate the container env**: `unset ANTHROPIC_CUSTOM_HEADERS` (and any other ambient var not in the resolved dict) before sourcing — a Claude Code session in this repo injects `.claude/settings.json` env into shells, which containers never see. 5. **Run**: `ANTHROPIC_BASE_URL=http://127.0.0.1:<port> CLAUDECODE= IS_SANDBOX=1 timeout 30 <cli> -p hi --model claude-sonnet-4-5 --max-turns 1`, then read the captured JSONL. ## Gotchas - Unit tests in `tests/test_patch.py` / `tests/test_patch_grade.py` need docker and fail on docker-less hosts — pre-existing, not your change. - The docker `-e` injection leg itself can't be exercised without docker; it's the same mechanism that carries `ANTHROPIC_API_KEY` in production. - For the interactive-skills surface, copy `.claude/settings.json` into a fresh temp dir and run the host `claude` from there (with ambient `ANTHROPIC_CUSTOM_HEADERS` unset so settings.json is the only source).
© anthropics · Apache-2.0 · anthropics/defending-code-reference-harness
Similar skills
All skills for Testing and QA →verify by other authors comes first.