Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

api-endpoint-creator

FreeNo executable scriptsNot checked

Guides standardized REST API endpoint creation following team conventions. Use when creating new API endpoints.

diegosouzapwby diegosouzapw★ 68 GitHub stars

About this skill

Codify REST API design conventions and best practices for creating consistent, well-documented, and tested API endpoints. Ensure all endpoints follow the same patterns for authentication, error handling, validation, and documentation. Use this skill when:
  • Creating a new REST API endpoint
  • Adding routes to an existing API
  • Refactoring endpoints to follow team standards
  • Building CRUD operations for new resources
  • Extending API functionality

Do NOT use this skill when:

  • Building GraphQL APIs (use graphql-design skill)
  • Creating internal-only functions (not exposed via API)
  • Working on non-REST protocols (WebSocket, gRPC)

Before using this skill, ensure:

  • API framework is set up (Flask, FastAPI, Express, etc.)
  • Authentication system is in place
  • Database models are defined
  • OpenAPI/Swagger documentation structure exists
  • Testing framework is configured
Define Endpoint Specification

Plan the endpoint before implementation:

Endpoint Details:

# Endpoint specification template
method: POST
path: /api/v1/resources
description: Create a new resource
auth_required: true
rate_limit: 10 requests/minute
request_body:
  content_type: application/json
  schema:
    name: string (required, max 100 chars)
    description: string (optional, max 1000 chars)
    tags: array of strings (optional)
response:
  success: 201 Created
  errors: 400 Bad Request, 401 Unauthorized, 409 Conflict

URL Structure Conventions:

Follow REST principles:

  • /api/v1/resources - Collection endpoint (GET all, POST new)
  • /api/v1/resources/{id} - Item endpoint (GET, PUT, PATCH, DELETE)
  • /api/v1/resources/{id}/subresources - Nested resources
  • /api/v1/resources/actions - Special actions (e.g., /search, /bulk)

HTTP Methods:

  • GET - Retrieve resource(s), no side effects
  • POST - Create new resource
  • PUT - Replace entire resource
  • PATCH - Update partial resource
  • DELETE - Remove resource
Implement Request Handling

Create the endpoint with proper structure:

Python/Flask Example:

from flask import Blueprint, request, jsonify
from functools import wraps
from marshmallow import Schema, fields, ValidationError

# Define request schema
class CreateResourceSchema(Schema):
    name = fields.String(required=True, validate=lambda x: len(x) <= 100)
    description = fields.String(validate=lambda x: len(x) <= 1000)
    tags = fields.List(fields.String())

create_resource_schema = CreateResourceSchema()

@api_bp.route('/api/v1/resources', methods=['POST'])
@require_auth  # Authentication decorator
@rate_limit(max_requests=10, window=60)  # Rate limiting
def create_resource():
    """Create a new resource.

    Request body:
        {
            "name": "Resource name",
            "description": "Optional description",
            "tags": ["tag1", "tag2"]
        }

    Returns:
        201: Resource created successfully
        400: Invalid request data
        401: Authentication required
        409: Resource already exists
    """
    # 1. Parse and validate request
    try:
        data = create_resource_schema.load(request.get_json())
    except ValidationError as e:
        return jsonify({'error': 'Validation failed', 'details': e.messages}), 400

    # 2. Authorization check (can user create resources?)
    if not current_user.has_permission('create_resource'):
        return jsonify({'error': 'Permission denied'}), 403

    # 3. Business logic validation
    existing = Resource.query.filter_by(
        name=data['name'],
        user_id=current_user.id
    ).first()
    if existing:
        return jsonify({'error': 'Resource with this name already exists'}), 409

    # 4. Create resource
    try:
        resource = Resource(
            name=data['name'],
            description=data.get('description', ''),
            tags=data.get('tags', []),
            user_id=current_user.id,
            created_at=datetime.utcnow()
        )
        db.session.add(resource)
        db.session.commit()

        # 5. Return response
        return jsonify(resource.to_dict()), 201

    except Exception as e:
        db.session.rollback()
        logger.error(f"Failed to create resource: {e}")
        return jsonify({'error': 'Failed to create resource'}), 500

Node.js/Express Example:

const express = require('express');
const { body, validationResult } = require('express-validator');

router.post('/api/v1/resources',
    // Authentication middleware
    requireAuth,

    // Rate limiting middleware
    rateLimit({ max: 10, windowMs: 60000 }),

    // Validation middleware
    body('name').isString().isLength({ max: 100 }).notEmpty(),
    body('description').optional().isString().isLength({ max: 1000 }),
    body('tags').optional().isArray(),

    async (req, res) => {
        // 1. Check validation
        const error
Full SKILL.md on GitHub

Install api-endpoint-creator in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

metadata.json

FAQ

What does the api-endpoint-creator skill do?

Guides standardized REST API endpoint creation following team conventions. Use when creating new API endpoints.

How do I install the api-endpoint-creator skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the api-endpoint-creator skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare api-endpoint-creator with