jeremylongshore/tons-of-skills-marketplace / plugins/api-development/api-documentation-generator/skills/generating-api-docs
generating-api-docs
VerifiedCreate comprehensive API documentation with examples, authentication guides, and SDKs. Use when creating comprehensive API documentation. Trigger with phrases like "generate API docs", "create API documentation", or "document the API".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.4 KB |
| references/errors.md | markdown | 1.0 KB |
| references/examples.md | markdown | 4.3 KB |
| references/implementation.md | markdown | 1.5 KB |
references/examples.md
View on GitHub# API Documentation Generation Examples
## Redoc Configuration
```yaml
# docs/config/redoc.yaml
openapi: ./openapi.yaml
output: ./docs/site/index.html
options:
theme:
colors:
primary:
main: '#1a73e8'
typography:
fontFamily: 'Inter, sans-serif'
sidebar:
backgroundColor: '#1e1e2e'
hideDownloadButton: false
expandResponses: '200,201'
requiredPropsFirst: true
pathInMiddlePanel: true
```
## Multi-Language Code Example Generator
```javascript
// docs/examples/generate-examples.js
function generateExamples(method, path, headers, body) {
const url = `https://api.example.com${path}`;
return {
curl: generateCurl(method, url, headers, body),
javascript: generateJS(method, url, headers, body),
python: generatePython(method, url, headers, body),
};
}
function generateCurl(method, url, headers, body) {
let cmd = `curl -X ${method} "${url}"`;
for (const [k, v] of Object.entries(headers)) {
cmd += `\n -H "${k}: ${v}"`;
}
if (body) cmd += `\n -d '${JSON.stringify(body, null, 2)}'`;
return cmd;
}
function generateJS(method, url, headers, body) {
return `const response = await fetch("${url}", {
method: "${method}",
headers: ${JSON.stringify(headers, null, 4)},${body ? `
body: JSON.stringify(${JSON.stringify(body, null, 4)}),` : ''}
});
const data = await response.json();`;
}
function generatePython(method, url, headers, body) {
return `import httpx
response = httpx.${method.toLowerCase()}("${url}",
headers=${JSON.stringify(headers)},${body ? `
json=${JSON.stringify(body)},` : ''})
data = response.json()`;
}
```
## Generated Code Example Output
```bash
# curl
curl -X POST "https://api.example.com/users" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Alice Smith", "email": "alice@example.com"}'
```
```javascript
// JavaScript (fetch)
const response = await fetch("https://api.example.com/users", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ name: "Alice Smith", email: "alice@example.com" }),
});
const user = await response.json();
// { "id": "usr_abc123", "name": "Alice Smith", ... }
```
```python
# Python (httpx)
import httpx
response = httpx.post("https://api.example.com/users",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"name": "Alice Smith", "email": "alice@example.com"})
user = response.json()
```
## Authentication Guide Template
```markdown
## API Key Authentication
Include your key in the X-API-Key header:
curl https://api.example.com/users -H "X-API-Key: sk_live_abc123..."
## OAuth 2.0 Bearer Token
1. Obtain a token:
curl -X POST https://auth.example.com/oauth/token \
-d "grant_type=client_credentials&client_id=ID&client_secret=SECRET"
2. Use the token:
curl https://api.example.com/users -H "Authorization: Bearer eyJhbG..."
```
## Error Reference Table
```markdown
| Status | Code | Description | Resolution |
|--------|------|-------------|------------|
| 400 | VALIDATION_ERROR | Invalid fields | Check errors array |
| 401 | TOKEN_EXPIRED | Token expired | Refresh or re-auth |
| 403 | INSUFFICIENT_SCOPE | Missing scope | Request more scopes |
| 404 | RESOURCE_NOT_FOUND | ID not found | Verify resource ID |
| 429 | RATE_LIMITED | Too many requests | Wait Retry-After seconds |
```
## CI Documentation Deployment
```yaml
# .github/workflows/docs.yml
name: Deploy API Docs
on:
push:
paths: ['openapi.yaml']
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx @redocly/cli lint openapi.yaml
- run: npx @redocly/cli build-docs openapi.yaml -o docs/site/index.html
- run: node docs/examples/generate-examples.js
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/site
```
## Versioned Documentation
```javascript
const versions = ['v1', 'v2'];
for (const version of versions) {
execSync(
`npx @redocly/cli build-docs specs/openapi-${version}.yaml ` +
`-o docs/site/${version}/index.html`
);
}
```
---
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |