P

Power Add Invoker

Powerful command for setup, comprehensive, application, performance. Includes structured workflows, validation checks, and reusable patterns for performance.

CommandClipticsperformancev1.0.0MIT
0 views0 copies

Power Add Invoker

Invoke intelligent addition of new code components, dependencies, configurations, or infrastructure elements into existing projects with automatic integration wiring.

When to Use This Command

Run this command when...

  • You need to add a new service, controller, model, or component that integrates with existing architecture
  • A new dependency or library needs to be installed and properly configured across the project
  • You want to add a new API endpoint with all required layers: route, controller, service, and tests
  • Infrastructure elements like database tables, queues, or cache configurations need to be added
  • You need to scaffold a new module following the exact patterns already established in the codebase

Quick Start

# .claude/commands/power-add-invoker.md --- name: Power Add Invoker description: Add new components with automatic integration and wiring command: true --- Add to project: $ARGUMENTS 1. Analyze what needs to be added and where it fits 2. Scan existing patterns for naming and structure conventions 3. Create the new element following project conventions 4. Wire it into existing infrastructure (routes, DI, config) 5. Generate corresponding tests
# Invoke the command claude "/power-add-invoker new PaymentService with Stripe integration" # Expected output # > Analyzing project structure... # > Detected patterns: layered architecture, repository pattern, Jest testing # > Creating: # > src/services/PaymentService.ts (service layer) # > src/controllers/PaymentController.ts (API layer) # > src/routes/payment.routes.ts (routing) # > src/repositories/PaymentRepository.ts (data layer) # > src/types/payment.ts (type definitions) # > Wiring: # > Added route registration in src/app.ts # > Added Stripe config to src/config/services.ts # > Tests: # > tests/services/PaymentService.test.ts (8 test cases) # > Addition complete: 5 files created, 2 files modified

Core Concepts

ConceptDescription
Pattern DetectionScans existing code to learn naming, structure, and architectural conventions
Full-Stack ScaffoldingCreates all layers needed for the addition: types, service, controller, routes, tests
Auto-WiringRegisters new components in routers, dependency injection containers, and config files
Convention MatchingNew code matches existing style: error handling, logging, response formatting
Integration TestingGenerates tests that verify the new component works within the existing system
Power Add Pipeline
===================

  What to Add --> Analyze Project --> Detect Patterns --> Scaffold
       |               |                  |                 |
  Parse request   Read structure     Learn naming      Create files
  Identify type   Map layers         conventions       per layer
  Find target     Find wiring pts    Match style       Follow patterns
                                                            |
                                          Test <-- Wire <---+
                                           |        |
                                      Generate   Register in
                                      test cases  routes, DI,
                                                  config

Configuration

ParameterDescriptionDefaultExampleRequired
$ARGUMENTSWhat to add with context and requirementsnone"new EmailService with SendGrid"Yes
layersWhich layers to generateall detected"service,controller"No
skip_testsSkip test file generationfalsetrueNo
wire_onlyOnly add wiring for an existing componentfalsetrueNo
template_sourceSpecific existing file to use as templateauto-detect"src/services/UserService.ts"No

Best Practices

  1. Name components explicitly -- "Add PaymentService" is better than "add payment handling." Clear names let the invoker scaffold files with correct naming from the start.

  2. Reference existing components as templates -- Use template_source to point at a well-structured existing service when you want the new addition to exactly match a specific pattern.

  3. Review auto-wiring changes -- The invoker modifies existing files to register new components. Review these modifications carefully, especially in route files and dependency injection containers.

  4. Add one component at a time -- Adding multiple unrelated services in a single invocation can lead to tangled wiring. Add sequentially and verify each integration before proceeding.

  5. Check for naming conflicts before adding -- If a PaymentService already exists, the invoker may overwrite or conflict. Search first to ensure the name is available.

Common Issues

Wrong pattern detected: In codebases with mixed architectures, the invoker may scaffold using patterns from a different module. Specify template_source to force the correct pattern.

Auto-wiring misses registration points: Some projects register routes or services in non-standard locations. If the new component is not accessible after creation, manually check the wiring entry points.

Generated tests use unavailable mocking strategy: The test generator follows detected testing patterns, but complex mocking setups may not be fully replicated. Review generated test files and adjust mock configurations as needed.

Community

Reviews

Write a review

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

Similar Templates