check-generated-code
Creates bounded source contracts for important facts inside large generated files. Use when verifying request shapes, route tables, bindings, operation names, or headers without loading the full generated artifact into model context.
- License 许可
- Apache-2.0
- 所属仓库
- reoring/shepherd
- 最近更新
- 2026-08-18
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- check-generated-code
- description
- Creates bounded source contracts for important facts inside large generated files. Use when verifying request shapes, route tables, bindings, operation names, or headers without loading the full generated artifact into model context.
03 SKILL.md 正文
Check Generated Code
Outcome
Extract a small, stable set of public-contract facts from a large generated file through one exact symbol slice, while avoiding broad model context and adjacent generated function contamination.
Existing Contract Fast Path
When the user supplies an existing contract, do not begin with broad repository search.
The commands below are authoritative. Do not search for the skill, checker, or source before running the preflight.
- Run
shepherd check "$REPO" --contract "$CONTRACT" --json. - If the installed bin is unavailable in this checkout, run
node src/shepherd-cli.ts check "$REPO" --contract "$CONTRACT" --jsonfrom the repository root. - Do not invent flags such as
--context. - On PASS, use returned grounded facts and inspect only source paths needed for the requested risk review.
- On FAIL, inspect only failed facts and their bounded source paths before changing the contract.
- Treat
check-source-contractas the deterministic authority. If the user also requests an answer, hand the passing contract toquery-large-source; do not reconstruct the answer in this skill.
Use When
- Generated artifacts are large enough to exceed practical model input limits.
- A specific generated operation or binding has a stable symbol.
- Generated output is reviewed through its owning schema but exact emitted facts still matter.
- Source regeneration should fail CI when a public request/route/binding changes.
Do not use this skill to validate generated formatting, whitespace, comments, or implementation noise. Prefer generator drift checks for whole-file reproducibility.
Workflow
- Identify the owning schema/generator and the exact generated symbol.
- Select the smallest source window containing all required facts.
- Define one fact per public concern: method, path, header, operation ID, binding name, or field number.
- Use selectors that describe syntax shape without embedding the expected output value.
- Use exact cardinality to reject adjacent-function matches.
- Run
shepherd checkimmediately after regeneration. - If the generated output changes intentionally, update schema, generated file, and contract in one review.
Good Facts
- HTTP method literal
- URL/path template
- idempotency or auth header name
- generated operation method name
- route name
- protobuf field/binding identity when represented as stable source literals
Bad Facts
- generated timestamps
- formatting
- line numbers
- comments
- arbitrary helper implementation details
- values already protected by a canonical generator checksum
Bounding Rules
- Prefer
source.kind: symbolover repository-wide literal search. - Keep
beforeat zero unless preceding declarations are evidence. - Set
afterto the target function length, not a large convenience window. - If multiple identical request lines appear, shrink the source before changing cardinality.
Failure Policy
SOURCE_NOT_FOUND: generated operation was renamed or removed; inspect the owning schema.CARDINALITY_MISMATCH: source window may include adjacent generated operations.CAPTURE_FAILED: generator syntax changed; review before updating the extractor.- Never edit generated source manually to restore a check.
Acceptance
- Facts correspond to public/generated contract boundaries.
- No expected value is copied into a selector.
- The bounded source excludes neighboring operations.
- Regeneration is the only source writer.
- Local and CI checks run with zero model calls.
04 同仓库更多 Skills
query-large-source
Orchestrates conversational questions over large source through direct inspection tools and bounded Shepherd evidence queries.
check-source-contract
Validates a versioned source-fact contract deterministically with zero model calls. Use in local development or CI to detect extraction, grounding, finalization, answer-pattern, and source drift failures.
check-sdk-wiring
Creates and verifies cross-file source contracts from handwritten SDK services to generated request builders. Use when preserving validation labels, client method wiring, HTTP methods, URL templates, headers, or idempotency behavior.
check-registration-inventory
Creates and verifies source contracts for plugin, controller, route, provider, or handler inventories. Use when an exact registration list, order, or cardinality is an architectural invariant checked locally or in CI.
check-config-mappings
Creates and verifies source contracts for configuration defaults and constructor wiring. Use when checking zero-value defaults, config field assignments, timeout/retry settings, environment option mapping, or production constructor fields.
check-cli-registrations
Creates and verifies source contracts for CLI root and subcommand registrations. Use when preserving constructor wiring, source order, exact registration cardinality, or detecting command additions, removals, renames, and duplicates.