@leejungkiin/awkit 1.0.0

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.
Files changed (139) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +146 -0
  3. package/VERSION +1 -0
  4. package/bin/awf.js +549 -0
  5. package/bin/awk.js +1759 -0
  6. package/core/AGENTS.md +39 -0
  7. package/core/GEMINI.md +202 -0
  8. package/core/GEMINI.md.bak +244 -0
  9. package/core/orchestrator.md +58 -0
  10. package/package.json +46 -0
  11. package/schemas/brain.schema.json +342 -0
  12. package/schemas/preferences.schema.json +95 -0
  13. package/schemas/session.schema.json +112 -0
  14. package/skill-packs/neural-memory/README.md +111 -0
  15. package/skill-packs/neural-memory/pack.json +35 -0
  16. package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
  17. package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
  18. package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
  19. package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
  20. package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
  21. package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
  22. package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
  23. package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
  24. package/skills/adaptive-language/SKILL.md +189 -0
  25. package/skills/ambient-brain/SKILL.md +314 -0
  26. package/skills/ambient-brain/brain-router.md +185 -0
  27. package/skills/ambient-brain/brain-templates.md +201 -0
  28. package/skills/auto-save/SKILL.md +223 -0
  29. package/skills/awf-adaptive-language/SKILL.md +189 -0
  30. package/skills/awf-context-help/SKILL.md +180 -0
  31. package/skills/awf-error-translator/SKILL.md +153 -0
  32. package/skills/awf-session-restore/SKILL.md +270 -0
  33. package/skills/awf-version-tracker/SKILL.md +32 -0
  34. package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
  35. package/skills/beads-manager/SKILL.md +323 -0
  36. package/skills/brainstorm-agent/SKILL.md +295 -0
  37. package/skills/context-help/SKILL.md +180 -0
  38. package/skills/error-translator/SKILL.md +153 -0
  39. package/skills/ios-engineer/SKILL.md +101 -0
  40. package/skills/memory-sync/SKILL.md +378 -0
  41. package/skills/memory-sync/memory-router.md +185 -0
  42. package/skills/memory-sync/memory-templates.md +201 -0
  43. package/skills/orchestrator/SKILL.md +193 -0
  44. package/skills/session-restore/SKILL.md +240 -0
  45. package/templates/CODEBASE.md +80 -0
  46. package/templates/brain.example.json +321 -0
  47. package/templates/preferences.example.json +21 -0
  48. package/templates/project-identity/android.json +28 -0
  49. package/templates/project-identity/backend-nestjs.json +24 -0
  50. package/templates/project-identity/expo.json +27 -0
  51. package/templates/project-identity/ios.json +27 -0
  52. package/templates/project-identity/web-nextjs.json +24 -0
  53. package/templates/session.example.json +53 -0
  54. package/templates/specs/design-template.md +166 -0
  55. package/templates/specs/requirements-template.md +65 -0
  56. package/templates/specs/tasks-template.md +132 -0
  57. package/templates/structures/android.txt +10 -0
  58. package/templates/structures/backend-nestjs.txt +6 -0
  59. package/templates/structures/expo.txt +9 -0
  60. package/templates/structures/ios.txt +9 -0
  61. package/templates/structures/web-nextjs.txt +6 -0
  62. package/templates/workflow_dual_mode_template.md +87 -0
  63. package/workflows/_uncategorized/README.md +339 -0
  64. package/workflows/_uncategorized/ads-creative.md +357 -0
  65. package/workflows/_uncategorized/ads-full-optimization.md +308 -0
  66. package/workflows/_uncategorized/ads-plan.md +247 -0
  67. package/workflows/_uncategorized/ads-user-analysis.md +337 -0
  68. package/workflows/_uncategorized/skill-health.md +35 -0
  69. package/workflows/_uncategorized/skill-rollback.md +35 -0
  70. package/workflows/ads/admob.md +62 -0
  71. package/workflows/ads/ads-analyst.md +201 -0
  72. package/workflows/ads/ads-audit.md +106 -0
  73. package/workflows/ads/ads-optimize.md +97 -0
  74. package/workflows/ads/ads-targeting.md +241 -0
  75. package/workflows/ads/adsExpert.md +160 -0
  76. package/workflows/ads/smali-ads-config.md +400 -0
  77. package/workflows/ads/smali-ads-flow.md +331 -0
  78. package/workflows/ads/smali-ads-interstitial.md +377 -0
  79. package/workflows/ads/smali-ads-native.md +382 -0
  80. package/workflows/context/auto-execution-workflow.md +291 -0
  81. package/workflows/context/auto-implement.md +211 -0
  82. package/workflows/context/codebase-sync.md +163 -0
  83. package/workflows/context/logic-reasoning-workflow.md +260 -0
  84. package/workflows/context/next.md +195 -0
  85. package/workflows/context/recap.md +212 -0
  86. package/workflows/context/save-brain.md +285 -0
  87. package/workflows/context/user-intent-analysis-workflow.md +206 -0
  88. package/workflows/expert/codeExpert.md +126 -0
  89. package/workflows/expert/debugExpert.md +136 -0
  90. package/workflows/expert/planExpert.md +112 -0
  91. package/workflows/git/cloudflare-tunnel.md +135 -0
  92. package/workflows/git/git-commit-workflow.md +75 -0
  93. package/workflows/git/hotfix.md +357 -0
  94. package/workflows/git/release-notes.md +160 -0
  95. package/workflows/git/rollback.md +52 -0
  96. package/workflows/git/smart-git-ops.md +103 -0
  97. package/workflows/lifecycle/brainstorm.md +377 -0
  98. package/workflows/lifecycle/code.md +663 -0
  99. package/workflows/lifecycle/debug.md +116 -0
  100. package/workflows/lifecycle/deploy.md +95 -0
  101. package/workflows/lifecycle/init.md +152 -0
  102. package/workflows/lifecycle/master-code-workflow.md +300 -0
  103. package/workflows/lifecycle/migration.md +196 -0
  104. package/workflows/lifecycle/plan.md +91 -0
  105. package/workflows/lifecycle/refactor.md +165 -0
  106. package/workflows/lifecycle/run.md +52 -0
  107. package/workflows/lifecycle/test.md +91 -0
  108. package/workflows/meta/customize.md +346 -0
  109. package/workflows/meta/file-protection-rules.md +129 -0
  110. package/workflows/meta/help.html +350 -0
  111. package/workflows/meta/project-identity-enforcement.md +180 -0
  112. package/workflows/mobile/app-analysis.md +64 -0
  113. package/workflows/mobile/maestro-qa-workflow.md +470 -0
  114. package/workflows/mobile/maestro-test-workflow.md +84 -0
  115. package/workflows/mobile/structure-clean-architect.md +271 -0
  116. package/workflows/mobile/turbo-mobile-build.md +190 -0
  117. package/workflows/quality/accessibility-audit.md +311 -0
  118. package/workflows/quality/audit.md +217 -0
  119. package/workflows/quality/bug-hunter.md +243 -0
  120. package/workflows/quality/code-janitor.md +209 -0
  121. package/workflows/quality/code-quality-rules.md +132 -0
  122. package/workflows/quality/performance-audit.md +343 -0
  123. package/workflows/quality/project-audit.md +61 -0
  124. package/workflows/quality/self-healing-test.md +192 -0
  125. package/workflows/quality/ui-review.md +130 -0
  126. package/workflows/quality/ux-audit.md +213 -0
  127. package/workflows/quality/visual-debug.md +34 -0
  128. package/workflows/roles/oracle.md +267 -0
  129. package/workflows/roles/product-manager-workflow.md +52 -0
  130. package/workflows/roles/qa-engineer-workflow.md +41 -0
  131. package/workflows/roles/tech-lead-workflow.md +45 -0
  132. package/workflows/roles/ui-ux-designer-workflow.md +42 -0
  133. package/workflows/roles/vibe-coding-master-workflow.md +52 -0
  134. package/workflows/ui/app-screen-analyzer.md +152 -0
  135. package/workflows/ui/create-feature.md +332 -0
  136. package/workflows/ui/create-spec-architect.md +184 -0
  137. package/workflows/ui/design-to-ui.md +308 -0
  138. package/workflows/ui/ui-first-methodology.md +279 -0
  139. package/workflows/ui/visualize.md +298 -0
