xiaohongshu
xiaohongshu
api-documentation
Use when API code changes (routes, endpoints, schemas). Enforces Swagger/OpenAPI sync. Pauses work if documentation has drifted, triggering documentation-audit skill.
Full skill instructions
Ensures all API changes are reflected in Swagger/OpenAPI documentation. When documentation drift is detected, work pauses until documentation is synchronized.
Core principle: API documentation is a first-class artifact, not an afterthought. No API change ships without documentation.
Announce at start: "I'm using api-documentation to verify Swagger/OpenAPI sync."
This skill is triggered when ANY of these file patterns are modified:
| Pattern | Framework | Trigger Reason |
|---|---|---|
**/routes/**/*.ts | Express/Fastify | Route definitions |
**/controllers/**/*.ts | NestJS/Express | Controller endpoints |
**/*.controller.ts | NestJS | Controller class |
**/api/**/*.py | FastAPI/Flask | API endpoints |
**/*_router.py | FastAPI | Router definitions |
**/handlers/**/*.go | Go | HTTP handlers |
**/schema*.ts | TypeScript | Schema definitions |
**/dto/**/*.ts | NestJS | Data transfer objects |
**/models/**/*.ts | Various | API models |
Check these locations for existing API documentation:
| File | Format | Standard |
|---|---|---|
openapi.yaml | YAML | OpenAPI 3.x |
openapi.json | JSON | OpenAPI 3.x |
swagger.yaml | YAML | Swagger 2.0 |
swagger.json | JSON | Swagger 2.0 |
docs/api.yaml | YAML | OpenAPI 3.x |
api/openapi.yaml | YAML | OpenAPI 3.x |
# Check if current changes affect API
API_CHANGED=false
# Check common API file patterns
for pattern in "routes/" "controllers/" "api/" "handlers/" "*.controller.ts" "*_router.py"; do
if git diff --name-only HEAD~1 | grep -q "$pattern"; then
API_CHANGED=true
break
fi
done
# Check for schema/DTO changes
if git diff --name-only HEAD~1 | grep -qE "(schema|dto|model)"; then
API_CHANGED=true
fi
echo "API Changed: $API_CHANGED"
find_api_docs() {
for file in openapi.yaml openapi.json swagger.yaml swagger.json \
docs/api.yaml docs/openapi.yaml api/openapi.yaml; do
if [ -f "$file" ]; then
echo "$file"
return 0
fi
done
return 1
}
DOC_FILE=$(find_api_docs)
if [ -z "$DOC_FILE" ]; then
echo "ERROR: No API documentation file found"
echo "PAUSE: Trigger documentation-audit skill"
fi
Compare API code with documentation:
verify_api_sync() {
local doc_file=$1
# Extract endpoints from code
CODE_ENDPOINTS=$(find . -name "*.ts" -path "*/routes/*" -exec grep -h "@(Get|Post|Put|Delete|Patch)" {} \; | \
sed 's/.*@\(Get\|Post\|Put\|Delete\|Patch\)(\([^)]*\)).*/\1 \2/' | sort -u)
# Extract endpoints from OpenAPI
DOC_ENDPOINTS=$(yq '.paths | keys[]' "$doc_file" 2>/dev/null | sort -u)
# Compare
MISSING=$(comm -23 <(echo "$CODE_ENDPOINTS" | sort) <(echo "$DOC_ENDPOINTS" | sort))
if [ -n "$MISSING" ]; then
echo "DRIFT DETECTED: Endpoints in code but not in docs:"
echo "$MISSING"
return 1
fi
return 0
}
If documentation drift is detected:
## API Documentation Drift Detected
**Status:** PAUSED
**Reason:** API documentation is out of sync with code
### Missing from Documentation
- `POST /api/users` (found in `routes/users.ts:45`)
- `GET /api/users/:id/profile` (found in `routes/users.ts:67`)
### Action Required
1. Invoke `documentation-audit` skill
2. Update Swagger/OpenAPI documentation
3. Resume current work after sync complete
---
*api-documentation skill paused work*
Then invoke documentation-audit:
Use Skill tool: documentation-audit
When updating API documentation, include:
| Field | Description |
|---|---|
summary | Short description of endpoint |
description | Detailed explanation |
parameters | All path/query/header params |
requestBody | Request schema with examples |
responses | All response codes with schemas |
tags | Grouping for organization |
security | Auth requirements |
Every endpoint must have:
/api/users:
post:
summary: Create a new user
description: |
Creates a new user account with the provided details.
Requires admin authentication.
tags:
- Users
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
example:
email: [email protected]
name: John Doe
role: member
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
example:
id: usr_123abc
email: [email protected]
name: John Doe
role: member
createdAt: '2025-01-02T10:30:00Z'
'400':
description: Invalid request body
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
code: VALIDATION_ERROR
message: Email is required
'401':
description: Authentication required
'403':
description: Insufficient permissions
After updating documentation, validate:
# Validate OpenAPI spec
npx @apidevtools/swagger-cli validate openapi.yaml
# Or with yq for basic structure check
yq 'has("openapi") and has("paths") and has("info")' openapi.yaml
Before resuming work:
This skill coordinates with:
| Skill | Purpose |
|---|---|
documentation-audit | Full documentation sync |
issue-driven-development | Triggered during implementation |
comprehensive-review | Validates documentation complete |
This skill can be skipped when:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience