Agent skill

Contract Generation

by EmeaAppGbb in EmeaAppGbb/spec2cloud

Generate API contracts, shared TypeScript types, and infrastructure resource definitions from Gherkin scenarios and test files.

MITAuto-check passedBackend & APIs

Install Contract Generation

skills CLI
$ npx skills add EmeaAppGbb/spec2cloud --skill contract-generation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install EmeaAppGbb/spec2cloud contract-generation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/EmeaAppGbb/spec2cloud.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/contract-generation .claude/skills/contract-generation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
contract-generation
GitHub stars
100
Token cost
~1.6k tokens
SKILL.md length
675 words
Files
2 (incl. references)
Skills in repo
39
Repo updated
First seen
Licence
MIT

At a glance

Generate API contracts, shared TypeScript types, and infrastructure resource definitions from Gherkin scenarios and test files.

  • Works in 4 steps: Extract endpoint definitions from… → Define for each endpoint → Use the simplified OpenAPI-inspired YAML… → …
  • Generating contracts
  • SKILL.md covers Role, Inputs, Outputs and Tasks, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Contract Generation is an agent skill from EmeaAppGbb/spec2cloud. 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.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/schemas.md`).

It sits in Backend & APIs, covering API design, Type safety and OpenAPI specifications. The licence is MIT.

When your agent uses it

  • Generating contracts
  • Creating shared types
  • Defining API specs
  • Updating infrastructure requirements per increment

Example prompts

  • “/contract-generation”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Extract endpoint definitions from Gherkin scenarios and test files.
  2. Define for each endpoint
  3. Use the simplified OpenAPI-inspired YAML format (see references/schemas.md).
  4. Cross-reference Gherkin scenarios to ensure every behavior is covered by an endpoint.

What it can do on your machine

Read from SKILL.md and the folder at commit 8e76618. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are json).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Contract Generation loads about 1.6k tokens when it runs, and up to ~2.8k if it reads all its reference files. Until then it costs about 88 tokens; SKILL.md has 675 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~88
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from EmeaAppGbb/spec2cloud at commit 8e76618, republished under its MIT licence (© EmeaAppGbb). 675 words, ~1,641 tokens.

Download SKILL.mdSave it as .claude/skills/contract-generation/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
contract-generation
description
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.

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

ArtifactLocationCardinality
API contractsspecs/contracts/api/{feature-id}.yamlOne per feature
Shared TypeScript typessrc/shared/types/{feature-id}.tsOne per feature
Infrastructure contractspecs/contracts/infra/resources.yamlSingle file

Tasks

Task 1 — Generate API Contracts

For each feature, produce an API contract in specs/contracts/api/{feature-id}.yaml:

  1. Extract endpoint definitions from Gherkin scenarios and test files.
  2. 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
  3. Use the simplified OpenAPI-inspired YAML format (see references/schemas.md).
  4. 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:

  1. Extract TypeScript interfaces from the API contracts.
  2. 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
  3. Use strict TypeScript: no any types, explicit null/undefined handling.
  4. Export all types as named exports.
  5. 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:

  1. Aggregate resource needs across all features in this increment.
  2. 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
  3. Consider the deployment target (Azure Container Apps via AZD) and existing infra/ Bicep templates.
  4. Flag any gaps between current infrastructure and what the features require.

See references/schemas.md for the full infrastructure contract YAML format.

Show full SKILL.md (261 more words)Show less
Task 4 — Self-Review and Cross-Validation

After generating all contracts, verify:

CheckWhat to verify
CompletenessEvery Gherkin scenario maps to at least one API endpoint
ConsistencyRequest/response types in API contracts match shared TypeScript types
Test alignmentTest files reference endpoints and types that exist in the contracts
Infra coverageEvery service (API, Web) has a corresponding infrastructure resource
No conflictsEndpoint 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:

json
{
  "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:

json
{
  "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=done

Mandatory 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.yaml is 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) and specs/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.

© EmeaAppGbb, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in .github/skills/contract-generation of EmeaAppGbb/spec2cloud.

  • SKILL.md
  • references/schemas.md

Open the folder on GitHubat commit 8e76618

Compare with similar skills

Contract Generation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Contract Generation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Contract Generation this skillEmeaAppGbb/spec2cloud100—~1.6kAutomated safety check: PassMIT
API DesignerJeffallan/claude-skills12k2 repos~2kAutomated safety check: PassMIT
Old Coder API DesignAmazingAng/old-coder7491 repos~3.4kAutomated safety check: PassMIT
API Surface Reviewpolarsource/polar10k—~1.3kAutomated safety check: PassMIT
API ContractChenyCHENYU/Robot_Admin1k—~1.9kAutomated safety check: PassMIT
Designing APIsCloudAI-X/opencode-workflow2751 repos~2.2kAutomated safety check: PassMIT

Similar skills

  • API Designer

    Jeffallan/claude-skills

    Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.

    12k GitHub starsUsed in 2 repos~2k tokens
    Backend & APIsAuto-check passed
  • Old Coder API Design

    AmazingAng/old-coder

    Reviews or designs an HTTP/JSON API's endpoints, auth, pagination, versioning and deprecations, guarding against inventing a bespoke interface or silently breaking consumers.

    749 GitHub starsUsed in 1 repo~3.4k tokens
    Backend & APIsAuto-check passed
  • API Surface Review

    polarsource/polar

    Review changes to Polar's API contract — Pydantic schemas, FastAPI endpoints, OpenAPI output and the generated SDKs.

    10k GitHub stars~1.3k tokensUpdated today
    Backend & APIsAuto-check passed
  • API Contract

    ChenyCHENYU/Robot_Admin

    A skill your agent uses when: generating TypeScript API layer (type definitions + request functions) from page-spec JSON or Swagger/OpenAPI docs.

    1k GitHub stars~1.9k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Designing APIs

    CloudAI-X/opencode-workflow

    Guides REST and GraphQL API design, endpoint patterns, request/response schemas, versioning, and API best practices.

    275 GitHub starsUsed in 1 repo~2.2k tokens
    Backend & APIsAuto-check passed
  • Land TS Mono

    UKGovernmentBEIS/inspect_ai

    Land a PR that requires a coordinated ts-mono submodule change.

    2.9k GitHub stars~3k tokensUpdated today
    Backend & APIsAuto-check passed

More from EmeaAppGbb/spec2cloud

All 39 skills in this repo
  • Azure Deployment

    EmeaAppGbb/spec2cloud

    Provision Azure infrastructure, deploy to Azure Container Apps, and verify via smoke tests.

    100 GitHub stars~1.8k tokensUpdated 5 mo ago
    Auto-check passed
  • Ddd Modeling

    EmeaAppGbb/spec2cloud

    Create Domain-Driven Design proposals from product specs or brownfield extraction outputs.

    100 GitHub stars~2.4k tokensUpdated 5 mo ago
    Auto-check passed
  • Implementation

    EmeaAppGbb/spec2cloud

    Write application code to make failing tests pass using contract-driven, slice-based architecture.

    100 GitHub stars~2.8k tokensUpdated 5 mo ago
    Auto-check passed
  • Spec Refinement

    EmeaAppGbb/spec2cloud

    Review PRDs and FRDs through product and technical lenses. An agent skill from EmeaAppGbb/spec2cloud.

    100 GitHub stars~2.2k tokensUpdated 5 mo ago
    Auto-check passed
  • State Management

    EmeaAppGbb/spec2cloud

    Read, write, and maintain .spec2cloud/state.json across phases and increments.

    100 GitHub stars~1.5k tokensUpdated 5 mo ago
    Auto-check passed
  • Tech Stack Resolution

    EmeaAppGbb/spec2cloud

    Identify, research, and resolve every technology needed by the application.

    100 GitHub stars~1.8k tokensUpdated 5 mo ago
    Auto-check passed

Categories

Questions about Contract Generation

What does Contract Generation do?

Generate API contracts, shared TypeScript types, and infrastructure resource definitions from Gherkin scenarios and test files. Contract Generation is an agent skill from EmeaAppGbb/spec2cloud. Generate API contracts, shared TypeScript types, and infrastructure resource definitions from Gherkin scenarios and test files.

When should I use Contract Generation?

Contract Generation fits situations like: generating contracts; creating shared types; defining API specs; updating infrastructure requirements per increment.

How do I install Contract Generation in Claude Code?

Run `npx skills add EmeaAppGbb/spec2cloud --skill contract-generation -a claude-code`. Or copy the skill folder (.github/skills/contract-generation in EmeaAppGbb/spec2cloud) into .claude/skills/contract-generation in your project. Claude Code loads it when a task matches its description.

How do I install Contract Generation in Codex?

Run `npx skills add EmeaAppGbb/spec2cloud --skill contract-generation -a codex`. Or copy the skill folder (.github/skills/contract-generation in EmeaAppGbb/spec2cloud) into .agents/skills/contract-generation in your project. Codex loads it when a task matches its description.

Can I use Contract Generation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add EmeaAppGbb/spec2cloud --skill contract-generation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/contract-generation, .gemini/skills/contract-generation, .github/skills/contract-generation and .opencode/skills/contract-generation in your project.

What does Contract Generation need to run?

SKILL.md names no scripts, command-line tools or credentials: Contract Generation is instructions for the agent only.

Does Contract Generation access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Contract Generation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Contract Generation use?

Contract Generation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Contract Generation use?

About 1.6k tokens (SKILL.md is roughly 6.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.1k tokens, read only when the agent opens those files.

What are the alternatives to Contract Generation?

Skills that share tags, products or a category with Contract Generation: API Designer (Jeffallan/claude-skills, 12k stars), Old Coder API Design (AmazingAng/old-coder, 749 stars), API Surface Review (polarsource/polar, 10k stars) and API Contract (ChenyCHENYU/Robot_Admin, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Contract Generation?

EmeaAppGbb (a GitHub organization) maintains it in EmeaAppGbb/spec2cloud, which has 100 GitHub stars. The repository holds 39 skills in this directory. The repository was last updated on April 16, 2026.

Source: EmeaAppGbb/spec2cloud on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.