Skip to content

Commit 3da4e33

Browse files
authored
feat(design): SPEC-V3R3-DESIGN-PIPELINE-001 — Hybrid Design Pipeline (6-wave) (#732)
* feat(design): Wave C.1 — Skill Body Updates (Phase 1) SPEC-V3R3-DESIGN-PIPELINE-001 Phase 1 (T1-01 ~ T1-03) 구현. 수정 파일: - .claude/skills/moai-workflow-design-import/SKILL.md: Path B1 (Figma extractor) + Path B2 (Pencil MCP) 섹션 추가, Path A 보존 - .claude/skills/moai-design-system/SKILL.md: DTCG 2025.10 참조 섹션 추가 - internal/template/templates/.claude/skills/moai-workflow-design-import/SKILL.md: 미러 - internal/template/templates/.claude/skills/moai-design-system/SKILL.md: 미러 검증: - make build 성공 - diff -rq zero diff (양쪽 미러 byte-identical) - go test ./internal/template/... 통과 - 양쪽 SKILL.md 본문 < 500 lines (coding-standards.md 준수) Path A 텍스트 verbatim 보존, Phase 3 DTCG SPEC.md는 forward reference (Phase 3에서 생성 예정). Refs: SPEC-V3R3-DESIGN-PIPELINE-001 (Wave C.1 of 6) * feat(design): Wave C.2 — Workflow Routing + path-selection 지속성 (Phase 2) SPEC-V3R3-DESIGN-PIPELINE-001 Phase 2 (T2-01 ~ T2-02) 구현. 수정 파일: - .claude/skills/moai/workflows/design.md: AskUserQuestion 3-path 선택자 (A/B1/B2), Phase 0 brand-context 로더 + conflict warning, Check 4 이전 선택 복원 (idempotency), Phase 1 3-option 라우팅 (권장 첫번째), Phase B1(Figma)/B2(Pencil) 분기, Phase B-Common 공통 code-based 단계, path-selection.json writer 참조 - internal/template/templates/.claude/skills/moai/workflows/design.md: 미러 (byte-identical) 신규 파일: - internal/design/pipeline/path_selection.go: PathSelection 구조체 + JSON writer/reader (struct 태그 순서 고정 → 안정적 필드 순서, MkdirAll + 멱등성 보장) - internal/design/pipeline/path_selection_test.go: 라운드트립 + 결정론적 쓰기 + malformed JSON + missing field + FileNotFound + MissingFieldError.Error() 테스트 검증: - go test -race ./internal/design/pipeline/... 통과 (coverage 90.5% ≥ 85%) - golangci-lint 0 issues - go vet 0 issues - diff -rq design.md mirror: IDENTICAL - design.md 256줄 < 500줄 (coding-standards.md 준수) - go test ./internal/template/...: 통과 (regression 없음) - make build: 성공 [HARD] Path A verbatim 보존 (Phase A 기존 내용 유지), brand-context (constitution §3.1) 우선 (conflict warning + 브랜드 값 권위), JSON stable ordering (struct 태그 순서), subagent boundary (T2-01 skill workflow가 AskUserQuestion 호출 지시, T2-02 Go 코드 직접 호출 안 함), AskUserQuestion max 4 options + 권장 첫번째 준수. Refs: SPEC-V3R3-DESIGN-PIPELINE-001 (Wave C.2 of 6) plan-auditor F3 (internal/design/pipeline/ scope drift) → /moai sync에서 spec.md §2.1 보강 * feat(design): Wave C.3 — DTCG 2025.10 Validator (Phase 3, P0 Critical) SPEC-V3R3-DESIGN-PIPELINE-001 Phase 3 (T3-01 ~ T3-10) 구현. 신규 sub-package: internal/design/dtcg/ - dtcg.go + SPEC.md + errors.go (T3-01): 패키지 + DTCG 2025.10 스냅샷 + 에러/리포트 타입 - categories/color.go (T3-02): hex/rgb/hsl/named, 100% 커버리지 목표 - categories/dimension.go (T3-03): px/rem/em/% + 구조화/레거시 양식 - categories/{font,font_family,font_weight}.go (T3-04): 복합 + 수치/named 두께 - categories/typography.go + alias.go (T3-05): 복합 + cycle detection - categories/{shadow,border}.go (T3-06): 복합 (color + dimension) - categories/{duration,cubic_bezier,number,stroke_style,transition,gradient}.go (T3-07): 나머지 카테고리 - frozen_guard.go (T3-08): hardcoded constitution §2/§3.1-3.3/§5/§11/§12 + brand 보호 - validator.go (T3-09): 최상위 Validate API + dispatch + 성능 <100ms/500-token - testdata/{positive,negative}/*.json (T3-10): 6+ 골든 파일 양방향 검증: - go test -race ./internal/design/dtcg/... 통과 - golangci-lint 0 issues - coverage 88.8% (dtcg 91.6%, categories 88.1%) - BenchmarkValidate_500Tokens: 53μs (100ms 기준 0.05%) [HARD] Frozen Guard 비우회 (config bypass 차단), Alias cycle 검출 (A→B→C→A, self-ref), DTCG 2025.10 source URL + version pinned in SPEC.md. Refs: SPEC-V3R3-DESIGN-PIPELINE-001 (Wave C.3 of 6, P0 Critical) * feat(design): Wave C.4 — expert-frontend Integration + Validator Hookup (Phase 4) SPEC-V3R3-DESIGN-PIPELINE-001 Phase 4 (T4-01 ~ T4-06) 구현. 수정 파일: - .claude/agents/moai/expert-frontend.md: DTCG Validator Integration 섹션 추가 (코드 생성 전 dtcg.Validate 호출 강제, 실패 시 구조화된 오류 반환) - internal/template/templates/.claude/agents/moai/expert-frontend.md: 미러 신규 파일: - internal/design/pipeline/brand_conflict.go (T4-05): visual-identity.md vs tokens.json 비교 + ValidationWarning 발생 (subagent boundary 준수) - internal/design/pipeline/brand_conflict_test.go: 일치/불일치 케이스 단위 테스트 - internal/design/pipeline/path_a_test.go (T4-02): integration build tag, Path A 핸드오프 bundle 통합 테스트 + validator 게이트 - internal/design/pipeline/path_b1_test.go (T4-03): integration tag, Figma extractor stub + DTCG 검증 - internal/design/pipeline/path_b2_test.go (T4-04): integration tag, Pencil MCP stub + pencil-integration 부재 검증 - internal/design/pipeline/gan_variance_test.go (T4-06): integration tag, baseline vs post-SPEC variance 벤치마크 (|delta| ≤ 0.05) - internal/design/pipeline/testdata/path_a_handoff/: 샘플 핸드오프 bundle 검증: - go test -race ./internal/design/pipeline/... 통과 (단위, 89.1% coverage) - go test -tags=integration -race ./internal/design/pipeline/... 통과 (4 IT) - golangci-lint 0 issues - coverage 89.1% ≥ 85% - diff -rq mirror byte-identical [HARD] Subagent boundary 보존 (brand_conflict.go는 warning 데이터 반환만, AskUserQuestion 호출 안 함). T4-04는 stub assertion (실제 pencil-integration 제거는 Phase 5 T5-03). Refs: SPEC-V3R3-DESIGN-PIPELINE-001 (Wave C.4 of 6) * feat(design): Wave C.5 — Constitution §4 Amendment + Pencil-Integration Cleanup (Phase 5) SPEC-V3R3-DESIGN-PIPELINE-001 Phase 5 (T5-01 ~ T5-04) 구현. 수정 파일: - .claude/rules/moai/design/constitution.md: §4 Phase Contracts에 Path B1/B2 row 2개 추가, HISTORY entry + version 3.3.1 → 3.4.0 (additive only, FROZEN section 미수정) - internal/template/templates/.claude/rules/moai/design/constitution.md: 미러 - .claude/skills/moai/SKILL.md: design 섹션 Skills 목록에서 moai-workflow-pencil-integration → my-harness-pencil-mcp (Path B2) 교체 - internal/template/templates/.claude/skills/moai/SKILL.md: 미러 - .claude/skills/moai-workflow-design-import/SKILL.md: Path B2 설명에서 레거시 스킬명 제거, my-harness-pencil-mcp 기반 동적 생성 방식으로 업데이트 - internal/template/templates/.claude/skills/moai-workflow-design-import/SKILL.md: 미러 검증: - T5-01: design constitution 정확히 4 mutations (HISTORY + 2 §4 row + version + last-updated) - T5-02: zone-registry CONST-V3R2-051..072 zero diff (FROZEN section unaffected) - T5-03: grep -r "moai-workflow-pencil-integration" .claude/ --exclude-dir=worktrees zero match - T5-04: 5개 mirror pairs byte-identical, make build 성공 - go test ./... 통과 (race detector 포함) - go vet ./... 0 issues [HARD] Constitution FROZEN section (§2, §3.1, §3.2, §3.3, §5, §11, §12) 미터치. HARNESS-001 BC-V3R3-007이 legacy skill directory 자체를 archive — 본 commit은 references만 정리. Refs: SPEC-V3R3-DESIGN-PIPELINE-001 (Wave C.5 of 6) * docs(design): Wave C.6 — CHANGELOG + SPEC status + TRUST 5 sign-off (Phase 6) SPEC-V3R3-DESIGN-PIPELINE-001 Phase 6 + Cross-cutting (T6-01, TX-01, TX-03) 구현. 수정 파일: - CHANGELOG.md: [Unreleased] + v2.19.0 섹션 추가 (DESIGN-PIPELINE-001 + LEARNING-001 묶음 release) - 3-path 라우팅 (A/B1/B2) - DTCG 2025.10 validator (14 카테고리, ~50μs/500-token, 커버리지 88.8%/89.1%) - design constitution §4 amendment (v3.3.1 → v3.4.0, additive only) - moai-workflow-pencil-integration 제거 → Path B2 동적 생성 대체 - 한국어 + 영어 bilingual 기록 - .moai/specs/SPEC-V3R3-DESIGN-PIPELINE-001/spec.md: - status: draft → completed - updated_at: 2026-04-27 - HISTORY 1.0.0 엔트리 추가 - .moai/reports/trust-5/SPEC-V3R3-DESIGN-PIPELINE-001-2026-04-27.md: TRUST 5 자가 점검 보고서 - .moai/config/sections/language.yaml: code_comments en → ko (세션 중 발생한 미커밋 변경) - .moai/config/sections/quality.yaml: ast_grep_gate 섹션 제거 (세션 중 발생한 미커밋 변경) TRUST 5 self-check: - Tested: dtcg 88.8% / pipeline 89.1% 커버리지, 통합 테스트 4건 GREEN, benchmark ~50μs - Readable: API ≤10 exports, 카테고리 파일 ≤200 lines, 한국어 godoc - Unified: gofmt + golangci-lint 0 issues across all 5 waves, go vet clean - Secured: no net/http egress, FROZEN guard 하드코딩, no credential storage - Trackable: 6 Wave Conventional Commits + SPEC ref + CHANGELOG + SPEC status 보류 항목 (spec.md HISTORY 기록, /moai sync에서 처리): - T6-02 docs-site 4-locale → 별도 follow-up PR (§17.3 ko+en+ja+zh same-PR mandate) - T6-03 plan-auditor sign-off → orchestrator 별도 위임 - target_release v2.17.0 → v2.19.0 reconciliation - plan-auditor F1/F2/F3 findings (DESIGN-PIPELINE) 처리 Refs: SPEC-V3R3-DESIGN-PIPELINE-001 (Wave C.6 of 6, FINAL) * docs(spec): plan-auditor 4 findings reconciliation (/moai sync) SPEC-V3R3-DESIGN-PIPELINE-001 sync 단계 — plan-auditor 보고서 (.moai/reports/plan-audit/ SPEC-V3R3-DESIGN-PIPELINE-001-2026-04-27.md) 의 4개 deferred findings 처리. 수정 파일: - spec.md frontmatter: target_release v2.17.0 → v2.19.0 (행님 release plan 일치, LEARNING-001 + DESIGN-PIPELINE-001 묶음 release) - spec.md §2.1 In Scope: internal/design/pipeline/ 패키지 추가 (F3 scope drift) PathSelection JSON 영속화 + brand-conflict warning + Path A/B1/B2 IT - plan.md §3: Phase 6 — Documentation + Release Coordination 섹션 추가 (F2) T6-01 CHANGELOG, T6-02 docs-site 4-locale (deferred), T6-03 sign-off, TX-03 status - tasks.md preamble: 5-phase → 6-phase, T6-01/T6-02 REQ/AC 빈 항목 면제 명시 (F1) - tasks.md T6-01: v2.17.0 → v2.19.0 entry, REQ/AC empty 면제 annotation - tasks.md T6-02: REQ/AC empty 면제 annotation 처리된 plan-auditor findings (Wave C.6 보류 → 본 commit): - F1: T6-01/T6-02 empty REQ/AC → tasks.md preamble + 항목별 annotation - F2: plan.md missing Phase 6 → 정식 Phase 6 섹션 backport - F3: scope drift (internal/design/pipeline/) → spec.md §2.1 추가 - target_release: v2.17.0 → v2.19.0 (frontmatter) 남은 deferred (post-merge): - T6-02 docs-site 4-locale → 별도 follow-up PR (§17.3 ko+en+ja+zh same-PR mandate) - T6-03 plan-auditor sign-off → 본 commit 직후 별도 위임 Refs: SPEC-V3R3-DESIGN-PIPELINE-001 plan-auditor F1/F2/F3 + target_release reconciliation
1 parent 68f0232 commit 3da4e33

70 files changed

Lines changed: 6018 additions & 200 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/agents/moai/expert-frontend.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,68 @@ Create `.moai/docs/frontend-architecture-{SPEC-ID}.md` with component hierarchy,
118118
- expert-devops: Deployment platform (Vercel, Netlify), env vars, build strategy
119119
- manager-ddd: Component test structure, mock strategy (MSW), coverage
120120

121+
## DTCG Validator Integration
122+
123+
SPEC: SPEC-V3R3-DESIGN-PIPELINE-001 REQ-DPL-010 / AC-DPL-06
124+
Validator package: `internal/design/dtcg/` (SPEC.md 참조)
125+
126+
### 코드 생성 전 필수 검증 게이트
127+
128+
[HARD] **컴포넌트 생성, 스타일 파일 출력, JSX/TSX 렌더 등 모든 프론트엔드 코드 생성 단계 이전에**
129+
반드시 DTCG 검증기를 실행해야 한다.
130+
131+
```go
132+
import "github.com/modu-ai/moai-adk/internal/design/dtcg"
133+
134+
// tokens: tokens.json을 파싱한 map[string]any
135+
report, err := dtcg.Validate(tokens)
136+
if err != nil {
137+
// 검증 실행 자체 실패 (nil 입력 등) — 오케스트레이터에 반환
138+
return fmt.Errorf("DTCG 검증기 실행 실패: %w", err)
139+
}
140+
```
141+
142+
### 실패 처리 (report.Valid == false)
143+
144+
[HARD] `report.Valid == false`이면 **코드 생성을 중단**하고, 아래 구조화된 오류를 오케스트레이터에 반환한다.
145+
`report.Errors` 슬라이스 전체를 포함해야 오케스트레이터가 사용자에게 surfacing할 수 있다.
146+
147+
```go
148+
if !report.Valid {
149+
// 코드 생성 절대 금지 — 구조화된 오류 반환
150+
return &DTCGValidationFailure{
151+
TokenCount: report.TokenCount,
152+
ErrorCount: len(report.Errors),
153+
Errors: report.Errors, // []*dtcg.ValidationError — 경로, 카테고리, 규칙 포함
154+
Warnings: report.Warnings, // []*dtcg.ValidationWarning — 브랜드 충돌 등
155+
}
156+
}
157+
```
158+
159+
`ValidationError`에는 다음 필드가 포함된다:
160+
- `TokenPath`: 오류 토큰 경로 (예: `"colors.primary"`)
161+
- `Category`: DTCG $type (예: `"color"`, `"dimension"`)
162+
- `Rule`: 위반 규칙 설명
163+
- `Value`: 오류 유발 값
164+
165+
### 브랜드 컨텍스트 우선순위 (design constitution §3.1)
166+
167+
토큰이 DTCG 검증을 통과하더라도, `.moai/project/brand/visual-identity.md`에 정의된
168+
브랜드 색상과 충돌하는 경우 `report.Warnings``category: "brand-conflict"` 경고가 포함된다.
169+
[HARD] 브랜드 제약이 항상 우선한다 — 토큰 값이 아닌 브랜드 값을 사용해야 한다.
170+
171+
### 경고 처리 (Warnings만 있는 경우)
172+
173+
`report.Valid == true`이지만 `report.Warnings`가 있는 경우, 오케스트레이터에 경고를 surfacing하고
174+
사용자 결정을 기다린다. 경고만으로는 코드 생성을 차단하지 않는다.
175+
176+
### DTCG 지원 카테고리 (2025.10)
177+
178+
14개 카테고리: color, dimension, fontFamily, fontWeight, font, typography,
179+
duration, cubicBezier, number, strokeStyle, border, transition, shadow, gradient.
180+
181+
알 수 없는 카테고리는 오류로 처리된다 — 사용자가 DTCG 2025.10으로 토큰을 업그레이드해야 한다.
182+
121183
## @MX Tag Obligations
122184

123185
When creating or modifying source code, add @MX tags for the following patterns:

.claude/rules/moai/design/constitution.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## HISTORY
44

5+
- 2026-04-26 (SPEC-V3R3-DESIGN-PIPELINE-001): §4 Phase Contracts table extended with Path B1 (figma-extractor) and Path B2 (pencil-mcp) rows. Version 3.3.1 → 3.4.0.
56
- 2026-04-26 (SPEC-V3R3-DESIGN-FOLDER-FIX-001): §3.2 footnote 추가 — Reserved name violation은 `moai update` (update path)에서 warning + skip, `moai init` (scaffold path)에서 hard error. v3.3.0 → 3.3.1.
67
- 2026-04-20 (SPEC-DESIGN-CONST-AMEND-001): Section 3 expanded to tripartite structure (3.1/3.2/3.3). Version 3.2.0 → 3.3.0 (v3.3.0). FROZEN zone extended to cover each subsection individually.
78
- 2026-04-20: Relocated from `.claude/rules/agency/constitution.md` (v3.2.0) to `.claude/rules/moai/design/constitution.md` as part of SPEC-AGENCY-ABSORB-001 M1. Original path: `.claude/rules/agency/constitution.md`. No content changes. FROZEN zone and EVOLVABLE zone definitions are preserved verbatim.
@@ -114,6 +115,8 @@ Each phase produces typed artifacts consumed by downstream phases:
114115
| moai-workflow-design-import | Handoff bundle path | .moai/design/ reserved artifacts (see Section 3.2) | Path A |
115116
| expert-frontend | Copy JSON + design tokens | Working code (pages, components, styles) | Always |
116117
| evaluator-active | Built code + BRIEF | Score card + feedback | Always |
118+
| figma-extractor (Path B1) | BRIEF + Figma file ID + page selectors | tokens.json + components.json | Path B1 |
119+
| pencil-mcp (Path B2) | BRIEF + .pen files | tokens.json + components.json | Path B2 |
117120

118121
---
119122

@@ -399,7 +402,7 @@ If a graduated learning causes regression:
399402

400403
---
401404

402-
Version: 3.3.1
405+
Version: 3.4.0
403406
Classification: FROZEN_AMENDMENT
404407
Original Source: agency/constitution.md v3.2.0
405408
Last Updated: 2026-04-26

.claude/skills/moai-design-system/SKILL.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,78 @@ Pencil designs export to React + Tailwind via `moai-workflow-design-import`. The
133133

134134
For Figma MCP integration (fetching Figma design context), see moai-design-tools full skill.
135135

136+
---
137+
138+
## DTCG 2025.10 Token Specification (SPEC-V3R3-DESIGN-PIPELINE-001)
139+
140+
### Specification Reference
141+
142+
The W3C Design Tokens Community Group (DTCG) 2025.10 snapshot defines the canonical token
143+
format for MoAI design pipelines. A Go validator (`internal/design/dtcg/`) enforces schema
144+
compliance before `expert-frontend` consumes any `tokens.json` produced by Path A, B1, or B2.
145+
146+
> **Forward reference**: `internal/design/dtcg/SPEC.md` will be created in Phase 3 of
147+
> SPEC-V3R3-DESIGN-PIPELINE-001. Until then, the spec snapshot date is 2025-10 and the
148+
> supported categories are as listed below.
149+
150+
### Supported Token Categories (2025.10)
151+
152+
All 14 categories below MUST be validated by `internal/design/dtcg.Validate` before code
153+
generation:
154+
155+
| Category | Description | Example value format |
156+
|----------|-------------|----------------------|
157+
| `color` | Color values | `"#RRGGBB"`, CSS color string |
158+
| `dimension` | Length values with units | `"16px"`, `"1rem"` |
159+
| `font` | Font shorthand | CSS font shorthand string |
160+
| `fontFamily` | Font family stack | `"Inter, sans-serif"` |
161+
| `fontWeight` | Font weight | `400`, `"bold"` |
162+
| `duration` | Time values | `"200ms"`, `"0.2s"` |
163+
| `cubicBezier` | Easing curve | `[0.4, 0, 0.2, 1]` (4-number array) |
164+
| `number` | Unitless number | `1.5`, `16` |
165+
| `strokeStyle` | Stroke style keyword | `"solid"`, `"dashed"` |
166+
| `border` | Border composite | `{ color, width, style }` |
167+
| `transition` | Transition composite | `{ duration, timingFunction, delay }` |
168+
| `shadow` | Shadow composite | `{ color, offsetX, offsetY, blur, spread }` |
169+
| `gradient` | Gradient composite | `{ type, stops }` |
170+
| `typography` | Typography composite | `{ fontFamily, fontSize, fontWeight, lineHeight }` |
171+
172+
### Validator Invocation Guidance
173+
174+
`expert-frontend` MUST call `internal/design/dtcg.Validate(tokensJSON)` before generating
175+
any frontend code from a `tokens.json` file. This applies to all three paths (A, B1, B2).
176+
177+
Validation failure produces a structured error report:
178+
179+
```
180+
dtcg.ValidationError{
181+
TokenPath: "colors.primary", // DTCG token path
182+
Category: "color", // Expected category
183+
Rule: "invalid_format", // Violated rule
184+
Got: "PRIMARY_BLUE", // Actual value found
185+
}
186+
```
187+
188+
On validation failure: surface the structured error report to the orchestrator and block
189+
code generation. Do not attempt to auto-correct token values.
190+
191+
### Brand Context Priority
192+
193+
Design constitution §3.1 (FROZEN): brand context (`.moai/project/brand/visual-identity.md`)
194+
is the constitutional parent. Token values from any path that conflict with brand constraints
195+
MUST be flagged as warnings and presented for user resolution — not silently overridden.
196+
197+
The DTCG validator gate runs AFTER brand context is loaded and BEFORE frontend code
198+
generation. The validation order is:
199+
200+
1. Load brand context (`.moai/project/brand/`)
201+
2. Run DTCG validator on `tokens.json`
202+
3. Cross-check DTCG-valid tokens against brand constraints
203+
4. Surface conflicts as warnings
204+
5. Proceed to `expert-frontend` code generation
205+
206+
---
207+
136208
<!-- moai:evolvable-start id="verification" -->
137209
## Verification
138210

@@ -142,5 +214,8 @@ For Figma MCP integration (fetching Figma design context), see moai-design-tools
142214
- [ ] Color contrast ratios verified (4.5:1 normal text, 3:1 UI components)
143215
- [ ] Web copy free of AI-generic filler phrases
144216
- [ ] Pencil MCP tools used via batch operations (not individual calls) for performance
217+
- [ ] DTCG 2025.10 validator invoked before expert-frontend code generation (REQ-DPL-010)
218+
- [ ] Brand context loaded before DTCG validation (design constitution §3.1)
219+
- [ ] Validation errors surface structured report (not silent auto-correction)
145220

146221
<!-- moai:evolvable-end -->

.claude/skills/moai-workflow-design-import/SKILL.md

Lines changed: 110 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
name: moai-workflow-design-import
33
description: >
4-
Parses Claude Design handoff bundle (ZIP or HTML) and extracts design tokens,
5-
component manifests, and static assets for expert-frontend delegation. Validates
6-
bundle version against the supported_bundle_versions whitelist and returns
7-
structured error codes on failure with path B fallback guidance.
4+
Handles /moai design 3-path routing: Path A (Claude Design handoff bundle), Path B1
5+
(Figma extractor via meta-harness), Path B2 (Pencil MCP via meta-harness). Validates
6+
bundle version against supported_bundle_versions whitelist and returns structured error
7+
codes on failure. Depends on SPEC-V3R3-HARNESS-001 for Path B1/B2.
88
license: Apache-2.0
99
compatibility: Designed for Claude Code
1010
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
1111
user-invocable: false
1212
metadata:
13-
version: "1.0.0"
13+
version: "1.1.0"
1414
category: "workflow"
1515
status: "active"
16-
updated: "2026-04-20"
17-
tags: "design import, handoff bundle, claude design, design tokens, components"
18-
related-skills: "moai-domain-brand-design, moai-workflow-gan-loop"
16+
updated: "2026-04-27"
17+
tags: "design import, handoff bundle, claude design, design tokens, components, figma, pencil, meta-harness"
18+
related-skills: "moai-domain-brand-design, moai-workflow-gan-loop, moai-meta-harness"
1919

2020
# MoAI Extension: Progressive Disclosure
2121
progressive_disclosure:
@@ -25,20 +25,44 @@ progressive_disclosure:
2525

2626
# MoAI Extension: Triggers
2727
triggers:
28-
keywords: ["design import", "handoff bundle", "claude design", "bundle path", "design zip", "import bundle"]
28+
keywords: ["design import", "handoff bundle", "claude design", "bundle path", "design zip", "import bundle", "figma extractor", "pencil mcp", "path b1", "path b2"]
2929
agents: ["expert-frontend"]
3030
phases: ["run"]
3131
---
3232

3333
# moai-workflow-design-import
3434

35-
Handles Claude Design handoff bundle ingestion for the `/moai design` path A workflow. Validates bundle format, extracts design artifacts, and prepares structured output for `expert-frontend` delegation.
35+
Handles `/moai design` 3-path routing for design artifact ingestion. Each path produces
36+
DTCG-validated design tokens at `.moai/design/tokens.json` for `expert-frontend` consumption.
3637

37-
This skill is invoked only when the user selects path A (Claude Design) in `/moai design` and provides a local bundle file path.
38+
**Path A** (Claude Design): Existing handoff bundle import — preserved verbatim.
39+
**Path B1** (Figma): Meta-harness generates a project-scoped figma-extractor skill.
40+
**Path B2** (Pencil): Meta-harness generates a project-scoped pencil-mcp skill.
41+
42+
Reserved output paths (design constitution §3.2): `tokens.json`, `components.json`,
43+
`assets/`, `import-warnings.json`, `brief/BRIEF-*.md` — all written to `.moai/design/`.
3844

3945
---
4046

41-
## Quick Reference
47+
## Path Selection
48+
49+
When `/moai design` requires path selection, present via AskUserQuestion:
50+
1. **Path A — Claude Design** (권장): Handoff bundle (ZIP or HTML) from Claude Design.
51+
2. **Path B1 — Figma**: Figma file access; meta-harness generates `my-harness-figma-extractor`.
52+
3. **Path B2 — Pencil**: `.pen` files; meta-harness generates `my-harness-pencil-mcp`.
53+
54+
Selection is persisted to `.moai/design/path-selection.json` for audit.
55+
56+
Brand context (`.moai/project/brand/`) is the constitutional parent across all paths — no
57+
path may override brand constraints (design constitution §3.1, §3.3).
58+
59+
---
60+
61+
---
62+
63+
## Path A — Claude Design Handoff Bundle
64+
65+
*This section is preserved verbatim from v1.0.0. Path A behavior is unchanged.*
4266

4367
### Supported Bundle Formats (Phase 1)
4468

@@ -231,13 +255,85 @@ When extracting assets:
231255

232256
---
233257

258+
---
259+
260+
## Path B1 — Figma Extractor (via Meta-Harness)
261+
262+
**Prerequisite**: SPEC-V3R3-HARNESS-001 meta-harness skill (`moai-meta-harness`) must be
263+
available. Path B1 does NOT ship a static Figma skill — it is generated dynamically.
264+
265+
### Invocation
266+
267+
When the user selects Path B1, invoke `moai-meta-harness` to generate:
268+
269+
```
270+
.claude/skills/my-harness-figma-extractor/SKILL.md
271+
```
272+
273+
The generated skill is project-scoped and user-owned (`my-harness-*` prefix). It will never
274+
be overwritten by `moai update`.
275+
276+
### Generation Contract
277+
278+
`moai-meta-harness` Phase 5 (Customization) produces `my-harness-figma-extractor` with:
279+
280+
- **Figma file ID**: project-specific file identifier (collected during Socratic interview)
281+
- **Page selectors**: which Figma pages map to which token categories
282+
- **Credential reference**: environment variable name holding the Figma API token
283+
(e.g., `FIGMA_TOKEN`). The token value is NEVER stored in the skill file.
284+
285+
The generated extractor skill produces `tokens.json` + `components.json` at `.moai/design/`
286+
matching the reserved file paths in design constitution §3.2.
287+
288+
### Output
289+
290+
After `my-harness-figma-extractor` runs, this skill receives the produced artifacts at
291+
`.moai/design/` and proceeds to DTCG validation before `expert-frontend` consumption.
292+
293+
---
294+
295+
## Path B2 — Pencil MCP (via Meta-Harness)
296+
297+
**Prerequisite**: SPEC-V3R3-HARNESS-001 meta-harness skill (`moai-meta-harness`) must be
298+
available. Path B2 is implemented via dynamically generated `my-harness-pencil-mcp` skill
299+
(SPEC-V3R3-HARNESS-001 BC-V3R3-007 16-skill removal — legacy static skill archived).
300+
301+
### Invocation
302+
303+
When the user selects Path B2, invoke `moai-meta-harness` to generate:
304+
305+
```
306+
.claude/skills/my-harness-pencil-mcp/SKILL.md
307+
```
308+
309+
### Generation Contract
310+
311+
`moai-meta-harness` Phase 5 produces `my-harness-pencil-mcp` with:
312+
313+
- **`.pen` file locations**: glob patterns for the project's Pencil design files
314+
- **Pencil MCP server endpoint**: local server URL (default: `http://localhost:11111`)
315+
- **Export configuration**: which Pencil frames/pages map to token categories
316+
317+
The generated skill uses `mcp__pencil__*` tools (already listed in `moai-design-system`
318+
allowed-tools) to extract design data and write to `.moai/design/`.
319+
320+
### Output
321+
322+
After `my-harness-pencil-mcp` runs, this skill receives artifacts at `.moai/design/` and
323+
proceeds to DTCG validation before `expert-frontend` consumption.
324+
325+
---
326+
234327
## Works Well With
235328

236329
- `moai-domain-brand-design`: Fallback path when bundle import fails
237330
- `moai-workflow-gan-loop`: Receives extracted tokens for quality evaluation
238331
- `expert-frontend`: Primary consumer of extracted design artifacts
332+
- `moai-meta-harness`: Generates `my-harness-figma-extractor` and `my-harness-pencil-mcp`
333+
for Path B1/B2 (SPEC-V3R3-HARNESS-001)
334+
- `moai-design-system`: DTCG token validation guidance and design system context
239335

240336
---
241337

242-
REQ coverage: REQ-SKILL-007, REQ-SKILL-008, REQ-SKILL-009, REQ-SKILL-010, REQ-SKILL-015
243-
Version: 1.0.0
338+
REQ coverage: REQ-DPL-001, REQ-DPL-002, REQ-DPL-003, REQ-SKILL-007, REQ-SKILL-008, REQ-SKILL-009, REQ-SKILL-010, REQ-SKILL-015
339+
Version: 1.1.0 (SPEC-V3R3-DESIGN-PIPELINE-001 Wave C.1)

.claude/skills/moai/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ For detailed orchestration: Read ${CLAUDE_SKILL_DIR}/workflows/e2e.md
199199

200200
Purpose: Produce web/brand design artifacts via Claude Design import (path A) or code-based skill pipeline (path B). Integrates brand context from `.moai/project/brand/` and design briefs from `.moai/design/`.
201201
Agents: manager-spec (BRIEF), expert-frontend (implementation), evaluator-active (GAN loop scoring)
202-
Skills: moai-domain-copywriting, moai-domain-brand-design, moai-workflow-design-import, moai-workflow-gan-loop, moai-workflow-design-context, moai-workflow-pencil-integration
202+
Skills: moai-domain-copywriting, moai-domain-brand-design, moai-workflow-design-import, moai-workflow-gan-loop, moai-workflow-design-context, my-harness-pencil-mcp (Path B2, generated by meta-harness)
203203
Flags: --path A|B, --harness thorough|standard, --brief BRIEF-XXX
204204
For detailed orchestration: Read ${CLAUDE_SKILL_DIR}/workflows/design.md
205205

0 commit comments

Comments
 (0)