Source-Grounded API Usage: Verify Before You Code

Verifies API calls against the installed version's source and types, citing file:line for each behavior the code relies on.

Development / Engineeringsource-verificationapi-usage
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Verify this API implementation matches the OpenAPI spec”
Beforegeneric AI agent
I can review your API implementation against the OpenAPI spec. To do this well, I'd need to see both the spec file and your code. The main things I'd check are whether the endpoints exist as defined, whether the request parameters match, whether the response schemas are correct, and whether error handling aligns with the spec. What language is your API implemented in? Do you have the OpenAPI file handy? Are there any parts of the spec you're not sure about, or are there known differences between what you built and what was spec'd?
Afterwith Source-Grounded API Usage: Verify Before You Code
SOURCE-GROUNDED API VERIFICATION

API UNDER REVIEW: User Management Service

DOCUMENT SOURCES
  Specification: openapi.yaml (v3.0.0, 342 lines)
  Implementation: src/api/users.js (427 lines)
  Live deployment: api.example.com/users
  Test coverage: tests/users.test.js (18 tests)

FINDINGS BY ENDPOINT

Endpoint 1: GET /users/{id}
  Spec definition (line 87-112):
    Parameter: id (integer, required)
    Response 200: User object with fields {id, email, created_at, role}
    Response 404: Error object with fields {code, message}
  
  Implementation check:
    Route exists at line 45: ✓
    Parameter validation: ✓ Validates integer type
    Response schema: ✓ Returns all 4 required fields
    Error handling: MISMATCH - Returns {error_message, status_code} instead of {code, message}
    Flag: Response error schema does not match spec. See lines 67-72 of users.js

Endpoint 2: POST /users
  Spec definition (line 114-148):
    Request body: {email (string), password (string), role (string, enum: admin/user)}
    Response 201: Created User object
    Response 400: Validation error
  
  Implementation check:
    Route exists: ✓
    Request validation: ✓ Checks email format, password length
    Role validation: MISMATCH - Implementation allows role="moderator" but spec only allows admin/user
    Flag: Role enum not restricted per spec. See line 78 of users.js

Endpoint 3: PUT /users/{id}
  Spec definition (line 150-180):
    Allowed updates: email, password, role
    Restriction: Users can only update themselves unless admin
  
  Implementation check:
    Authorization logic: DEVIATION - Implementation checks user_id === auth.id but spec says users can only update themselves unless admin
    Schema alignment: ✓ All updatable fields match
    Flag: Auth check does not match permission hierarchy in spec. See line 112 of users.js

DEVIATION SUMMARY
  Total deviations found: 3
    Type 1 - Response schema mismatch: 1 instance
    Type 2 - Validation mismatch: 1 instance
    Type 3 - Authorization logic mismatch: 1 instance
  
  Severity breakdown:
    Critical (breaks clients): 1 (response schema)
    Medium (security/logic): 1 (authorization)
    Low (validation strictness): 1 (role enum)

RECOMMENDATIONS
  1. FIX IMMEDIATELY: Align error response schema to spec {code, message} format
     Where: users.js lines 67-72
     Impact: Live clients expecting {code, message} will fail
  
  2. FIX BEFORE DEPLOY: Restrict role enum to admin/user only
     Where: users.js line 78 (add enum validation)
     Impact: Security - unknown roles could cause privilege escalation
  
  3. CLARIFY WITH PRODUCT: Confirm authorization model in spec
     Current implementation allows self-edit only; spec suggests admin override
     If admin override needed, add new endpoint or document in spec

COMPLIANCE SCORE: 73% (matches spec)
  Passing: 15 of 18 checks
  Deviations: 3 of 18 checks
  Recommendation: Address critical + medium issues before production release

About this skill

Claude wrote code against a library method that doesn't exist in your version. Or it used last year's option name, or assumed a default timeout the library never had. The code looked right, the types were close, and it broke at runtime. This skill makes Claude find the version you actually have installed and read that version's source before relying on any behavior. Every claim gets labeled by the evidence behind it.

What it does

  • Pins the real installed version from lockfiles and resolved packages, not the docs site's "latest"
  • Locates and reads the installed source and type definitions for npm, Python, Go, Rust, and JVM dependencies
  • Reads implementation bodies for the things types hide: defaults, null vs throw, retries, mutation, pagination
  • Labels every behavioral claim VERIFIED, DOCUMENTED, or UNVERIFIED, with file:line or a versioned doc link
  • Flags discrepancies between memory, docs, and installed code, and says which one wins and why
  • With no file access, gives ranked one-line commands so you can check the riskiest assumptions yourself

What you get

Working code plus a short evidence table listing each external behavior the code depends on, where it was confirmed, and anything still unverified, with the exact command to check it.

Best for

Developers using Claude Code on projects with pinned or older dependencies, fast-moving SDKs, or internal libraries, where "it compiled" isn't proof that the call does what the code assumes.

SKILL.md preview

SKILL.md
---
name: source-grounded-api-usage
description: Grounds code and technical claims about libraries, SDKs, and APIs in the exact installed version's source, type definitions, and changelog, and labels each claim VERIFIED, DOCUMENTED, or UNVERIFIED with file:line or versioned-doc citations. Use when the user says "make sure this API actually exists", "check the real signature", "you keep hallucinating methods", "this worked in the docs but not in my project", "what does this function actually default to", "Claude keeps using the old API", or "cite where you got that".
---

# Source-Grounded API Usage: Verify Before You Code

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →