一键导入
contract-check
Audit health of contract tests across services — staleness, sync gaps, uncommitted pacts, missing tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Audit health of contract tests across services — staleness, sync gaps, uncommitted pacts, missing tests.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Query an independent peer or a configurable local/OpenRouter review panel, with distinct quorum and evidence-backed consensus interpretation policies.
Safely coordinate bounded delegation while preserving observable outcome and acceptance-evidence pairs through one-writer execution, independent review, and parent validation. Explicit invocation only.
Detect whether a beads repository needs classic-to-Dolt migration or an in-place Dolt schema upgrade.
Migrate beads from classic SQLite/JSONL to Dolt, or safely upgrade an existing Dolt schema after a bd upgrade.
Read-only current-session and UTC-week token telemetry dashboard for Pi, Claude Code, Codex, and optional OpenRouter management analytics.
Read-only audit of Pi routing and configured second-opinion panel model IDs against the active Pi catalog and public live model metadata; reports when Pi or configured models merit review without editing config.
| name | contract-check |
| description | Audit health of contract tests across services — staleness, sync gaps, uncommitted pacts, missing tests. |
| allowed-tools | Read,Grep,Glob,Bash(./scripts/contract-check:*),Bash(./scripts/mgit:*),Bash(ls:*),Bash(chmod:*),Skill,AskUserQuestion |
| model-tier | standard |
| model | sonnet |
| effort | medium |
| version | 1.1.0 |
| author | flurdy |
Audits the health of consumer-driven contract tests across all letterbox services. Surfaces staleness, sync gaps, uncommitted pacts, missing tests, documentation drift, and disabled tests.
This is a read-only audit — it does not run tests or modify files. Use /contract-test to execute contract test workflows.
/contract-check # Full audit (all checks)
/contract-check status # Summary dashboard only
/contract-check stale # Consumer output newer than provider copy
/contract-check uncommitted # Pact files not committed in service repos
/contract-check sync-gaps # Trace each intended edge: consumer test → built pact → synced to provider
/contract-check coverage # Provider CI verifies each synced pact? (catches commented-out/disabled consumers)
/contract-check missing # Connectors with no consumer tests
/contract-check docs # Documentation drift in pact-workflow.md
/contract-check disabled # Contract tests excluded from default builds
/contract-check <service> # All checks scoped to one service
On first run, ensure the script symlink exists:
ln -sfn "$SKILLS_DIR/contract-check/scripts/contract-check.sh" ./scripts/contract-check
chmod +x ./scripts/contract-check
Where $SKILLS_DIR resolves to ${CLAUDE_HOME:-$HOME/.claude}/skills.
Check that ./scripts/contract-check exists and is executable. If not, create the symlink as shown in Setup above.
Parse the user's argument:
(none) or full → Run all checks (mechanical + semantic)status → Run all checks but only show the summary tablestale → Run ./scripts/contract-check staleuncommitted → Run ./scripts/contract-check uncommittedsync-gaps → Run ./scripts/contract-check sync-gapscoverage → Run ./scripts/contract-check coverage (CI verifies each synced pact?)missing → Run semantic Missing Consumer Tests check (Step 3)docs → Run semantic Documentation Drift check (Step 4)disabled → Run semantic Disabled Tests check (Step 5). coverage is the mechanical
companion: it catches commented-out PACTCONSUMER entries in a provider's CI verify job.<service> → Run all checks scoped to that servicematrix → Run ./scripts/contract-check matrixBefore running the uncommitted check (or all/full), suggest running make normalize-pacts first. Pact libraries regenerate random UUIDs, dates, and strings on every test run, causing noisy git diffs that aren't real contract changes. The normalizer replaces these with deterministic placeholders.
Note: normalize-pacts.py currently only normalizes values referenced by generators.body metadata. UUIDs in providerStates.params, request.path, request.headers, and response.headers are NOT yet normalized — those may still show as noise in uncommitted diffs. Flag these as noise in the report when the diff is UUID-only.
Run the appropriate script subcommand:
./scripts/contract-check all # or stale, uncommitted, sync-gaps, coverage, matrix
Parse the script output. Each line starts with a status keyword:
OK — no action neededSTALE — consumer pact is newer than provider copyDIFFERS — same age but content differsMISSING_PROVIDER — provider does not have this pact fileUNCOMMITTED — pact file has uncommitted changesNOT_BUILT — (sync-gaps) consumer test exists but produced no pact in target/ (tests not run)NOT_SYNCED — (sync-gaps) pact is built but not copied into the provider (run sync-pacts.sh)GAP — (coverage) provider CI does not verify all its synced consumer pacts
(style=enum with commented-out consumers, or style=none with no verify job)CLEAN — no issues foundNO_DATA — no consumer pact files foundSUMMARY — counts for the checkFor each consumer service, compare connectors against consumer test files:
Find connectors — Glob for connector files:
<service>/app/connectors/*Connector.scala<service>/src/main/scala/**/connectors/*Connector.scalaFind consumer tests — Glob for consumer test files:
<service>/test/contract/*Consumer*.scala<service>/src/test/scala/**/contract/*Consumer*.scalaExtract provider name from connector filename: strip Connector suffix, lowercase. E.g., AccountConnector.scala → account.
Exclude external connectors that are not internal services:
Cross-reference: For each connector, check if a matching consumer test exists. Report connectors with no consumer test.
Output format:
### Missing Consumer Tests
| Service | Connector | Provider | Has Consumer Test |
|---------|-----------|----------|-------------------|
| reconciler | EventConnector | event | NO |
| reconciler | MessageQueueConnector | messagequeue | NO |
docs/pact-workflow.md./scripts/contract-check matrix to get actual relationshipsSearch for contract test exclusions in build.sbt files:
-l tags.ContractTest or --exclude-tags=ContractTestFor services with active exclusions, check if the Makefile test-contract target overrides it (e.g., with set Test/testOptions := Nil)
Report:
sbt test silently skips contract teststest-contract Makefile target entirelyCombine all findings into a health report:
# Contract Health Report
## Summary
| Check | Status | Details |
|------------------|--------|--------------------------------|
| Staleness | PASS/WARN/FAIL | X stale / Y total |
| Uncommitted | PASS/WARN | X files across Y services |
| Sync coverage | PASS/FAIL | X/Y pairs in sync-pacts.sh |
| Verify coverage | PASS/FAIL | X providers verify all synced pacts |
| Missing tests | PASS/WARN | X connectors without tests |
| Documentation | PASS/FAIL | X items out of date |
| Disabled tests | PASS/INFO | X services exclude by default |
## Staleness
[details from script output]
## Uncommitted Pact Files
[details from script output]
## Sync Coverage Gaps
[details from script output]
## Missing Consumer Tests
[details from LLM analysis]
## Documentation Drift
[details from LLM analysis]
## Disabled Tests
[details from LLM analysis]
## Recommended Actions (priority order)
1. [most impactful fix first]
2. ...
Status thresholds:
After presenting the report, ask the user:
Would you like me to create beads for the issues found? I can triage them as P3 tasks with appropriate service labels.
If the user agrees, use /triage to create beads for actionable findings. Group related findings into single beads where appropriate (e.g., "Add digest, patrol, reconciler to sync-pacts.sh" as one bead rather than three).
When invoked with a service name (/contract-check dispatch):
make test-contract in consumer servicesMost providers use test/resources/pacts/. Exceptions:
src/test/resources/pacts/src/test/resources/pacts/Braintree, Stripe, SES, SpamConfiguration, WebConfiguration, ApiConnector (abstract base), ConnectorConfiguration, ConnectorModule