huangjia2019/claude-code-engineering / 04-Skills/projects/05-api-generator
api-generating
UnverifiedGenerate API endpoint code and documentation from specifications. Use when the user wants to create new API endpoints, generate route handlers, scaffold REST APIs, or produce OpenAPI/Swagger specs from code.
| File | Kind | Size |
|---|---|---|
| EXAMPLES.md | markdown | 2.7 KB |
| PATTERNS.md | markdown | 1.6 KB |
| README.md | markdown | 2.2 KB |
| SKILL.md | skill md | 1.5 KB |
| STANDARDS.md | markdown | 1.7 KB |
| scripts/detect_routes.pyexecutable | script | 3.4 KB |
| scripts/validate_openapi.shexecutable | script | 2.2 KB |
| templates/endpoint.md | markdown | 873 B |
| templates/index.md | markdown | 881 B |
| templates/openapi.yaml | config | 1.6 KB |
scripts/validate_openapi.sh
View on GitHub#!/bin/bash
#
# OpenAPI Specification Validator
#
# Usage:
# ./validate_openapi.sh <spec_file>
#
# Validates an OpenAPI 3.0 specification file using spectral or openapi-generator-cli
# if available, otherwise performs basic YAML validation.
#
set -e
SPEC_FILE="$1"
if [ -z "$SPEC_FILE" ]; then
echo "Usage: $0 <spec_file>"
exit 1
fi
if [ ! -f "$SPEC_FILE" ]; then
echo "Error: File not found: $SPEC_FILE"
exit 1
fi
echo "Validating OpenAPI spec: $SPEC_FILE"
echo "================================"
# Try spectral first (most comprehensive)
if command -v spectral &> /dev/null; then
echo "Using Spectral for validation..."
spectral lint "$SPEC_FILE"
exit $?
fi
# Try openapi-generator-cli
if command -v openapi-generator-cli &> /dev/null; then
echo "Using openapi-generator-cli for validation..."
openapi-generator-cli validate -i "$SPEC_FILE"
exit $?
fi
# Try swagger-cli
if command -v swagger-cli &> /dev/null; then
echo "Using swagger-cli for validation..."
swagger-cli validate "$SPEC_FILE"
exit $?
fi
# Fallback to basic YAML validation with Python
if command -v python3 &> /dev/null; then
echo "Using Python for basic YAML validation..."
python3 -c "
import yaml
import sys
try:
with open('$SPEC_FILE', 'r') as f:
spec = yaml.safe_load(f)
# Basic structure checks
required_fields = ['openapi', 'info', 'paths']
missing = [f for f in required_fields if f not in spec]
if missing:
print(f'Error: Missing required fields: {missing}')
sys.exit(1)
if not spec['openapi'].startswith('3.'):
print(f'Warning: OpenAPI version {spec[\"openapi\"]} may not be 3.x')
print(f'Basic validation passed!')
print(f' - OpenAPI version: {spec[\"openapi\"]}')
print(f' - API title: {spec[\"info\"].get(\"title\", \"N/A\")}')
print(f' - Paths defined: {len(spec[\"paths\"])}')
except yaml.YAMLError as e:
print(f'YAML parsing error: {e}')
sys.exit(1)
except Exception as e:
print(f'Validation error: {e}')
sys.exit(1)
"
exit $?
fi
echo "Warning: No validation tool found."
echo "Install one of: spectral, openapi-generator-cli, swagger-cli, or python3 with pyyaml"
exit 1
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: 463k | 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: 195k | 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: 195k | 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: 195k | Updated | Claude CodeCodex | Verified | Install |