Sponsor Suno AI Music arrow_forward
Slash Command

Generate Rest Api

Generate production-ready RESTful APIs with best practices

Type
Slash Command
GitHub stars
2.8k
License
MIT
Repo last updated
Sep 27, 2026

What Generate Rest Api is

Generate Rest Api is a slash command published in the jeremylongshore/tons-of-skills-marketplace repository on GitHub, which has about 2.8k stars. The repository describes itself as: “Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com.”

A slash command is a reusable prompt saved as a markdown file and run by typing its name after a slash. In Claude Code, custom commands have been merged into skills: a file in .claude/commands/ and a skill folder in .claude/skills/ both create the same kind of command, and existing command files keep working.

Generate Rest Api gives you a repeatable way to run the same instructions without retyping them, optionally with arguments.

How to install Generate Rest Api

Claude Code

  1. Download generate-rest-api.md from the repository.
  2. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md.
  3. Run it by typing / followed by its name.

Claude Cowork

  1. Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it.
  2. In Customize → Skills, click +, then upload the ZIP.
  3. Run it from any task with / and the skill name.

New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.

Inside the source file

An excerpt from plugins/api-development/rest-api-generator/commands/generate-rest-api.md, shared under the repository's MIT license. Read the full file on GitHub.

Automatically generate comprehensive RESTful API implementations from schema definitions with proper routing, validation, error handling, authentication, pagination, and OpenAPI documentation following industry best practices.

When to Use This Command

Use /generate-rest-api when you need to:

  • Build CRUD APIs quickly with consistent patterns
  • Create microservices with RESTful interfaces
  • Generate APIs from database schemas or models
  • Implement standardized API patterns across projects
  • Support multiple client applications (web, mobile, IoT)
  • Build public APIs with comprehensive documentation

DON'T use this when:

  • Building real-time applications (consider WebSocket/gRPC)
  • Internal services need maximum performance (consider gRPC)
  • Complex event-driven architectures (consider event streaming)
  • GraphQL would better serve client needs

Design Decisions

This command implements OpenAPI-first design as the primary approach because:

  • Contract-first development ensures consistency
  • Auto-generates server stubs and client SDKs
  • Provides interactive API documentation
  • Enables API mocking during development
  • Supports multiple framework implementations
  • Industry-standard specification format

Alternative considered: Code-first with annotations

  • Faster initial development
  • Tighter coupling to implementation
  • Less portable across frameworks
  • Recommended for rapid prototyping

Alternative considered: GraphQL

  • More flexible client queries
  • Reduced over/under-fetching
  • Higher complexity
  • Recommended for complex client needs

Prerequisites

Before running this command:

  1. Define your data models and relationships
  2. Choose target framework (Express, FastAPI, NestJS, etc.)
  3. Select database technology
  4. Determine authentication requirements
  5. Plan API versioning strategy

Implementation Process

Step 1: Define OpenAPI Specification

Create comprehensive API contracts with schemas, endpoints, and examples.

Step 2: Generate Server Stubs

Build framework-specific implementations from OpenAPI specs.

Step 3: Implement Business Logic

Add controllers, services, and data access layers.

Step 4: Add Middleware

Configure authentication, validation, rate limiting, and CORS.

Step 5: Generate Documentation

Create interactive docs, client SDKs, and Postman collections.

Output Format

The command generates:

  • openapi.yaml - Complete API specification
  • src/controllers/ - Request handlers with business logic
  • src/routes/ - RESTful endpoint definitions
  • src/models/ - Data models and schemas
  • src/middleware/ - Auth, validation, rate limiting
  • src/services/ - Business logic layer
  • tests/ - Integration and unit tests
  • docs/ - API documentation and examples

Code Examples

Example 1: E-commerce API with Express.js and TypeScript

# openapi.yaml
openapi: 3.0.0
info:
  title: E-commerce API
  version: 1.0.0
  description: RESTful API for e-commerce platform

servers:
  - url: https://api.example.com/v1
    description: Production server
  - url: http://localhost:3000/v1
    description: Development server

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
…
// src/app.ts - Express application setup
import express, { Application } from 'express';
import helmet from 'helmet';
import cors from 'cors';
import compression from 'compression';
import morgan from 'morgan';
import swaggerUi from 'swagger-ui-express';
import { rateLimit } from 'express-rate-limit';
import { errorHandler } from './middleware/errorHandler';
import { notFoundHandler } from './middleware/notFoundHandler';
import { authMiddleware } from './middleware/auth';
import { validationMiddleware } from './middleware/validation';
import { productRouter } from './routes/products';
import { loadOpenAPISpec } from './utils/openapi';

export class App {
    public app: Application;
…

Example 2: FastAPI Implementation with Python

# main.py - FastAPI application
from fastapi import FastAPI, HTTPException, Query, Depends, status
from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.trustedhost import TrustedHostMiddleware
from fastapi.middleware.gzip import GZipMiddleware
from fastapi.responses import JSONResponse
from slowapi import Limiter, _rate_limit_exceeded_handler
from slowapi.util import get_remote_address
from slowapi.errors import RateLimitExceeded
from typing import Optional, List
from datetime import datetime
from pydantic import BaseModel, Field, validator
import uvicorn

# Create rate limiter
limiter = Limiter(key_func=get_remote_address)

# Create FastAPI app
…

Example 3: Integration Tests

// tests/products.test.js
const request = require('supertest');
const { app } = require('../src/app');
const { generateToken } = require('../src/utils/auth');

describe('Products API', () => {
    let authToken;
    let productId;

    beforeAll(async () => {
        // Generate auth token for protected routes
        authToken = await generateToken({ userId: 'test-user', role: 'admin' });
    });

    describe('GET /v1/products', () => {
        it('should return paginated products', async () => {
            const res = await request(app)
                .get('/v1/products')
…

Before you install

  • Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
  • Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
  • Try it in a test project or a copy of your files before pointing it at real work.
  • Pin the version you tested, and review changes before updating.
  • Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.

FAQ

What is Generate Rest Api?

Generate Rest Api is a slash command for Claude Code and Claude Cowork from the jeremylongshore/tons-of-skills-marketplace repository on GitHub. Generate production-ready RESTful APIs with best practices

How do I install Generate Rest Api in Claude Code?

Download generate-rest-api.md from the repository. Save it to ~/.claude/commands/ (all projects) or .claude/commands/ (one project). As a skill, you can instead save it as ~/.claude/skills/<name>/SKILL.md. Run it by typing / followed by its name.

Can I use Generate Rest Api in Claude Cowork?

Turn the command into a skill: create a folder with the file saved as SKILL.md and zip it. In Customize → Skills, click +, then upload the ZIP. Run it from any task with / and the skill name.

Is Generate Rest Api safe to install?

It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.

Similar resources

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.