Claude Skill

test-contract

Verify API schemas and contracts match expected format. Validate request/response structures. Use when testing APIs, before integration, or after schema changes.

LLM Mart · 0 points · 2 views 0 listing impressions 0 install-command copies
Download dhaupin-vant-models_public_vant_skills_vant-skill-test-contract-e1e348e.zip · 0 KB

Install

skills CLI npx skills add https://github.com/dhaupin/vant/tree/main/models/public/vant/skills/vant-skill-test-contract
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install dhaupin-vant@llmmart
Git git clone https://github.com/dhaupin/vant.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole dhaupin/vant collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Test Contract

API schema validation.

When To Use

  • API testing
  • Before integration
  • After schema changes

What To Test

1. Request Schema

const requestSchema = {
  type: 'object',
  required: ['email', 'password'],
  properties: {
    email: { type: 'string', format: 'email' },
    password: { type: 'string', minLength: 8 }
  }
}

2. Response Schema

const responseSchema = {
  type: 'object',
  required: ['id', 'email'],
  properties: {
    id: { type: 'string' },
    email: { type: 'string' }
  }
}

3. Validate

const Ajv = require('ajv')
const ajv = new Ajv()
const validate = ajv.compile(requestSchema)
const valid = validate(requestBody)

Tools

Tool Use
ajv JSON Schema validation
json-schema-validator Node validation
Swagger/OpenAPI API spec validation

Output

## Contract Tests

| Schema | Valid |
|--------|-------|
| Request | [PASS/FAIL] |
| Response | [PASS/FAIL] |

### Errors
- [n] violations

Role: Contract Tester Input: Schema + Data Output: Validation results

Files (vant)
  • SKILL.md 1.4 KB
    ---
    name: test-contract
    description: Verify API schemas and contracts match expected format. Validate request/response structures. Use when testing APIs, before integration, or after schema changes.
    license: MIT
    metadata:
      author: vant
      version: "1.0"
    ---
    
    # Test Contract
    
    > API schema validation.
    
    ## When To Use
    
    - API testing
    - Before integration
    - After schema changes
    
    ## What To Test
    
    ### 1. Request Schema
    
    ```javascript
    const requestSchema = {
      type: 'object',
      required: ['email', 'password'],
      properties: {
        email: { type: 'string', format: 'email' },
        password: { type: 'string', minLength: 8 }
      }
    }
    ```
    
    ### 2. Response Schema
    
    ```javascript
    const responseSchema = {
      type: 'object',
      required: ['id', 'email'],
      properties: {
        id: { type: 'string' },
        email: { type: 'string' }
      }
    }
    ```
    
    ### 3. Validate
    
    ```javascript
    const Ajv = require('ajv')
    const ajv = new Ajv()
    const validate = ajv.compile(requestSchema)
    const valid = validate(requestBody)
    ```
    
    ## Tools
    
    | Tool | Use |
    |------|-----|
    | ajv | JSON Schema validation |
    | json-schema-validator | Node validation |
    | Swagger/OpenAPI | API spec validation |
    
    ---
    
    ## Output
    
    ```
    ## Contract Tests
    
    | Schema | Valid |
    |--------|-------|
    | Request | [PASS/FAIL] |
    | Response | [PASS/FAIL] |
    
    ### Errors
    - [n] violations
    ```
    
    **Role**: Contract Tester **Input**: Schema + Data **Output**: Validation results

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.