Skip to content

Commit e20eb24

Browse files
authored
Merge pull request #16 from singyichen/refactor/design-folder-restructure
refactor: consolidate design folders under design/
2 parents 526c8b8 + b4e3838 commit e20eb24

27 files changed

Lines changed: 7296 additions & 1416 deletions

File tree

.claude/skills/ui-ux-pro-max/SKILL.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,24 @@ winget install Python.Python.3.12
122122

123123
When user requests UI/UX work (design, build, create, implement, review, fix, improve), follow this workflow:
124124

125+
### Step 0: Load Existing Project Design System (if present)
126+
127+
Before doing any design work, check whether this project already has a design system:
128+
129+
1. **Read `design/system/MASTER.md`** (if it exists) — this is the authoritative style spec: color tokens, typography, spacing, components, and anti-patterns. Always follow it instead of generating a new design system from scratch.
130+
131+
2. **Read `design/wireframes/design-system.pen`** (if it exists) via Pencil MCP tools — this contains the **visual component library** that is the source of truth for implemented component specs:
132+
```
133+
mcp__pencil__open_document("design/wireframes/design-system.pen")
134+
mcp__pencil__get_editor_state(include_schema=false)
135+
mcp__pencil__batch_get(patterns=[{reusable: true}], readDepth=2)
136+
```
137+
Extract: reusable component IDs, their fills/strokes/cornerRadius/padding/font values, and variable names (e.g. `$color-surface`, `$color-ink`). Use these exact values when implementing prototype components — **do not invent new values**.
138+
139+
3. **Page-specific overrides**: also check `design/system/pages/[page-name].md` if building a specific page. Its rules override MASTER.md.
140+
141+
If neither file exists, proceed with Step 1–4 as normal to generate a new design system.
142+
125143
### Step 1: Analyze User Requirements
126144

