api-examples
Generate API usage examples and tutorials from code analysis
npx skills add majiayu000/claude-skill-registry --skill api-examples --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Analyzes an API and produces usage examples, code snippets, and tutorials for developers. Accepts ARGUMENTS to specify API focus or language (e.g., “REST”, “GraphQL”, “python”, “javascript”).
How it works
- Uses a cache-based workflow to minimize analysis: checks for a cached API schema at .claude/cache/api/api_schema.json and loads endpoints, auth methods, and base URL from it. If cache is stale or missing, it suggests running /api-validate and may fall back to minimal discovery.
- Loads pre-built language templates from .claude/cache/api/example_templates.json and fills them with endpoint-specific data (e.g., resource names, paths, tokens) to render concrete examples.
- Performs pattern-based endpoint discovery via grep-like methods (rg) to identify routes without full implementation reads when cache is available.
- Supports language-specific generation by honoring ARGUMENTS as the target language; detects primary language from project files (package.json, requirements.txt, go.mod) and restricts output accordingly.
- Provides progressive examples: starts with a quick start and can expand to advanced topics if requested (e.g., error handling, pagination, authentication).
- Integrates with a shared cache structure under .claude/cache/api/ and references other skills like /api-validate and /api-docs-generate for caching and schema sharing.
When to use it
Use when you need ready-to-run API usage examples and tutorials tailored to a specific language or API focus, and you want to leverage cached data for faster generation. Particularly beneficial after initial schema caching via /api-validate and when you want language-restricted outputs.
What it can touch
- Files and paths: .claude/cache/api/, including api_schema.json and example_templates.json
- Commands and scripts: sample shell blocks that reference cat, jq, rg, and standard shell constructs
- It references and integrates with tools/skills like /api-validate and /api-docs-generate for caching and schema sharing
Caveats
- Depends on presence and freshness of cached API schema and templates; stale or missing cache reduces effectiveness and may trigger fallback behavior.
- Output is constrained to facts present in the skill’s own cache and templates; does not speculate beyond that data.
- License mentioned is MIT for the skill; no further licensing constraints are stated within the provided content.
# 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 <think> Effective API examples require understanding: 1. **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? 2. **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? 3. **Example Types** - Quick start / Getting started - Authentication examples - CRUD operation examples - Complex workflow examples - Error handling patterns - Best practices and anti-patterns 4. **Format & Organization** - Code snippets for common operations - Complete working examples - Interactive tutorials - SDK usage examples - cURL/HTTP examples for testing </think> ## Token Optimization **Status:** ✅ Fully Optimized (Phase 2 Batch 4B, 2026-01-27) **Targ
- Strategic Planning Process
- Token Optimization
- Core Strategy: Cache-Based Example Generation
- 1. Cached API Schema (75% savings)
- 2. Template-Based Examples (70% savings)
- 3. Grep for Endpoints (80% savings)
- 4. Language-Specific Templates (75% savings)
- 5. Progressive Examples (60% savings)
- Cache Structure & Integration
- Optimization Workflow
- Performance Metrics
- Best Practices
- Integration Examples
- Phase 1: API Discovery
Instead of analyzing route files (HIGH COST): Analyze request/response schemas (1,000+ tokens) Use cached schema (LOW COST): cat .claude/cache/api/api_schema.json # 200 tokens Check cache first if [ -f .claude/cache/api/api_schema.json ]; then echo "✓ Using cached API schema" else echo "⚠ Cache miss - suggest running /api-validate first" fi
What does the api-examples skill do?
Generate API usage examples and tutorials from code analysis
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill api-examples --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
