LogoSkills

/cc-product:scaffold — 코드 뼈대 "자동 생성" 단계

4.5단계: Scaffold — Mason brick 스캐폴딩, BDD feature 초안 작성 (Patrol E2E 시나리오는 app/{app}/integration_test/에 사람이 직접 작성, 코드 생성기 없음)

/cc-product:scaffold — 코드 뼈대 "자동 생성" 단계#

항목내용
실행 명령/cc-product:scaffold
분류파이프라인
난이도●●○ 보통

파이프라인 4.5단계(Scaffold). 설계 문서를 바탕으로 기능별 코드 뼈대와 테스트 파일을 자동으로 만들어, 개발자가 곧바로 살을 붙일 수 있게 준비합니다.

한마디로#

설계도가 나온 뒤, 건물의 골조와 배관을 미리 세워두는 단계입니다. 방마다 벽·문·창틀을 먼저 자동으로 세워두면, 사람은 인테리어(실제 기능 구현)만 채워 넣으면 되는 것과 같아요.

누가·언제 쓰나요#

  • 설계(Design)가 끝나 이제 실제 코드 구조를 만들기 시작할 때
  • 새 기능 모듈을 Clean Architecture 형태로 한 번에 깔끔하게 세팅하고 싶을 때
  • 기획서의 요구사항(Acceptance Criteria)을 BDD 테스트 뼈대로 바꿔두고 싶을 때

👉 건너뛰어도 되는 경우: 이미 코드 구조가 잡혀 있거나, BDD 테스트 생성이 필요 없는 작업이라면 --skip-bdd·--skip-tests 옵션으로 일부 단계를 생략할 수 있습니다.

무엇을 해주나요#

기능마다 코드 뼈대와 BDD 시나리오 초안이 자동으로 만들어집니다. 주요 결과물은:

  • feature/application/(기능이름)/ — 프론트엔드 기능 코드 뼈대 (기능별). BDD 관련 파일은 하나도 들어가지 않습니다.
  • backend/(프로젝트)_server/feature/(기능이름)/ — 백엔드 코드 뼈대 (기능별)
  • app/(앱이름)/integration_test/features/(기능).feature — BDD 시나리오 초안 (사람이 읽는 요구사항 명세, 빌드 대상 아님)
  • app/(앱이름)/integration_test/step/, scenarios/ — Patrol step·시나리오 템플릿(TODO 표시, 코드 생성기 없이 이 단계가 직접 작성하며 Development 단계에서 사람이 채워 넣습니다)

어떻게 쓰나요#

# 기본 (설계 문서에서 기능·엔티티를 자동으로 알아냄)
/cc-product:scaffold

# 특정 기능·엔티티를 직접 지정
/cc-product:scaffold --feature community --entity Post

# BDD .feature 파일 생성은 건너뛰기
/cc-product:scaffold --skip-bdd

# 테스트 파일 생성은 건너뛰기
/cc-product:scaffold --skip-tests

자동 매칭된 brick이 틀렸을 때는 --brick으로 특정 brick을 강제로 지정할 수 있습니다.

안에서 무슨 일이 벌어지나요#

크게 네 단계로 진행됩니다.

  1. 기능 정리 — 설계 문서(아키텍처·UX·기획서)를 읽어, 어떤 기능이 있고 각 기능에 어떤 화면·엔티티·요구사항이 필요한지 목록으로 정리합니다.
  2. 코드 뼈대 생성 — 정리된 기능마다 Mason brick(미리 만들어 둔 코드 틀)을 골라, 프론트엔드·백엔드 폴더 구조와 파일을 자동으로 찍어냅니다.
  3. BDD 시나리오 초안 생성 — 기획서의 요구사항을 .feature 시나리오 초안으로 바꿔 app/{app}/integration_test/features/에 둡니다. Patrol E2E 테스트와 step 함수는 코드 생성기 없이 TODO 템플릿으로만 마련되며, 실제 구현은 Development 단계에서 사람이 채워 넣습니다.
  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#

/cc-product:scaffold
/cc-product:scaffold --feature community --entity Post
/cc-product:scaffold --skip-bdd
/cc-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 Patrol step/scenario template generation under app/{app}/integration_test/ (the .feature draft is still generated unless --skip-bdd)
--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 의 실제 11개 feature-* 모듈에서 매칭
    

Phase 2: Brick Scaffolding#

Source: cc-bricks

For each feature in the manifest:

  1. Brick matching — Match feature name to the closest brick among cc-bricks 의 실제 11개 feature-* 모듈 (skills/ 참조; console brick 없음)

    • Exact match: storefeature-store
    • Keyword match: messagingfeature-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 (bdd-scenario-agent)

For each feature with screens:

  1. Generate .feature draft from PRD Acceptance Criteria, written directly to app/{app}/integration_test/features/{feature_name}.feature (documentation only, never a build target — never written into the feature package)

        /cc-flutter:bdd:generate {feature_name} \
      --entity-name {PrimaryEntity} \
      --screens  " {screen_list} " 
    

    ⛔ No build_runner/co_test_gen/bdd_test_gen/bdd_widget_test step follows this. Nothing under feature/{type}/{feature_name}/ is touched by BDD scaffolding — there is no test/src/bdd/ directory in the feature package, and no builder block is added to that package's build.yaml.

  2. Step + Patrol scenario templates (hand-authored, no code generator) — this stage writes TODO-marked template files directly (not via a build tool) into:

    • app/{app}/integration_test/step/*.dart — TestDriver-based step function templates
    • app/{app}/integration_test/scenarios/{feature_name}_{scenario}_test.dart — Patrol test template; a human copies the .feature Scenario name and step order in during Development
    /// Usage: Given I am on the post list page
    /// Purpose: Navigate to post list page
    Future<void> iAmOnThePostListPage(TestDriver driver) async {
      // TODO: Implement step - fill in by hand during Development
      throw UnimplementedError('Step not yet implemented');
    }
    

    Reuse canonical shared steps from package:test_driver/shared_steps.dart before writing a new local step — see cc-flutter:bdd-canonical-steps.

  3. Commit: "test({scope}): draft BDD scenario and step templates 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 (no BDD files)
Feature files.feature file exists in app/{app}/integration_test/features/ for each screen feature (never in the feature package)
Patrol scenario templatesapp/{app}/integration_test/scenarios/{feature_name}_{scenario}_test.dart templates exist, hand-authored (no code generator)
Step templatesAll Gherkin steps have corresponding step function templates in app/{app}/integration_test/step/

Gate fails if any check does not pass. Scaffold is revised with feedback.

Artifacts#

feature/application/{feature_name}/                 # Scaffolded feature code (per feature) — no BDD files
backend/{project}_server/feature/{name}/             # Scaffolded backend code (per feature)
app/{app}/integration_test/features/{feature}.feature            # BDD feature files (documentation, never a build target)
app/{app}/integration_test/step/                                 # Step function templates (hand-filled, no code generator)
app/{app}/integration_test/scenarios/{feature}_{scenario}_test.dart  # Patrol E2E test templates (hand-filled)

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 draft files generated
  - {K} Patrol E2E test templates created (hand-filled, no code generator)
  - {S} step function templates created (to be implemented in Development)

**Option 1 (Recommended)**: Clear context and continue to Issue Breakdown
  /clear
  Then run: /cc-product:breakdown

**Option 2**: Continue in current context
  Proceed directly to /cc-product:breakdown

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 /cc-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