Efficient Create Handler
Streamline your workflow with this create, product, requirements, document. Includes structured workflows, validation checks, and reusable patterns for project management.
Efficient Create Handler
Handle complex creation workflows that involve multiple interconnected files, database schemas, API contracts, and infrastructure definitions as a coordinated unit.
When to Use This Command
Run this command when...
- You need to create a complete feature slice spanning database, API, and frontend layers simultaneously
- A new domain entity requires schema, migrations, models, services, controllers, and tests created together
- You want to ensure all created artifacts are consistent with each other (types match across layers)
- The creation involves infrastructure definitions like Terraform, CloudFormation, or Kubernetes manifests
- You need to generate an API contract (OpenAPI spec) alongside the implementation code
Quick Start
# .claude/commands/efficient-create-handler.md --- name: Efficient Create Handler description: Create complex multi-layer features as coordinated units command: true --- Create with full coordination: $ARGUMENTS 1. Parse the creation request and identify all required layers 2. Design the data model and API contract first 3. Generate all artifacts in dependency order 4. Ensure type consistency across all layers 5. Wire everything together and verify
# Invoke the command claude "/efficient-create-handler Product entity with CRUD API and admin UI" # Expected output # > Planning creation for Product entity... # > Layers identified: # > Database: products table, migration, seed data # > Backend: Product model, service, controller, routes # > API: OpenAPI spec for /api/products endpoints # > Frontend: ProductList, ProductForm, ProductDetail components # > Tests: Unit (service), Integration (API), Component (UI) # > Creating in dependency order... # > 1. Migration: create_products_table (id, name, price, sku, timestamps) # > 2. Model: Product.ts with Zod schema validation # > 3. Service: ProductService with CRUD operations # > 4. Controller: ProductController with request handling # > 5. Routes: /api/products (GET, POST, PUT, DELETE) # > 6. Components: ProductList, ProductForm, ProductDetail # > 7. Tests: 24 test cases across all layers # > Type consistency verified across all 14 files # > Creation complete: 14 files created, 3 files modified
Core Concepts
| Concept | Description |
|---|---|
| Multi-Layer Coordination | Creates database, backend, API, and frontend artifacts as one atomic unit |
| Schema-First Design | Defines the data model first, then derives all other layers from it |
| Type Consistency | Ensures TypeScript types, database schemas, and API contracts match exactly |
| Dependency Ordering | Creates artifacts in the order required by their dependencies |
| Contract Generation | Optionally generates OpenAPI, GraphQL, or protobuf definitions alongside code |
Creation Dependency Order
==========================
[Data Model] --> [Migration] --> [ORM Model]
| |
v v
[API Contract] [Service Layer]
| |
v v
[Frontend Types] [Controller Layer]
| |
v v
[UI Components] [Route Wiring]
| |
+----------+-------------------+
|
[Test Suite]
Unit + Integration + E2E
Configuration
| Parameter | Description | Default | Example | Required |
|---|---|---|---|---|
$ARGUMENTS | Entity or feature to create with scope | none | "Product entity with CRUD" | Yes |
layers | Which layers to generate | all detected | "backend,database" | No |
schema_format | Data model format to use as source of truth | auto-detect | "zod", "prisma", "typeorm" | No |
api_contract | Generate API contract file | false | "openapi", "graphql" | No |
include_seed | Generate database seed data | false | true | No |
Best Practices
-
Define the data model clearly in your arguments -- Mention key fields and relationships: "Product entity with name, price, SKU, belongs to Category." This helps the handler generate accurate schemas.
-
Start with fewer layers and expand -- Create the database and backend first, verify correctness, then add frontend layers. This prevents debugging issues across too many files simultaneously.
-
Use schema-first design -- Let the migration and model definition drive the service, controller, and component code. Changes to the schema propagate automatically to derived layers.
-
Verify type consistency manually -- While the handler checks for consistency, review that TypeScript interfaces, database columns, and API response shapes actually match your requirements.
-
Generate seed data for development -- Enable
include_seed: trueto create sample data that makes the new feature immediately testable in the development environment.
Common Issues
Type mismatch between layers: Despite automated consistency checks, edge cases like nullable fields or enum mappings can diverge between database and TypeScript types. Review generated type definitions carefully.
Migration ordering conflicts: In teams with active development, a new migration may conflict with others created simultaneously. Coordinate migration creation to avoid sequence conflicts.
Frontend components assume API structure: Generated UI components are tightly coupled to the API contract. If the API changes later, components need updates too.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.