@@ -0,0 +1,52 @@
1
+ ---
2
+ description: Điều phối quy trình làm việc chuyên nghiệp giữa PM, Designer, Tech Lead và QA.
3
+ alwaysApply: false
4
+ priority: "high"
5
+ ---
6
+
7
+ # Vibe Coding Master Workflow
8
+
9
+ ## 🎯 Philosophy
10
+ "Vibe Coding" isn't just fast coding; it's **flow-state engineering**. To maintain flow while ensuring quality, we switch "hats" rapidly but explicitly.
11
+
12
+ ## 🔄 The Cycle
13
+
14
+ ### Phase 1: Alignment (The PM Hat) 🎩
15
+ **Trigger**: New Request / Feature Idea.
16
+ 1. **Understand**: Read `user-intent-analysis-workflow`.
17
+ 2. **Define**: What is the MVP? (PM Role).
18
+ 3. **Output**: Clear Scope & Acceptance Criteria.
19
+
20
+ ### Phase 2: Envisioning (The Designer Hat) 🎨
21
+ **Trigger**: UI/Visual task.
22
+ 1. **Vibe Check**: Is it modern? Premium?
23
+ 2. **Specs**: Colors, Spacing, Animation strategy.
24
+ 3. **Output**: Visual plan / Component specs.
25
+
26
+ ### Phase 3: Architecting (The Tech Lead Hat) 🏗️
27
+ **Trigger**: Complex Logic / New Component.
28
+ 1. **Plan**: Check `code-quality.md` & `project-identity`.
29
+ 2. **Structure**: File organization & Data flow.
30
+ 3. **Output**: `docs/specs/[feature]/design.md` & `bd create` tasks.
31
+
32
+ ### Phase 4: Building (The Developer Hat) 💻
33
+ **Trigger**: Approved Plan.
34
+ 1. **Execute**: Write code.
35
+ 2. **Self-Check**: Real-time validation (auto-imports, types).
36
+ 3. **Output**: Working Code.
37
+
38
+ ### Phase 5: Verifying (The QA Hat) 🕵️
39
+ **Trigger**: Code Complete.
40
+ 1. **verify**: Run tests / Manual check.
41
+ 2. **Edge Cases**: try to break it.
42
+ 3. **Output**: `walkthrough.md` / Fixes.
43
+
44
+ ## 🚀 How to Use
45
+ - **Auto-Switch**: As an AI, I will seamlessly switch personas.
46
+ - **Explicit Call**: You can say "Put on your PM hat" or "QA this for me".
47
+ - **Progress**: Use `bd list` to track which phase we are in.
48
+
49
+ ## 🌟 The Vibe
50
+ - Keep it **Fast**.
51
+ - Keep it **Fun**.
52
+ - Keep it **Professional**.
@@ -0,0 +1,152 @@
1
+ ---
2
+ description: 📱 Phân tích màn hình & tạo đặc tả UI
3
+ ---
4
+
5
+ # /app-screen-analyzer
6
+
7
+ **Mission:** Analyze idea/image → Generate complete spec docs (requirements, design, tasks) for ALL screens (Core + Secondary + Common).
8
+
9
+ ## 🎯 Overview
10
+ 1. **Input Analysis**: Detect App Type & Context.
11
+ 2. **Screen Discovery**: Core → Secondary → Common.
12
+ 3. **Feature Grouping**: Organize screens into Features.
13
+ 4. **Spec Gen**: Create `docs/specs/[feature]/{requirements,design}.md` and init tasks via **bd**.
14
+ 5. **Overview**: Create `docs/specs/_overview.md`.
15
+
16
+ ---
17
+
18
+ ## Phase 0: Input & Context
19
+ **0.1. Input**: Text idea OR Screenshots.
20
+ **0.2. App Type**:
21
+ * `social` (Chat, Feed) | `ecommerce` (Shop, Cart) | `fitness` (Track, Plans)
22
+ * `content` (Media, News) | `productivity` (Tools) | `finance` (Bank, Wallet)
23
+ **0.3. Check Context**: Read `.project-identity` if exists.
24
+
25
+ ---
26
+
27
+ ## Phase 1: Screen Discovery
28
+
29
+ ### 1.1. Core & Secondary Analysis
30
+ Analyze input to list screens. For each Core Screen, identify Secondary Screens (Details, Modals, Edits, Filters).
31
+
32
+ **Output Format:**
33
+ ```markdown
34
+ ## Screen Discovery
35
+ - **[CoreScreen]**: [Purpose]
36
+ - *Secondary*: [Detail/Modal/Edit]
37
+ ```
38
+
39
+ ### 1.2. Common Screens (Auto-Add)
40
+ Add screens based on App Type:
41
+ * **ALL**: Splash, Onboarding, Auth (Login/Reg/Forgot), Home, Settings, Profile.
42
+ * **Social**: Search, Notifications, Feed, UserProfile.
43
+ * **E-commerce**: Search, Cart, Checkout, Orders, ProductDetail.
44
+ * **Fitness**: ActivityLog, Stats, Plans, WorkoutPlayer.
45
+ * **Content**: Library, Player/Reader, Favorites.
46
+ * **Finance**: Transactions, Wallet, Transfer, Report.
47
+
48
+ ---
49
+
50
+ ## Phase 2: Feature Grouping
51
+ Group screens into features (subdirectories in `docs/specs/`).
52
+
53
+ **Structure:**
54
+ * `onboarding/`: Splash, Welcome, Steps.
55
+ * `auth/`: Login, Register, OTP.
56
+ * `home/`: Dashboard, Feed.
57
+ * `[feature-name]/`: Core feature specific screens.
58
+ * `profile/`: User details, preferences.
59
+ * `settings/`: App configs, About.
60
+ * `common/`: Shared UI (Alerts, Modals).
61
+
62
+ ---
63
+
64
+ ## Phase 3: Spec Generation
65
+ For EACH feature, create 3 files using these optimized templates:
66
+
67
+ ### 3.1. requirements.md
68
+ ```markdown
69
+ # [Feature] Requirements
70
+
71
+ ## Screens
72
+ 1. **[Screen1]**: [Desc]
73
+ 2. **[Screen2]**: [Desc]
74
+
75
+ ## Requirements
76
+ ### RQ-01: [Screen1]
77
+ **Story:** As [user], I want [action], so that [value].
78
+ **Criteria:**
79
+ 1. WHEN [trigger] THEN [behavior]
80
+ 2. WHEN [error] THEN [handling]
81
+ ```
82
+
83
+ ### 3.2. design.md
84
+ ```markdown
85
+ # [Feature] Design
86
+
87
+ ## Hierarchy
88
+ [Feature]View
89
+ ├── [Screen1]
90
+ │ └── [Components]
91
+ ├── [Screen2]
92
+ └── [Shared]
93
+
94
+ ## Models
95
+ ```swift
96
+ struct [Model]: Identifiable, Codable { let id: UUID; ... }
97
+ enum ViewState { case idle, loading, loaded([Model]), error(Error) }
98
+ ```
99
+
100
+ ## Flow
101
+ [Entry] -> [Screen1] -> [Screen2]
102
+ ```
103
+
104
+ ### 3.3. Task Initialization (bd)
105
+ ```bash
106
+ bd create "Implement [Feature] - A1: Models & Repos" --body "File: Domain & Data\nValidates: RQ-01"
107
+ bd create "Implement [Feature] - B1: [Screen1]" --body "File: Presentation/[Feature]/"
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Phase 4: App Overview
113
+ Create `docs/specs/_overview.md`:
114
+ ```markdown
115
+ # App Screen Map
116
+ **Type:** [Type] | **Total Specs:** [N] directories
117
+
118
+ ## Navigation
119
+ Tab 1: Home | Tab 2: [Feature] | Tab 3: Profile
120
+
121
+ ## Feature Index
122
+ | Feature | Specs | Status |
123
+ |---|---|---|
124
+ | Auth | ./auth/ | ✅ |
125
+ | [Feature] | ./[feat]/ | ✅ |
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Rules
131
+ 1. **NO CODE**: Only specs.
132
+ 2. **COMPLETE**: Do not miss Common Screens.
133
+ 3. **FORMAT**: Always 3 files per feature.
134
+
135
+ ---
136
+
137
+ ## ⚠️ Workflow Integration
138
+ | Action | Related Workflow |
139
+ |---|---|
140
+ | Auto-Implement | `/auto-implement docs/specs/[feature]` |
141
+ | Code Quality | `/code-review-workflow` |
142
+ | Progress | `/recap` |
143
+
144
+ ## Quick Start
145
+ **Trigger:** User says "Analyze app [idea]" or sends screenshots.
146
+
147
+ **Example:**
148
+ User: "Analyze app: Pregnancy tracker with AI chat and nutrition plans"
149
+ AI: [Runs workflow]
150
+ → Detects: fitness + content
151
+ → Discovers: 25 screens (Core + Secondary + Common)
152
+ → Generates: 9 features × 3 specs each
@@ -0,0 +1,332 @@
1
+ ---
2
+ description: ✨ Hoàn thiện tính năng với UX cao cấp
3
+ ---
4
+
5
+ # /create-feature - Feature Finalizer
6
+
7
+ > 💡 **Tip:** For complete feature design from scratch (architecture → specs → UI → implementation), use `/feature-design-pipeline` master workflow.
8
+
9
+ You are **Antigravity Senior Developer**. User wants to turn ideas into production-ready code.
10
+
11
+ **Mission:** Code correctly, cleanly, and securely. Auto-handle things User doesn't know about.
12
+
13
+ ---
14
+
15
+ ## Phase 0: Spec Initialization (Auto-check)
16
+
17
+ ### 0.1. Check Specs Directory
18
+ // turbo
19
+ Check if `docs/specs/` exists in the project:
20
+
21
+ ```bash
22
+ # Check if docs/specs/ exists
23
+ [ -d "docs/specs" ] && echo "EXISTS" || echo "MISSING"
24
+ ```
25
+
26
+ ### 0.2. Auto-Init When Missing
27
+ If `docs/specs/` is MISSING, create the structure based on the feature being worked on:
28
+
29
+ **Required Structure for each feature:**
30
+ ```
31
+ docs/specs/
32
+ └── [feature-name]/
33
+ ├── requirements.md # User stories & acceptance criteria
34
+ ├── design.md # Technical design & architecture
35
+ └── design.md # Technical design & architecture
36
+ ```
37
+
38
+ **Additional steering docs (project-level, create once if missing):**
39
+ ```
40
+ docs/steering/
41
+ ├── product.md # Product overview, mission, target users
42
+ ├── structure.md # Project structure documentation
43
+ └── tech.md # Tech stack, build commands, conventions
44
+ ```
45
+
46
+ ### 0.3. Spec Templates
47
+
48
+ #### requirements.md Template
49
+ ```markdown
50
+ # [Feature Name] Requirements Document
51
+
52
+ ## Introduction
53
+ [Brief description of the feature and its purpose]
54
+
55
+ ## Glossary
56
+ - **Term_1**: [Definition]
57
+ - **Term_2**: [Definition]
58
+
59
+ ## Requirements
60
+
61
+ ### Requirement 1
62
+ **User Story:** As a [user type], I want to [action], so that [benefit].
63
+
64
+ #### Acceptance Criteria
65
+ 1. WHEN [condition], THE System SHALL [behavior]
66
+ 2. WHEN [condition], THE System SHALL [behavior]
67
+ 3. WHILE [context], THE System SHALL [behavior]
68
+
69
+ ### Requirement 2
70
+ **User Story:** As a [user type], I want to [action], so that [benefit].
71
+
72
+ #### Acceptance Criteria
73
+ 1. WHEN [condition], THE System SHALL [behavior]
74
+ 2. WHEN [condition], THE System SHALL [behavior]
75
+ ```
76
+
77
+ #### design.md Template
78
+ ```markdown
79
+ # [Feature Name] Design Document
80
+
81
+ ## Overview
82
+ [High-level description of the feature architecture]
83
+
84
+ ## Architecture
85
+ [Description of architectural approach]
86
+
87
+ ### Component Hierarchy
88
+ ```
89
+ FeatureView (Root)
90
+ ├── SubComponent1
91
+ ├── SubComponent2
92
+ └── SubComponent3
93
+ ```
94
+
95
+ ## Components and Interfaces
96
+ ### ComponentName
97
+ - **Purpose**: [What it does]
98
+ - **Key Features**: [List features]
99
+
100
+ ## Data Models
101
+ ```swift
102
+ struct ModelName: Codable {
103
+ // properties
104
+ }
105
+ ```
106
+
107
+ ## Correctness Properties
108
+ Property 1: [Property description]
109
+ **Validates: Requirements X.X, X.X**
110
+ ```
111
+
112
+ #### Task Creation (using bd)
113
+ Instead of a `tasks.md` file, use `bd` to create tracking issues:
114
+
115
+ ```bash
116
+ # Initialize tasks for the feature
117
+ bd create "Implement [Feature Name] - Phase A: Foundation" --body "Models, Repositories"
118
+ bd create "Implement [Feature Name] - Phase B: UI" --body "Views, Components"
119
+ bd create "Implement [Feature Name] - Phase C: Logic" --body "ViewModels, Services"
120
+ ```
121
+
122
+ #### product.md Template (Steering - one-time)
123
+ ```markdown
124
+ # [Project Name] Product Overview
125
+
126
+ [Brief description of the product]
127
+
128
+ ## Core Purpose
129
+ - **Target Users**: [Who uses this]
130
+ - **Primary Market**: [Target market]
131
+ - **Mission**: "[Mission statement]"
132
+
133
+ ## Key Features
134
+ - **Feature 1**: [Description]
135
+ - **Feature 2**: [Description]
136
+
137
+ ## Design Philosophy
138
+ - [Design principle 1]
139
+ - [Design principle 2]
140
+
141
+ ## Business Model
142
+ - [Revenue model description]
143
+ ```
144
+
145
+ #### structure.md Template (Steering - one-time)
146
+ ```markdown
147
+ # [Project Name] Project Structure
148
+
149
+ ## Root Level Organization
150
+ ```
151
+ ProjectRoot/
152
+ ├── src/ # Source code
153
+ ├── docs/ # Documentation
154
+ └── [other folders]
155
+ ```
156
+
157
+ ## Core Structure
158
+ [Description of main code organization]
159
+
160
+ ## File Naming Conventions
161
+ - **Views**: `[Feature][Purpose]View.swift`
162
+ - **Components**: Descriptive names
163
+ - **Models**: `[Feature]Models.swift`
164
+
165
+ ## Architecture Patterns
166
+ - [Pattern 1]
167
+ - [Pattern 2]
168
+ ```
169
+
170
+ #### tech.md Template (Steering - one-time)
171
+ ```markdown
172
+ # [Project Name] Technical Stack
173
+
174
+ ## Build System & Platform
175
+ - **Primary IDE**: [IDE]
176
+ - **Build System**: [Build system]
177
+ - **Deployment Targets**: [Targets]
178
+
179
+ ## Tech Stack
180
+ - **Frontend**: [Framework]
181
+ - **Language**: [Language]
182
+ - **State Management**: [Approach]
183
+
184
+ ## Common Commands
185
+
186
+ ### Building & Running
187
+ ```bash
188
+ # Build command
189
+ [build command]
190
+
191
+ # Run command
192
+ [run command]
193
+ ```
194
+
195
+ ## Code Style & Conventions
196
+ - [Convention 1]
197
+ - [Convention 2]
198
+ ```
199
+
200
+ ### 0.4. Init Workflow
201
+ When initiating specs, follow this process:
202
+
203
+ 1. **Check what exists**: Only create missing files
204
+ 2. **Feature-specific specs**: Create in `docs/specs/[feature-name]/`
205
+ 3. **Steering docs**: Create in `docs/steering/` (only if missing)
206
+ 4. **Ask for confirmation**: "I'll create [list files]. OK?"
207
+ 5. **Populate templates**: Fill in with available context from `.project-identity` and existing code
208
+
209
+ ---
210
+
211
+ ## Phase 1: Context Awareness
212
+
213
+ ### 1.1. Check Spec
214
+ Is there a spec file in `docs/specs/[current-feature]/`?
215
+ - **YES**: **Strict Implementation** mode (follow spec exactly, track progress with `bd`)
216
+ - **NO**: **Agile Coding** mode (quick implementation, optionally create spec first)
217
+
218
+ ### 1.2. Agile Coding Mode
219
+ - Analyze User requirements
220
+ - Create "Mini-Plan" (3-4 steps)
221
+ - Confirm: "I'll modify file A, create file B. OK?"
222
+ - **Suggestion**: "Do you want me to create a spec for this feature in `docs/specs/[feature-name]/`?"
223
+
224
+ ---
225
+
226
+ ## Phase 2: Hidden Requirements (Auto-add)
227
+
228
+ Users often FORGET these. AI MUST ADD:
229
+
230
+ ### 2.1. Input Validation
231
+ - Email format valid?
232
+ - Phone number valid?
233
+ - Numbers not negative?
234
+ - Strings not too long?
235
+
236
+ ### 2.2. Error Handling
237
+ - All API calls have try-catch
238
+ - All DB queries handle errors
239
+ - User-friendly error messages (no technical details)
240
+
241
+ ### 2.3. Security
242
+ - **SQL Injection**: Use parameterized queries
243
+ - **XSS**: Escape HTML output
244
+ - **CSRF**: Use tokens for forms
245
+ - **Auth Check**: Sensitive APIs require authentication
246
+
247
+ ### 2.4. Performance
248
+ - Pagination for long lists
249
+ - Lazy loading for images
250
+ - Debounce for search input
251
+
252
+ ### 2.5. Logging
253
+ - Log important actions (User login, Order created)
254
+ - Log errors with enough context to debug
255
+
256
+ ### 2.6. Localization
257
+ - NO hardcoded strings in UI
258
+ - Use localization keys from the start
259
+
260
+ ---
261
+
262
+ ## Phase 3: Implementation
263
+
264
+ ### 3.1. Code Structure
265
+ - Separate logic into services/utils
266
+ - No complex logic in UI components
267
+ - Clear variable/function naming
268
+
269
+ ### 3.2. Type Safety
270
+ - Define complete Types/Interfaces
271
+ - Avoid `any` unless absolutely necessary
272
+
273
+ ### 3.3. Self-Correction
274
+ - Missing import → Auto-add
275
+ - Missing type → Auto-define
276
+ - Duplicate code → Auto-extract to function
277
+
278
+ ### 3.4. Task Sync
279
+ If working in **Strict Implementation** mode:
280
+ - Mark tasks as completed using `bd close [id]`
281
+ - Update `design.md` if architecture changes
282
+ - Keep specs as source of truth
283
+
284
+ ---
285
+
286
+ ## Phase 4: Quality Check (Automatic)
287
+
288
+ ### 4.1. Syntax Check
289
+ - Does code compile?
290
+ - Any type errors?
291
+
292
+ ### 4.2. Logic Check
293
+ - Matches original requirements?
294
+ - Edge cases covered?
295
+
296
+ ### 4.3. Auto Code Review
297
+ - Self-review written code
298
+ - Check for code smells
299
+ - Check for potential bugs
300
+
301
+ ---
302
+
303
+ ## Phase 5: Handover
304
+
305
+ 1. Report: "Completed [Task Name]."
306
+ 2. List: "Changed files: [List]"
307
+ 3. If using specs: Update `bd` status with `bd update [id]`
308
+ 4. Suggest next steps:
309
+ - "Use `/run` to test."
310
+ - "Use `/test` to verify logic."
311
+
312
+ ---
313
+
314
+ ## ⚠️ AUTO-REMINDERS:
315
+
316
+ ### After major changes (Database, New Module):
317
+ - "This is an important change. Remember `/save-brain` at end of day!"
318
+
319
+ ### After security-sensitive changes:
320
+ - "Security measures added. Consider `/audit` for additional review."
321
+
322
+ ### After creating/updating specs:
323
+ - "Specs updated in `docs/specs/[feature]/`. Use `/recap` to check progress anytime."
324
+
325
+ ---
326
+
327
+ ## ⚠️ NEXT STEPS:
328
+ - Code done → `/run` to test
329
+ - Need tests → `/test`
330
+ - Error → `/debug`
331
+ - End of day → `/save-brain`
332
+ - Check progress → `/recap`
@@ -0,0 +1,184 @@
1
+ ---
2
+ description: 📐 Thiết kế đặc tả kỹ thuật trước khi code
3
+ ---
4
+
5
+ # /create-spec-architect - Spec Designer
6
+
7
+ > **Role:** Antigravity Architect - Chỉ thiết kế, KHÔNG code.
8
+ > **Output:** `docs/specs/[feature]/` với 2 file (requirements.md, design.md) và init tasks script
9
+
10
+ ---
11
+
12
+ ## Phase 1: Context Check
13
+
14
+ ### 1.1. Verify Project Identity
15
+ // turbo
16
+ ```bash
17
+ [ -f ".project-identity" ] && echo "✅ Found" || echo "❌ Missing"
18
+ ```
19
+
20
+ ### 1.2. Check Existing Specs
21
+ // turbo
22
+ ```bash
23
+ [ -d "docs/specs" ] && ls docs/specs/ || echo "No specs yet"
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Phase 2: Gather Requirements
29
+
30
+ ### 2.1. Ask User
31
+ Hỏi người dùng các câu hỏi:
32
+ 1. **Feature name?** (slug format: `user-profile`, `meal-plan`)
33
+ 2. **User Story?** "As a [who], I want [what], so that [why]"
34
+ 3. **Key scenarios?** (Happy path + Edge cases)
35
+ 4. **Platform?** (iOS/Android/Web/Expo)
36
+
37
+ ### 2.2. Analyze Context
38
+ - Đọc `.project-identity` để hiểu tech stack
39
+ - Đọc `docs/steering/` nếu có
40
+ - Xác định patterns hiện có trong codebase
41
+
42
+ ---
43
+
44
+ ## Phase 3: Create Specs
45
+
46
+ ### 3.1. Create Feature Directory
47
+ // turbo
48
+ ```bash
49
+ mkdir -p docs/specs/[feature-name]
50
+ ```
51
+
52
+ ### 3.2. Requirements Template
53
+
54
+ **File:** `docs/specs/[feature]/requirements.md`
55
+
56
+ ```markdown
57
+ # [Feature] Requirements
58
+
59
+ ## Introduction
60
+ [1-2 sentences: What & Why]
61
+
62
+ ## Glossary
63
+ - **Term**: Definition
64
+
65
+ ## Requirements
66
+
67
+ ### RQ-01: [Requirement Name]
68
+ **Story:** As a [user], I want [action], so that [benefit].
69
+
70
+ **Criteria:**
71
+ 1. WHEN [trigger], THEN [behavior]
72
+ 2. WHEN [error], THEN [handling]
73
+ 3. WHILE [state], THEN [constraint]
74
+
75
+ ### RQ-02: [Requirement Name]
76
+ **Story:** As a [user], I want [action], so that [benefit].
77
+
78
+ **Criteria:**
79
+ 1. WHEN [trigger], THEN [behavior]
80
+ ```
81
+
82
+ ### 3.3. Design Template
83
+
84
+ **File:** `docs/specs/[feature]/design.md`
85
+
86
+ ```markdown
87
+ # [Feature] Design
88
+
89
+ ## Overview
90
+ [Architecture approach in 2-3 sentences]
91
+
92
+ ## Component Hierarchy
93
+ ```
94
+ FeatureView
95
+ ├── HeaderComponent
96
+ ├── ContentSection
97
+ │ ├── ItemList
98
+ │ └── ItemDetail
99
+ └── ActionButtons
100
+ ```
101
+
102
+ ## Data Models
103
+ ```swift
104
+ struct Model: Codable, Identifiable {
105
+ let id: UUID
106
+ let property: String
107
+ }
108
+
109
+ enum ViewState {
110
+ case idle, loading, loaded([Model]), error(Error)
111
+ }
112
+ ```
113
+
114
+ ## Key Interfaces
115
+ | Component | Purpose | Dependencies |
116
+ |-----------|---------|--------------|
117
+ | ViewModel | State management | Repository |
118
+ | Repository | Data access | API, Cache |
119
+
120
+ ## UI Specs
121
+ - **Colors:** [Primary, Secondary, Accent]
122
+ - **Typography:** [Title, Body, Caption sizes]
123
+ - **Animations:** [Duration, Easing]
124
+ ```
125
+
126
+ ### 3.4. Task Generation (bd commands)
127
+
128
+ **Script:** `docs/specs/[feature]/init_tasks.sh`
129
+
130
+ ```bash
131
+ #!/bin/bash
132
+
133
+ # Phase A: Foundation
134
+ bd create "Implement [Feature] - A1: Models" --body "File: Domain/Models/[Feature].swift\nValidates: RQ-01"
135
+ bd create "Implement [Feature] - A2: Repository" --body "File: Data/Repositories/[Feature]Repository.swift\nValidates: RQ-01, RQ-02"
136
+
137
+ # Phase B: UI
138
+ bd create "Implement [Feature] - B1: Main View" --body "File: Presentation/[Feature]/[Feature]View.swift\nValidates: RQ-01"
139
+ bd create "Implement [Feature] - B2: Components" --body "File: Presentation/[Feature]/Components/\nValidates: RQ-01"
140
+
141
+ # Phase C: Logic
142
+ bd create "Implement [Feature] - C1: ViewModel" --body "File: Presentation/[Feature]/[Feature]ViewModel.swift\nValidates: RQ-01, RQ-02"
143
+
144
+ # Phase D: Polish
145
+ bd create "Implement [Feature] - D1: Localization" --body "Type: i18n"
146
+ bd create "Implement [Feature] - D2: Accessibility" --body "Type: a11y"
147
+
148
+ # Phase E: Verify
149
+ bd create "Implement [Feature] - E1: Unit Tests" --body "Type: test"
150
+ bd create "Implement [Feature] - E2: Final Review" --body "Type: checkpoint"
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Phase 4: Review & Confirm
156
+
157
+ ### 4.1. Summary
158
+ Sau khi tạo xong, trình bày:
159
+ ```
160
+ 📁 Created: docs/specs/[feature]/
161
+ ├── requirements.md (X requirements, Y criteria)
162
+ ├── design.md (Component hierarchy, Models, UI specs)
163
+ └── init_tasks.sh (Script to create bd tasks)
164
+
165
+ Ready for implementation with /auto-implement
166
+ ```
167
+
168
+ ### 4.2. Next Steps
169
+ - **Implement now:** `/auto-implement docs/specs/[feature]`
170
+ - **Review specs:** Người dùng đọc và chỉnh sửa nếu cần
171
+ - **Add more detail:** Bổ sung edge cases, security requirements
172
+
173
+ ---
174
+
175
+ ## Rules
176
+
177
+ 1. **NO CODE** - Chỉ viết documentation
178
+ 2. **COMPLETE** - Đủ 3 files, không thiếu
179
+ 3. **TRACEABLE** - Mỗi task link về requirement
180
+ 4. **ACTIONABLE** - Task đủ chi tiết để AI khác execute
181
+
182
+ ---
183
+
184
+ **Success:** Bộ specs đầy đủ, sẵn sàng cho `/auto-implement`.