| íëŠĐ | ëīėĐ |
|---|---|
| Invoke | /project:scaffold |
| Category | pipeline |
| Complexity | moderate |
/project:scaffold#
Stage 4.5: Scaffold â Scaffolds full-stack code via Mason bricks (co-bricks), generates BDD .feature files from PRD Acceptance Criteria, and auto-generates widget + patrol test files via co-test-gen.
Triggers#
- When scaffolding full-stack code structure after Design stage completion
- When generating BDD test scaffolding from PRD Acceptance Criteria
- When bootstrapping a new feature module with Clean Architecture layers
Usage#
/project:scaffold
/project:scaffold --feature community --entity Post
/project:scaffold --skip-bdd
/project:scaffold --skip-tests
Options#
| Option | Default | Description |
|---|---|---|
--feature |
Auto-inferred from architecture doc | Feature name (snake_case) |
--entity |
Auto-inferred from architecture doc | Primary entity name (PascalCase) |
--skip-bdd |
false |
Skip BDD .feature file generation |
--skip-tests |
false |
Skip build_runner test file generation |
--brick | Auto-matched | Force specific brick name |
Prerequisites#
- Design stage completed (Solutioning Gate passed)
- Architecture Doc (
docs/architecture-{slug}.md) exists - UX Spec (
docs/ux-spec-{slug}.md) exists - PRD (
docs/prd-{slug}.md) with Acceptance Criteria exists
Execution Flow#
Phase 1: Feature Extraction#
Source: cc-pipeline (internal)
-
Parse Architecture Doc (
docs/architecture-{slug}.md)- Extract feature list from architecture layer definitions
- Identify primary/secondary entity per feature
- Map feature â Clean Architecture layers (domain, data, presentation)
-
Parse UX Spec (
docs/ux-spec-{slug}.md)- Extract screen list per feature (list, detail, form, etc.)
- Identify screen-to-feature mapping
-
Parse PRD (
docs/prd-{slug}.md)- Extract Acceptance Criteria per feature
- Map AC â Gherkin-ready scenario descriptions
-
Build Feature Manifest
features: - name: community # snake_case primary_entity: Post # PascalCase secondary_entity: Comment # PascalCase (optional) screens: [list, detail, form] acceptance_criteria: - " User can view post list " - " User can create new post " - " User can add comment to post " brick_match: feature-community # Auto-matched from 27 app bricks
Phase 2: Brick Scaffolding#
Source: cc-bricks-feature
For each feature in the manifest:
-
Brick matching â Match feature name to closest available brick from 27 app bricks + 29 console bricks
- Exact match:
communityâfeature-community - Keyword match:
messagingâfeature-chat - Fallback: use generic feature structure
- Exact match:
-
Run Mason brick per feature
mason make feature-{brick_name} \ --project_name {project_name} \ --org_name {org_name} \ --org_tld {org_tld} \ --feature_name {feature_name} -
Verify scaffolded output
feature/application/{feature_name}/ âââ lib/src/ â âââ domain/ # Entity, UseCase, Repository Interface â âââ data/ # Repository impl, Cache, OpenAPI Mixin â âââ presentation/ # BLoC, Page, Widgets â âââ route/ # GoRouter TypedRoute â âââ di/ # Dependency Injection âââ test/src/ # Test directory structure backend/{project}_server/feature/{feature_name}/ âââ model/ # .spy.yaml models âââ endpoint/ # CRUD handlers âââ service/ # Business logic âââ exception/ # Domain exceptions âââ validation/ # Input validation -
Commit:
"feat({scope}): scaffold {feature_name} via mason brick"
Phase 3: BDD Scenario Generation#
Source: cc-flutter-dev (bdd-scenario-agent)
For each feature with screens:
-
Generate .feature files from PRD Acceptance Criteria
/bdd:generate {feature_name} \ --entity-name {PrimaryEntity} \ --screens " {screen_list} " \ --builder dual \ --run-build true -
co-test-gen build_runner generates dual test files
dart run build_runner build --delete-conflicting-outputsOutput per feature:
test/src/bdd/{feature}.featureâ Gherkin scenariostest/src/bdd/{feature}.widget_test.dartâ Auto-generated (DO NOT MODIFY)test/src/bdd/{feature}.patrol_test.dartâ Auto-generated (DO NOT MODIFY)test/src/bdd/step/â Step function stubs (to be implemented in Development)
-
Step stub generation â Create skeleton step functions with TestDriver API
/// Usage: Given I am on the post list page /// Purpose: Navigate to post list page Future<void> iAmOnThePostListPage(TestDriver driver) async { // TODO: Implement step - scaffold generated stub throw UnimplementedError('Step not yet implemented'); } -
Commit:
"test({scope}): generate BDD scenarios and test stubs for {feature_name}"
Phase 4: Scaffold Gate#
Scaffold Gate verification per feature:
| Check | Criteria |
|---|---|
| Brick output |
feature/application/{feature_name}/lib/src/
directory exists with domain, data, presentation layers
|
| Feature files | .feature file exists in test/src/bdd/ for each screen feature |
| Widget test gen | .widget_test.dart generated by co-test-gen build_runner |
| Patrol test gen | .patrol_test.dart generated by co-test-gen build_runner |
| Step stubs | All Gherkin steps have corresponding step function stubs in step/ folder |
Gate fails if any check does not pass. Scaffold is revised with feedback.
Artifacts#
feature/application/{feature_name}/ # Scaffolded feature code (per feature)
backend/{project}_server/feature/{name}/ # Scaffolded backend code (per feature)
test/src/bdd/{feature}.feature # BDD feature files
test/src/bdd/{feature}.widget_test.dart # Auto-generated widget tests
test/src/bdd/{feature}.patrol_test.dart # Auto-generated patrol tests
test/src/bdd/step/ # Step function stubs
After Completion#
- Verify Scaffold Gate passed
- Update
.pipeline/{slug}.yamlstate - Present context-clear handoff:
â
Scaffold stage complete (Scaffold Gate PASSED).
- {N} features scaffolded via Mason bricks
- {M} .feature files generated
- {K} widget + patrol test files auto-generated
- {S} step function stubs created (to be implemented in Development)
**Option 1 (Recommended)**: Clear context and continue to Epic Creation
/clear
Then run: /project:epic
**Option 2**: Continue in current context
Proceed directly to /project:epic
Notes#
-
Step function stubs are intentionally unimplemented (
throw UnimplementedError) â they become the DoD for each Story in the Development stage - The BDD Coverage Gate (Step 8.3 in /dev:run) will enforce that all step stubs are implemented before PR creation
-
Brick selection uses a best-match heuristic; use
--brickto override if the auto-match is incorrect - For features without a matching brick, the scaffold phase creates a minimal Clean Architecture directory structure