Agent Skill
2/7/2026

create-feature

Scaffold a new feature with all required files and structure

L
lssm
2GitHub Stars
2Views
npx skills add lssm-tech/contractspec

SKILL.md

Namecreate-feature
DescriptionScaffold a new feature with all required files and structure

ContractSpec

npm version npm downloads Ask DeepWiki

Website: https://contractspec.io

Stabilize your AI-generated code

The deterministic, spec-first compiler that keeps AI-written software coherent, safe, and regenerable. You keep your app. You own the code. We're the compiler, not the prison.

<p align="center"> <img src="https://www.contractspec.io/icon.png" alt="ContractSpec Logo" width="300" height="300"> </p>

The Problem

In 2025, "vibe coding" and AI agents generate enormous amounts of code. But they have critical limitations:

  • Can't enforce invariants — AI-generated code drifts from business rules over time
  • Break multi-surface consistency — API, DB, UI, and events get out of sync
  • Hallucinate refactors — AI "improvements" introduce subtle bugs and break contracts
  • Destroy long-term maintainability — No source of truth, no safe regeneration path

The result: Teams ship fast initially, then spend months untangling AI-generated spaghetti.

How ContractSpec Works

  1. Define contracts once — Write specs in TypeScript. Just types and Zod schemas you already know.
  2. Generate all surfaces — One spec generates API, DB schema, UI types, events, and MCP tools.
  3. Regenerate safely — Update specs, regenerate code. Invariants are enforced. Breaking changes caught at compile time.
  4. AI reads specs — AI agents read contracts as their source of truth, not implementations.

What Gets Generated

From a single contract spec:

SurfaceOutput
REST APIType-safe endpoints with validation
GraphQLSchema and resolvers
DatabasePrisma migrations and types
MCP ToolsAI agent tool definitions
Client SDKType-safe API clients
UI ComponentsReact forms and views

No Lock-in

ContractSpec is a compiler, not a platform:

  • ✅ Generated code is standard TypeScript you can read and modify
  • ✅ Uses standard tech (Prisma, GraphQL, Zod, React)
  • No proprietary runtime — eject anytime, keep everything
  • Incremental adoption — start with one module, expand at your pace

Quick Start: OSS Core

# Initialize project
bunx contractspec init

# Create a spec
contractspec create --type operation

# Generate implementation
contractspec build src/contracts/mySpec.ts

# Validate
contractspec validate src/contracts/mySpec.ts

See the CLI documentation for full usage.

GitHub Actions Quickstart

Use the ContractSpec actions directly; this repo's workflows are thin wrappers around them.

PR checks

name: ContractSpec PR
on: pull_request
jobs:
  contractspec:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    steps:
      - uses: actions/checkout@v4

      - name: ContractSpec PR checks
        uses: lssm-tech/contractspec/packages/apps/action-pr@main
        with:
          generate-command: 'bun contractspec generate'

Drift check

name: ContractSpec Drift
on:
  push:
    branches: [main]
jobs:
  contractspec:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v4

      - name: ContractSpec drift check
        uses: lssm-tech/contractspec/packages/apps/action-drift@main
        with:
          generate-command: 'bun contractspec generate'

Notes: add pull-requests: write permissions for PR comments, and add contents: write + pull-requests: write for drift PR creation.

Inputs (defaults)

ActionInputDefaultNotes
PRpackage-managerbunbun, npm, pnpm, yarn
PRworking-directory.Repo root or package path
PRreport-modesummarysummary, comment, both, off
PRenable-drifttrueRuns generate + drift check
PRfail-onanybreaking, drift, any, never
PRgenerate-commandrequiredRequired when drift enabled
PRcontracts-diremptyDirectory for contract changes
PRcontracts-globemptyGlob for contract changes
Driftgenerate-commandrequiredRegenerate artifacts
Drifton-driftfailfail, issue, pr
Driftdrift-paths-allowlistemptyComma-separated globs

Sample output

