Skip to main content

Behavioral Contracts

Runtime behavior specifications for npm packages

TypeScript checks types. Behavioral Contracts check behavior.
Catch runtime errors before they hit production.

Catches What TypeScript Can't

TypeScript validates types, but can't catch unhandled API errors, missing rate limit handling, or edge cases.

// TypeScript: ✅ Types are fine
// Runtime: 💥 Unhandled error
const user = await axios.get('/api/user');

Source-Backed Claims

Every behavioral contract is backed by official documentation URLs. No opinions, only facts.

postcondition:
  throws: AxiosError
  required_handling: "..."
  source: https://axios-http.com/docs

AI-Friendly Output

Structured JSON output designed to feed directly to Claude or ChatGPT for automated fixes.

verify-cli --output violations.json
# Feed to AI agent
# Get automated fixes

100+ Package Contracts

Pre-built contracts for axios, prisma, stripe, openai, and 100+ more popular npm packages.

Open Source & Free

Fully open source under CC BY-SA 4.0 (corpus) and AGPL-3.0 (CLI). Free for all use. No vendor lock-in, no telemetry.

CI/CD Ready

Integrate into your build pipeline. Fail builds on critical violations before they reach production.

See It In Action

❌ Before

async function getUser(id: string) {
  // No error handling!
  const response = await axios.get(`/api/users/${id}`);
  return response.data;
}

✅ After

async function getUser(id: string) {
  try {
    const response = await axios.get(`/api/users/${id}`);
    return response.data;
  } catch (error) {
    if (axios.isAxiosError(error)) {
      if (error.response) {
        // Handle HTTP errors (4xx, 5xx)
      } else {
        // Handle network errors
      }
    }
    throw error;
  }
}
CLI Output:
❌ ERROR: axios.get() called without try-catch
   Location: src/api/users.ts:42:15
   Contract: axios@1.0.0 → get → network-failure postcondition
   Required: Check error.response exists before accessing properties
   Source: https://axios-http.com/docs/handling_errors