contract-generation
Skill100 starsChanged 7 months agoMITView on GitHub
Generate API contracts, shared TypeScript types, and infrastructure resource definitions from Gherkin scenarios and test files. Produce the stable foundation for parallel frontend/backend implementation. Use when generating contracts, creating shared types, defining API specs, or updating infrastructure requirements per increment.
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 56
Use the simplified OpenAPI-inspired YAML format (see references/schemas.md).
- Very specific: line 70
Use strict TypeScript: no any types, explicit null/undefined handling.
- Distinctive: line 72
Ensure types compile standalone (no circular dependencies, no runtime imports).
- Very specific: line 86
Consider the deployment target (Azure Container Apps via AZD) and existing infra/ Bicep templates.
- Distinctive: line 94
After generating all contracts, verify:
- Distinctive: line 107
If a Gherkin scenario cannot be mapped to an API endpoint, flag it as a gap.
- Distinctive: line 108
If test files reference types not in the contracts, update the contracts.
- Distinctive: line 109
After self-review, present all contracts to the orchestrator for human gate approval.
- Distinctive: line 113
After completing contract generation for a feature:
- Distinctive: line 134
After completing the infrastructure contract:
- Distinctive: line 163
BLOCKING: If any item is unchecked, the skill has NOT completed successfully.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Contract Generation
Role
You are the contract generation agent. You produce the contracts that bridge test generation and implementation: API specifications, shared TypeScript types, and infrastructure resource requirements. Contracts are generated per increment — only for the features and endpoints scoped to the current increment.
Your output is the stable foundation that enables frontend and backend implementation slices to run in parallel without conflicts.
Inputs
- The current increment's scope from
specs/increment-plan.md - Approved FRDs scoped to this increment (
specs/frd-*.md) - Gherkin feature files for this increment (
specs/features/*.feature) - E2E test specs for this increment (Playwright specs, Page Object Models)
- BDD test scaffolding for this increment (step definitions, unit test files)
- Existing contracts from previous increments (to extend, not conflict)
- Current
.spec2cloud/state.json
Outputs
| Artifact | Location | Cardinality |
| API contracts | specs/contracts/api/{feature-id}.yaml | One per feature |
| Shared TypeScript types | src/shared/types/{feature-id}.ts | One per feature |
| Infrastructure contract | specs/contracts/infra/resources.yaml | Single file |
Tasks
Task 1 — Generate API Contracts
For each feature, produce an API contract in specs/contracts/api/{feature-id}.yaml:
- Extract endpoint definitions from Gherkin scenarios and test files.
- Define for each endpoint:
- HTTP method and path (e.g.,
POST /api/auth/register) - Route parameters and query parameters
- Request body schema with required/optional fields, types, and validation rules
- Response body schema for success (2xx) and error (4xx, 5xx) cases
- Authentication/authorization requirements (e.g., JWT required, admin role)
- Status codes with descriptions
- HTTP method and path (e.g.,
- Use the simplified OpenAPI-inspired YAML format (see
references/schemas.md). - Cross-reference Gherkin scenarios to ensure every behavior is covered by an endpoint.
Task 2 — Generate Shared TypeScript Types
For each feature, produce shared types in src/shared/types/{feature-id}.ts:
- Extract TypeScript interfaces from the API contracts.
- Include:
- Request DTOs (e.g.,
RegisterRequest,LoginRequest) - Response DTOs (e.g.,
RegisterResponse,UserProfile) - Entity models shared between API and Web (e.g.,
User,Session) - Enum types and constants (e.g.,
UserRole,ErrorCode) - Component prop types derived from response shapes
- Request DTOs (e.g.,
- Use strict TypeScript: no
anytypes, explicit null/undefined handling. - Export all types as named exports.
- Ensure types compile standalone (no circular dependencies, no runtime imports).
Task 3 — Generate Infrastructure Contract
Produce a single infrastructure contract at specs/contracts/infra/resources.yaml:
- Aggregate resource needs across all features in this increment.
- Define for each Azure resource:
- Resource type (e.g.,
Microsoft.App/containerApps) - SKU/tier with justification
- Scaling: min/max replicas, CPU/memory allocation
- Environment variables and secrets the resource needs
- Dependencies between resources
- Networking: ingress rules, CORS configuration, internal-only access
- Resource type (e.g.,
- Consider the deployment target (Azure Container Apps via AZD) and existing
infra/Bicep templates. - Flag any gaps between current infrastructure and what the features require.
See references/schemas.md for the full infrastructure contract YAML format.
Task 4 — Self-Review and Cross-Validation
After generating all contracts, verify:
| Check | What to verify |
| Completeness | Every Gherkin scenario maps to at least one API endpoint |
| Consistency | Request/response types in API contracts match shared TypeScript types |
| Test alignment | Test files reference endpoints and types that exist in the contracts |
| Infra coverage | Every service (API, Web) has a corresponding infrastructure resource |
| No conflicts | Endpoint paths don't collide across features; type names are unique or namespaced |
Iteration Rules
- Generate contracts for all features in the increment before presenting for review.
- If a Gherkin scenario cannot be mapped to an API endpoint, flag it as a gap.
- If test files reference types not in the contracts, update the contracts.
- After self-review, present all contracts to the orchestrator for human gate approval.
State Updates
After completing contract generation for a feature:
{
"contracts": {
"api": {
"{feature-id}": {
"status": "done",
"specFile": "specs/contracts/api/{feature-id}.yaml"
}
},
"sharedTypes": {
"{feature-id}": {
"status": "done",
"outputFiles": ["src/shared/types/{feature-id}.ts"]
}
}
}
}After completing the infrastructure contract:
{
"contracts": {
"infra": {
"status": "done",
"specFile": "specs/contracts/infra/resources.yaml"
}
}
}Append to .spec2cloud/audit.log:
[ISO-timestamp] increment={id} step=contracts action=contracts-generated result=doneMandatory Completion Checklist
The orchestrator MUST verify ALL of the following before marking contract-generation as complete:
- API contracts exist in
specs/contracts/api/for every endpoint in the increment - Shared types in
src/shared/types/cover all data structures used across API and Web specs/contracts/infra/resources.yamlis updated with any NEW infrastructure needs for this increment (new Azure resources, new model deployments, new env vars)- Any new Azure resources needed are flagged for provisioning and have corresponding Bicep definitions in
infra/ - Any new environment variables are documented in both
resources.yaml(per-resource env_vars) andspecs/tech-stack.md(per-increment map)
BLOCKING: If any item is unchecked, the skill has NOT completed successfully. The orchestrator must loop back and complete the missing items before advancing to implementation.
Other versions1 project uses a version of this.
Word for word · 1
- crgarcia12/Liliput★ 4100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository47 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- adrSkill
- api-extractorSkill
- architecture-mapperSkill
- aspireSkill
- audit-logSkill
- azure-deploymentSkill
- bug-fixSkill
- build-checkSkill
- cloud-native-assessmentSkill
- cloud-native-plannerSkill
- codebase-scannerSkill
- commit-protocolSkill
- data-model-extractorSkill
- ddd-modelingSkill
- dependency-inventorySkill
- deploy-diagnosticsSkill
- e2e-generationSkill
- error-handlingSkill
- extension-plannerSkill
- find-skillsSkill
- frd-generatorSkill
- gherkin-generationSkill
- human-gateSkill
- implementationSkill
- modernization-assessmentSkill
- modernization-plannerSkill
- performance-assessmentSkill
- playwright-cliSkill
- prd-generatorSkill
- research-best-practicesSkill
- resumeSkill
- rewrite-assessmentSkill
- rewrite-plannerSkill
- security-assessmentSkill
- security-plannerSkill
- skill-creatorSkill
- skill-discoverySkill
- spec-refinementSkill
- spec-validatorSkill
- state-managementSkill
- tech-stack-resolutionSkill
- test-discoverySkill
- test-generationSkill
- test-runnerSkill
- ui-ux-designSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

