_                              _    ____ _                 _
| |    __ _ _ __ __ ___   _____| |  / ___| | __ _ _   _  __| | ___
| |   / _` | '__/ _` \ \ / / _ \ | | |   | |/ _` | | | |/ _` |/ _ \
| |__| (_| | | | (_| |\ V /  __/ | | |___| | (_| | |_| | (_| |  __/
|_____\__,_|_|  \__,_| \_/ \___|_|  \____|_|\__,_|\__,_|\__,_|\___|
                          _____ ___   ___  _     _  _____ _____
                         |_   _/ _ \ / _ \| |   | |/ /_ _|_   _|
                           | || | | | | | | |   | ' / | |  | |
                           | || |_| | |_| | |___| . \ | |  | |
                           |_| \___/ \___/|_____|_|\_\___| |_|
                    

$ whoami

Laravel starter kit for AI-assisted modular development

# WHY THIS TOOLKIT?

$ cat problem.txt

Laravel projects grow into tangled monoliths where adding features becomes risky and testing becomes painful.

$ cat solution.txt

Structured patterns (DDD, Hexagonal) + AI guardrails that enforce consistency and guide architectural decisions.

Testable | Maintainable | Scalable | AI-Guided
# QUICK START
$ gh repo create my-app --template Chemaclass/laravel-claude-toolkit --public --clone
$ cd my-app && composer setup
$ APP_PORT=8085 VITE_PORT=5174 ./vendor/bin/sail up -d
PHP 8.4 Laravel 12 SQLite Tailwind CSS 4 Sail
# QUALITY TOOLING
TOOL DESCRIPTION
PHPStan (max level) Static analysis with Larastan
Run:
composer phpstan
Features:
- Level max (strictest analysis) - Laravel-aware via Larastan - Catches type errors before runtime - Analyzes modules/ directory
Rector Automated refactoring & upgrades
Run:
composer rector # dry-run
composer rector:fix # apply changes
Features:
- Auto-upgrade PHP syntax - Dead code removal - Code quality improvements - Consistent coding patterns
Pint Laravel code style fixer
Run:
composer lint # check style
composer fix # auto-fix
Features:
- Laravel coding standards - PSR-12 compliant - Automatic formatting - Zero configuration needed
PHPUnit Testing framework
Run:
./vendor/bin/sail test
Features:
- Unit, Integration & Feature tests - Parallel test execution - Code coverage reports - Laravel testing helpers
Git Hooks Pre-commit quality gates
Auto-configured:
composer setup # enables hooks
Pre-commit runs:
- Pint (code style check) - PHPStan (static analysis) - Blocks commits if checks fail
# CLAUDE CODE AGENTS
AGENT PURPOSE
domain-architect DDD & hexagonal architecture guidance
You ask:
"How should I structure the Order module?"
Agent helps with:
- Entity design (Order, OrderLine, OrderId) - Value objects (Money, Quantity, Address) - Repository interface placement - Module boundaries & dependencies
tdd-coach Red-green-refactor workflow coaching
You ask:
"Help me TDD a discount calculator"
Agent guides you through:
1. RED: Write failing test for 10% discount 2. GREEN: Implement minimum code to pass 3. REFACTOR: Extract discount strategy pattern 4. Repeat for edge cases (max discount, stacking)
clean-code-reviewer SOLID principles & code smell detection
You ask:
"Review my OrderService class"
Agent identifies:
- SRP violation: Split payment logic to PaymentService - DIP violation: Depend on interface, not Eloquent model - Long method: Extract validateOrder() helper - Missing null check on optional discount
security-reviewer OWASP Top 10 & Laravel security analysis
You ask:
"Review security of the auth module"
Agent checks:
- Hardcoded secrets detection - SQL injection vulnerabilities - XSS prevention (Blade escaping) - CSRF protection & rate limiting
# CLAUDE CODE COMMANDS
COMMAND GENERATES
/create-module Full module structure with all layers
Input:
/create-module Order
Creates:
modules/Order/Domain/{Entity,ValueObject,Repository,Exception}/
modules/Order/Application/{Command,Query}/
modules/Order/Infrastructure/{Http,Persistence,Provider}/
/create-entity Domain entity + value objects + test
Input:
/create-entity Order Order
Creates:
modules/Order/Domain/Entity/Order.php
modules/Order/Domain/Entity/OrderId.php
tests/Unit/Order/Domain/Entity/OrderTest.php
/create-value-object Immutable value object + validation + test
Input:
/create-value-object Order Money
Creates:
modules/Order/Domain/ValueObject/Money.php
modules/Order/Domain/Exception/InvalidMoney.php
tests/Unit/Order/Domain/ValueObject/MoneyTest.php
/create-repository Interface + Eloquent + InMemory impls
Input:
/create-repository Order Order
Creates:
modules/Order/Domain/Repository/OrderRepository.php
modules/Order/Infrastructure/Persistence/Eloquent/OrderEloquentRepository.php
modules/Order/Infrastructure/Persistence/InMemory/OrderInMemoryRepository.php
/create-use-case Command/Query DTO + Handler + test
Input:
/create-use-case Order Command CreateOrder
Creates:
modules/Order/Application/Command/CreateOrder.php
modules/Order/Application/Command/CreateOrderHandler.php
tests/Unit/Order/Application/Command/CreateOrderHandlerTest.php
/create-controller Thin controller + request + resource
Input:
/create-controller Order Order
Creates:
modules/Order/Infrastructure/Http/Controller/OrderController.php
modules/Order/Infrastructure/Http/Request/CreateOrderRequest.php
modules/Order/Infrastructure/Http/Resource/OrderResource.php
/tdd-cycle Interactive red-green-refactor guide
Input:
/tdd-cycle
Guides you through:
Phase 1: RED - Write a failing test first Phase 2: GREEN - Write minimal code to pass Phase 3: REFACTOR - Improve while tests pass Then loops back to RED for next behavior
/refactor-check SOLID violations & improvement report
Input:
/refactor-check modules/Order/
Reports:
- Classes with too many dependencies - Methods exceeding complexity threshold - Missing interface abstractions - Suggested refactoring patterns
/code-review Code quality & architecture compliance
Input:
/code-review modules/Order/
Checks:
- Architecture layer compliance - Naming conventions & code quality - Test coverage for changes - Security best practices
/security-review Security analysis with OWASP checks
Input:
/security-review modules/User/
Analyzes:
- Dependency vulnerabilities (composer audit) - Hardcoded secrets & credentials - Input validation & SQL injection - Authentication & authorization
# CLAUDE CODE SKILLS
SKILL PROVIDES
create-entity Domain entity scaffolding templates
Skill provides:
- final readonly class pattern - Private constructor + static factory - Invariant validation in create() - Identity value object (EntityId)
create-repository Repository pattern implementations
Skill provides:
- Interface in Domain layer - Eloquent implementation for production - InMemory implementation for tests - Service provider bindings
create-use-case CQRS handler templates & best practices
Skill provides:
- Command/Query DTO with readonly props - Handler with __invoke() method - Repository injection pattern - Unit test with InMemory repository
create-controller HTTP layer scaffolding
Skill provides:
- Thin controller (validate, dispatch, respond) - Form Request for validation rules - API Resource for transformation - Route registration example
tdd-cycle Test-driven development workflow
Skill provides:
- RED: Test naming conventions - GREEN: Minimal implementation tips - REFACTOR: When & how to refactor - Test isolation best practices
refactor-check Code quality analysis rules
Skill analyzes:
- Single Responsibility violations - Dependency Inversion issues - Method complexity metrics - Coupling between modules
# ARCHITECTURE

modules/{Module}/

├── Domain/ # Pure PHP entities & value objects

├── Application/ # Command/Query handlers (CQRS)

└── Infrastructure/ # Laravel adapters & HTTP layer

Modular Monolith | Hexagonal | DDD | TDD | SOLID

Connect