## ContractSpec Report

### 1) What changed

2 contract file(s) changed.

ContractSpec Studio

ContractSpec Studio is the AI-powered product decision engine built on top of ContractSpec.

It turns product signals into spec-first deliverables through a deterministic loop:

Evidence -> Correlation -> Decision -> Change -> Export -> Check -> Notify -> Autopilot
  • Evidence: Ingest product signals from meetings, support, analytics, code, docs, and Slack.
  • Correlation: Cluster evidence into scored patterns using hybrid heuristics + AI signatures.
  • Decision: Create evidence-backed focus briefs with citation chains and clear constraints.
  • Change: Compile patch intents into spec diffs, impact reports, and task packs.
  • Export: Push execution-ready outputs to Linear, Jira, Notion, and GitHub.
  • Check + Autopilot: Verify outcomes, feed learning dividends back into evidence, and automate safely with policy gates.

contractspec is the grammar and compiler. Studio is the IDE and decision platform that runs on top of it.

Try Studio

Example Contract

import { defineCommand } from '@contractspec/lib.contracts';
import { SchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';

const UserInput = new SchemaModel({
  name: 'UserInput',
  fields: {
    email: { type: ScalarTypeEnum.Email(), isOptional: false },
    name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
  },
});

export const CreateUser = defineCommand({
  meta: {
    name: 'user.create',
    version: '1.0.0',
    description: 'Register a new user',
    owners: ['team-auth'],
    tags: ['auth'],
  },
  io: {
    input: UserInput,
    output: new SchemaModel({
      name: 'UserOutput',
      fields: {
        id: { type: ScalarTypeEnum.String(), isOptional: false },
      },
    }),
  },
  policy: {
    auth: 'anonymous',
  },
});

Packages

Contracts Core

npmPackageDescription
npm downloads@contractspec/lib.contracts-specCore contract declarations, registries, policy, workflow, and shared spec types
npm downloads@contractspec/lib.contracts-integrationsIntegration definitions (providers, capabilities, connection/runtime metadata)
npm downloads@contractspec/lib.schemaSchema definitions for multi-surface consistency
npm downloads@contractspec/app.cli-contractspecCLI for creating, generating, validating, and running CI checks

Contracts Runtime Adapters

npmPackageDescription
npm downloads@contractspec/lib.contracts-runtime-client-reactReact runtime adapters for forms and feature rendering
npm downloads@contractspec/lib.contracts-runtime-server-restREST server adapters (rest-next-app, rest-express, rest-elysia, generic)
npm downloads@contractspec/lib.contracts-runtime-server-graphqlGraphQL runtime adapter (graphql-pothos)
npm downloads@contractspec/lib.contracts-runtime-server-mcpMCP runtime adapter (provider-mcp + MCP registrars)

Legacy Package

npmPackageDescription
npm downloads@contractspec/lib.contracts (deprecated)Deprecated monolith kept as migration marker; use split packages above

AI & Evolution

npmPackageDescription
npm downloads@contractspec/lib.ai-agentAI agent orchestration with contract governance
npm downloads@contractspec/lib.evolutionAuto-evolution and safe regeneration

Testing & Quality

npmPackageDescription
npm downloads@contractspec/lib.testingGolden tests for safe regeneration verification
npm downloads@contractspec/lib.observabilityTracing, metrics, and structured logging

Who It's For

AI-Native Startups & Technical Founders

  • Using Cursor, Copilot, Claude, or AI agents heavily
  • Messy AI-generated backends, inconsistent APIs
  • Need to stabilize without rewriting

Small Teams with AI-Generated Chaos

  • Shipped fast with AI, now have tech debt
  • Multiple surfaces out of sync
  • Need incremental stabilization

AI Dev Agencies

  • Building many projects for clients
  • Need reusable templates and consistent quality
  • Need professional handoff artifacts

Learn More

License

MIT

Skills Info
Original Name:create-featureAuthor:lssm