api-examples
БесплатноБез исполняемых скриптовНе проверенGenerate API usage examples and tutorials from code analysis
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
API Examples & Tutorial Generator
I'll analyze your API and generate comprehensive usage examples, code snippets, and tutorials for developers.
Arguments: $ARGUMENTS - specific API focus or language (e.g., "REST", "GraphQL", "python", "javascript")
Strategic Planning Process
API Analysis
- What type of API? (REST, GraphQL, gRPC, WebSocket)
- What endpoints/operations exist?
- What's the authentication method?
- What are common use cases?
- What error handling is needed?
Audience Consideration
- Who are the API consumers? (internal, external, partners)
- What languages do they use?
- What's their experience level?
- What examples will be most valuable?
Example Types
- Quick start / Getting started
- Authentication examples
- CRUD operation examples
- Complex workflow examples
- Error handling patterns
- Best practices and anti-patterns
Format & Organization
- Code snippets for common operations
- Complete working examples
- Interactive tutorials
- SDK usage examples
- cURL/HTTP examples for testing
Token Optimization
Status: ✅ Fully Optimized (Phase 2 Batch 4B, 2026-01-27)
Target: 65-80% reduction (3,500-5,000 → 900-1,500 tokens)
Core Strategy: Cache-Based Example Generation
Generate API usage examples efficiently by reusing cached API schemas and pre-built templates instead of analyzing implementation code.
Optimization Impact:
- Before: 3,500-5,000 tokens (full API analysis + schema reading + example generation)
- After: 900-1,500 tokens (cache lookup + template rendering + targeted examples)
- Savings: 65-80% reduction
1. Cached API Schema (75% savings)
Pattern: Reuse OpenAPI/GraphQL schema from /api-validate, /api-docs-generate cache
# Instead of analyzing route files (HIGH COST):
# Read: src/routes/*.js (2,000+ tokens)
# Read: src/controllers/*.js (2,000+ tokens)
# Analyze request/response schemas (1,000+ tokens)
# Use cached schema (LOW COST):
cat .claude/cache/api/api_schema.json # 200 tokens
Cache Structure:
{
"schema_version": "1.0",
"api_type": "REST",
"framework": "express",
"base_url": "/api/v1",
"endpoints": [
{
"path": "/users",
"methods": ["GET", "POST"],
"auth_required": true,
"request_schema": {...},
"response_schema": {...}
}
],
"auth_methods": ["Bearer", "API Key"],
"last_updated": "2026-01-27T10:00:00Z"
}
Implementation:
# Check cache first
if [ -f .claude/cache/api/api_schema.json ]; then
echo "✓ Using cached API schema"
ENDPOINTS=$(jq -r '.endpoints[] | "\(.methods[]) \(.path)"' .claude/cache/api/api_schema.json)
AUTH_TYPE=$(jq -r '.auth_methods[0]' .claude/cache/api/api_schema.json)
else
echo "⚠ Cache miss - suggest running /api-validate first"
# Fallback to minimal discovery
fi
Savings: 2,000-3,000 tokens avoided per invocation
2. Template-Based Examples (70% savings)
Pattern: Use pre-built language templates instead of generating from scratch
# Instead of generating examples from scratch (HIGH COST):
# Analyze endpoint parameters (500+ tokens)
# Generate JavaScript example (400+ tokens)
# Generate Python example (400+ tokens)
# Generate cURL example (300+ tokens)
# Use cached templates (LOW COST):
cat .claude/cache/api/example_templates.json # 150 tokens
# Fill in endpoint-specific data (100 tokens)
Template Cache:
{
"templates": {
"rest_get_js": "async function get{Resource}(id) {\n const response = await fetch(`${API_BASE}/{resource}/${id}`, {\n headers: { 'Authorization': 'Bearer {token}' }\n });\n return response.json();\n}",
"rest_post_js": "async function create{Resource}(data) {\n const response = await fetch(`${API_BASE}/{resource}`, {\n method: 'POST',\n headers: { 'Authorization': 'Bearer {token}', 'Content-Type': 'application/json' },\n body: JSON.stringify(data)\n });\n return response.json();\n}",
"rest_get_py": "def get_{resource}(id):\n response = requests.get(f'{API_BASE}/{resource}/{id}', headers={'Authorization': f'Bearer {token}'})\n response.raise_for_status()\n return response.json()",
"graphql_query_js": "const {QUERY_NAME} = gql`\n query {QueryName}($id: ID!) {\n {resource}(id: $id) {\n {fields}\n }\n }\n`;"
},
"languages": ["javascript", "python", "curl", "typescript"],
"patterns": ["CRUD", "authentication", "pagination", "error_handling"]
}
Implementation:
# Generate examples from templates
ENDPOINT="/users"
METHOD="GET"
RESOURCE="User"
# Lookup and fill template
TEMPLATE=$(jq -r '.templates.rest_get_js' .claude/cache/api/example_templates.json)
echo "$TEMPLATE" | sed "s/{Resource}/$RESOURCE/g" | sed "s|{resource}|${ENDPOINT#/}|g"
Savings: 1,000-1,500 tokens per language set
3. Grep for Endpoints (8
Установить api-examples в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-examples?
Generate API usage examples and tutorials from code analysis
Как установить скилл api-examples?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-examples запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic