Claude Code
Add conservative CI evidence to Claude Code.
DiffCI gives Claude Code a repeatable way to inspect the change, trace affected tests, and measure a selected command against the full command without modifying real CI.
npx "@diffci.com/diffci@latest" init
npx "@diffci.com/diffci@latest" checkUse the generated Claude instructions
init creates or proposes a CLAUDE.md policy alongside the portable AGENTS.md guidance. The policy asks Claude Code to run DiffCI before a PR-ready response and to keep existing project checks authoritative.
The default check command may execute inferred full and selected test commands. It writes reports outside the checkout and sends nothing to DiffCI Cloud, but repository scripts can still generate or modify files.
Separate analysis from execution
Use check when measured validation is wanted. Use observe --no-send when Claude should only inspect dependency and selection evidence. This distinction belongs in the prompt whenever executing repository scripts would be inappropriate.
- Never convert a candidate selection into skipped required CI.
- Never describe a test count as saved runtime.
- Never treat an unsupported or refused analysis as green.
Read the result before summarizing
Claude Code should name why DiffCI selected tests or fell back, which commands were executed, whether both passed, and where the JSON or savings report was written. When evidence is incomplete, the correct result is a full run—not an optimistic selection.
Troubleshooting
If Claude cannot find the base commit, fetch sufficient Git history before retrying. If a repository script modifies generated files, inspect the working tree after check or use observe --no-send when execution is not appropriate.
Verify the Claude Code setup
- Confirm that
CLAUDE.mdcontains the generated DiffCI policy and remains visible from the directory where Claude Code starts. - Run one direct
checkand confirm the final answer includes the verdict, commands executed, fallback reason when present, and report path. - Use the repository's normal tests when DiffCI refuses analysis or cannot obtain both comparison commits.