LogoSkills

product:scaffold

Stage 4.5: Scaffold โ€” Mason brick scaffolding, BDD feature generation, dual test auto-generation

ํ•ญ๋ชฉ๋‚ด์šฉ
Invoke/product:scaffold
Categorypipeline
Complexitymoderate

/product:scaffold โ€” ์ฝ”๋“œ ๋ผˆ๋Œ€ "์ž๋™ ์ƒ์„ฑ" ๋‹จ๊ณ„#

ํŒŒ์ดํ”„๋ผ์ธ 4.5๋‹จ๊ณ„(Scaffold). ์„ค๊ณ„ ๋ฌธ์„œ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๊ธฐ๋Šฅ๋ณ„ ์ฝ”๋“œ ๋ผˆ๋Œ€์™€ ํ…Œ์ŠคํŠธ ํŒŒ์ผ์„ ์ž๋™์œผ๋กœ ๋งŒ๋“ค์–ด, ๊ฐœ๋ฐœ์ž๊ฐ€ ๊ณง๋ฐ”๋กœ ์‚ด์„ ๋ถ™์ผ ์ˆ˜ ์žˆ๊ฒŒ ์ค€๋น„ํ•ฉ๋‹ˆ๋‹ค.

ํ•œ๋งˆ๋””๋กœ#

์„ค๊ณ„๋„๊ฐ€ ๋‚˜์˜จ ๋’ค, ๊ฑด๋ฌผ์˜ ๊ณจ์กฐ์™€ ๋ฐฐ๊ด€์„ ๋ฏธ๋ฆฌ ์„ธ์›Œ๋‘๋Š” ๋‹จ๊ณ„์ž…๋‹ˆ๋‹ค. ๋ฐฉ๋งˆ๋‹ค ๋ฒฝยท๋ฌธยท์ฐฝํ‹€์„ ๋จผ์ € ์ž๋™์œผ๋กœ ์„ธ์›Œ๋‘๋ฉด, ์‚ฌ๋žŒ์€ ์ธํ…Œ๋ฆฌ์–ด(์‹ค์ œ ๊ธฐ๋Šฅ ๊ตฌํ˜„)๋งŒ ์ฑ„์›Œ ๋„ฃ์œผ๋ฉด ๋˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์•„์š”.

๋ˆ„๊ฐ€ยท์–ธ์ œ ์“ฐ๋‚˜์š”#

  • ์„ค๊ณ„(Design)๊ฐ€ ๋๋‚˜ ์ด์ œ ์‹ค์ œ ์ฝ”๋“œ ๊ตฌ์กฐ๋ฅผ ๋งŒ๋“ค๊ธฐ ์‹œ์ž‘ํ•  ๋•Œ
  • ์ƒˆ ๊ธฐ๋Šฅ ๋ชจ๋“ˆ์„ Clean Architecture ํ˜•ํƒœ๋กœ ํ•œ ๋ฒˆ์— ๊น”๋”ํ•˜๊ฒŒ ์„ธํŒ…ํ•˜๊ณ  ์‹ถ์„ ๋•Œ
  • ๊ธฐํš์„œ์˜ ์š”๊ตฌ์‚ฌํ•ญ(Acceptance Criteria)์„ BDD ํ…Œ์ŠคํŠธ ๋ผˆ๋Œ€๋กœ ๋ฐ”๊ฟ”๋‘๊ณ  ์‹ถ์„ ๋•Œ

๐Ÿ‘‰ ๊ฑด๋„ˆ๋›ฐ์–ด๋„ ๋˜๋Š” ๊ฒฝ์šฐ: ์ด๋ฏธ ์ฝ”๋“œ ๊ตฌ์กฐ๊ฐ€ ์žกํ˜€ ์žˆ๊ฑฐ๋‚˜, BDD ํ…Œ์ŠคํŠธ ์ƒ์„ฑ์ด ํ•„์š” ์—†๋Š” ์ž‘์—…์ด๋ผ๋ฉด --skip-bddยท--skip-tests ์˜ต์…˜์œผ๋กœ ์ผ๋ถ€ ๋‹จ๊ณ„๋ฅผ ์ƒ๋žตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฌด์—‡์„ ํ•ด์ฃผ๋‚˜์š”#

