E

Efficient Create Handler

Streamline your workflow with this create, product, requirements, document. Includes structured workflows, validation checks, and reusable patterns for project management.

CommandClipticsproject managementv1.0.0MIT
0 views0 copies

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

ConceptDescription
Multi-Layer CoordinationCreates database, backend, API, and frontend artifacts as one atomic unit
Schema-First DesignDefines the data model first, then derives all other layers from it
Type ConsistencyEnsures TypeScript types, database schemas, and API contracts match exactly
Dependency OrderingCreates artifacts in the order required by their dependencies
Contract GenerationOptionally 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

ParameterDescriptionDefaultExampleRequired
$ARGUMENTSEntity or feature to create with scopenone"Product entity with CRUD"Yes
layersWhich layers to generateall detected"backend,database"No
schema_formatData model format to use as source of truthauto-detect"zod", "prisma", "typeorm"No
api_contractGenerate API contract filefalse"openapi", "graphql"No
include_seedGenerate database seed datafalsetrueNo

Best Practices

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

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

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

  4. Verify type consistency manually -- While the handler checks for consistency, review that TypeScript interfaces, database columns, and API response shapes actually match your requirements.

  5. Generate seed data for development -- Enable include_seed: true to 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.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates