

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1234567# Validate Contracts89> **HARD GATE** — Do NOT deploy or migrate data without running `validate-contracts` first. Silent data divergence between system boundaries causes the hardest-to-debug production bugs.10>11> **HARD GATE** — Contract files MUST be version-controlled alongside code. Outdated contracts are worse than no contracts. If a contract hasn't been reviewed in 30 days, flag it as stale.1213Validate that data structures stay in sync across system boundaries — front-end vs back-end, API responses vs expected schemas, config files vs code assumptions, migration output vs target shape.1415## Contract types1617| Mode | What it catches | When to use |18|------|----------------|-------------|19| **Schema** | API response shape mismatches | Before every deploy, after API changes |20| **Key-set** | Missing/unexpected keys across two data sources | Translation files, configs, enum definitions |21| **Shape** | Column type or format violations | After migrations, before consuming exports |2223## Contract file convention2425All contract files live in `specs/contracts/` as YAML. See [REFERENCE.md](REFERENCE.md) for extended examples.2627### Key-set example2829```yaml30# specs/contracts/i18n-keys.yaml31sources:32 reference: src/locales/en.json33 target: src/messages/en.json34mode: subset35```3637## Process3839### 1. Define contract4041Create a YAML file in `specs/contracts/` following the schema for the mode.4243### 2. Run validation4445```bash46bash scripts/validate-contracts.sh specs/contracts/<contract>.yaml47```4849The runner auto-detects key-set contracts (`sources:` block). Schema and shape modes are documented in REFERENCE.md for consumer projects.5051### 3. Read the report5253```54PASS: key-set contract55# or56FAIL: key-set — N keys in reference missing from target57```5859JSON Lines output for CI is planned for schema/shape modes; key-set failures exit non-zero.6061### 4. Fix divergence6263- **Missing keys** → add to target source64- **Type mismatches** → update schema or fix producer65- **Shape violations** → fix migration or consumer6667### 5. Re-validate6869```bash70bash scripts/validate-contracts.sh specs/contracts/<contract>.yaml71```7273## Verify arc7475Part of **★ VERIFY ★**: `verify-work` → `validate-contracts` → `smoke-test` → `run-evals` → `audit-code`7677## Verify7879→ verify: `test -x scripts/validate-contracts.sh && bash scripts/validate-contracts.sh --self-test && grep -q 'validate-contracts.sh' skills/validate-contracts/SKILL.md && echo OK`8081---8283# Validate Contracts — Reference8485## Navigation8687| Lines | Section |88|-------|---------|89| 1 | Title |90| 3–23 | Navigation |91| 24–32 | Integration |92| 33–44 | Configuration |93| 45–54 | Verification |94| 55–71 | Reference block 1 |95| 72–92 | Reference block 2 |96| 93–104 | Example 1 |97| 105–121 | Example 2 |98| 122–133 | Example 3 |99| 134–144 | Example 4 |100| 145–165 | Example 5 |101| 166–176 | Example 6 |102| 177–185 | Integration |103| 186–197 | Configuration |104| 198–204 | Verification |105106## Integration107108- **Pre-deploy gate:** The `deploy` skill runs `validate-contracts` before smoke-test.109- **CI pipeline:** JSON Lines output is CI-friendly; pipe to `jq` for assertions.110- **Pre-migration:** Run `validate-contracts --shape` before consuming migration output.111112113---114115## Configuration116117| Variable | Default | Description |118|----------|---------|-------------|119| `CONTRACTS_DIR` | `specs/contracts/` | Directory containing contract YAML files |120| `VALIDATE_ALL` | `false` | If true, run all contracts in the directory |121| `STRICT_MODE` | `false` | Treat warnings as failures |122| `OUTPUT_FORMAT` | `text` | `text` or `json` |123124125---126127## Verification128129→ verify: `test -f validate-contracts/SKILL.md && grep -q 'name: validate-contracts' validate-contracts/SKILL.md && echo OK`130→ verify: `grep -qi 'specs/contracts\|JSON Schema\|key.set\|data.shape' validate-contracts/SKILL.md && echo OK`131→ verify: `grep -ci 'divergence\|missing key\|type mismatch\|diff\|conforms\|column' validate-contracts/SKILL.md | awk '{if($1>=3) print "OK"; else print "FAIL"}'`132→ verify: `grep -ci 'JSON Lines\|machine.parse\|CI\|deploy.*gate\|pre.deploy' validate-contracts/SKILL.md | awk '{if($1>=2) print "OK"; else print "FAIL"}'`133→ verify: `grep -q 'validate-contracts' SKILL-INDEX.md && echo OK`134135---136137## Reference block 1138139```yaml140# specs/contracts/users.schema.yaml141endpoint: /api/users142method: GET143schema:144 type: object145 required: [id, name, email]146 properties:147 id: { type: number }148 name: { type: string }149 email: { type: string, format: email }150```151152---153154## Reference block 2155156```yaml157# specs/contracts/migration-output.yaml158file: data/users-export.json159format: json160fields:161 - name: user_id162 type: number163 required: true164 - name: full_name165 type: string166 required: true167 - name: created_at168 type: string169 format: date-time170 required: false171```172173---174175## Example 1176177```178specs/contracts/179├── users.schema.yaml # API response schema180├── i18n-keys.yaml # Key-set comparison181├── migration-output.yaml # Data shape contract182└── README.md # Local conventions183```184185---186187## Example 2188189```yaml190# specs/contracts/users.schema.yaml191endpoint: /api/users192method: GET193schema:194 type: object195 required: [id, name, email]196 properties:197 id: { type: number }198 name: { type: string }199 email: { type: string, format: email }200```201202---203204## Example 3205206```yaml207# specs/contracts/i18n-keys.yaml208sources:209 reference: src/frontend/locales/en.json210 target: src/backend/messages/en.json211mode: subset # all target keys must exist in reference212```213214---215216## Example 4217218```bash219validate-contracts --key-set specs/contracts/i18n-keys.yaml220# → missing: 2 keys in reference not found in target: ['settings.privacy', 'help.faq']221# → added: 1 key in target not in reference: ['deprecated.field']222# → exit 1 (divergence)223```224225---226227## Example 5228229```yaml230# specs/contracts/migration-output.yaml231file: data/users-export.json232format: json233fields:234 - name: user_id235 type: number236 required: true237 - name: full_name238 type: string239 required: true240 - name: created_at241 type: string242 format: date-time243 required: false244```245246---247248## Example 6249250```bash251validate-contracts --shape specs/contracts/migration-output.yaml252# → PASS: 3/3 fields validated, 5000 rows OK253# → WARN: field 'full_name' has 12 null values (0.24%)254# → FAIL: field 'user_id' has 3 rows with type string (expected number)255```256257---258259## Integration260261- **Pre-deploy gate:** The `deploy` skill runs `validate-contracts` before smoke-test.262- **CI pipeline:** JSON Lines output is CI-friendly; pipe to `jq` for assertions.263- **Pre-migration:** Run `validate-contracts --shape` before consuming migration output.264265266---267268## Configuration269270| Variable | Default | Description |271|----------|---------|-------------|272| `CONTRACTS_DIR` | `specs/contracts/` | Directory containing contract YAML files |273| `VALIDATE_ALL` | `false` | If true, run all contracts in the directory |274| `STRICT_MODE` | `false` | Treat warnings as failures |275| `OUTPUT_FORMAT` | `text` | `text` or `json` |276277278---279280## Verification281282→ verify: `test -f validate-contracts/SKILL.md && grep -q 'name: validate-contracts' validate-contracts/SKILL.md && echo OK`283→ verify: `grep -qi 'specs/contracts\|JSON Schema\|key.set\|data.shape' validate-contracts/SKILL.md && echo OK`284→ verify: `grep -ci 'divergence\|missing key\|type mismatch\|diff\|conforms\|column' validate-contracts/SKILL.md | awk '{if($1>=3) print "OK"; else print "FAIL"}'`285→ verify: `grep -ci 'JSON Lines\|machine.parse\|CI\|deploy.*gate\|pre.deploy' validate-contracts/SKILL.md | awk '{if($1>=2) print "OK"; else print "FAIL"}'`286→ verify: `grep -q 'validate-contracts' SKILL-INDEX.md && echo OK`287
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.cursor/rules/simple-english.mdc · 139 | Cursor rules | styletypesgitdatabase+6 | 47/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/assess-impact.mdc · 139 | Cursor rules | testtesting-strategydeployment | 66/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/audit-plan.mdc · 139 | Cursor rules | buildteststylegit | 74/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/build-epic.mdc · 139 | Cursor rules | buildgit | 58/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/change-request.mdc · 139 | Cursor rules | no sections | 48/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/commit-message.mdc · 139 | Cursor rules | lint-formatstyletypesgit+3 | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/compose-workflow.mdc · 139 | Cursor rules | styledo-notagent-behaviour | 65/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/context7-mcp.mdc · 139 | Cursor rules | style | 54/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/deepen-architecture.mdc · 139 | Cursor rules | testtesting-strategydo-not | 57/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-language.mdc · 139 | Cursor rules | lint-formatdo-not | 65/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/define-success.mdc · 139 | Cursor rules | no sections | 4/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/delegate-task.mdc · 139 | Cursor rules | git | 62/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/deploy.mdc · 139 | Cursor rules | setupbuildtestdeployment | 77/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/verify-work.md · 139 | Windsurf rules | buildtestlint-formatagent-behaviour | 74/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/develop-tdd.mdc · 139 | Cursor rules | teststylearchtesting-strategy+5 | 85/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-root.mdc · 139 | Cursor rules | no sections | 39/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/diagnose-stall.mdc · 139 | Cursor rules | no sections | 44/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/dispatch-agents.mdc · 139 | Cursor rules | git | 54/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/edit-document.mdc · 139 | Cursor rules | no sections | 39/100 | 14 days ago | |
| danielvm-git/bigpowers.cursor/rules/elaborate-spec.mdc · 139 | Cursor rules | test | 58/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| danielvm-git/bigpowers.windsurf/rules/organize-workspace.md · 139 | Windsurf rules | buildstylegitdeployment+2 | 89/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/guard-git.md · 139 | Windsurf rules | stylearchgitsecurity+2 | 89/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/quick-fix.md · 139 | Windsurf rules | teststylegitdeployment+1 | 85/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/develop-tdd.md · 139 | Windsurf rules | teststylearchtesting-strategy+5 | 85/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/extract-design.md · 139 | Windsurf rules | lint-formatstyledependenciesui | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/commit-message.md · 139 | Windsurf rules | lint-formatstyletypesgit+3 | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/session-state.md · 139 | Windsurf rules | lint-formatstyleagent-behaviour | 82/100 | 14 days ago | |
| danielvm-git/bigpowers.windsurf/rules/setup-environment.md · 139 | Windsurf rules | setupstylesecuritydo-not+1 | 81/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/danielvm-git-bigpowers-windsurf-rules-validate-contracts)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.