๊ธฐ๋Šฅ๋งˆ๋‹ค ์ฝ”๋“œ ๋ผˆ๋Œ€์™€ ํ…Œ์ŠคํŠธ ํŒŒ์ผ์ด ์ž๋™์œผ๋กœ ๋งŒ๋“ค์–ด์ง‘๋‹ˆ๋‹ค. ์ฃผ์š” ๊ฒฐ๊ณผ๋ฌผ์€:

  • feature/application/(๊ธฐ๋Šฅ์ด๋ฆ„)/ โ€” ํ”„๋ก ํŠธ์—”๋“œ ๊ธฐ๋Šฅ ์ฝ”๋“œ ๋ผˆ๋Œ€ (๊ธฐ๋Šฅ๋ณ„)
  • backend/(ํ”„๋กœ์ ํŠธ)_server/feature/(๊ธฐ๋Šฅ์ด๋ฆ„)/ โ€” ๋ฐฑ์—”๋“œ ์ฝ”๋“œ ๋ผˆ๋Œ€ (๊ธฐ๋Šฅ๋ณ„)
  • test/src/bdd/(๊ธฐ๋Šฅ).feature โ€” BDD ์‹œ๋‚˜๋ฆฌ์˜ค ํŒŒ์ผ (์‚ฌ๋žŒ์ด ์ฝ๋Š” ์š”๊ตฌ์‚ฌํ•ญ ๋ช…์„ธ)
  • test/src/bdd/(๊ธฐ๋Šฅ).widget_test.dart โ€” ์ž๋™ ์ƒ์„ฑ๋œ ์œ„์ ฏ ํ…Œ์ŠคํŠธ
  • test/src/bdd/(๊ธฐ๋Šฅ).patrol_test.dart โ€” ์ž๋™ ์ƒ์„ฑ๋œ patrol ํ…Œ์ŠคํŠธ
  • test/src/bdd/step/ โ€” ๋‹จ๊ณ„๋ณ„ ํ•จ์ˆ˜ ๋ผˆ๋Œ€ (๊ฐœ๋ฐœ ๋‹จ๊ณ„์—์„œ ์ฑ„์›Œ ๋„ฃ์„ ๋นˆ์นธ)

์–ด๋–ป๊ฒŒ ์“ฐ๋‚˜์š”#

# ๊ธฐ๋ณธ (์„ค๊ณ„ ๋ฌธ์„œ์—์„œ ๊ธฐ๋Šฅยท์—”ํ‹ฐํ‹ฐ๋ฅผ ์ž๋™์œผ๋กœ ์•Œ์•„๋ƒ„)
/product:scaffold

# ํŠน์ • ๊ธฐ๋Šฅยท์—”ํ‹ฐํ‹ฐ๋ฅผ ์ง์ ‘ ์ง€์ •
/product:scaffold --feature community --entity Post

# BDD .feature ํŒŒ์ผ ์ƒ์„ฑ์€ ๊ฑด๋„ˆ๋›ฐ๊ธฐ
/product:scaffold --skip-bdd

# ํ…Œ์ŠคํŠธ ํŒŒ์ผ ์ƒ์„ฑ์€ ๊ฑด๋„ˆ๋›ฐ๊ธฐ
/product:scaffold --skip-tests

์ž๋™ ๋งค์นญ๋œ brick์ด ํ‹€๋ ธ์„ ๋•Œ๋Š” --brick์œผ๋กœ ํŠน์ • brick์„ ๊ฐ•์ œ๋กœ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์•ˆ์—์„œ ๋ฌด์Šจ ์ผ์ด ๋ฒŒ์–ด์ง€๋‚˜์š”#

ํฌ๊ฒŒ ๋„ค ๋‹จ๊ณ„๋กœ ์ง„ํ–‰๋ฉ๋‹ˆ๋‹ค.

  1. ๊ธฐ๋Šฅ ์ •๋ฆฌ โ€” ์„ค๊ณ„ ๋ฌธ์„œ(์•„ํ‚คํ…์ฒ˜ยทUXยท๊ธฐํš์„œ)๋ฅผ ์ฝ์–ด, ์–ด๋–ค ๊ธฐ๋Šฅ์ด ์žˆ๊ณ  ๊ฐ ๊ธฐ๋Šฅ์— ์–ด๋–ค ํ™”๋ฉดยท์—”ํ‹ฐํ‹ฐยท์š”๊ตฌ์‚ฌํ•ญ์ด ํ•„์š”ํ•œ์ง€ ๋ชฉ๋ก์œผ๋กœ ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  2. ์ฝ”๋“œ ๋ผˆ๋Œ€ ์ƒ์„ฑ โ€” ์ •๋ฆฌ๋œ ๊ธฐ๋Šฅ๋งˆ๋‹ค Mason brick(๋ฏธ๋ฆฌ ๋งŒ๋“ค์–ด ๋‘” ์ฝ”๋“œ ํ‹€)์„ ๊ณจ๋ผ, ํ”„๋ก ํŠธ์—”๋“œยท๋ฐฑ์—”๋“œ ํด๋” ๊ตฌ์กฐ์™€ ํŒŒ์ผ์„ ์ž๋™์œผ๋กœ ์ฐ์–ด๋ƒ…๋‹ˆ๋‹ค.
  3. BDD ํ…Œ์ŠคํŠธ ๋ผˆ๋Œ€ ์ƒ์„ฑ โ€” ๊ธฐํš์„œ์˜ ์š”๊ตฌ์‚ฌํ•ญ์„ .feature ์‹œ๋‚˜๋ฆฌ์˜ค๋กœ ๋ฐ”๊พธ๊ณ , ์œ„์ ฏยทpatrol ํ…Œ์ŠคํŠธ ํŒŒ์ผ๊ณผ ๋นˆ ๋‹จ๊ณ„ ํ•จ์ˆ˜๋“ค์„ ์ž๋™์œผ๋กœ ๋งŒ๋“ค์–ด ๋‘ก๋‹ˆ๋‹ค.
  4. ๊ฒ€์ˆ˜(Scaffold Gate) โ€” ๋ผˆ๋Œ€ ํด๋”ยท์‹œ๋‚˜๋ฆฌ์˜ค ํŒŒ์ผยทํ…Œ์ŠคํŠธ ํŒŒ์ผยท๋‹จ๊ณ„ ํ•จ์ˆ˜๊ฐ€ ๋น ์ง์—†์ด ๋งŒ๋“ค์–ด์กŒ๋Š”์ง€ ํ™•์ธํ•˜๊ณ , ๋น ์ง„ ๊ฒŒ ์žˆ์œผ๋ฉด ๋ณด์™„ํ•ฉ๋‹ˆ๋‹ค.

โš™๏ธ ์ƒ์„ธ ์˜ต์…˜ยท์‹คํ–‰ ๋ช…์„ธ (๊ฐœ๋ฐœ์ž / AI ์—์ด์ „ํŠธ์šฉ)

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#

/product:scaffold
/product:scaffold --feature community --entity Post
/product:scaffold --skip-bdd
/product:scaffold --skip-tests

Options#

OptionDefaultDescription
--featureAuto-inferred from architecture docFeature name (snake_case)
--entityAuto-inferred from architecture docPrimary entity name (PascalCase)
--skip-bddfalseSkip BDD .feature file generation
--skip-testsfalseSkip build_runner test file generation
--brickAuto-matchedForce 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-product (internal)

  1. 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)
  2. Parse UX Spec (docs/ux-spec-{slug}.md)

    • Extract screen list per feature (list, detail, form, etc.)
    • Identify screen-to-feature mapping
  3. Parse PRD (docs/prd-{slug}.md)

    • Extract Acceptance Criteria per feature
    • Map AC โ†’ Gherkin-ready scenario descriptions
  4. 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-store  # cc-bricks-feature ์˜ ์‹ค์ œ 11๊ฐœ feature-* ๋ชจ๋“ˆ์—์„œ ๋งค์นญ
    

Phase 2: Brick Scaffolding#

Source: cc-bricks-feature

For each feature in the manifest:

  1. Brick matching โ€” Match feature name to the closest brick among cc-bricks-feature ์˜ ์‹ค์ œ 11๊ฐœ feature-* ๋ชจ๋“ˆ (skills/ ์ฐธ์กฐ; console brick ์—†์Œ)

    • Exact match: store โ†’ feature-store
    • Keyword match: messaging โ†’ feature-chat
    • Fallback: use generic feature structure
  2. 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}
    
  3. 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
    
  4. 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:

  1. Generate .feature files from PRD Acceptance Criteria

        /bdd:generate {feature_name} \
      --entity-name {PrimaryEntity} \
      --screens  " {screen_list} "   \
      --builder dual \
      --run-build true
    
  2. co-test-gen build_runner generates dual test files

        dart run build_runner build --delete-conflicting-outputs
    

    Output per feature:

    • test/src/bdd/{feature}.feature โ€” Gherkin scenarios
    • test/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)
  3. 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');
    }
    
  4. Commit: "test({scope}): generate BDD scenarios and test stubs for {feature_name}"

Phase 4: Scaffold Gate#

Scaffold Gate verification per feature:

CheckCriteria
Brick outputfeature/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 stubsAll 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}.yaml state
  • 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: /product:epic

**Option 2**: Continue in current context
  Proceed directly to /product: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 --brick to override if the auto-match is incorrect
  • For features without a matching brick, the scaffold phase creates a minimal Clean Architecture directory structure