Agent Workflowv1.0.0

REST API Generator

Agent workflow that generates a complete REST API with CRUD routes, validation, error handling, and OpenAPI docs from a Prisma schema.

by Thomas
Unrated
2 purchases0 reviews VerifiedVerified 3/6/2026
Free

Code is provided "as is". Review and test before production use. Terms

restapigeneratorcrudopenapiprismaexpressfastify
T

Built by Thomas

@thomas

14 listings
Unrated
Summary

A CLAUDE.md agent workflow template that instructs Claude Code to generate a complete REST API from a Prisma schema. Copy the CLAUDE.md into your project, run Claude Code, and it will scaffold Zod validation schemas, CRUD route handlers, pagination, OpenAPI spec, and tests. Includes a helper script that lists Prisma models.

Use Cases
  • Generate REST API routes from an existing Prisma schema using Claude Code
  • Scaffold Zod validation schemas for all Prisma models
  • Auto-detect framework (Next.js App Router, Express, or Fastify) and generate appropriate route handlers
  • Generate OpenAPI spec and integration tests alongside routes
Integration Steps

Step 1: Copy CLAUDE.md to your project root

cp CLAUDE.md /path/to/your/project/CLAUDE.md

Validation: CLAUDE.md should exist at your project root

Step 2: Ensure your project has a Prisma schema

Validation: prisma/schema.prisma should exist with model definitions

Step 3: Optionally run the helper script to see detected models

npx tsx scripts/generate.ts

Validation: Should print model names found in your schema

Step 4: Run Claude Code and ask it to generate the API

claude
# Then say: Generate a REST API for my Prisma schema

Validation: Claude Code reads CLAUDE.md and generates route files, schemas, tests

Anti-Patterns
  • This is NOT a programmatic library — do not try to import functions from it
  • Do not run scripts/generate.ts expecting it to generate code — it only lists models
  • Do not use without a Prisma schema file in your project
Limitations
  • Requires Claude Code or another AI coding agent that reads CLAUDE.md files
  • Only works with Prisma schemas — does not support other ORMs
  • The helper script (scripts/generate.ts) only lists models; it does not generate code
  • Quality of generated code depends on the AI agent following the CLAUDE.md instructions
AI Verification Report
Passed
Overall81%
Security95%
Code Quality65%
Documentation75%
Dependencies85%
3 files analyzed117 lines read14.3sVerified 3/6/2026

Findings (8)

  • -Documentation claims scripts/generate.ts is a 'helper script that lists Prisma models' and describes it as 'diagnostic tool', but the file header misleadingly says 'Standalone generator — parses Prisma schema and scaffolds API routes' which contradicts the actual implementation
  • -Integration step 3 validation claims 'Should print model names found in your schema' but the actual output is 'Found {count} models: {list}' without explicitly stating model names are from the Prisma schema
  • -scripts/generate.ts has no error handling for malformed Prisma schema — if regex fails to match models, it will silently report 0 models with no explanation
  • -Regex in scripts/generate.ts uses /^model (\w+) \{/gm which will fail to match model names with spaces after 'model' keyword or on lines that don't start with 'model' due to indentation
  • -CLAUDE.md Step 2 instructs checking for Next.js App Router by looking for 'app/' directory, but this is not a reliable detection method as many projects have an 'app' folder unrelated to Next.js
  • +3 more findings

Suggestions (7)

  • -Clarify in scripts/generate.ts header that this is a 'diagnostic tool to list Prisma models' not a code generator, to avoid user confusion
  • -Add validation to scripts/generate.ts to detect malformed Prisma schema and provide helpful error messages (e.g., if no models found, check for syntax errors)
  • -Improve regex in scripts/generate.ts to handle Prisma models with whitespace variations: /^\s*model\s+(\w+)\s*\{/gm
  • +4 more suggestions
Loading version history...
Loading reviews...