prizmkit 1.1.53 → 1.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-prizmkit.js +2 -0
- package/bundled/VERSION.json +3 -3
- package/bundled/rules/_rules-metadata.json +6 -1
- package/bundled/rules/general/cohesive-modeling.md +27 -0
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/app-planner/SKILL.md +114 -4
- package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +609 -0
- package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +285 -0
- package/bundled/skills/app-planner/references/rules/backend/question-bank.md +249 -0
- package/bundled/skills/app-planner/references/rules/backend/template.md +173 -0
- package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +373 -0
- package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +211 -0
- package/bundled/skills/app-planner/references/rules/database/question-bank.md +184 -0
- package/bundled/skills/app-planner/references/rules/database/template.md +158 -0
- package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +810 -0
- package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +188 -0
- package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +302 -0
- package/bundled/skills/app-planner/references/rules/frontend/template.md +320 -0
- package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +639 -0
- package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +290 -0
- package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +232 -0
- package/bundled/skills/app-planner/references/rules/mobile/template.md +175 -0
- package/bundled/skills/prizm-kit/SKILL.md +1 -1
- package/bundled/skills/prizmkit-init/SKILL.md +47 -6
- package/bundled/skills/prizmkit-init/references/config-schema.md +7 -3
- package/bundled/skills/prizmkit-init/references/rules/layer-detection.md +41 -0
- package/package.json +1 -1
- package/src/index.js +10 -0
- package/src/scaffold.js +124 -7
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# Fixed Rules — Complete Frontend Fixed Rules
|
|
2
|
+
|
|
3
|
+
> This file is read by the `frontend-rules` skill in Phase 1 and injected directly into `frontend-rules.md`.
|
|
4
|
+
> These rules are industry consensus / best practices — **do not ask the user**.
|
|
5
|
+
> Every rule includes RATIONALE so the AI understands intent, not just constraints.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## F1. Types & Code Quality
|
|
10
|
+
|
|
11
|
+
### F1.1 TypeScript Strict Mode
|
|
12
|
+
- **Rule**: `tsconfig.json` must enable `"strict": true`.
|
|
13
|
+
- **Forbidden**: Using `any`. Use `unknown` and apply type guards before use.
|
|
14
|
+
- **Forbidden**: `@ts-ignore`. If ignoring is necessary, use `@ts-expect-error` with a reason comment.
|
|
15
|
+
- **RATIONALE**: Types are the safety net for large projects. AI understands context more accurately in strict mode.
|
|
16
|
+
|
|
17
|
+
### F1.2 Lint & Formatting
|
|
18
|
+
- **Rule**: ESLint + Prettier config must be committed to the repository root.
|
|
19
|
+
- **Rule**: Git pre-commit hooks (husky + lint-staged) enforce lint and format.
|
|
20
|
+
- **Forbidden**: Committing `console.log`, `debugger`, unattributed `TODO` (must include issue number or owner).
|
|
21
|
+
- **RATIONALE**: Automated guardrails are always more reliable than manual review.
|
|
22
|
+
|
|
23
|
+
### F1.3 Naming Conventions
|
|
24
|
+
- **Component files**: PascalCase (`UserCard.tsx`)
|
|
25
|
+
- **Hook files**: camelCase prefixed with `use` (`useAuth.ts`)
|
|
26
|
+
- **Utility functions**: camelCase (`formatDate.ts`)
|
|
27
|
+
- **Constants**: SCREAMING_SNAKE_CASE (`MAX_RETRY_COUNT`)
|
|
28
|
+
- **Types/Interfaces**: PascalCase. Avoid `I` prefix (`User`, not `IUser`).
|
|
29
|
+
- **Forbidden**: Pinyin names, meaningless abbreviations (`a`/`b`/`tmp`), numeric suffixes (`button2`/`utils3`).
|
|
30
|
+
- **RATIONALE**: Consistent naming significantly improves AI search/completion hit rates.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## F2. Style Deny List (universally applicable)
|
|
35
|
+
|
|
36
|
+
- **Forbid** `!important` (unless overriding uncontrollable third-party styles, with a comment explaining why).
|
|
37
|
+
- **Forbid** hardcoded color values (must use design tokens).
|
|
38
|
+
- **Forbid** hardcoded font sizes, line heights, spacing, border radius, shadows, animation durations.
|
|
39
|
+
- **Forbid** magic numbers (must use named constants).
|
|
40
|
+
- **Forbid** inline `style` attributes (unless for dynamically computed positions/sizes, with a comment).
|
|
41
|
+
- **Forbid** raw `z-index` numbers (must use a z-index layer constant).
|
|
42
|
+
- **RATIONALE**: Hardcoded values make the design system meaningless. Once AI learns to hardcode, it spreads everywhere.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## F3. Component Design
|
|
47
|
+
|
|
48
|
+
### F3.1 Component Contract
|
|
49
|
+
- **Rule**: All Props must have complete TypeScript types. Forbid `Props: any`.
|
|
50
|
+
- **Rule**: Components must support `className` forwarding, merged via `clsx`/`cn`.
|
|
51
|
+
- **Rule**: Controlled vs. uncontrolled must be explicit. "Semi-controlled" is not allowed.
|
|
52
|
+
- **Rule**: Exposed `ref` must use `forwardRef` with typing.
|
|
53
|
+
- **RATIONALE**: Unclear component contracts are the main reason AI breaks three things when changing one.
|
|
54
|
+
|
|
55
|
+
### F3.2 File Size
|
|
56
|
+
- **Rule**: Single component file ≤ 300 lines (including comments).
|
|
57
|
+
- **Rule**: Beyond this, split by logic/view/types into the same directory.
|
|
58
|
+
- **RATIONALE**: Beyond 300 lines, the risk of AI losing context during modification spikes sharply.
|
|
59
|
+
|
|
60
|
+
### F3.3 Four-State Completeness
|
|
61
|
+
- **Rule**: All data-driven views must explicitly handle `loading` / `error` / `empty` / `success` states.
|
|
62
|
+
- **Forbid**: Using `data && <UI/>` to gloss over the empty state.
|
|
63
|
+
- **RATIONALE**: Missing states are the largest source of hidden UX bugs.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## F4. Internationalization (i18n) Baseline
|
|
68
|
+
|
|
69
|
+
- **Forbid**: Hardcoding any user-visible text (buttons, titles, tooltips, error messages, empty states, placeholders).
|
|
70
|
+
- **Rule**: All user-visible text must use i18n keys.
|
|
71
|
+
- **Rule**: i18n key naming follows `page.section.element` three-segment format (e.g., `login.form.submitBtn`).
|
|
72
|
+
- **Exception**: Pure brand names, trademarks, fixed acronyms (like `API`, `URL`) may be hardcoded.
|
|
73
|
+
- **RATIONALE**: Even for single-language projects, reserving the i18n channel costs almost nothing. Retrofitting it later costs an enormous amount.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## F5. Error Handling
|
|
78
|
+
|
|
79
|
+
- **Rule**: Route-level ErrorBoundary must exist.
|
|
80
|
+
- **Rule**: Async operations must have loading + error UI. "Silent failure" is not allowed.
|
|
81
|
+
- **Rule**: API failures must have user notification (toast/inline) + retry entry.
|
|
82
|
+
- **Rule**: Caught errors must be reported to monitoring (Sentry / custom).
|
|
83
|
+
- **Forbid**: `catch(e) {}` empty catch blocks.
|
|
84
|
+
- **RATIONALE**: The worst frontend experience isn't a bug — it's "nothing happened."
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## F6. Accessibility (a11y Baseline)
|
|
89
|
+
|
|
90
|
+
- **Rule**: All interactive elements must be keyboard-operable (Tab/Enter/Space/Esc).
|
|
91
|
+
- **Rule**: Images must have `alt`. Decorative images use `alt=""`.
|
|
92
|
+
- **Rule**: Icon buttons must have `aria-label`.
|
|
93
|
+
- **Rule**: Form controls must be associated with `<label>` (`htmlFor` or wrapping).
|
|
94
|
+
- **Rule**: Modal open must move focus into the modal. Modal close must return focus to the trigger element.
|
|
95
|
+
- **Forbid**: `<div onClick>` as a substitute for `<button>`.
|
|
96
|
+
- **Forbid**: Conveying information through color alone (must pair with icon/text).
|
|
97
|
+
- **RATIONALE**: a11y is not a moral requirement — it's a legal requirement (GDPR/ADA), and SEO shares the same foundation.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## F7. Git Collaboration
|
|
102
|
+
|
|
103
|
+
### F7.1 Branching & Commits
|
|
104
|
+
- **Branch naming**: `feat/xxx`, `fix/xxx`, `refactor/xxx`, `chore/xxx`, `docs/xxx`.
|
|
105
|
+
- **Commit messages**: Follow Conventional Commits (`type(scope): subject`).
|
|
106
|
+
- **Rule**: Main branch protection. PR + Code Review required to merge.
|
|
107
|
+
- **Rule**: Single PR changes ≤ 500 lines (generated code excluded). Beyond this, must split.
|
|
108
|
+
|
|
109
|
+
### F7.2 PR Self-Check Checklist (must review each item)
|
|
110
|
+
- [ ] Local `lint` / `typecheck` / `test` all green
|
|
111
|
+
- [ ] New components registered in component index
|
|
112
|
+
- [ ] New user-visible text has i18n keys
|
|
113
|
+
- [ ] Four states (loading/error/empty/success) covered
|
|
114
|
+
- [ ] No hardcoded colors/font sizes/spacing
|
|
115
|
+
- [ ] No `console.log` / `debugger` / `any`
|
|
116
|
+
- [ ] Key changes have supporting description (screenshots / recordings / design links)
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## F8. Security Baseline
|
|
121
|
+
|
|
122
|
+
- **Forbid**: Writing API keys, tokens, or secrets into frontend code.
|
|
123
|
+
- **Forbid**: Using `dangerouslySetInnerHTML` / `v-html` to render user input (must sanitize).
|
|
124
|
+
- **Rule**: All external links with `target="_blank"` must include `rel="noopener noreferrer"`.
|
|
125
|
+
- **Rule**: Form submission requires client-side validation, but **forbid** relying solely on client-side validation.
|
|
126
|
+
- **Rule**: Sensitive operations (delete, payment) require secondary confirmation.
|
|
127
|
+
- **RATIONALE**: The frontend is an attack surface, not a security boundary.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## F9. AI Vibecoding Baseline Constraints (project-agnostic, always active)
|
|
132
|
+
|
|
133
|
+
### F9.1 Search First
|
|
134
|
+
- **Rule**: Before generating a new component, AI must search the `src/components/` index to check if a similar component already exists.
|
|
135
|
+
- **Rule**: Before generating a utility function, AI must search `src/utils/` / `src/hooks/`. Forbid reinventing the wheel.
|
|
136
|
+
|
|
137
|
+
### F9.2 Dependency Control
|
|
138
|
+
- **Rule**: AI must not introduce new npm dependencies on its own.
|
|
139
|
+
- **Rule**: If a new dependency is truly needed, AI must **explicitly list** in its response: package name, version, reason, alternative comparison. Human reviews the `package.json` change.
|
|
140
|
+
|
|
141
|
+
### F9.3 Breaking Changes
|
|
142
|
+
- **Rule**: Before modifying a shared component / common hook / common type, AI must first list **all callers**.
|
|
143
|
+
- **Rule**: If the change would break callers, AI must provide a migration plan or refuse the change.
|
|
144
|
+
|
|
145
|
+
### F9.4 Context Honesty
|
|
146
|
+
- **Rule**: When uncertain, AI must explicitly say "I'm not sure." Forbid inventing API paths, file paths, or field names.
|
|
147
|
+
- **Rule**: AI must read the latest file contents before modifying. Forbid generating diffs based on guesswork.
|
|
148
|
+
|
|
149
|
+
### F9.5 Comment Obligation
|
|
150
|
+
- **Rule**: Non-obvious AI-generated code must include a "why" comment (not "what").
|
|
151
|
+
- **Forbid**: AI deleting existing comments (unless the corresponding code is also deleted).
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## F10. Performance Baseline
|
|
156
|
+
|
|
157
|
+
- **Rule**: List rendering must have `key`, and `key` must not use index (unless the list is purely static).
|
|
158
|
+
- **Rule**: Long lists (>100 items) must use virtual scrolling.
|
|
159
|
+
- **Rule**: Routes must be code-split (dynamic import).
|
|
160
|
+
- **Rule**: Images must be lazy-loaded (`loading="lazy"`) + modern formats (webp/avif) + explicit width/height (prevents CLS).
|
|
161
|
+
- **Rule**: Avoid creating new objects/functions in render (unless wrapped with memo).
|
|
162
|
+
- **RATIONALE**: These are zero-cost performance optimizations. There is no reason not to do them.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Injection Instructions (for the AI executing this skill)
|
|
167
|
+
|
|
168
|
+
Each chapter in this file corresponds to a `{{ FIXED_RULES_* }}` placeholder in the template. During Phase 4 rendering, copy each chapter's full body (including RATIONALE) directly into the corresponding placeholder:
|
|
169
|
+
|
|
170
|
+
| Chapter | Inject Into Placeholder | Template Section |
|
|
171
|
+
|---------|------------------------|-------------------|
|
|
172
|
+
| F1.1 TypeScript Strict Mode | `{{ FIXED_RULES_TYPESCRIPT }}` | §3.1 Type Safety |
|
|
173
|
+
| F1.3 Naming Conventions | `{{ FIXED_RULES_NAMING }}` | §3.2 Naming Conventions |
|
|
174
|
+
| F2 Style Deny List | `{{ FIXED_RULES_DENY_LIST }}` | §1.5 Style Deny List |
|
|
175
|
+
| F3.1 Component Contract | `{{ FIXED_RULES_COMPONENT_CONTRACT }}` | §2.1 Component Contract |
|
|
176
|
+
| F4 i18n Baseline | `{{ FIXED_RULES_I18N_BASELINE }}` | §5.4 Internationalization |
|
|
177
|
+
| F5 Error Handling | `{{ FIXED_RULES_ERROR_HANDLING }}` | §5.2 Error Handling Rules |
|
|
178
|
+
| F6 a11y Baseline | `{{ FIXED_RULES_A11Y }}` | §5.3 Accessibility |
|
|
179
|
+
| F7 Git Collaboration | `{{ FIXED_RULES_GIT }}` | §8.1 Branching & Commits |
|
|
180
|
+
| F8 Security Baseline | `{{ FIXED_RULES_SECURITY }}` | §9 Security Baseline |
|
|
181
|
+
| F9 AI Baseline Constraints | `{{ FIXED_RULES_AI_BASE }}` | §7.1 Baseline Constraints |
|
|
182
|
+
| F10 Performance Baseline | `{{ FIXED_RULES_PERFORMANCE }}` | §5.5 Performance Baseline |
|
|
183
|
+
|
|
184
|
+
**Rendering rules**:
|
|
185
|
+
1. For chapters marked "already present as fixed text in template", AI does not need to re-inject — the template has them hardcoded.
|
|
186
|
+
2. Chapters marked "merged into..." should be prepended as baseline rules at the front of the corresponding derivation rule blocks.
|
|
187
|
+
3. **RATIONALE fields must be preserved** — they give AI the basis for judgment at boundary cases.
|
|
188
|
+
4. Keep the original markdown list structure when injecting. Do not rewrite as prose paragraphs.
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# Question Bank — Frontend Interactive Question Bank
|
|
2
|
+
|
|
3
|
+
> This file is read on demand by SKILL.md in Phase 2. The AI must strictly follow the group order defined in this file, asking **one group at a time (1–5 questions)**, never dumping all questions at once.
|
|
4
|
+
> For every question, show the user: question number, question text, options, **recommended choice (marked "Recommended")**, and a one-line description.
|
|
5
|
+
> After each user response, immediately record the choice to internal state `answers[Qx] = ...` and proceed to the next group.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Asking Rules
|
|
10
|
+
|
|
11
|
+
1. **Group order**: G1 → G2 → G3 → G4 → G5 → G6 → G7 → G8 → G9. Do not skip.
|
|
12
|
+
2. **Shortcut commands** (respond immediately when user types these at any point):
|
|
13
|
+
- `recommended` / `default` → skip current group, adopt all recommended options
|
|
14
|
+
- `all recommended` / `one-click` → skip all remaining groups, adopt all recommended options
|
|
15
|
+
- `strict` / `strictest` → adopt the strictest option for the current group
|
|
16
|
+
- `skip` / `don't need this` → mark current group as N/A, note in output that "project does not require this yet"
|
|
17
|
+
- `custom: xxx` → record user's custom content, do not match against options
|
|
18
|
+
3. **Abbreviation recognition**: `A` / `a` / `1` all mean option A. `A,C` means multi-select (only for multi-select questions).
|
|
19
|
+
4. **Follow-up rule**: If the user gives an answer outside the options (e.g., "I use Astro"), first confirm whether to classify as an "other" branch of an existing option before continuing.
|
|
20
|
+
5. **Forbidden behaviors**:
|
|
21
|
+
- Must not make choices for the user before they explicitly answer.
|
|
22
|
+
- Must not fabricate user preferences to complete the answer set.
|
|
23
|
+
- Must not output more than 3 questions in a single message.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Group Overview
|
|
28
|
+
|
|
29
|
+
| Group | Topic | Questions | Count |
|
|
30
|
+
|-------|-------|-----------|-------|
|
|
31
|
+
| G1 | Tech Stack | Q1–Q3 | 3 |
|
|
32
|
+
| G2 | Styling | Q4–Q4b | 2 |
|
|
33
|
+
| G3 | State & Data Fetching | Q5–Q7 | 3 |
|
|
34
|
+
| G4 | Design System | Q8–Q10 | 3 |
|
|
35
|
+
| G5 | Responsive & Adaptation | Q11–Q12 | 2 |
|
|
36
|
+
| G6 | i18n & Accessibility | Q13–Q14 | 2 |
|
|
37
|
+
| G7 | Testing & Quality | Q15–Q17 | 3 |
|
|
38
|
+
| G8 | AI Vibecoding Constraints | Q18–Q22 | 5 |
|
|
39
|
+
| G9 | Performance Baseline | Q23–Q24 | 2 |
|
|
40
|
+
|
|
41
|
+
Total: 25 questions.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## G1 — Tech Stack
|
|
46
|
+
|
|
47
|
+
### Q1. Frontend Framework
|
|
48
|
+
- **Options**:
|
|
49
|
+
- A) React 18+ **【Recommended】**
|
|
50
|
+
- B) Vue 3
|
|
51
|
+
- C) Svelte 5
|
|
52
|
+
- D) Solid
|
|
53
|
+
- E) Custom (specify version)
|
|
54
|
+
- **Note**: Determines which hooks/Composition API-specific rules are injected.
|
|
55
|
+
- **Maps to**: `{{ framework }}` (TL;DR) + `{{ tech_stack_rules }}` (derivation injection)
|
|
56
|
+
|
|
57
|
+
### Q2. Meta-Framework
|
|
58
|
+
- **Options**:
|
|
59
|
+
- A) Next.js (App Router) **【Recommended for React projects】**
|
|
60
|
+
- B) Nuxt (Recommended for Vue projects)
|
|
61
|
+
- C) Remix
|
|
62
|
+
- D) Plain SPA (Vite)
|
|
63
|
+
- E) Custom
|
|
64
|
+
- **Note**: Affects SSR/RSC, routing conventions, data fetching rules.
|
|
65
|
+
- **Maps to**: `{{ meta_framework }}` (TL;DR + §2.4) + `{{ tech_stack_rules }}` (derivation injection)
|
|
66
|
+
|
|
67
|
+
### Q3. Package Manager
|
|
68
|
+
- **Options**:
|
|
69
|
+
- A) pnpm **【Recommended】**
|
|
70
|
+
- B) npm
|
|
71
|
+
- C) yarn
|
|
72
|
+
- D) bun
|
|
73
|
+
- **Strict option**: A (pnpm, enforced workspace + lockfile commit)
|
|
74
|
+
- **Note**: Affects monorepo capability, CI caching, lockfile rules.
|
|
75
|
+
- **Maps to**: `{{ package_manager }}` (TL;DR) + `{{ tech_stack_rules }}` (derivation injection)
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## G2 — Styling
|
|
80
|
+
|
|
81
|
+
### Q4. Styling Solution (**single choice, no mixing**)
|
|
82
|
+
- **Options**:
|
|
83
|
+
- A) Tailwind CSS **【Recommended: atomic, AI-friendly】**
|
|
84
|
+
- B) CSS Modules
|
|
85
|
+
- C) CSS-in-JS (styled-components / emotion)
|
|
86
|
+
- D) UnoCSS
|
|
87
|
+
- E) Plain CSS + BEM
|
|
88
|
+
- **Strict option**: A (Tailwind + forbid arbitrary values)
|
|
89
|
+
- **Note**: This choice determines the D2 branch rule set injected by derivation-rules.md (each option has dedicated rules).
|
|
90
|
+
- **Maps to**: `{{ style_solution }}` (TL;DR) + `{{ style_specific_rules }}` (derivation injection into §2.3)
|
|
91
|
+
|
|
92
|
+
### Q4b. Font Loading Strategy
|
|
93
|
+
- **Options**:
|
|
94
|
+
- A) Self-hosted with font-display: swap **【Recommended: best performance + privacy】**
|
|
95
|
+
- B) Google Fonts / CDN with font-display: swap
|
|
96
|
+
- C) System font stack only (no custom fonts)
|
|
97
|
+
- D) Not decided yet
|
|
98
|
+
- **Note**: Affects font loading performance and privacy. A provides the best control; B is simpler but adds a third-party dependency; C has zero download overhead.
|
|
99
|
+
- **Maps to**: `{{ font_strategy }}` (TL;DR) + `{{ performance_rules }}` (additional derivation)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## G3 — State & Data Fetching
|
|
104
|
+
|
|
105
|
+
### Q5. Global State Library
|
|
106
|
+
- **Options**:
|
|
107
|
+
- A) Zustand **【Recommended for React】**
|
|
108
|
+
- B) Pinia **【Recommended for Vue】**
|
|
109
|
+
- C) Redux Toolkit
|
|
110
|
+
- D) Jotai / Valtio
|
|
111
|
+
- E) Context / Provide-Inject only, no global store
|
|
112
|
+
- **Note**: Recommendation depends on Q1 framework choice.
|
|
113
|
+
- **Maps to**: `{{ state_lib }}` (TL;DR + §4.1) + `{{ state_rules }}` (derivation injection)
|
|
114
|
+
|
|
115
|
+
### Q6. Server State Library
|
|
116
|
+
- **Options**:
|
|
117
|
+
- A) TanStack Query **【Recommended】**
|
|
118
|
+
- B) SWR
|
|
119
|
+
- C) RTK Query
|
|
120
|
+
- D) Custom fetch hook wrapper
|
|
121
|
+
- **Strict option**: A (TanStack Query + enforced queryKey convention)
|
|
122
|
+
- **Note**: Affects API caching, retry, and staleTime rules.
|
|
123
|
+
- **Maps to**: `{{ server_state_lib }}` (TL;DR + §4.2) + `{{ server_state_rules }}` (derivation injection)
|
|
124
|
+
|
|
125
|
+
### Q7. API Type Source
|
|
126
|
+
- **Options**:
|
|
127
|
+
- A) Backend OpenAPI auto-generation **【Recommended】**
|
|
128
|
+
- B) Backend Protobuf generation
|
|
129
|
+
- C) Hand-written .d.ts
|
|
130
|
+
- D) Shared monorepo type package with backend
|
|
131
|
+
- **Strict option**: A or B (eliminates hand-written types)
|
|
132
|
+
- **Note**: Determines whether to inject the "forbid hand-written API types" constraint.
|
|
133
|
+
- **Maps to**: `{{ api_type_source }}` (TL;DR + §4.3) + `{{ server_state_rules }}` (derivation injection)
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## G4 — Design System
|
|
138
|
+
|
|
139
|
+
### Q8. Primary Design/Mockup Source
|
|
140
|
+
- **Options**:
|
|
141
|
+
- A) Existing HTML prototype in `temp/` directory
|
|
142
|
+
- B) Existing Figma designs
|
|
143
|
+
- C) Other location (specify path)
|
|
144
|
+
- D) None, starting from scratch
|
|
145
|
+
- **Note**: If multiple sources exist, select the primary one. Additional sources will be noted in the output. A/B trigger a "design extraction" step (annotate token sources in output). D triggers a "recommend doing a style direction first" hint.
|
|
146
|
+
- **Maps to**: `{{ design_source }}` (document header metadata)
|
|
147
|
+
|
|
148
|
+
### Q9. Token Naming Layers
|
|
149
|
+
- **Options**:
|
|
150
|
+
- A) Three-layer (primitive / semantic / component) **【Recommended】**
|
|
151
|
+
- B) Two-layer (base / semantic)
|
|
152
|
+
- C) Single-layer (semantic only)
|
|
153
|
+
- **Strict option**: A
|
|
154
|
+
- **Note**: Three layers makes theme switching and brand reuse straightforward.
|
|
155
|
+
- **Maps to**: `{{ token_layering }}` (TL;DR) + `{{ token_layering_rules }}` (derivation injection into §1.1)
|
|
156
|
+
|
|
157
|
+
### Q10. Dark Mode
|
|
158
|
+
- **Options**:
|
|
159
|
+
- A) Supported, via CSS variable switching **【Recommended】**
|
|
160
|
+
- B) Supported, via class switching (Tailwind `dark:` prefix)
|
|
161
|
+
- C) Not supported
|
|
162
|
+
- **Note**: Choosing A/B auto-injects "tokens must include both light/dark value pairs" rule.
|
|
163
|
+
- **Maps to**: `{{ dark_mode }}` (TL;DR) + `{{ dark_mode_rules }}` (derivation injection into §1.3)
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## G5 — Responsive & Adaptation
|
|
168
|
+
|
|
169
|
+
### Q11. Adaptation Strategy
|
|
170
|
+
- **Options**:
|
|
171
|
+
- A) Mobile-first **【Recommended】**
|
|
172
|
+
- B) Desktop-first
|
|
173
|
+
- C) Desktop only
|
|
174
|
+
- D) Mobile only
|
|
175
|
+
- **Note**: Determines media query writing direction and default style conventions.
|
|
176
|
+
- **Maps to**: `{{ responsive_strategy }}` (TL;DR) + `{{ breakpoint_rules }}` (derivation injection into §1.4)
|
|
177
|
+
|
|
178
|
+
### Q12. Breakpoint Scheme
|
|
179
|
+
- **Options**:
|
|
180
|
+
- A) Tailwind defaults (sm 640 / md 768 / lg 1024 / xl 1280 / 2xl 1536) **【Recommended】**
|
|
181
|
+
- B) Material Design (xs / sm / md / lg / xl)
|
|
182
|
+
- C) Custom (provide full breakpoint table)
|
|
183
|
+
- **Note**: Choosing A with Q4=Tailwind locks the breakpoints.
|
|
184
|
+
- **Maps to**: `{{ breakpoint_rules }}` (derivation injection into §1.4)
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## G6 — i18n & Accessibility
|
|
189
|
+
|
|
190
|
+
### Q13. Internationalization (i18n)
|
|
191
|
+
- **Options**:
|
|
192
|
+
- A) Multi-language with full i18n framework (specify: zh-CN, en-US, ja-JP, etc.)
|
|
193
|
+
- B) Single-language, but text centralized in i18n files for future expansion **【Recommended: early-stage projects】**
|
|
194
|
+
- C) Single-language, hardcoding allowed (no i18n infrastructure)
|
|
195
|
+
- **Note**: Choosing A auto-injects i18n key naming rules and forbid hardcoding user-visible text. B centralizes text but does not require multi-language support. C allows hardcoding and requires no i18n infrastructure.
|
|
196
|
+
- **Maps to**: `{{ i18n }}` (TL;DR) + `{{ i18n_rules }}` (derivation injection into §5.4)
|
|
197
|
+
|
|
198
|
+
### Q14. Accessibility Target
|
|
199
|
+
- **Options**:
|
|
200
|
+
- A) WCAG 2.1 AA **【Recommended】**
|
|
201
|
+
- B) WCAG 2.1 AAA
|
|
202
|
+
- C) Basic keyboard reachability only
|
|
203
|
+
- **Strict option**: B
|
|
204
|
+
- **Note**: Affects contrast ratio thresholds and ARIA check strictness.
|
|
205
|
+
- **Maps to**: `{{ a11y_level }}` (TL;DR + §5.3) + `{{ a11y_extra_rules }}` (injected into §5.3)
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## G7 — Testing & Quality
|
|
210
|
+
|
|
211
|
+
### Q15. Test Coverage Requirements
|
|
212
|
+
- **Options**:
|
|
213
|
+
- A) Shared component unit tests + critical path E2E **【Recommended】**
|
|
214
|
+
- B) Unit tests only
|
|
215
|
+
- C) E2E only
|
|
216
|
+
- D) Not required yet
|
|
217
|
+
- **Strict option**: A + enforced coverage ≥ 80%
|
|
218
|
+
- **Note**: Determines whether Q16/Q17 need to be asked.
|
|
219
|
+
- **Maps to**: `{{ test_rules }}` (dynamically assembled by D-TEST-01 into §6.1)
|
|
220
|
+
|
|
221
|
+
### Q16. Unit Test Framework (only ask if Q15 = A or B)
|
|
222
|
+
- **Options**:
|
|
223
|
+
- A) Vitest **【Recommended for Vite/Next projects】**
|
|
224
|
+
- B) Jest
|
|
225
|
+
- C) Node test runner
|
|
226
|
+
- **Note**: Match with build tool first.
|
|
227
|
+
- **Maps to**: `{{ unit_test_framework }}` (TL;DR) + assembled into `{{ test_rules }}` by D-TEST-01
|
|
228
|
+
|
|
229
|
+
### Q17. E2E Framework (only ask if Q15 = A or C)
|
|
230
|
+
- **Options**:
|
|
231
|
+
- A) Playwright **【Recommended】**
|
|
232
|
+
- B) Cypress
|
|
233
|
+
- C) WebdriverIO
|
|
234
|
+
- **Note**: Playwright has the best multi-browser support.
|
|
235
|
+
- **Maps to**: `{{ e2e_framework }}` (TL;DR) + assembled into `{{ test_rules }}` by D-TEST-01
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## G8 — AI Vibecoding Constraints
|
|
240
|
+
|
|
241
|
+
### Q18. AI Component Index Sync
|
|
242
|
+
- **Options**:
|
|
243
|
+
- A) Must sync to `src/components/index.ts` + type exports **【Recommended】**
|
|
244
|
+
- B) Not required
|
|
245
|
+
- **Strict option**: A
|
|
246
|
+
- **Note**: Determines whether AI will reinvent existing components. Strict is safer.
|
|
247
|
+
- **Maps to**: `{{ ai_index_rule }}` (injected into §7.3)
|
|
248
|
+
|
|
249
|
+
### Q19. AI Permission to Add Dependencies
|
|
250
|
+
- **Options**:
|
|
251
|
+
- A) Forbid AI from adding dependencies on its own; human must review `package.json` changes **【Recommended】**
|
|
252
|
+
- B) Allowed, but must declare in PR description with alternative comparison
|
|
253
|
+
- C) Fully allowed
|
|
254
|
+
- **Strict option**: A
|
|
255
|
+
- **Note**: A is key for supply chain security + bundle size control.
|
|
256
|
+
- **Maps to**: `{{ ai_dependency_rule }}` (injected into §7.3)
|
|
257
|
+
|
|
258
|
+
### Q20. AI Impact Analysis Before Modifying Shared Components
|
|
259
|
+
- **Options**:
|
|
260
|
+
- A) Must list all callers and declare in change notes first **【Recommended】**
|
|
261
|
+
- B) Not required
|
|
262
|
+
- **Strict option**: A
|
|
263
|
+
- **Note**: Prevents "fix one component, break ten pages."
|
|
264
|
+
- **Maps to**: `{{ ai_breaking_change_rule }}` (injected into §7.3)
|
|
265
|
+
|
|
266
|
+
### Q21. AI Permission to Modify Config Files
|
|
267
|
+
- **Options**:
|
|
268
|
+
- A) Forbid; config files (tsconfig, vite, eslint, tailwind) must be manually edited **【Recommended】**
|
|
269
|
+
- B) Allowed to modify, but must explain each change
|
|
270
|
+
- **Maps to**: `{{ ai_config_rule }}`
|
|
271
|
+
|
|
272
|
+
### Q22. AI Single File Generation Limit
|
|
273
|
+
- **Options**:
|
|
274
|
+
- A) 200 lines
|
|
275
|
+
- B) 300 lines **【Recommended】**
|
|
276
|
+
- C) 500 lines
|
|
277
|
+
- D) No limit
|
|
278
|
+
- **Strict option**: A
|
|
279
|
+
- **Note**: Exceeding the limit auto-triggers a split hint to prevent god components.
|
|
280
|
+
- **Maps to**: `{{ ai_max_lines }}` (appears in TL;DR + §3.3 + §7.3 + §8.2 — AI replaces the value in all locations)
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## G9 — Performance Baseline
|
|
285
|
+
|
|
286
|
+
### Q23. First Screen LCP Target
|
|
287
|
+
- **Options**:
|
|
288
|
+
- A) < 2.5s **【Recommended: Web Vitals "good" threshold】**
|
|
289
|
+
- B) < 1.5s (extreme performance, requires pre-rendering/edge deployment)
|
|
290
|
+
- C) Not required yet
|
|
291
|
+
- **Strict option**: B
|
|
292
|
+
- **Note**: Determines whether SSR/RSC, font preloading, and critical CSS inlining rules are required.
|
|
293
|
+
- **Maps to**: `{{ lcp_target }}` (TL;DR) + `{{ performance_rules }}` (derivation injection into §5.5)
|
|
294
|
+
|
|
295
|
+
### Q24. Single Chunk Size Limit
|
|
296
|
+
- **Options**:
|
|
297
|
+
- A) < 300KB (< 100KB gzipped) **【Recommended】**
|
|
298
|
+
- B) < 500KB
|
|
299
|
+
- C) No limit
|
|
300
|
+
- **Strict option**: A + configure bundle-analyzer for CI enforcement
|
|
301
|
+
- **Note**: Determines whether to inject "routes must be lazy-loaded" and "large third-party libs must use dynamic import" rules.
|
|
302
|
+
- **Maps to**: `{{ bundle_size }}` (TL;DR) + `{{ performance_rules }}` (derivation injection into §5.5)
|