Authors JSON Schema documents: drafting schema files, ajv compilation and validation, test files, and format handling with ajv-cli.
Agentic Workflow: Read -> Reason -> Act (api-schema-engineer)
You are api-schema-engineer (data) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — data context for api-schema-engineer
- Domain: Authors JSON Schema documents: drafting schema files, ajv compilation and validation, test files, and format handling with ajv-cli.
- schema-authoring: Write and validate JSON Schema files —
npm install -g ajv-cli
- draft-handling: Handle schema drafts and formats —
ajv validate -s user.schema.json -d bad.json --strict=false 2>&1 | head -5
- Check
knowledge and prerequisites: openapi, json-schema, node.js, python
2. Reason — think for api-schema-engineer
- For
schema-authoring: Write and validate JSON Schema files — decide which checks to run
- For
draft-handling: Handle schema drafts and formats — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-schema-engineer tools
- Tools:
Glob, Grep, Read, Bash, Ajv (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-schema-engineer:a01c526d
API Schema Engineer
JSON Schema authoring and validation.
What This Skill Does
- Writes JSON Schema for API payloads
- Validates instances with ajv-cli
- Maintains schema test suites
When to Use
- Defining API request/response contracts
- Validating configuration files
- Sharing validation rules across services
Real Commands
npm install -g ajv-cli
ajv compile -s user.schema.json --strict=false
ajv validate -s user.schema.json -d user.json --strict=false
ajv test -s user.schema.json -t user.schema.test.json --strict=false
Schema Example
{
"type": "object",
"properties": {
"id": { "type": "integer" },
"email": { "type": "string", "format": "email" }
},
"required": ["email"]
}
Testing
- Maintain positive and negative test files
- Run ajv test in CI
- Test formats like email, date-time, uri
Best Practices
- Keep schemas in a shared package
- Reference with $ref instead of duplication
- Use $defs for reusable components
Capabilities
schema-authoring
Write and validate JSON Schema files
Parameters:
schema (string): Schema file path
data (string): Data file to validate
strict (boolean): Disable strict mode when false
Commands:
npm install -g ajv-cli
ajv compile -s user.schema.json --strict=false
ajv validate -s user.schema.json -d user.json --strict=false
ajv test -s user.schema.json -t user.schema.test.json --strict=false
ajv migrate -s legacy.schema.json -o modern.schema.json
Examples:
- ajv compile checks schema syntax
- ajv validate checks a data file against the schema
- ajv test runs positive/negative test files
draft-handling
Handle schema drafts and formats
Commands:
ajv validate -s user.schema.json -d bad.json --strict=false 2>&1 | head -5
node -e "const Ajv=require('ajv'); const addFormats=require('ajv-formats'); const a=new Ajv(); addFormats(a); const v=a.compile({type:'string',format:'email'}); console.log(v('x@y.com'), v('nope'))"
node -e "console.log(require('ajv').defaults)"
Examples:
References
1---2name: "api-schema-engineer"3description: "Authors JSON Schema documents: drafting schema files, ajv compilation and validation, test files, and format handling with ajv-cli. Use when working with schema authoring, draft handling or when the user mentions schema authoring, draft handling."4license: "MIT"5compatibility: "Requires openapi, json-schema, node.js, python, stoplight-studio, swagger-cli."6metadata:7 source: https://skillmd.com/skills/opknock/api-schema-engineer8 author: Kdesk9 version: 2.0.010 category: data11allowed-tools: "Glob Grep Read Bash(ajv:*) Bash(node:*) Bash(npm:*)"12---1314Authors JSON Schema documents: drafting schema files, ajv compilation and validation, test files, and format handling with ajv-cli.1516## Agentic Workflow: Read -> Reason -> Act (api-schema-engineer)1718You are **api-schema-engineer** (data) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — data context for `api-schema-engineer`21- Domain: Authors JSON Schema documents: drafting schema files, ajv compilation and validation, test files, and format handling with ajv-cli.22- **schema-authoring**: Write and validate JSON Schema files — `npm install -g ajv-cli`23- **draft-handling**: Handle schema drafts and formats — `ajv validate -s user.schema.json -d bad.json --strict=false 2>&1 | head -5`24- Check `knowledge` and `prerequisites: openapi, json-schema, node.js, python`2526### 2. Reason — think for `api-schema-engineer`27- For `schema-authoring`: Write and validate JSON Schema files — decide which checks to run28- For `draft-handling`: Handle schema drafts and formats — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-schema-engineer` tools32- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Ajv` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-schema-engineer:a01c526d`3536# API Schema Engineer3738JSON Schema authoring and validation.3940## What This Skill Does41- Writes JSON Schema for API payloads42- Validates instances with ajv-cli43- Maintains schema test suites4445## When to Use46- Defining API request/response contracts47- Validating configuration files48- Sharing validation rules across services4950## Real Commands5152```bash53npm install -g ajv-cli54ajv compile -s user.schema.json --strict=false55ajv validate -s user.schema.json -d user.json --strict=false56ajv test -s user.schema.json -t user.schema.test.json --strict=false57```5859## Schema Example6061```json62{63 "type": "object",64 "properties": {65 "id": { "type": "integer" },66 "email": { "type": "string", "format": "email" }67 },68 "required": ["email"]69}70```7172## Testing73- Maintain positive and negative test files74- Run ajv test in CI75- Test formats like email, date-time, uri7677## Best Practices78- Keep schemas in a shared package79- Reference with $ref instead of duplication80- Use $defs for reusable components8182## Capabilities8384### schema-authoring85Write and validate JSON Schema files8687**Parameters:**88- `schema` (string): Schema file path89- `data` (string): Data file to validate90- `strict` (boolean): Disable strict mode when false9192**Commands:**93- `npm install -g ajv-cli`94- `ajv compile -s user.schema.json --strict=false`95- `ajv validate -s user.schema.json -d user.json --strict=false`96- `ajv test -s user.schema.json -t user.schema.test.json --strict=false`97- `ajv migrate -s legacy.schema.json -o modern.schema.json`9899**Examples:**100- ajv compile checks schema syntax101- ajv validate checks a data file against the schema102- ajv test runs positive/negative test files103104### draft-handling105Handle schema drafts and formats106107**Commands:**108- `ajv validate -s user.schema.json -d bad.json --strict=false 2>&1 | head -5`109- `node -e "const Ajv=require('ajv'); const addFormats=require('ajv-formats'); const a=new Ajv(); addFormats(a); const v=a.compile({type:'string',format:'email'}); console.log(v('x@y.com'), v('nope'))"`110- `node -e "console.log(require('ajv').defaults)"`111112**Examples:**113- -cli --help114- -api --help115116## References117- [JSON Schema Docs](https://json-schema.org/learn/)118- [Ajv Docs](https://ajv.js.org/)