127145
Extract key information from user request:
@@ -158,21 +176,21 @@ python3 skills/ui-ux-pro-max/scripts/search.py "<query>" --design-system --persi
158176
```
159177

160178
This creates:
161-
- `design-system/MASTER.md` — Global Source of Truth with all design rules
162-
- `design-system/pages/` — Folder for page-specific overrides
179+
- `design/system/<project-slug>/MASTER.md` — Global Source of Truth with all design rules
180+
- `design/system/<project-slug>/pages/` — Folder for page-specific overrides
163181

164182
**With page-specific override:**
165183
```bash
166184
python3 skills/ui-ux-pro-max/scripts/search.py "<query>" --design-system --persist -p "Project Name" --page "dashboard"
167185
```
168186

169187
This also creates:
170-
- `design-system/pages/dashboard.md` — Page-specific deviations from Master
188+
- `design/system/<project-slug>/pages/dashboard.md` — Page-specific deviations from Master
171189

172190
**How hierarchical retrieval works:**
173-
1. When building a specific page (e.g., "Checkout"), first check `design-system/pages/checkout.md`
191+
1. When building a specific page (e.g., "Checkout"), first check `design/system/<project-slug>/pages/checkout.md`
174192
2. If the page file exists, its rules **override** the Master file
175-
3. If not, use `design-system/MASTER.md` exclusively
193+
3. If not, use `design/system/<project-slug>/MASTER.md` exclusively
176194

177195
### Step 3: Supplement with Detailed Searches (as needed)
178196

.claude/skills/ui-ux-pro-max/scripts/design_system.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def generate_design_system(query: str, project_name: str = None, output_format:
468468
query: Search query (e.g., "SaaS dashboard", "e-commerce luxury")
469469
project_name: Optional project name for output header
470470
output_format: "ascii" (default) or "markdown"
471-
persist: If True, save design system to design-system/ folder
471+
persist: If True, save design system to design/system/ folder
472472
page: Optional page name for page-specific override file
473473
output_dir: Optional output directory (defaults to current working directory)
474474
@@ -490,7 +490,7 @@ def generate_design_system(query: str, project_name: str = None, output_format:
490490
# ============ PERSISTENCE FUNCTIONS ============
491491
def persist_design_system(design_system: dict, page: str = None, output_dir: str = None, page_query: str = None) -> dict:
492492
"""
493-
Persist design system to design-system/<project>/ folder using Master + Overrides pattern.
493+
Persist design system to design/system/<project>/ folder using Master + Overrides pattern.
494494
495495
Args:
496496
design_system: The generated design system dictionary
@@ -507,7 +507,7 @@ def persist_design_system(design_system: dict, page: str = None, output_dir: str
507507
project_name = design_system.get("project_name", "default")
508508
project_slug = project_name.lower().replace(' ', '-')
509509

510-
design_system_dir = base_dir / "design-system" / project_slug
510+
design_system_dir = base_dir / "design" / "system" / project_slug
511511
pages_dir = design_system_dir / "pages"
512512

513513
created_files = []
@@ -542,21 +542,22 @@ def persist_design_system(design_system: dict, page: str = None, output_dir: str
542542
def format_master_md(design_system: dict) -> str:
543543
"""Format design system as MASTER.md with hierarchical override logic."""
544544
project = design_system.get("project_name", "PROJECT")
545+
project_slug = project.lower().replace(' ', '-')
545546
pattern = design_system.get("pattern", {})
546547
style = design_system.get("style", {})
547548
colors = design_system.get("colors", {})
548549
typography = design_system.get("typography", {})
549550
effects = design_system.get("key_effects", "")
550551
anti_patterns = design_system.get("anti_patterns", "")
551-
552+
552553
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
553-
554+
554555
lines = []
555-
556+
556557
# Logic header
557558
lines.append("# Design System Master File")
558559
lines.append("")
559-
lines.append("> **LOGIC:** When building a specific page, first check `design-system/pages/[page-name].md`.")
560+
lines.append(f"> **LOGIC:** When building a specific page, first check `design/system/{project_slug}/pages/[page-name].md`.")
560561
lines.append("> If that file exists, its rules **override** this Master file.")
561562
lines.append("> If not, strictly follow the rules below.")
562563
lines.append("")
@@ -805,21 +806,22 @@ def format_master_md(design_system: dict) -> str:
805806
def format_page_override_md(design_system: dict, page_name: str, page_query: str = None) -> str:
806807
"""Format a page-specific override file with intelligent AI-generated content."""
807808
project = design_system.get("project_name", "PROJECT")
809+
project_slug = project.lower().replace(' ', '-')
808810
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
809811
page_title = page_name.replace("-", " ").replace("_", " ").title()
810-
812+
811813
# Detect page type and generate intelligent overrides
812814
page_overrides = _generate_intelligent_overrides(page_name, page_query, design_system)
813-
815+
814816
lines = []
815-
817+
816818
lines.append(f"# {page_title} Page Overrides")
817819
lines.append("")
818820
lines.append(f"> **PROJECT:** {project}")
819821
lines.append(f"> **Generated:** {timestamp}")
820822
lines.append(f"> **Page Type:** {page_overrides.get('page_type', 'General')}")
821823
lines.append("")
822-
lines.append("> ⚠️ **IMPORTANT:** Rules in this file **override** the Master file (`design-system/MASTER.md`).")
824+
lines.append(f"> ⚠️ **IMPORTANT:** Rules in this file **override** the Master file (`design/system/{project_slug}/MASTER.md`).")
823825
lines.append("> Only deviations from the Master are documented here. For all other rules, refer to the Master.")
824826
lines.append("")
825827
lines.append("---")

.claude/skills/ui-ux-pro-max/scripts/search.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
Stacks: html-tailwind, react, nextjs
1111
1212
Persistence (Master + Overrides pattern):
13-
--persist Save design system to design-system/MASTER.md
14-
--page Also create a page-specific override file in design-system/pages/
13+
--persist Save design system to design/system/MASTER.md
14+
--page Also create a page-specific override file in design/system/pages/
1515
"""
1616

1717
import argparse
@@ -65,8 +65,8 @@ def format_output(result):
6565
parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name for design system output")
6666
parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format for design system")
6767
# Persistence (Master + Overrides pattern)
68-
parser.add_argument("--persist", action="store_true", help="Save design system to design-system/MASTER.md (creates hierarchical structure)")
69-
parser.add_argument("--page", type=str, default=None, help="Create page-specific override file in design-system/pages/")
68+
parser.add_argument("--persist", action="store_true", help="Save design system to design/system/MASTER.md (creates hierarchical structure)")
69+
parser.add_argument("--page", type=str, default=None, help="Create page-specific override file in design/system/pages/")
7070
parser.add_argument("--output-dir", "-o", type=str, default=None, help="Output directory for persisted files (default: current directory)")
7171

7272
args = parser.parse_args()
@@ -87,13 +87,13 @@ def format_output(result):
8787
if args.persist:
8888
project_slug = args.project_name.lower().replace(' ', '-') if args.project_name else "default"
8989
print("\n" + "=" * 60)
90-
print(f"✅ Design system persisted to design-system/{project_slug}/")
91-
print(f" 📄 design-system/{project_slug}/MASTER.md (Global Source of Truth)")
90+
print(f"✅ Design system persisted to design/system/{project_slug}/")
91+
print(f" 📄 design/system/{project_slug}/MASTER.md (Global Source of Truth)")
9292
if args.page:
9393
page_filename = args.page.lower().replace(' ', '-')
94-
print(f" 📄 design-system/{project_slug}/pages/{page_filename}.md (Page Overrides)")
94+
print(f" 📄 design/system/{project_slug}/pages/{page_filename}.md (Page Overrides)")
9595
print("")
96-
print(f"📖 Usage: When building a page, check design-system/{project_slug}/pages/[page].md first.")
96+
print(f"📖 Usage: When building a page, check design/system/{project_slug}/pages/[page].md first.")
9797
print(f" If exists, its rules override MASTER.md. Otherwise, use MASTER.md.")
9898
print("=" * 60)
9999
# Stack search

.github/workflows/deploy-prototype.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Deploy Prototype to GitHub Pages
33
on:
44
push:
55
branches: [main]
6-
paths: ['prototype/**']
6+
paths: ['design/prototype/**']
77
workflow_dispatch: # allow manual trigger
88

99
concurrency:
@@ -29,7 +29,7 @@ jobs:
2929

3030
- uses: actions/upload-pages-artifact@v3
3131
with:
32-
path: prototype/
32+
path: design/prototype/
3333

3434
- uses: actions/deploy-pages@v4
3535
id: deployment

.specify/memory/constitution.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ Evaluation results must be fair and reproducible.
3434

3535
- Test-set answers must never be exposed to annotators
3636
- Scoring logic must be transparent and covered by tests
37-
- Leaderboard update mechanism must prevent duplicate submission abuse
3837

3938
### IV. Test-First (RECOMMENDED)
4039
- Backend: pytest coverage target ≥ 80%
41-
- E2E: Playwright covers core user flows (labeling, submission, leaderboard)
40+
- E2E: Playwright covers core user flows (labeling, submission, review)
4241
- Tests must be written and confirmed to fail before implementation begins
4342

4443
### V. Simplicity
@@ -48,7 +47,7 @@ Evaluation results must be fair and reproducible.
4847

4948
### VI. English-First
5049
- Code, comments, docstrings, commit messages, and variable/function names are always written in English
51-
- Traditional Chinese is permitted in `docs/` and `specs/` directories to accelerate research documentation
50+
- Traditional Chinese is permitted in `docs/`, `specs/`, `design/prototype/`, and `design/wireframes/` directories to accelerate research documentation and UI iteration
5251
- The only fully Chinese file outside those directories is `README.zh-TW.md`
5352

5453
## Governance
@@ -68,4 +67,4 @@ Constitution principles take precedence over all other conventions.
6867

6968
**Compliance Review**: All PRs must verify compliance with all six principles before merging. Use `/speckit.analyze` to check cross-artifact consistency and Constitution alignment.
7069

71-
**Version**: 1.2.1 | **Ratified**: 2026-03-18 | **Last Amended**: 2026-03-25
70+
**Version**: 1.2.3 | **Ratified**: 2026-03-18 | **Last Amended**: 2026-03-30

.specify/templates/agent-file-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Auto-generated from feature plans. Last updated: [DATE]
2525
- **KISS & YAGNI**: Pursue extreme simplicity. Reject over-engineering; write code only for current, clearly defined needs.
2626
- **Config-Driven**: Task types and evaluation metrics are defined in YAML/JSON config — never hardcoded.
2727
- **Security First (NON-NEGOTIABLE)**: Test-set answers must never be exposed to annotators or included in any annotator-facing API response.
28-
- **English-First**: Code, comments, and commit messages are written in English. Traditional Chinese is permitted in `docs/` and `specs/`.
28+
- **English-First**: Code, comments, and commit messages are written in English. Traditional Chinese is permitted in `docs/`, `specs/`, `design/prototype/`, and `design/wireframes/`.
2929

3030
## Protected Files
3131

.specify/templates/plan-template.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- [ ] III. Data Fairness: Does this involve test sets? If so, leakage prevention is planned
2525
- [ ] IV. Test-First: Test plan is listed
2626
- [ ] V. Simplicity: Any signs of over-engineering?
27-
- [ ] VI. English-First: Code, comments, and commit messages in English; Traditional Chinese allowed in `docs/` and `specs/`
27+
- [ ] VI. English-First: Code, comments, and commit messages in English; Traditional Chinese allowed in `docs/`, `specs/`, `design/prototype/`, and `design/wireframes/`
2828

2929
## Project Structure
3030

@@ -60,6 +60,42 @@ backend/
6060
└── integration/test_[feature].py
6161
```
6262

