api-spec-writer
Skill0 starsChanged 5 months agoMITView on GitHub
Design complete API contracts in OpenAPI 3.0/3.1 YAML with endpoints, schemas, security, pagination, error handling, and RFC 7807 problem details. Use when asking to design an API, create an OpenAPI spec, define API endpoints, write API contracts, or generate a Swagger specification.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- najunho04/harness-blueprint-plugintheir own version, first seen Aug 23, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- najunho04/harness-blueprint-plugin★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository28 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- 4r-code-reviewSkill
- acceptance-criteria-generatorSkill
- compliance-guardSkill
- context-engineerSkill
- decision-record-writerSkill
- documentation-architectSkill
- frontend-spec-writerSkill
- gherkin-feature-writerSkill
- judgeSkill
- observability-designerSkill
- prd-writerSkill
- prompt-engineerSkill
- prp-writerSkill
- release-plannerSkill
- reviewerSkill
- risk-assessorSkill
- solution-architectSkill
- spec-architectSkill
- spec-writerSkill
- story-refinerSkill
- task-breakdownSkill
- technical-plannerSkill
- togaf-writerSkill
- traceability-managerSkill
- validation-strategistSkill
- workflow-designerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
31 rules. About 0 are common, 18 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈18
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Use this skill to act as an API Architect and Contract Designer expert.
- Distinctive: line 34
Use this skill when the user asks to:
- Distinctive: line 37
Write an OpenAPI (Swagger) 3.0 or 3.1 specification for an existing or planned API.
- Distinctive: line 39
Add pagination, filtering, sorting, rate limiting, or idempotency to list endpoints.
- Distinctive: line 45
Do not use this skill for source-code implementation, database schema design, network topology, or product strategy.
- Distinctive: line 49
Strict RESTful semantics: Use HTTP methods correctly: GET (read, safe, idempotent), POST (create), PUT (full replace), PATCH (partial …
- Distinctive: line 50
Strong typing everywhere: Every request and response field must have a type, format, and optionality declaration.
- Distinctive: line 51
Standard error responses always: Use RFC 7807 Problem Details for all error payloads.
- Distinctive: line 52
Pagination on all list endpoints: Every endpoint that returns a collection must include cursor-based or offset-based pagination parameters.
- Very specific: line 56
Schema reuse via components: All reusable schemas, parameters, responses, and security schemes must be defined in components/ and …
- Distinctive: line 57
Request and response examples: Every operation must include at least one worked example for the success case and one for each major error …
- Very specific: line 58
OpenAPI validity check: Before presenting the YAML block, verify that the produced OpenAPI document is structurally valid: openapi version …
- Distinctive: line 64
Use that reference when you need detailed examples.
- Distinctive: line 68
Put pagination, idempotency, security, and versioning rules in the contract explicitly.
- Distinctive: line 69
Prefer backward-compatible schema evolution and named reusable responses.
- Distinctive: line 70
Treat examples as contract evidence, not decorative documentation.
- Very specific: line 95
Use required arrays to declare mandatory fields.
- Very specific: line 96
Add readOnly: true for fields that are returned but never accepted as input.
- Very specific: line 104
Use the standard Error and ValidationError schemas from components/schemas/.
- Very specific: line 110
Verify every $ref resolves to a defined component.
- Very specific: line 111
Ensure every operation has operationId that is unique within the spec.
- Distinctive: line 112
Add examples for all major request and response payloads.
- Very specific: line 118
Check that openapi field is set to a valid version string.
- Very specific: line 119
Verify that every path parameter appears in the operation's parameter list with in: path.
- Very specific: line 120
Verify that every required parameter is marked required: true.
- Very specific: line 121
Verify that every content object has a media type key (e.g., application/json).
- Distinctive: line 126
Use this two-part format for every response:
- Distinctive: line 209
Before presenting the result, verify:
- Distinctive: line 229
User provides a vague requirement: Create a baseline API with the most common REST patterns and flag explicit decisions as open questions.
- Very specific: line 230
Conflicting HTTP semantics: If the user requests a non-REST pattern (e.g., GET /deleteUser), explain why REST prohibits it and propose the …
- Very specific: line 231
Polymorphic schemas too complex: Use oneOf without discriminator for fewer than 3 variants.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Contract and Specification Designer
Purpose
Use this skill to act as an API Architect and Contract Designer expert. The agent transforms functional requirements, domain models, architecture decisions, or integration specifications into complete, valid, and testable API contracts written in OpenAPI 3.0/3.1 YAML format.
The agent produces human-readable endpoint documentation alongside machine-valid OpenAPI specifications that can be imported directly into API clients, code generators, testing tools, and documentation platforms.
This skill is domain-generic. It must work for any REST API, internal microservice, external-facing product API, partner integration, or webhook interface without embedding project-specific assumptions.
When to Use
Use this skill when the user asks to:
- Design a complete or partial REST API from requirements, domain models, or integration needs.
- Write an OpenAPI (Swagger) 3.0 or 3.1 specification for an existing or planned API.
- Define endpoints, resource models, authentication schemes, and error responses for an API.
- Add pagination, filtering, sorting, rate limiting, or idempotency to list endpoints.
- Validate or improve an existing OpenAPI specification.
- Generate a machine-readable API contract that downstream tools can consume.
- Produce API documentation with request/response examples ready for developer consumption.
- Define webhook events, callback interfaces, or subscription models.
Do not use this skill for source-code implementation, database schema design, network topology, or product strategy. Keep the output at API contract and specification level.
Core Operating Rules
- Strict RESTful semantics. Use HTTP methods correctly: GET (read, safe, idempotent), POST (create), PUT (full replace), PATCH (partial update), DELETE (remove, idempotent). Use plural nouns for resource paths:
/users,/orders/123/items, not/getUseror/userById. - Strong typing everywhere. Every request and response field must have a type, format, and optionality declaration. No fields should be described as "arbitrary JSON" unless intentionally polymorphic.
- Standard error responses always. Use RFC 7807 Problem Details for all error payloads. Define consistent error schemas across all endpoints.
- Pagination on all list endpoints. Every endpoint that returns a collection must include cursor-based or offset-based pagination parameters.
- Idempotency declared. Any endpoint that creates, updates, or deletes state must declare whether it is idempotent and document the idempotency key mechanism if applicable.
- Security is first-class. Define authentication and authorization at both global and operation levels. Use OAuth2, JWT Bearer, or API Key as appropriate.
- Versioning from day one. Include a version prefix in the base URL (
/api/v1/) and define a deprecation policy. - Schema reuse via components. All reusable schemas, parameters, responses, and security schemes must be defined in
components/and referenced by$ref, not duplicated inline. - Request and response examples. Every operation must include at least one worked example for the success case and one for each major error case.
- OpenAPI validity check. Before presenting the YAML block, verify that the produced OpenAPI document is structurally valid:
openapiversion field is present, every$refresolves, and all required fields for paths and schemas are present.
Detailed API Design Reference
The full reusable reference for OpenAPI structure, HTTP status standards, RFC 7807 error payloads, pagination patterns, idempotency, security schemes, schema reuse, versioning, and rate-limiting guidance lives in references/openapi-design-reference.md.
Use that reference when you need detailed examples. In the main skill body, enforce these condensed rules:
- Reuse schemas through
componentsinstead of duplicating inline structures. - Standardize all error payloads using RFC 7807 Problem Details.
- Put pagination, idempotency, security, and versioning rules in the contract explicitly.
- Prefer backward-compatible schema evolution and named reusable responses.
- Treat examples as contract evidence, not decorative documentation.
Execution Workflow
Phase 1: Intake and Scope Definition
- Identify the API's purpose, target consumers, and authentication model.
- Extract resources, operations, and domain rules from the input (requirements, spec document, domain model, or architecture artifact).
- Determine whether the user needs a full API spec or specific endpoints only.
- Identify which endpoints require pagination, idempotency, and webhooks.
- List assumptions, missing information, and design choices that need clarification.
Phase 2: Resource and Endpoint Modeling
- Identify all resources and sub-resources.
- Map each resource to CRUD operations using correct HTTP methods.
- Design resource paths using plural nouns and nested relations only when the relation is truly intrinsic.
- Define which endpoints are public, authenticated, or require specific scopes.
- Mark idempotent operations clearly.
Phase 3: Schema Design
- Define data models for all request bodies and response payloads.
- Extract shared schemas into
components/schemas/with$refreuse. - Apply strong typing: string (with format), integer, number, boolean, array, object.
- Use
requiredarrays to declare mandatory fields. - Add
readOnly: truefor fields that are returned but never accepted as input. - Apply pattern constraints, min/max length, minimum/maximum values where applicable.
- Design polymorphic schemas using
oneOf/anyOfwith discriminators.
Phase 4: Response and Error Definition
- Define the success response schema per operation.
- Define error response schemas for all applicable HTTP status codes.
- Use the standard
ErrorandValidationErrorschemas fromcomponents/schemas/. - Include response headers where relevant (Location, RateLimit, Pagination-Cursor).
Phase 5: OpenAPI YAML Generation
- Assemble the complete OpenAPI document following the standard structure.
- Verify every
$refresolves to a defined component. - Ensure every operation has
operationIdthat is unique within the spec. - Add examples for all major request and response payloads.
- Apply
tagsto group endpoints by resource for documentation clarity. - Include server entries for all environments (development, staging, production).
Phase 6: Quality Verification
- Check that
openapifield is set to a valid version string. - Verify that every path parameter appears in the operation's parameter list with
in: path. - Verify that every required parameter is marked
required: true. - Verify that every
contentobject has a media type key (e.g.,application/json). - Confirm all security schemes referenced in
securityare defined incomponents/securitySchemes.
Required Output Structure
Use this two-part format for every response:
Part 1: Human-Readable API Summary
# API Contract: <API Name>
## 1. API Overview
- **Purpose:** <What problem this API solves>
- **Base URL:** `/api/v1/`
- **Auth:** <Auth type> — <Bearer JWT / OAuth2 / API Key>
- **Version:** `1.0.0` — <Deprecation policy if any>
## 2. Resources
| Resource | Description | Path |
| --- | --- | --- |
## 3. Endpoint Index
| Method | Path | Description | Auth | Idempotent |
| --- | --- | --- | --- | --- |
| GET | /resource | List | Yes | Yes |
| POST | /resource | Create | Yes | No |
## 4. Global Rules
- Pagination: <cursor / offset> with default limit
- Rate limit: <N> req/min per API key
- Error format: RFC 7807 Problem Details
- Versioning: URL path (/api/v1/, /api/v2/)Part 2: Per-Endpoint Detail
### `GET /resource/{id}`
**Description:** Retrieve a specific resource by its identifier.
**Parameters:**
| Name | Location | Type | Required | Description |
| --- | --- | --- | --- | --- |
**Responses:**
- `200 OK` — Returns the requested resource
- `404 Not Found` — Resource does not exist
- `401 Unauthorized` — Missing or invalid token
**Example response (200):**
```json
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Sample Resource",
"created_at": "2025-01-15T09:30:00Z"
}
### Part 3: OpenAPI YAML Block
```yaml
openapi: 3.1.0
info:
title: <API Name>
version: 1.0.0
description: |
<API purpose and usage notes.>
contact:
name: <Team>
url: https://...
license:
name: Apache-2.0
servers:
- url: https://api.example.com/api/v1
description: Production
paths:
...
components:
schemas:
securitySchemes:
security:
- BearerAuth: []Quality Checklist
Before presenting the result, verify:
- All HTTP methods are used semantically correctly (GET is safe and idempotent, DELETE is idempotent, etc.).
- Every schema field has a declared type, and required fields are explicitly listed.
- Every list endpoint includes pagination parameters and a pagination response wrapper.
- Every mutation endpoint (POST/PUT/PATCH/DELETE) has a defined error response for each applicable status code.
- The error schema follows RFC 7807 / Problem Details format.
- Authentication is declared globally and overridden only where it differs per operation.
- All
$refvalues resolve to a defined component. - Every operation has a unique
operationId. - Examples are provided for all major request and response payloads.
- The spec is written in English.
- No internal implementation details (database table names, internal service names) appear in paths or schema field names.
Present Results to User
Lead with the Human-Readable API Summary so the user can immediately understand the API shape. Present the endpoint index as a table for quick scanning. Present the OpenAPI YAML block after the human-readable sections — this is the machine-readable deliverable that can be copied directly into tools. Highlight any design decisions that required tradeoffs (e.g., cursor vs. offset pagination, OAuth2 vs. API Key, versioning approach).
Troubleshooting
- User provides a vague requirement: Create a baseline API with the most common REST patterns and flag explicit decisions as open questions.
- Conflicting HTTP semantics: If the user requests a non-REST pattern (e.g.,
GET /deleteUser), explain why REST prohibits it and propose the RESTful equivalent. - Polymorphic schemas too complex: Use
oneOfwithout discriminator for fewer than 3 variants; add discriminator only when runtime type detection is needed. - Too many endpoints: The API scope may be too broad — suggest grouping related resources and delivering a phased spec.
- User wants JSON Schema instead of OpenAPI: Clarify that OpenAPI is the standard for API contracts and can embed JSON Schema; produce OpenAPI but note that the schemas can be extracted as standalone JSON Schema.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

