@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,243 @@
1
+ ---
2
+ description: 🐛 Tìm, tái hiện & sửa lỗi từ log
3
+ safe_auto_run: false
4
+ ---
5
+
6
+ # /bug-hunter - The Bug Detective
7
+
8
+ A forensic approach to fixing bugs with progressive solutions.
9
+
10
+ ---
11
+
12
+ ## Phase 1: Triage & Reproduction
13
+
14
+ ### 1.1. Bug Classification
15
+ "What type of bug is this?"
16
+ - A) **Crash** - App terminates unexpectedly
17
+ - B) **UI Glitch** - Visual issues
18
+ - C) **Logic Error** - Wrong behavior/output
19
+ - D) **Performance** - Slow/laggy
20
+ - E) **Intermittent** - Happens sometimes (hardest!)
21
+
22
+ ### 1.2. Gather Evidence
23
+ ```markdown
24
+ **Bug Report:**
25
+ - Description: [What's happening]
26
+ - Expected: [What should happen]
27
+ - Steps to reproduce: [1, 2, 3...]
28
+ - Frequency: [Always/Sometimes/Rare]
29
+ - Environment: [Device, OS, App version]
30
+ - Logs/Screenshots: [Attached]
31
+ ```
32
+
33
+ ### 1.3. Create Reproduction Test
34
+ // turbo
35
+ ```swift
36
+ // iOS - Create failing test first (TDD approach)
37
+ func testBugReproduction_ISSUE123() {
38
+ // Arrange - Set up the conditions
39
+ let sut = SystemUnderTest()
40
+
41
+ // Act - Perform the action that triggers bug
42
+ let result = sut.performAction()
43
+
44
+ // Assert - This should FAIL initially
45
+ XCTAssertEqual(result, expectedValue)
46
+ }
47
+ ```
48
+
49
+ ```kotlin
50
+ // Android
51
+ @Test
52
+ fun `ISSUE-123 - bug reproduction`() {
53
+ // Arrange
54
+ val sut = SystemUnderTest()
55
+
56
+ // Act
57
+ val result = sut.performAction()
58
+
59
+ // Assert - Should FAIL initially
60
+ assertEquals(expectedValue, result)
61
+ }
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Phase 2: Three-Level Root Cause Analysis
67
+
68
+ ### Level 1: WHAT (Surface)
69
+ > What is the observable symptom?
70
+
71
+ ### Level 2: WHY (Root Cause)
72
+ > What is the underlying technical cause?
73
+
74
+ ### Level 3: HOW (Solution)
75
+ > What is the specific fix?
76
+
77
+ **Example:**
78
+ ```markdown
79
+ **Level 1 (Surface):** User sees stale data after pulling to refresh
80
+
81
+ **Level 2 (Root Cause):**
82
+ - API response is cached
83
+ - Cache invalidation not triggered on pull-to-refresh
84
+ - StateFlow not updated with fresh data
85
+
86
+ **Level 3 (Solution):**
87
+ ```kotlin
88
+ fun refresh() {
89
+ viewModelScope.launch {
90
+ // Force cache bypass
91
+ repository.fetchData(forceRefresh = true)
92
+ }
93
+ }
94
+ ```
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Phase 3: Progressive Solutions
100
+
101
+ ### 1️⃣ Minimal Fix (Quick Patch)
102
+ - Fix the immediate symptom
103
+ - May not address root cause
104
+ - Acceptable for urgent hotfixes
105
+
106
+ ```swift
107
+ // Quick fix: Force unwrap guard
108
+ if data == nil { return } // Band-aid
109
+ ```
110
+
111
+ ### 2️⃣ Better Fix (Proper Solution)
112
+ - Address the root cause
113
+ - Add defensive checks
114
+ - Includes basic test
115
+
116
+ ```swift
117
+ // Proper fix: Handle nil case correctly
118
+ guard let data = data else {
119
+ showError("No data available")
120
+ return
121
+ }
122
+ ```
123
+
124
+ ### 3️⃣ Complete Fix (Robust Solution)
125
+ - Fix + refactor if needed
126
+ - Comprehensive tests
127
+ - Documentation update
128
+ - Monitoring added
129
+
130
+ ```swift
131
+ // Robust: Full error handling + logging
132
+ do {
133
+ let data = try await fetchData()
134
+ await MainActor.run { updateUI(with: data) }
135
+ } catch {
136
+ Logger.error("Data fetch failed: \(error)")
137
+ showUserFriendlyError(error)
138
+ Analytics.track("data_fetch_error", error: error)
139
+ }
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Phase 4: Isolation Techniques
145
+
146
+ ### 4.1. Binary Search (Bisect)
147
+ ```bash
148
+ # Find the commit that introduced the bug
149
+ git bisect start
150
+ git bisect bad HEAD
151
+ git bisect good v1.0.0
152
+ # Git will help find the exact commit
153
+ ```
154
+
155
+ ### 4.2. Strategic Logging
156
+ ```swift
157
+ // Add temporary debug logs
158
+ func suspectFunction() {
159
+ print("🔍 DEBUG: Entering suspectFunction")
160
+ print("🔍 DEBUG: Variable state = \(variable)")
161
+ // ... logic
162
+ print("🔍 DEBUG: Exiting with result = \(result)")
163
+ }
164
+ ```
165
+
166
+ ### 4.3. Divide and Conquer
167
+ 1. Comment out half the suspect code
168
+ 2. Does bug still occur?
169
+ 3. If yes → bug in remaining code
170
+ 4. If no → bug in commented code
171
+ 5. Repeat until isolated
172
+
173
+ ---
174
+
175
+ ## Phase 5: Fix Implementation
176
+
177
+ ### 5.1. Apply Fix
178
+ Based on severity, apply appropriate level fix (Minimal/Better/Complete)
179
+
180
+ ### 5.2. Verify with Reproduction Test
181
+ // turbo
182
+ ```bash
183
+ # iOS
184
+ xcodebuild test -only-testing:TestTarget/testBugReproduction_ISSUE123
185
+
186
+ # Android
187
+ ./gradlew testDebugUnitTest --tests "*ISSUE123*"
188
+ ```
189
+
190
+ ### 5.3. Regression Check
191
+ // turbo
192
+ ```bash
193
+ # Run related tests to ensure nothing else broke
194
+ # iOS
195
+ xcodebuild test -workspace *.xcworkspace -scheme [Scheme]
196
+
197
+ # Android
198
+ ./gradlew testDebugUnitTest
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Phase 6: Cleanup & Documentation
204
+
205
+ ### 6.1. Remove Debug Code
206
+ ```bash
207
+ # Find and remove debug logs
208
+ grep -rn "DEBUG\|🔍" --include="*.swift" --include="*.kt"
209
+ ```
210
+
211
+ ### 6.2. Update Documentation
212
+ - Add to known issues if relevant
213
+ - Update CHANGELOG
214
+ - Link to issue tracker
215
+
216
+ ### 6.3. Report
217
+ ```markdown
218
+ ## 🐛 Bug Fix Report
219
+
220
+ **Issue:** [ID or Description]
221
+ **Root Cause:** [What was actually wrong]
222
+ **Solution Level:** Minimal/Better/Complete
223
+ **Fix Applied:** [Description of changes]
224
+
225
+ **Files Changed:**
226
+ - `FileName.swift` - [What changed]
227
+
228
+ **Verification:**
229
+ - ✅ Reproduction test passes
230
+ - ✅ Regression tests pass
231
+ - ✅ Manual verification done
232
+
233
+ **Prevention:**
234
+ - [What can prevent similar bugs]
235
+ ```
236
+
237
+ ---
238
+
239
+ ## ⚠️ NEXT STEPS:
240
+ - Bug fixed → `/test` to run full suite
241
+ - Need deeper analysis → `/oracle`
242
+ - Made it worse → `/rollback`
243
+ - All good → `/smart-git-ops` to commit
@@ -0,0 +1,209 @@
1
+ ---
2
+ description: 🧹 Bảo trì mã nguồn & dọn tài nguyên thừa
3
+ safe_auto_run: true
4
+ ---
5
+
6
+ # /code-janitor - Mobile Project Cleaner
7
+
8
+ Keeps iOS/Android/Expo projects clean and consistent.
9
+
10
+ ---
11
+
12
+ ## Phase 1: Localization Audit
13
+ // turbo
14
+
15
+ ### iOS (Swift)
16
+ 1. **Scan for hardcoded strings:**
17
+ ```swift
18
+ // BAD
19
+ Text("Welcome back!")
20
+
21
+ // GOOD
22
+ Text(LocalizedStringKey("welcome_back"))
23
+ ```
24
+
25
+ 2. **Find missing keys:**
26
+ - Scan all `.swift` files for `LocalizedStringKey` usage
27
+ - Compare with `Localizable.strings`
28
+ - Report missing translations
29
+
30
+ 3. **Auto-fix:**
31
+ - Extract hardcoded strings to `Localizable.strings`
32
+ - Replace with localization keys
33
+
34
+ ### Android (Kotlin)
35
+ 1. **Scan for hardcoded strings:**
36
+ ```kotlin
37
+ // BAD
38
+ Text("Welcome back!")
39
+
40
+ // GOOD
41
+ stringResource(R.string.welcome_back)
42
+ ```
43
+
44
+ 2. **Find missing keys:**
45
+ - Scan for string usage
46
+ - Compare with `strings.xml`
47
+
48
+ ### Expo (TypeScript)
49
+ 1. **Scan for hardcoded strings:**
50
+ - Check for strings in components
51
+ - Verify i18n usage if configured
52
+
53
+ ---
54
+
55
+ ## Phase 2: Unused Resource Cleanup
56
+ // turbo
57
+
58
+ ### iOS
59
+ 1. **Unused Images:**
60
+ ```bash
61
+ # Find images in Assets.xcassets not referenced in code
62
+ find . -name "*.swift" -exec grep -l "imageName" {} \;
63
+ ```
64
+
65
+ 2. **Unused Colors:**
66
+ - Check Color assets vs code usage
67
+
68
+ 3. **Dead Code:**
69
+ - Run SwiftLint for unused imports
70
+ - Find unreferenced classes/structs
71
+
72
+ ### Android
73
+ 1. **Unused Resources:**
74
+ ```bash
75
+ ./gradlew lintDebug
76
+ # Check "UnusedResources" warnings
77
+ ```
78
+
79
+ 2. **Unused Dependencies:**
80
+ - Check for unused Gradle dependencies
81
+
82
+ ### Expo
83
+ 1. **Unused packages:**
84
+ ```bash
85
+ npx depcheck
86
+ ```
87
+
88
+ 2. **Unused images:**
89
+ - Scan `assets/` folder vs imports
90
+
91
+ ---
92
+
93
+ ## Phase 3: Code Formatting
94
+ // turbo
95
+
96
+ ### iOS
97
+ ```bash
98
+ # SwiftFormat
99
+ swiftformat . --config .swiftformat
100
+
101
+ # SwiftLint auto-correct
102
+ swiftlint --fix
103
+ ```
104
+
105
+ ### Android
106
+ ```bash
107
+ # Ktlint
108
+ ./gradlew ktlintFormat
109
+
110
+ # Or standalone
111
+ ktlint -F "**/*.kt"
112
+ ```
113
+
114
+ ### Expo
115
+ ```bash
116
+ # Prettier + ESLint
117
+ npm run lint -- --fix
118
+ npx prettier --write "**/*.{ts,tsx}"
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Phase 4: Project-Specific Cleanup
124
+
125
+ ### iOS
126
+ // turbo
127
+ 1. **Info.plist validation:**
128
+ - Check required keys present
129
+ - Verify bundle identifiers
130
+
131
+ 2. **Build Settings:**
132
+ - Check for deprecated settings
133
+ - Verify signing configuration
134
+
135
+ 3. **Podfile cleanup:**
136
+ - Remove unused pods
137
+ - Update pod versions
138
+
139
+ ### Android
140
+ // turbo
141
+ 1. **Manifest validation:**
142
+ - Check permissions
143
+ - Verify activities/services
144
+
145
+ 2. **Gradle cleanup:**
146
+ - Remove deprecated dependencies
147
+ - Update dependency versions
148
+
149
+ 3. **ProGuard rules:**
150
+ - Verify rules are current
151
+
152
+ ### Expo
153
+ // turbo
154
+ 1. **app.json validation:**
155
+ - Check required fields
156
+ - Verify splash/icon paths
157
+
158
+ 2. **Package.json cleanup:**
159
+ - Remove unused dependencies
160
+ - Update versions
161
+
162
+ ---
163
+
164
+ ## Phase 5: File Organization Check
165
+
166
+ ### Verify Architecture Compliance
167
+ 1. **Check if files are in correct folders:**
168
+ - Views in Views/
169
+ - ViewModels in ViewModels/
170
+ - Models in Models/
171
+
172
+ 2. **Check naming conventions:**
173
+ - iOS: PascalCase for files
174
+ - Android: PascalCase for Kotlin, lowercase for resources
175
+ - Expo: PascalCase for components
176
+
177
+ ---
178
+
179
+ ## Phase 6: Report
180
+ // turbo
181
+
182
+ ```markdown
183
+ # 🧹 Code Janitor Report
184
+
185
+ ## Localization
186
+ - Hardcoded strings found: X
187
+ - Strings extracted: Y
188
+ - Missing translations: Z
189
+
190
+ ## Resources
191
+ - Unused images removed: X
192
+ - Unused code detected: Y files
193
+
194
+ ## Formatting
195
+ - Files formatted: X
196
+ - Lint issues fixed: Y
197
+
198
+ ## Recommendations
199
+ - [ ] Review unused code before deletion
200
+ - [ ] Update translations for new strings
201
+ - [ ] Run /test after cleanup
202
+ ```
203
+
204
+ ---
205
+
206
+ ## ⚠️ NEXT STEPS:
207
+ - Review changes → Commit with `/smart-git-ops`
208
+ - Verify nothing broke → `/run`
209
+ - Full audit → `/ux-audit`
@@ -0,0 +1,132 @@
1
+ ---
2
+ description: Kiểm tra chất lượng code, tiêu chuẩn SOLID và các mẫu sửa lỗi tự động.
3
+ alwaysApply: false
4
+ priority: "high"
5
+ ---
6
+
7
+ # Code Quality & AI Automation Rules
8
+
9
+ ## 🎯 Core Purpose
10
+
11
+ **_BẮT BUỘC_** manual workflow cho AI assistants để tự động thực hiện code quality checks mà không dựa vào IDE auto-tools.
12
+
13
+ ## 🔧 MANDATORY AI Execution Rules
14
+
15
+ ### Before Writing Any Code
16
+
17
+ **_BẮT BUỘC_** AI phải thực hiện checklist này trước khi viết bất kỳ dòng code nào:
18
+
19
+ ```markdown
20
+ ☐ 1. SCAN existing file structure và imports
21
+ ☐ 2. IDENTIFY required dependencies và packages
22
+ ☐ 3. PREDICT potential import conflicts
23
+ ☐ 4. VALIDATE target file syntax structure
24
+ ☐ 5. PREPARE import statements list
25
+ ☐ 6. CHECK for existing naming conventions
26
+ ☐ 7. VERIFY package declarations match directory
27
+ ```
28
+
29
+ ### During Code Writing
30
+
31
+ **_BẮT BUỘC_** AI phải thực hiện real-time validation:
32
+
33
+ ```markdown
34
+ ☐ 1. ADD import statements ngay khi sử dụng class mới
35
+ ☐ 2. VALIDATE type compatibility trước khi assignment
36
+ ☐ 3. CHECK null safety cho tất cả nullable operations
37
+ ☐ 4. ENSURE proper bracket matching trong real-time
38
+ ☐ 5. VALIDATE function signatures match usage
39
+ ☐ 6. CHECK variable naming conventions
40
+ ☐ 7. VERIFY proper indentation và formatting
41
+ ```
42
+
43
+ ### After Code Completion
44
+
45
+ **_BẮT BUỘC_** AI phải thực hiện final validation:
46
+
47
+ ```markdown
48
+ ☐ 1. SCAN for any missing imports
49
+ ☐ 2. OPTIMIZE import statements (remove unused)
50
+ ☐ 3. FINAL type safety validation
51
+ ☐ 4. COMPLETE syntax error check
52
+ ☐ 5. VALIDATE code style consistency
53
+ ☐ 6. CHECK for potential performance issues
54
+ ☐ 7. ENSURE proper error handling patterns
55
+ ```
56
+
57
+ ## Code Quality Standards
58
+
59
+ ### Code Style
60
+ - **Naming**: Use consistent, meaningful English naming (camelCase for vars, PascalCase for classes, UPPER_CASE for constants).
61
+ - **Comments**: Explain "Why", not "What".
62
+ - **Formatting**: Consistent indentation (spaces vs tabs) and spacing.
63
+
64
+ ### Architecture & Design
65
+ - **SOLID**: Follow SOLID principles strictly.
66
+ - **Layers**: Clear separation of concerns (Presentation, Business, Data).
67
+ - **Dependency Injection**: Use DI to decouple components.
68
+ - **Composition over Inheritance**: Prefer composition.
69
+
70
+ ### Error Handling
71
+ - **Exceptions**: Catch specific exceptions, not generic ones.
72
+ - **Messages**: Provide meaningful, safe error messages.
73
+ - **Logging**: Log errors with context.
74
+
75
+ ### Performance
76
+ - **Database**: Avoid N+1 queries.
77
+ - **Caching**: Implement caching where appropriate.
78
+ - **Async**: Use async/await for non-blocking operations.
79
+
80
+ ### Security
81
+ - **Input Validation**: Validate all inputs.
82
+ - **Sanitization**: Sanitize data before display to prevent XSS.
83
+ - **SQL Injection**: Use parameterized queries.
84
+ - **Secrets**: Never hardcode secrets.
85
+
86
+ ## 🔍 Manual Code Quality Checklist
87
+
88
+ ### Critical Issues (Must Fix Immediately)
89
+
90
+ ```markdown
91
+ Priority: CRITICAL - Block execution until fixed
92
+
93
+ ☐ Missing import statements → AUTO-ADD appropriate imports
94
+ ☐ Syntax errors (brackets, semicolons) → AUTO-FIX basic syntax
95
+ ☐ Type mismatches → AUTO-CONVERT with safety checks
96
+ ☐ Null pointer risks → AUTO-ADD safe call operators
97
+ ☐ Unresolved references → AUTO-RESOLVE or flag for manual review
98
+ ```
99
+
100
+ ### High Priority Issues (Fix Before Proceeding)
101
+
102
+ ```markdown
103
+ Priority: HIGH - Fix immediately after critical issues
104
+
105
+ ☐ Unused imports → AUTO-REMOVE unused imports
106
+ ☐ Incorrect naming conventions → SUGGEST corrections
107
+ ☐ Missing error handling → AUTO-ADD basic try-catch
108
+ ☐ Performance anti-patterns → FLAG for review
109
+ ☐ Security vulnerabilities → FLAG for immediate review
110
+ ```
111
+
112
+ ## 🛠️ Common Fix Templates
113
+
114
+ ### Android/Kotlin Examples
115
+
116
+ ```kotlin
117
+ // AUTO-FIX TEMPLATE: Null safety
118
+ // BEFORE: user.name
119
+ // AFTER: user?.name
120
+
121
+ // AUTO-FIX TEMPLATE: Missing brackets
122
+ // BEFORE: if (condition) doSomething()
123
+ // AFTER: if (condition) { doSomething() }
124
+ ```
125
+
126
+ ### General Syntax Fixes
127
+
128
+ ```javascript
129
+ // AUTO-FIX TEMPLATE: Missing generic error handling
130
+ // BEFORE: try { call() } catch (e) { log(e) }
131
+ // AFTER: try { call() } catch (e) { logger.error("Call failed", e); throw new ServiceException(e) }
132
+ ```