63+
## System Flow & Data Flow *(include if feature involves API calls, async tasks, or multi-layer data processing)*
64+
65+
<!--
66+
Show how data moves through the system layers: Frontend → API → Service → DB.
67+
Include error paths and async flows (Celery tasks, WebSocket, etc.) where relevant.
68+
Renders natively on GitHub — no extra tooling needed.
69+
-->
70+
71+
```mermaid
72+
sequenceDiagram
73+
participant Frontend
74+
participant API
75+
participant Service
76+
participant DB
77+
78+
Frontend->>API: POST /api/[resource] {payload}
79+
API->>Service: [function_name](dto)
80+
Service->>DB: INSERT / UPDATE [table]
81+
DB-->>Service: return [entity]
82+
Service-->>API: [ResponseSchema]
83+
API-->>Frontend: 200 [ResponseDTO]
84+
85+
Note over Service,API: Error path
86+
Service-->>API: raise [Exception] {detail: "..."}
87+
API-->>Frontend: 4xx / 5xx {detail: "..."}
88+
```
89+
90+
| Layer | Component | Responsibility |
91+
|-------|-----------|---------------|
92+
| Frontend | `pages/[feature]` | Form state, API call, display result |
93+
| API | `api/routes/[feature].py` | Request validation, auth check, delegate to service |
94+
| Service | `services/[feature].py` | Business logic, DB interaction |
95+
| DB | `models/[feature].py` | Persistence |
96+
97+
---
98+
6399
## Complexity Tracking
64100

