domain-scaffolding
Skill0 starsChanged 6 months agoMITView on GitHub
Scaffolds a complete new domain from scratch with full CQRS structure (45+ files/touchpoints: entities, value objects, DTOs, ports, commands, queries, events, handlers, repository, controller, views, tests). Use when user requests to create a new domain/module/bounded context. References Cookie domain as template.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- pranataa-labs/Workflow-Mastertheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- pranataa-labs/Workflow-Master★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- api-endpoint-creationSkill
- database-migrationsSkill
- local-dev-testingSkill
- testing-cqrs-securitySkill
- business-rule-additionSkill
- chrome-devtools-expertSkill
- code-reviewSkill
- context7-docsSkill
- markitdown-converterSkill
- playwright-automationSkill
- property-additionSkill
- serena-code-generatorSkill
- strategic-plannerSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before starting, confirm with user:
- Very specific: line 42
Use ddd-specialist to create value objects following this pattern:
- Very specific: line 62
Use ddd-specialist to create entity with:
- Very specific: line 156
Add method to app/Config/Services.php:
- Distinctive: line 253
Create{Entity}() method for test data
- Distinctive: line 261
Run ALL quality checks:
- Distinctive: line 274
If ANY check fails, fix violations before completing.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Domain Scaffolding Skill
Automates creation of a complete domain with all standard files and touchpoints.
Prerequisites
Before starting, confirm with user:
- Domain name (PascalCase, singular): e.g., "Order", "Product"
- Primary value objects needed (e.g., OrderNumber, ProductSKU)
- Additional properties beyond standard (name, description, etc.)
Step 1: Create Directory Structure
mkdir -p app/Domain/{Domain}/{Commands,Queries,Events,Entities,ValueObjects,DTOs,Ports}
mkdir -p app/Models/{Domain}
mkdir -p app/Infrastructure/Persistence/Repositories
mkdir -p app/Controllers/Domain/{Domain}
mkdir -p app/Views/{entities}
mkdir -p tests/Unit/Domain/{Domain}/{ValueObjects,Entities,Commands,Queries,Events}
mkdir -p tests/Integration/Repositories
mkdir -p tests/Feature/{Domain}
mkdir -p tests/Support/FactoriesStep 2: Create Value Objects
For EACH value object:
Use ddd-specialist to create value objects following this pattern:
Reference: app/Domain/Cookie/ValueObjects/CookieName.php
Reference: app/Domain/Cookie/ValueObjects/CookiePrice.php
Key points:
- Readonly class
- Private constructor with validation
- Static factory method (fromString, fromFloat, etc.)
- getValue() method
- equals() method for comparison
Invoke: ddd-specialist + php-specialist to review
Step 3: Create Entity
Reference: app/Domain/Cookie/Entities/Cookie.php
Use ddd-specialist to create entity with:
- Private constructor
- Static create() method (for new entities)
- Static reconstitute() method (from database)
- Getters for all properties
- Business methods (not setters!)
Invoke: ddd-specialist + clean-code-specialist to review
Step 4: Create Commands (Create, Update, Delete)
For EACH command:
Command (readonly DTO):
- Reference:
app/Domain/Cookie/Commands/CreateCookie/CreateCookieCommand.php - Readonly class with public properties
Handler:
- Reference:
app/Domain/Cookie/Commands/CreateCookie/CreateCookieHandler.php - Inject repository interface, event dispatcher interface, and logger
- handle() method with business logic
- Dispatch events
Invoke: cqrs-specialist + clean-code-specialist to review
Step 5: Create Queries (ById, All, Paginated)
For EACH query:
Query (readonly DTO):
- Reference:
app/Domain/Cookie/Queries/GetCookieById/GetCookieByIdQuery.php
Handler:
- Reference:
app/Domain/Cookie/Queries/GetCookieById/GetCookieByIdHandler.php - Inject repository
- handle() method returns DTOs for presentation/API reads
Invoke: cqrs-specialist to review
Step 6: Create Events (Created, Updated, Deleted)
For EACH event:
Event (readonly DTO):
- Reference:
app/Domain/Cookie/Events/CookieCreated/CookieCreatedEvent.php - Past tense name
- Readonly with public properties
Event Handler:
- Reference:
app/Domain/Cookie/Events/CookieCreated/CookieCreatedEventHandler.php - __invoke() method
- Log event occurrence
Invoke: cqrs-specialist to review
Step 7: Create Service Provider
Reference: app/Domain/Cookie/CookieServiceProvider.php
Critical:
- Add #[DomainServiceProvider] attribute
- Implement DomainServiceProviderInterface
- Register all commands, queries, events
Invoke: cqrs-specialist + php-specialist to review
Step 8: Create Repository and Model
Model:
- Reference:
app/Models/Cookie/CookieModel.php - Extend CodeIgniter Model
- Set $table, $allowedFields, timestamps, soft deletes
Repository:
- Reference:
app/Infrastructure/Persistence/Repositories/CookieRepository.php - save(), findById(), delete() methods
- toDomainEntity() private method with array shape annotation
Invoke: codeigniter4-specialist + phpstan-specialist to review
Step 9: Add Repository to Services.php
Add method to app/Config/Services.php:
public static function {entity}Repository(bool $getShared = true): {Entity}RepositoryInterface
{
if ($getShared) {
return static::getSharedInstance('{entity}Repository');
}
return new {Entity}Repository(
self::logger(),
config('Logging')
);
}Step 10: Create Migration
php spark make:migration Create{Entities}TableReference: Cookie migration for structure
Include:
- id (auto_increment)
- All domain properties
- created_at, updated_at, deleted_at (nullable)
Invoke: codeigniter4-specialist to review
Run: php spark migrate
Step 11: Create Controller
Reference: app/Controllers/Domain/Cookie/CookieController.php
Thin controller:
- Delegate to command/query buses
- Handle validation errors
- Return responses
Invoke: cqrs-specialist + codeigniter4-specialist + clean-code-specialist
Step 12: Add Routes
Reference: Routes for Cookie in app/Config/Routes.php
Standard CRUD routes:
- GET '/' - index
- GET '/create' - create form
- POST '/' - store
- GET '/:num' - show
- GET '/:num/edit' - edit form
- POST '/:num' - update
- POST '/:num/delete' - delete
Step 13: Create Views (4 files)
References:
app/Views/cookies/index.phpapp/Views/cookies/show.phpapp/Views/cookies/create.phpapp/Views/cookies/edit.php
Use Bootstrap 5 with:
- Form validation feedback
- Flash messages
- Responsive design
Step 14: Create ALL Tests
Use test-specialist to create:
Unit Tests:
- Value object tests (validation, immutability, methods)
- Entity tests (create, reconstitute, business methods)
- Command handler tests (with mocks)
- Query handler tests (with mocks)
- Event tests
Integration Tests:
- Repository tests (save, find, update, delete)
Feature Tests:
- CRUD tests (all controller actions)
Test Factory:
- Create{Entity}() method for test data
Invoke: test-specialist for comprehensive coverage
Step 15: Final Validation
Run ALL quality checks:
vendor/bin/phpstan analyse --level=8
vendor/bin/phpcs
vendor/bin/phpunit --coverage-textInvoke in sequence:
phpstan-specialist- MUST pass with 0 errorsslevomat-specialist- MUST pass with 0 violationstest-specialist- MUST achieve 90%+ coverage
If ANY check fails, fix violations before completing.
Completion Checklist
- All 22 domain layer files created
- All 2 infrastructure files created
- Controller created
- 4 views created
- Migration created and run
- Routes added
- All 14 test files created
- Repository added to Services.php
- PHPStan Level 8: 0 errors
- Slevomat: 0 violations
- Tests: 90%+ coverage, all passing
Success Criteria
✅ Standard domain files/touchpoints created ✅ All specialists invoked for their expertise ✅ All quality checks passing ✅ Domain functional and tested
Report completion to user with file count and quality metrics.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

