api-mock-generator
Derive API mocks and contract tests from schemas or observed interfaces without inventing behavior.
- License 许可
- MIT
- 最近更新
- 2026-11-09
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- api-mock-generator
- risk
- low
- source
- openclawskills.net
- aliases
- [ "api", "mock", "test", "contract", "openapi", "swagger" ]
- enabled
- true
- version
- 1.0.0
- category
- media_and_utilities
- keywords
- [ "api", "mock", "test", "openapi", "swagger", "rest", "contract" ]
- metadata
- { "openclaw": { "requires": { "env": [], "bins": [] }, "primaryEnv": null } }
- triggers
- [ "Generate API mocks", "Create mock API", "API testing", "Mock endpoints" ]
- description
- Derive API mocks and contract tests from schemas or observed interfaces without inventing behavior.
- required_tools
- [ "test-framework" ]
03 SKILL.md 正文
API Mock & Contract Generator
Purpose
Generate API mocks and contract tests from OpenAPI schemas or observed interfaces. The skill ensures mocks accurately reflect the API contract without inventing behavior beyond the specification.
When to Use
- Setting up local development environments
- Writing contract tests
- Mocking external APIs for testing
- Generating API documentation examples
When NOT to Use
- For production API implementations
- When a real API is available and accessible
- For security testing (use specialized tools)
Capabilities
- OpenAPI/Swagger schema parsing
- JSON Schema to mock conversion
- Request/response example generation
- Contract test skeleton generation
- Mock server configuration
- Multi-format support (REST, GraphQL)
- Header and authentication simulation
Inputs
source(required) — OpenAPI file, JSON Schema, or HAR fileformat(optional) — mock-server, contract-tests, examplesframework(optional) — jest, pytest, etc.base_url(optional) — for mock server
Workflow
- Parse — Load and analyze schema
- Generate — Create mocks from definitions
- Validate — Ensure mocks match schema
- Package — Generate config files and tests
- Document — Provide usage instructions
Tools
- OpenAPI parsers
- Mock server tools (Prism, Prism, Mockoon)
- Test framework integration
Examples
User: "Generate mocks from this OpenAPI spec" Response:
Parsing openapi.yaml...
Found 15 endpoints, 45 schemas
Generated:
- mock-server.js (Prism mock server)
- contracts.test.js (Jest contract tests)
- examples.json (request/response examples)
Run: npx prism mock openapi.yaml
Safety
- Never mock sensitive data
- Clearly label generated code as mocks
- Don't use mocks in place of real integration tests
- Validate mocks against schema
Source
Auto-generated from openclawskills.net description.
Pairs Well With
testing(integration with test suite)frontend-design(frontend API development)db-inspector(backend data structures)
04 同仓库更多 Skills
oath
Auditing regulatory compliance (SOC2/PCI-DSS/HIPAA/ISO 27001): maps requirements, checks controls, designs audit trails, implements Policy as Code. Use when compliance auditing is needed.
nexus
Orchestrating multi-specialist task chains and scope-adaptive product delivery: classifies intent, selects and executes the minimum viable chain, aggregates results, and verifies acceptance criteria. For multi-domain tasks, build-first delivery, and product lifecycle execution.
nest
Designing LLM-optimized folder structures: audits and restructures directories for context efficiency, progressive disclosure, and prompt cache performance. Not for general repo structure (Grove).
native
Implementing production iOS/Android/macOS native features (SwiftUI, Compose) and iterating a screen against a reference design. Not for cross-platform RN/Flutter (Port) or web (Artisan).
muse
Defining and managing design tokens, applying token systems to existing codebases, building design system foundations. Use for spacing, color, typography, dark mode, cross-platform output.
morph
Converting document formats (Markdown/Word/Excel/PDF/HTML) and generating reusable conversion scripts. Use for distributable specs, accessibility-compliant PDFs, or Pandoc/LibreOffice pipelines.