65101
> Only fill in when a Constitution principle is violated and justification is required

.specify/templates/spec-template.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@
55
**Status**: Draft
66
**Input**: User description: "$ARGUMENTS"
77

8+
## Process Flow *(include if feature involves a multi-step business process or cross-role workflow)*
9+
10+
<!--
11+
Describe the end-to-end business process BEFORE breaking it into user stories.
12+
Focus on WHO does WHAT and in what ORDER — not on technical implementation.
13+
Use a Mermaid sequenceDiagram and a step table. Renders natively on GitHub — no extra tooling needed.
14+
-->
15+
16+
```mermaid
17+
sequenceDiagram
18+
actor ActorA
19+
participant System
20+
actor ActorB
21+
22+
ActorA->>System: [action]
23+
System-->>ActorB: [notification / response]
24+
ActorB->>System: [confirmation / next action]
25+
```
26+
27+
| Step | Role | Action | System Response |
28+
|------|------|--------|----------------|
29+
| 1 | [Role] | [What they do] | [What the system does] |
30+
31+
---
32+
833
## User Scenarios & Testing *(required)*
934

1035
<!--
@@ -54,6 +79,30 @@
5479
- **FR-002**: The system MUST [specific capability]
5580
- **FR-003**: Users MUST be able to [key interaction]
5681

82+
### User Flow & Navigation *(include if feature introduces new pages or modifies navigation)*
83+
84+
<!--
85+
1. Map every screen and its navigation triggers to prevent orphan pages.
86+
2. Include a Mermaid flowchart for flows with 3+ screens or branching paths.
87+
Renders natively on GitHub — no extra tooling needed.
88+
-->
89+
90+
```mermaid
91+
flowchart LR
92+
Login --> |login success| Dashboard
93+
Dashboard --> |click avatar| Profile
94+
Profile --> |sidebar link| Dashboard
95+
Dashboard --> |sign out| Login
96+
```
97+
98+
| From | Trigger | To |
99+
|------|---------|-----|
100+
| [Page A] | [e.g. click avatar] | [Page B] |
101+
| [Page B] | [e.g. sidebar link] | [Page A] |
102+
103+
**Entry points**: [Which existing pages link INTO the new pages?]
104+
**Exit points**: [Which pages can users navigate to FROM the new pages?]
105+
57106
### Key Entities *(include if feature involves data)*
58107

59108
- **[Entity 1]**: [What it represents, key attributes]

0 commit comments

Comments
 (0)