Skip to content

huangjia2019/claude-code-engineering / 04-Skills/projects/05-api-generator

api-generating

Unverified

Generate 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.

FileKindSize
EXAMPLES.mdmarkdown2.7 KB
PATTERNS.mdmarkdown1.6 KB
README.mdmarkdown2.2 KB
SKILL.mdskill md1.5 KB
STANDARDS.mdmarkdown1.7 KB
scripts/detect_routes.pyexecutablescript3.4 KB
scripts/validate_openapi.shexecutablescript2.2 KB
templates/endpoint.mdmarkdown873 B
templates/index.mdmarkdown881 B
templates/openapi.yamlconfig1.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
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: 463kUpdated Claude CodeCodexVerifiedInstall
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: 195kUpdated Claude CodeCodexVerifiedInstall
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: 195kUpdated Claude CodeCodexUnverifiedInstall
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: 195kUpdated Claude CodeCodexVerifiedInstall