API Designer — API Design, Documentation, Mocking, and Testing Pipeline
An agent team collaborates to generate API design, schema, documentation, and mock/tests in a single pass.
Execution Mode
Agent Team — 5 members communicate directly via SendMessage and cross-validate each other's work.
Agent Composition
| Agent |
File |
Role |
Type |
| api-architect |
.claude/agents/api-architect.md |
Resource modeling, endpoints, versioning |
general-purpose |
| schema-validator |
.claude/agents/schema-validator.md |
OpenAPI/GraphQL schema, type validation |
general-purpose |
| doc-writer |
.claude/agents/doc-writer.md |
Developer documentation, examples, error references |
general-purpose |
| mock-tester |
.claude/agents/mock-tester.md |
Mock server, integration tests, load scenarios |
general-purpose |
| review-auditor |
.claude/agents/review-auditor.md |
Security, consistency, performance, alignment validation |
general-purpose |
Workflow
Phase 1: Preparation (Performed directly by the orchestrator)
- Extract from user input:
- Domain: What service is the API for
- Paradigm: REST / GraphQL / Hybrid
- Key Resources: List of core entities
- Authentication Method (optional): OAuth, JWT, API Key
- Existing Files (optional): Existing schemas, documentation, code, etc.
- Create the
_workspace/ directory at the project root
- Organize the input and save to
_workspace/00_input.md
- If existing files are provided, copy them to
_workspace/ and skip the corresponding phase
- Determine the execution mode based on the scope of the request
Phase 2: Team Assembly and Execution
| Order |
Task |
Owner |
Dependencies |
Artifact |
| 1 |
API Design |
api-architect |
None |
_workspace/01_api_design.md |
| 2 |
Schema Generation & Validation |
schema-validator |
Task 1 |
_workspace/02_schema.yaml, 02_schema_validation.md |
| 3a |
API Documentation |
doc-writer |
Tasks 1, 2 |
_workspace/03_api_docs.md |
| 3b |
Mock Server & Tests |
mock-tester |
Tasks 1, 2 |
_workspace/04_mock_tests.md |
| 4 |
API Review |
review-auditor |
Tasks 2, 3a, 3b |
_workspace/05_review_report.md |
Tasks 3a (documentation) and 3b (tests) are executed in parallel.
Inter-team communication flow:
- api-architect completes -> Delivers resource model to schema-validator, endpoints to doc-writer, request/response examples to mock-tester
- schema-validator completes -> Delivers schema to doc-writer, schema-based examples to mock-tester
- doc-writer <-> mock-tester: Mutually verify that documentation examples and mock responses match
- review-auditor cross-validates all artifacts. When 🔴 must-fix issues are found, requests revisions from the relevant agent -> rework -> re-verify (up to 2 rounds)
Phase 3: Integration and Final Artifacts
Organize the final artifacts based on the review report:
- Verify all files in
_workspace/
- Confirm that all 🔴 must-fix items from the review report have been addressed
- Report the final summary to the user
Mode by Task Scale
| User Request Pattern |
Execution Mode |
Agents Deployed |
| "Design an API", "full design" |
Full Pipeline |
All 5 agents |
| "Just write API docs" (existing API) |
Documentation Mode |
doc-writer + review-auditor |
| "Validate this OpenAPI schema" |
Validation Mode |
schema-validator + review-auditor |
| "Design API tests" (existing schema) |
Test Mode |
mock-tester + review-auditor |
| "Review this API design" |
Review Mode |
review-auditor only |
Leveraging existing files: If the user provides schemas, documentation, or other existing files, skip the corresponding steps.
Data Transfer Protocol
| Strategy |
Method |
Purpose |
| File-based |
_workspace/ directory |
Store and share primary artifacts |
| Message-based |
SendMessage |
Real-time delivery of key information, revision requests |
| Task-based |
TaskCreate/TaskUpdate |
Progress tracking, dependency management |
File naming convention: {order}_{agent}_{artifact}.{extension}
Error Handling
| Error Type |
Strategy |
| Insufficient domain information |
API architect starts with generic CRUD resources; designs an extensible structure |
| REST vs GraphQL undecided |
Default to REST; present GraphQL extension options in an appendix |
| Agent failure |
Retry once -> If still fails, proceed without that artifact; note the omission in the review report |
| 🔴 found during review |
Request revision from the relevant agent -> rework -> re-verify (up to 2 rounds) |
| Existing schema parsing failure |
Manually extract endpoints and proceed |
Test Scenarios
Normal Flow
Prompt: "Design a REST API for an e-commerce platform. I need product, order, user, and cart resources"
Expected Result:
- API Design: 4 resources, CRUD endpoints, relationship modeling, authentication design
- Schema: OpenAPI 3.1 YAML, all model type definitions
- Documentation: Quick start + endpoint reference + error codes
- Tests: Per-resource CRUD tests + authentication tests + load scenarios
- Review: All items in the alignment matrix verified
Existing File Flow
Prompt: "Create API docs and tests from this OpenAPI schema" + schema file
Expected Result:
- Copy existing schema to
_workspace/02_schema.yaml
- Merged documentation + test mode: deploy doc-writer + mock-tester + review-auditor
- Skip api-architect and schema-validator
Error Flow
Prompt: "Design an API quickly, blog platform"
Expected Result:
- Insufficient domain information -> api-architect infers standard blog resources (Post, Comment, User, Tag)
- Execute in full pipeline mode
- Review report notes "design based on inferred domain requirements"
Agent Extension Skills
Extension skills that enhance each agent's domain expertise:
| Skill |
Target Agent |
Role |
rest-api-conventions |
api-architect |
URL naming, HTTP status codes, pagination, versioning |
api-error-design |
doc-writer, mock-tester |
Error code systems, error response structures, retry/fallback strategies |
1---2name: api-designer3description: Full pipeline for REST/GraphQL API design, documentation, mocking, and testing. An agent team collaborates to perform API architecture design, OpenAPI/GraphQL schema generation, developer documentation writing, and mock server and test design. Use this skill for any API design task including 'design an API', 'REST API', 'GraphQL API', 'API documentation', 'API schema', 'OpenAPI', 'Swagger', 'API testing', 'API mocking', 'endpoint design', etc. Also supports documentation and testing for existing APIs. Note: actual server implementation (Express, FastAPI, etc.), API Gateway deployment, and monitoring dashboard setup are outside the scope of this skill.4---56# API Designer — API Design, Documentation, Mocking, and Testing Pipeline78An agent team collaborates to generate API design, schema, documentation, and mock/tests in a single pass.910## Execution Mode1112**Agent Team** — 5 members communicate directly via SendMessage and cross-validate each other's work.1314## Agent Composition1516| Agent | File | Role | Type |17|-------|------|------|------|18| api-architect | `.claude/agents/api-architect.md` | Resource modeling, endpoints, versioning | general-purpose |19| schema-validator | `.claude/agents/schema-validator.md` | OpenAPI/GraphQL schema, type validation | general-purpose |20| doc-writer | `.claude/agents/doc-writer.md` | Developer documentation, examples, error references | general-purpose |21| mock-tester | `.claude/agents/mock-tester.md` | Mock server, integration tests, load scenarios | general-purpose |22| review-auditor | `.claude/agents/review-auditor.md` | Security, consistency, performance, alignment validation | general-purpose |2324## Workflow2526### Phase 1: Preparation (Performed directly by the orchestrator)27281. Extract from user input:29 - **Domain**: What service is the API for30 - **Paradigm**: REST / GraphQL / Hybrid31 - **Key Resources**: List of core entities32 - **Authentication Method** (optional): OAuth, JWT, API Key33 - **Existing Files** (optional): Existing schemas, documentation, code, etc.342. Create the `_workspace/` directory at the project root353. Organize the input and save to `_workspace/00_input.md`364. If existing files are provided, copy them to `_workspace/` and skip the corresponding phase375. Determine the **execution mode** based on the scope of the request3839### Phase 2: Team Assembly and Execution4041| Order | Task | Owner | Dependencies | Artifact |42|-------|------|-------|-------------|----------|43| 1 | API Design | api-architect | None | `_workspace/01_api_design.md` |44| 2 | Schema Generation & Validation | schema-validator | Task 1 | `_workspace/02_schema.yaml`, `02_schema_validation.md` |45| 3a | API Documentation | doc-writer | Tasks 1, 2 | `_workspace/03_api_docs.md` |46| 3b | Mock Server & Tests | mock-tester | Tasks 1, 2 | `_workspace/04_mock_tests.md` |47| 4 | API Review | review-auditor | Tasks 2, 3a, 3b | `_workspace/05_review_report.md` |4849Tasks 3a (documentation) and 3b (tests) are **executed in parallel**.5051**Inter-team communication flow:**52- api-architect completes -> Delivers resource model to schema-validator, endpoints to doc-writer, request/response examples to mock-tester53- schema-validator completes -> Delivers schema to doc-writer, schema-based examples to mock-tester54- doc-writer <-> mock-tester: Mutually verify that documentation examples and mock responses match55- review-auditor cross-validates all artifacts. When 🔴 must-fix issues are found, requests revisions from the relevant agent -> rework -> re-verify (up to 2 rounds)5657### Phase 3: Integration and Final Artifacts5859Organize the final artifacts based on the review report:60611. Verify all files in `_workspace/`622. Confirm that all 🔴 must-fix items from the review report have been addressed633. Report the final summary to the user6465## Mode by Task Scale6667| User Request Pattern | Execution Mode | Agents Deployed |68|---------------------|----------------|-----------------|69| "Design an API", "full design" | **Full Pipeline** | All 5 agents |70| "Just write API docs" (existing API) | **Documentation Mode** | doc-writer + review-auditor |71| "Validate this OpenAPI schema" | **Validation Mode** | schema-validator + review-auditor |72| "Design API tests" (existing schema) | **Test Mode** | mock-tester + review-auditor |73| "Review this API design" | **Review Mode** | review-auditor only |7475**Leveraging existing files**: If the user provides schemas, documentation, or other existing files, skip the corresponding steps.7677## Data Transfer Protocol7879| Strategy | Method | Purpose |80|----------|--------|---------|81| File-based | `_workspace/` directory | Store and share primary artifacts |82| Message-based | SendMessage | Real-time delivery of key information, revision requests |83| Task-based | TaskCreate/TaskUpdate | Progress tracking, dependency management |8485File naming convention: `{order}_{agent}_{artifact}.{extension}`8687## Error Handling8889| Error Type | Strategy |90|-----------|----------|91| Insufficient domain information | API architect starts with generic CRUD resources; designs an extensible structure |92| REST vs GraphQL undecided | Default to REST; present GraphQL extension options in an appendix |93| Agent failure | Retry once -> If still fails, proceed without that artifact; note the omission in the review report |94| 🔴 found during review | Request revision from the relevant agent -> rework -> re-verify (up to 2 rounds) |95| Existing schema parsing failure | Manually extract endpoints and proceed |9697## Test Scenarios9899### Normal Flow100**Prompt**: "Design a REST API for an e-commerce platform. I need product, order, user, and cart resources"101**Expected Result**:102- API Design: 4 resources, CRUD endpoints, relationship modeling, authentication design103- Schema: OpenAPI 3.1 YAML, all model type definitions104- Documentation: Quick start + endpoint reference + error codes105- Tests: Per-resource CRUD tests + authentication tests + load scenarios106- Review: All items in the alignment matrix verified107108### Existing File Flow109**Prompt**: "Create API docs and tests from this OpenAPI schema" + schema file110**Expected Result**:111- Copy existing schema to `_workspace/02_schema.yaml`112- Merged documentation + test mode: deploy doc-writer + mock-tester + review-auditor113- Skip api-architect and schema-validator114115### Error Flow116**Prompt**: "Design an API quickly, blog platform"117**Expected Result**:118- Insufficient domain information -> api-architect infers standard blog resources (Post, Comment, User, Tag)119- Execute in full pipeline mode120- Review report notes "design based on inferred domain requirements"121122## Agent Extension Skills123124Extension skills that enhance each agent's domain expertise:125126| Skill | Target Agent | Role |127|-------|-------------|------|128| `rest-api-conventions` | api-architect | URL naming, HTTP status codes, pagination, versioning |129| `api-error-design` | doc-writer, mock-tester | Error code systems, error response structures, retry/fallback strategies |