@dedesfr/prompter 0.9.0 → 1.1.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 (225) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +105 -77
  3. package/dist/cli/index.js +25 -1
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +35 -9
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/commands/login.d.ts +4 -0
  9. package/dist/commands/login.d.ts.map +1 -0
  10. package/dist/commands/login.js +56 -0
  11. package/dist/commands/login.js.map +1 -0
  12. package/dist/commands/logout.d.ts +4 -0
  13. package/dist/commands/logout.d.ts.map +1 -0
  14. package/dist/commands/logout.js +14 -0
  15. package/dist/commands/logout.js.map +1 -0
  16. package/dist/commands/update.d.ts +0 -2
  17. package/dist/commands/update.d.ts.map +1 -1
  18. package/dist/commands/update.js +19 -48
  19. package/dist/commands/update.js.map +1 -1
  20. package/dist/commands/whoami.d.ts +4 -0
  21. package/dist/commands/whoami.d.ts.map +1 -0
  22. package/dist/commands/whoami.js +42 -0
  23. package/dist/commands/whoami.js.map +1 -0
  24. package/dist/core/auth-store.d.ts +10 -0
  25. package/dist/core/auth-store.d.ts.map +1 -0
  26. package/dist/core/auth-store.js +39 -0
  27. package/dist/core/auth-store.js.map +1 -0
  28. package/dist/core/config.d.ts +0 -7
  29. package/dist/core/config.d.ts.map +1 -1
  30. package/dist/core/config.js +0 -128
  31. package/dist/core/config.js.map +1 -1
  32. package/dist/core/registry.d.ts +18 -0
  33. package/dist/core/registry.d.ts.map +1 -0
  34. package/dist/core/registry.js +94 -0
  35. package/dist/core/registry.js.map +1 -0
  36. package/package.json +7 -1
  37. package/AGENTS.md +0 -123
  38. package/CLAUDE.md +0 -17
  39. package/build.js +0 -20
  40. package/convex-setup.md +0 -403
  41. package/dist/core/prompt-templates.d.ts +0 -23
  42. package/dist/core/prompt-templates.d.ts.map +0 -1
  43. package/dist/core/prompt-templates.js +0 -3485
  44. package/dist/core/prompt-templates.js.map +0 -1
  45. package/prompt/ai-humanizer.md +0 -45
  46. package/prompt/api-contract-generator.md +0 -234
  47. package/prompt/apply.md +0 -17
  48. package/prompt/archive.md +0 -21
  49. package/prompt/design-system.md +0 -210
  50. package/prompt/document-explainer.md +0 -149
  51. package/prompt/epic-generator.md +0 -198
  52. package/prompt/epic-single.md +0 -47
  53. package/prompt/erd-generator.md +0 -130
  54. package/prompt/fsd-generator.md +0 -157
  55. package/prompt/prd-agent-generator.md +0 -147
  56. package/prompt/prd-generator.md +0 -195
  57. package/prompt/product-brief.md +0 -289
  58. package/prompt/proposal.md +0 -22
  59. package/prompt/qa-test-scenario.md +0 -133
  60. package/prompt/skill-creator.md +0 -350
  61. package/prompt/story-generator.md +0 -278
  62. package/prompt/story-single.md +0 -70
  63. package/prompt/tdd-generator.md +0 -294
  64. package/prompt/tdd-lite-generator.md +0 -224
  65. package/prompt/wireframe-generator.md +0 -219
  66. package/skills/ai-context-generator/SKILL.md +0 -54
  67. package/skills/ai-context-generator/references/AGENTS.template.md +0 -83
  68. package/skills/ai-context-generator/references/CLAUDE.template.md +0 -39
  69. package/skills/ai-context-generator/references/behavioral-guidelines.md +0 -71
  70. package/skills/ai-context-generator/references/discovery-checklist.md +0 -40
  71. package/skills/ai-context-generator/references/examples/AGENTS.good.md +0 -103
  72. package/skills/ai-context-generator/references/extraction-checklist.md +0 -23
  73. package/skills/ai-context-generator/references/overlays/laravel.md +0 -44
  74. package/skills/ai-humanizer/SKILL.md +0 -50
  75. package/skills/api-contract-generator/SKILL.md +0 -243
  76. package/skills/apply/SKILL.md +0 -23
  77. package/skills/archive/SKILL.md +0 -27
  78. package/skills/cerebro/SKILL.md +0 -187
  79. package/skills/cerebro/references/agents.md +0 -213
  80. package/skills/code-review/SKILL.md +0 -373
  81. package/skills/code-review/assets/report-template-agent.md +0 -212
  82. package/skills/code-review/assets/report-template-compact.md +0 -81
  83. package/skills/code-review/assets/report-template-full.md +0 -264
  84. package/skills/code-review/assets/report-template-human.md +0 -168
  85. package/skills/code-review/references/universal-patterns.md +0 -495
  86. package/skills/design-md/README.md +0 -34
  87. package/skills/design-md/SKILL.md +0 -172
  88. package/skills/design-md/examples/DESIGN.md +0 -154
  89. package/skills/design-system/SKILL.md +0 -216
  90. package/skills/design-system-generator/SKILL.md +0 -324
  91. package/skills/design-system-generator/assets/design-system-template.md +0 -348
  92. package/skills/design-system-generator/references/extraction-patterns.md +0 -321
  93. package/skills/doc-builder/SKILL.md +0 -115
  94. package/skills/doc-builder/references/ui-patterns.md +0 -394
  95. package/skills/document-explainer/SKILL.md +0 -155
  96. package/skills/document-translator/SKILL.md +0 -58
  97. package/skills/enhance/SKILL.md +0 -47
  98. package/skills/enhance-prompt/README.md +0 -34
  99. package/skills/enhance-prompt/SKILL.md +0 -204
  100. package/skills/enhance-prompt/references/KEYWORDS.md +0 -114
  101. package/skills/epic-generator/SKILL.md +0 -204
  102. package/skills/epic-single/SKILL.md +0 -63
  103. package/skills/erd-generator/SKILL.md +0 -138
  104. package/skills/feature-planner/SKILL.md +0 -305
  105. package/skills/feature-planner/assets/implementation-plan-template.md +0 -85
  106. package/skills/frontend-design/LICENSE.txt +0 -177
  107. package/skills/frontend-design/SKILL.md +0 -42
  108. package/skills/fsd-generator/SKILL.md +0 -163
  109. package/skills/gamma-builder/SKILL.md +0 -134
  110. package/skills/laravel-code-review/SKILL.md +0 -383
  111. package/skills/laravel-code-review/assets/report-template-agent.md +0 -195
  112. package/skills/laravel-code-review/assets/report-template-compact.md +0 -79
  113. package/skills/laravel-code-review/assets/report-template-full.md +0 -253
  114. package/skills/laravel-code-review/assets/report-template-human.md +0 -159
  115. package/skills/laravel-code-review/references/laravel-patterns.md +0 -571
  116. package/skills/laravel-code-review/references/php84-features.md +0 -442
  117. package/skills/mcp-builder/LICENSE.txt +0 -202
  118. package/skills/mcp-builder/SKILL.md +0 -236
  119. package/skills/mcp-builder/reference/evaluation.md +0 -602
  120. package/skills/mcp-builder/reference/mcp_best_practices.md +0 -249
  121. package/skills/mcp-builder/reference/node_mcp_server.md +0 -970
  122. package/skills/mcp-builder/reference/python_mcp_server.md +0 -719
  123. package/skills/mcp-builder/scripts/connections.py +0 -151
  124. package/skills/mcp-builder/scripts/evaluation.py +0 -373
  125. package/skills/mcp-builder/scripts/example_evaluation.xml +0 -22
  126. package/skills/mcp-builder/scripts/requirements.txt +0 -2
  127. package/skills/meeting-notes/SKILL.md +0 -159
  128. package/skills/meeting-notes/evals/evals.json +0 -23
  129. package/skills/prd-agent-generator/SKILL.md +0 -132
  130. package/skills/prd-generator/SKILL.md +0 -211
  131. package/skills/product-brief/SKILL.md +0 -141
  132. package/skills/project-orchestrator/SKILL.md +0 -487
  133. package/skills/project-orchestrator/assets/caddy-vps-setup.md +0 -180
  134. package/skills/project-orchestrator/assets/plan-summary-template.md +0 -159
  135. package/skills/prompter-specs/SKILL.md +0 -115
  136. package/skills/prompter-workflow/SKILL.md +0 -166
  137. package/skills/prompter-workflow/evals/evals.json +0 -89
  138. package/skills/proposal/SKILL.md +0 -28
  139. package/skills/qa-test-scenario/SKILL.md +0 -149
  140. package/skills/skill-creator/SKILL.md +0 -173
  141. package/skills/sph-generator/SKILL.md +0 -488
  142. package/skills/story-generator/SKILL.md +0 -285
  143. package/skills/story-single/SKILL.md +0 -86
  144. package/skills/tdd-generator/SKILL.md +0 -300
  145. package/skills/tdd-lite-generator/SKILL.md +0 -230
  146. package/skills/ui-ux-pro/SKILL.md +0 -199
  147. package/skills/ui-ux-pro/assets/design-spec-template.md +0 -173
  148. package/skills/ui-ux-pro/references/component-patterns.md +0 -255
  149. package/skills/ui-ux-pro/references/design-principles.md +0 -167
  150. package/skills/wireframe-generator/SKILL.md +0 -227
  151. package/src/cli/index.ts +0 -223
  152. package/src/commands/archive.ts +0 -302
  153. package/src/commands/change.ts +0 -292
  154. package/src/commands/config.ts +0 -233
  155. package/src/commands/guide.ts +0 -50
  156. package/src/commands/init.ts +0 -597
  157. package/src/commands/list.ts +0 -194
  158. package/src/commands/show.ts +0 -138
  159. package/src/commands/spec.ts +0 -251
  160. package/src/commands/update.ts +0 -129
  161. package/src/commands/upgrade.ts +0 -30
  162. package/src/commands/validate.ts +0 -326
  163. package/src/core/artifact-graph/graph.ts +0 -167
  164. package/src/core/artifact-graph/index.ts +0 -44
  165. package/src/core/artifact-graph/instruction-loader.ts +0 -302
  166. package/src/core/artifact-graph/resolver.ts +0 -226
  167. package/src/core/artifact-graph/schema.ts +0 -124
  168. package/src/core/artifact-graph/state.ts +0 -64
  169. package/src/core/artifact-graph/types.ts +0 -65
  170. package/src/core/completions/command-registry.ts +0 -382
  171. package/src/core/completions/completion-provider.ts +0 -128
  172. package/src/core/completions/generators/bash-generator.ts +0 -191
  173. package/src/core/completions/generators/fish-generator.ts +0 -188
  174. package/src/core/completions/generators/powershell-generator.ts +0 -223
  175. package/src/core/completions/generators/zsh-generator.ts +0 -281
  176. package/src/core/completions/templates/bash-templates.ts +0 -24
  177. package/src/core/completions/templates/fish-templates.ts +0 -40
  178. package/src/core/completions/templates/powershell-templates.ts +0 -25
  179. package/src/core/completions/templates/zsh-templates.ts +0 -36
  180. package/src/core/completions/types.ts +0 -90
  181. package/src/core/config-schema.ts +0 -230
  182. package/src/core/config.ts +0 -181
  183. package/src/core/configurators/slash/antigravity.ts +0 -10
  184. package/src/core/configurators/slash/base.ts +0 -109
  185. package/src/core/configurators/slash/claude.ts +0 -10
  186. package/src/core/configurators/slash/codex.ts +0 -10
  187. package/src/core/configurators/slash/droid.ts +0 -10
  188. package/src/core/configurators/slash/forge.ts +0 -10
  189. package/src/core/configurators/slash/github-copilot.ts +0 -10
  190. package/src/core/configurators/slash/index.ts +0 -10
  191. package/src/core/configurators/slash/kilocode.ts +0 -10
  192. package/src/core/configurators/slash/opencode.ts +0 -10
  193. package/src/core/configurators/slash/registry.ts +0 -51
  194. package/src/core/converters/json-converter.ts +0 -62
  195. package/src/core/global-config.ts +0 -136
  196. package/src/core/parsers/change-parser.ts +0 -234
  197. package/src/core/parsers/markdown-parser.ts +0 -237
  198. package/src/core/parsers/requirement-blocks.ts +0 -234
  199. package/src/core/prompt-templates.ts +0 -3504
  200. package/src/core/schemas/base.schema.ts +0 -20
  201. package/src/core/schemas/change.schema.ts +0 -42
  202. package/src/core/schemas/index.ts +0 -20
  203. package/src/core/schemas/spec.schema.ts +0 -17
  204. package/src/core/skill-discovery.ts +0 -68
  205. package/src/core/specs-apply.ts +0 -483
  206. package/src/core/styles/palette.ts +0 -8
  207. package/src/core/templates/agents-template.ts +0 -459
  208. package/src/core/templates/claude-template.ts +0 -2
  209. package/src/core/templates/index.ts +0 -3
  210. package/src/core/templates/project-template.ts +0 -32
  211. package/src/core/validation/constants.ts +0 -48
  212. package/src/core/validation/types.ts +0 -19
  213. package/src/core/validation/validator.ts +0 -449
  214. package/src/core/view.ts +0 -219
  215. package/src/index.ts +0 -1
  216. package/src/utils/change-metadata.ts +0 -171
  217. package/src/utils/change-utils.ts +0 -131
  218. package/src/utils/file-system.ts +0 -252
  219. package/src/utils/index.ts +0 -12
  220. package/src/utils/interactive.ts +0 -29
  221. package/src/utils/item-discovery.ts +0 -66
  222. package/src/utils/match.ts +0 -26
  223. package/src/utils/shell-detection.ts +0 -62
  224. package/src/utils/task-progress.ts +0 -43
  225. package/tsconfig.json +0 -28
@@ -1,168 +0,0 @@
1
- ````markdown
2
- # Code Review Report
3
-
4
- **Generated:** {{TIMESTAMP}}
5
- **Review Style:** {{REVIEW_STYLE_EMOJI}} {{REVIEW_STYLE}}
6
- **Tech Stack:** {{TECH_STACK}}
7
- **Files Reviewed:** {{FILE_COUNT}} | **Issues Found:** {{ISSUE_COUNT}}
8
-
9
- ---
10
-
11
- ## 🎯 Review Configuration
12
-
13
- | Setting | Value |
14
- | ---------------- | ------------------------------------------- |
15
- | **Review Style** | {{REVIEW_STYLE_EMOJI}} **{{REVIEW_STYLE}}** |
16
- | **Tech Stack** | {{TECH_STACK}} |
17
- | **AGENTS.md** | {{AGENTS_MD_STATUS}} |
18
-
19
- ### Focus Areas
20
-
21
- | Focus Area | Status | Level |
22
- | ----------------- | --------------------------- | --------------------------- |
23
- | Security | {{FOCUS_SECURITY_EMOJI}} | {{FOCUS_SECURITY_LEVEL}} |
24
- | Performance | {{FOCUS_PERFORMANCE_EMOJI}} | {{FOCUS_PERFORMANCE_LEVEL}} |
25
- | Bug detection | {{FOCUS_BUGS_EMOJI}} | {{FOCUS_BUGS_LEVEL}} |
26
- | Code style | {{FOCUS_STYLE_EMOJI}} | {{FOCUS_STYLE_LEVEL}} |
27
- | Test coverage | {{FOCUS_TESTS_EMOJI}} | {{FOCUS_TESTS_LEVEL}} |
28
- | Documentation | {{FOCUS_DOCS_EMOJI}} | {{FOCUS_DOCS_LEVEL}} |
29
-
30
- ---
31
-
32
- ## 📊 Overview
33
-
34
- | 🔴 Critical | 🟠 Warning | 🟡 Optimize | 🔵 Quality |
35
- | :----------------: | :---------------: | :--------------------: | :---------------: |
36
- | {{CRITICAL_COUNT}} | {{WARNING_COUNT}} | {{OPTIMIZATION_COUNT}} | {{QUALITY_COUNT}} |
37
-
38
- **Categories:** {{SECURITY_COUNT}} security | {{PERFORMANCE_COUNT}} performance | {{ARCHITECTURE_COUNT}} architecture | {{LANG_FRAMEWORK_COUNT}} lang/fw | {{ERROR_HANDLING_COUNT}} error handling
39
-
40
- ---
41
-
42
- {{#if has_critical}}
43
- ## 🔴 Critical Issues (Fix Before Commit)
44
-
45
- {{#each critical_issues}}
46
- ### {{file_short}}
47
-
48
- **Line {{line}}** — {{title}}
49
-
50
- > {{description}}
51
-
52
- **Fix:** {{recommendation}}
53
-
54
- {{#if suggested_fix}}
55
- ```{{language}}
56
- {{suggested_fix}}
57
- ```
58
- {{/if}}
59
-
60
- {{#if agents_md_rule}}
61
- 📋 **AGENTS.md:** {{agents_md_rule}}
62
- {{/if}}
63
-
64
- ---
65
- {{/each}}
66
- {{/if}}
67
-
68
- {{#if has_warnings}}
69
- {{#if_not_lenient}}
70
- ## 🟠 Warnings (Should Address)
71
-
72
- {{#each warning_issues}}
73
- - **{{file_short}}:{{line}}** — {{title}}
74
- - {{description}}
75
- - 💡 {{recommendation}}
76
- {{/each}}
77
-
78
- ---
79
- {{/if_not_lenient}}
80
- {{/if}}
81
-
82
- {{#if has_optimization}}
83
- {{#if_not_lenient}}
84
- ## 🟡 Optimization Suggestions
85
-
86
- {{#each optimization_issues}}
87
- - **{{file_short}}:{{line}}** — {{title}}
88
- - {{recommendation}}
89
- {{/each}}
90
-
91
- ---
92
- {{/if_not_lenient}}
93
- {{/if}}
94
-
95
- {{#if has_quality}}
96
- {{#if_strict}}
97
- ## 🔵 Code Quality
98
-
99
- {{#each quality_issues}}
100
- - **{{file_short}}:{{line}}** — {{title}}
101
- {{/each}}
102
-
103
- ---
104
- {{/if_strict}}
105
- {{/if}}
106
-
107
- ## ✅ Quick Action Checklist
108
-
109
- ### Must Fix (Critical)
110
- {{#each critical_issues}}
111
- - [ ] `{{file_short}}:{{line}}` — {{title}}
112
- {{/each}}
113
- {{#if_no_critical}}
114
- - ✅ No critical issues found!
115
- {{/if_no_critical}}
116
-
117
- {{#if_not_lenient}}
118
- ### Should Fix (Warnings)
119
- {{#each warning_issues}}
120
- - [ ] `{{file_short}}:{{line}}` — {{title}}
121
- {{/each}}
122
- {{#if_no_warnings}}
123
- - ✅ No warnings found!
124
- {{/if_no_warnings}}
125
-
126
- ### Nice to Have (Optimization)
127
- {{#each optimization_issues}}
128
- - [ ] `{{file_short}}:{{line}}` — {{title}}
129
- {{/each}}
130
- {{/if_not_lenient}}
131
-
132
- {{#if_strict}}
133
- ### Polish (Quality)
134
- {{#each quality_issues}}
135
- - [ ] `{{file_short}}:{{line}}` — {{title}}
136
- {{/each}}
137
- {{/if_strict}}
138
-
139
- ---
140
-
141
- {{#if agents_md_found}}
142
- ## 📋 AGENTS.md Convention Compliance
143
-
144
- {{#each convention_checks}}
145
- - {{status_emoji}} **{{convention_name}}** — {{notes}}
146
- {{/each}}
147
- {{/if}}
148
-
149
- ---
150
-
151
- ## 💬 Review Summary
152
-
153
- {{#if_strict}}
154
- > **Strict Mode:** This review flagged all potential issues across all focus areas. Address critical and warning issues before committing. Quality issues are optional but recommended for production code.
155
- {{/if_strict}}
156
-
157
- {{#if_balanced}}
158
- > **Balanced Mode:** This review focused on high-confidence issues. Critical issues must be fixed. Warnings are strongly recommended. Lower severity items were filtered for practicality.
159
- {{/if_balanced}}
160
-
161
- {{#if_lenient}}
162
- > **Lenient Mode:** This review only flagged critical bugs and security issues. Great job on the code! 🎉 Only urgent items require attention before commit.
163
- {{/if_lenient}}
164
-
165
- ---
166
-
167
- *Generated by code-review skill • Human-readable format • {{REVIEW_STYLE}} mode*
168
- ````
@@ -1,495 +0,0 @@
1
- ````markdown
2
- # Universal Code Review Detection Patterns
3
-
4
- Cross-language patterns for identifying common issues. Organized by category with language-specific examples.
5
-
6
- ---
7
-
8
- ## Security Issues
9
-
10
- ### Injection Flaws
11
-
12
- **SQL Injection:**
13
- ```python
14
- # ❌ Bad: String concatenation in query
15
- cursor.execute("SELECT * FROM users WHERE id = " + user_id)
16
-
17
- # ✅ Good: Parameterized query
18
- cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
19
- ```
20
-
21
- ```javascript
22
- // ❌ Bad: Template literal in query
23
- db.query(`SELECT * FROM users WHERE id = ${userId}`);
24
-
25
- // ✅ Good: Parameterized query
26
- db.query("SELECT * FROM users WHERE id = $1", [userId]);
27
- ```
28
-
29
- ```go
30
- // ❌ Bad: String formatting in query
31
- db.Query(fmt.Sprintf("SELECT * FROM users WHERE id = %s", id))
32
-
33
- // ✅ Good: Parameterized query
34
- db.Query("SELECT * FROM users WHERE id = $1", id)
35
- ```
36
-
37
- **Command Injection:**
38
- ```python
39
- # ❌ Bad: User input in shell command
40
- os.system("ls " + user_input)
41
- subprocess.run(f"grep {pattern} file.txt", shell=True)
42
-
43
- # ✅ Good: Use list form, avoid shell=True
44
- subprocess.run(["grep", pattern, "file.txt"])
45
- ```
46
-
47
- ```javascript
48
- // ❌ Bad: User input in exec
49
- const { exec } = require("child_process");
50
- exec("ls " + userInput);
51
-
52
- // ✅ Good: Use execFile with arguments
53
- const { execFile } = require("child_process");
54
- execFile("ls", [userInput]);
55
- ```
56
-
57
- ### Hardcoded Secrets
58
-
59
- ```python
60
- # ❌ Bad: Hardcoded credentials
61
- API_KEY = "sk-1234567890abcdef"
62
- db_password = "supersecret123"
63
- ```
64
-
65
- ```javascript
66
- // ❌ Bad: Secrets in source code
67
- const stripe = require("stripe")("sk_live_xxx");
68
- ```
69
-
70
- ```go
71
- // ❌ Bad: Embedded credentials
72
- const apiKey = "AIzaSy..."
73
- ```
74
-
75
- **Detection patterns (all languages):**
76
- - Strings matching: `password`, `secret`, `api_key`, `token`, `credential`
77
- - Base64-encoded strings assigned to auth variables
78
- - Connection strings with embedded passwords
79
- - Private keys or certificates in source
80
-
81
- **✅ Good: Use environment variables or secret managers**
82
-
83
- ### XSS (Cross-Site Scripting)
84
-
85
- ```javascript
86
- // ❌ Bad: innerHTML with user data
87
- element.innerHTML = userInput;
88
-
89
- // ✅ Good: Use textContent or sanitize
90
- element.textContent = userInput;
91
- ```
92
-
93
- ```python
94
- # ❌ Bad: Jinja2 with |safe on user input
95
- {{ user_comment|safe }}
96
-
97
- # ✅ Good: Auto-escaped (default)
98
- {{ user_comment }}
99
- ```
100
-
101
- ### Mass Assignment / Over-posting
102
-
103
- ```python
104
- # ❌ Bad: Using all request data to create object
105
- user = User(**request.data)
106
-
107
- # ✅ Good: Whitelist fields
108
- user = User(name=data["name"], email=data["email"])
109
- ```
110
-
111
- ```javascript
112
- // ❌ Bad: Spreading request body into model
113
- const user = await User.create(req.body);
114
-
115
- // ✅ Good: Pick specific fields
116
- const { name, email } = req.body;
117
- const user = await User.create({ name, email });
118
- ```
119
-
120
- ```csharp
121
- // ❌ Bad: Binding all properties
122
- public IActionResult Create([FromBody] User user)
123
-
124
- // ✅ Good: Use DTO or [Bind] attribute
125
- public IActionResult Create([Bind("Name,Email")] User user)
126
- ```
127
-
128
- ---
129
-
130
- ## Performance Anti-patterns
131
-
132
- ### N+1 Query Problem
133
-
134
- ```python
135
- # ❌ Bad: N+1 in Django
136
- posts = Post.objects.all()
137
- for post in posts:
138
- print(post.author.name) # Query per post!
139
-
140
- # ✅ Good: select_related / prefetch_related
141
- posts = Post.objects.select_related("author").all()
142
- ```
143
-
144
- ```ruby
145
- # ❌ Bad: N+1 in Rails
146
- @posts = Post.all
147
- @posts.each { |p| p.author.name } # N+1!
148
-
149
- # ✅ Good: Eager loading
150
- @posts = Post.includes(:author).all
151
- ```
152
-
153
- ```javascript
154
- // ❌ Bad: N+1 in Sequelize
155
- const posts = await Post.findAll();
156
- for (const post of posts) {
157
- const author = await post.getAuthor(); // N+1!
158
- }
159
-
160
- // ✅ Good: Include association
161
- const posts = await Post.findAll({ include: "author" });
162
- ```
163
-
164
- ```go
165
- // ❌ Bad: N+1 in GORM
166
- var posts []Post
167
- db.Find(&posts)
168
- for _, post := range posts {
169
- db.First(&post.Author, post.AuthorID) // N+1!
170
- }
171
-
172
- // ✅ Good: Preload
173
- db.Preload("Author").Find(&posts)
174
- ```
175
-
176
- ### Blocking Operations in Async Context
177
-
178
- ```javascript
179
- // ❌ Bad: Synchronous file read in async server
180
- const data = fs.readFileSync("/large/file.json");
181
-
182
- // ✅ Good: Async version
183
- const data = await fs.promises.readFile("/large/file.json");
184
- ```
185
-
186
- ```python
187
- # ❌ Bad: Blocking call in async function
188
- async def handler():
189
- data = requests.get(url) # Blocks event loop!
190
-
191
- # ✅ Good: Use async HTTP client
192
- async def handler():
193
- async with aiohttp.ClientSession() as session:
194
- data = await session.get(url)
195
- ```
196
-
197
- ### Inefficient Algorithms
198
-
199
- ```python
200
- # ❌ Bad: O(n²) lookup
201
- for item in items:
202
- if item in large_list: # O(n) per check
203
- process(item)
204
-
205
- # ✅ Good: O(n) with set
206
- large_set = set(large_list)
207
- for item in items:
208
- if item in large_set: # O(1) per check
209
- process(item)
210
- ```
211
-
212
- ```javascript
213
- // ❌ Bad: Repeated array.includes in loop (O(n²))
214
- items.forEach((item) => {
215
- if (largeArray.includes(item)) process(item);
216
- });
217
-
218
- // ✅ Good: Use Set (O(n))
219
- const largeSet = new Set(largeArray);
220
- items.forEach((item) => {
221
- if (largeSet.has(item)) process(item);
222
- });
223
- ```
224
-
225
- ### Missing Pagination
226
-
227
- ```python
228
- # ❌ Bad: Loading all records
229
- users = User.objects.all()
230
-
231
- # ✅ Good: Paginate
232
- users = User.objects.all()[:25] # or use Paginator
233
- ```
234
-
235
- ```javascript
236
- // ❌ Bad: No limit
237
- const users = await db.query("SELECT * FROM users");
238
-
239
- // ✅ Good: Paginate
240
- const users = await db.query("SELECT * FROM users LIMIT $1 OFFSET $2", [limit, offset]);
241
- ```
242
-
243
- ---
244
-
245
- ## Error Handling
246
-
247
- ### Swallowed Exceptions
248
-
249
- ```python
250
- # ❌ Bad: Silent catch
251
- try:
252
- process_data()
253
- except Exception:
254
- pass
255
-
256
- # ✅ Good: Log or handle
257
- try:
258
- process_data()
259
- except Exception as e:
260
- logger.error("Processing failed", exc_info=e)
261
- raise
262
- ```
263
-
264
- ```javascript
265
- // ❌ Bad: Empty catch
266
- try {
267
- await processData();
268
- } catch (e) {}
269
-
270
- // ✅ Good: Handle the error
271
- try {
272
- await processData();
273
- } catch (e) {
274
- logger.error("Processing failed", e);
275
- throw;
276
- }
277
- ```
278
-
279
- ```go
280
- // ❌ Bad: Ignoring error
281
- result, _ := doSomething()
282
-
283
- // ✅ Good: Handle the error
284
- result, err := doSomething()
285
- if err != nil {
286
- return fmt.Errorf("doSomething failed: %w", err)
287
- }
288
- ```
289
-
290
- ### Overly Broad Exception Catching
291
-
292
- ```python
293
- # ❌ Bad: Catching everything
294
- except Exception:
295
- except BaseException:
296
-
297
- # ✅ Good: Specific exceptions
298
- except (ValueError, KeyError) as e:
299
- ```
300
-
301
- ```java
302
- // ❌ Bad: Catching generic Exception
303
- catch (Exception e) { }
304
-
305
- // ✅ Good: Specific exception types
306
- catch (IOException | ParseException e) { }
307
- ```
308
-
309
- ### Missing Error Handling for I/O
310
-
311
- ```python
312
- # ❌ Bad: No error handling for file I/O
313
- data = open("config.json").read()
314
-
315
- # ✅ Good: Handle potential errors
316
- try:
317
- with open("config.json") as f:
318
- data = f.read()
319
- except FileNotFoundError:
320
- data = default_config
321
- ```
322
-
323
- ---
324
-
325
- ## Architecture Issues
326
-
327
- ### God Object / Fat Controller
328
-
329
- **Detection:** Class or function with >200 lines, >10 methods, or >5 dependencies.
330
-
331
- ```python
332
- # ❌ Bad: Controller doing everything
333
- class UserView(APIView):
334
- def post(self, request):
335
- # Validates, creates user, sends email, creates token,
336
- # logs event, syncs to CRM... all in one method
337
-
338
- # ✅ Good: Delegate to service layer
339
- class UserView(APIView):
340
- def post(self, request):
341
- serializer = UserSerializer(data=request.data)
342
- serializer.is_valid(raise_exception=True)
343
- user = UserService.register(serializer.validated_data)
344
- return Response(UserSerializer(user).data, status=201)
345
- ```
346
-
347
- ### Business Logic in Wrong Layer
348
-
349
- **Detection:** Database queries in views/templates, HTTP concerns in models/services.
350
-
351
- ```javascript
352
- // ❌ Bad: DB query in React component
353
- function UserList() {
354
- const users = await db.query("SELECT * FROM users"); // Wrong layer!
355
- }
356
-
357
- // ✅ Good: API call from component, query in backend
358
- function UserList() {
359
- const users = await fetch("/api/users").then((r) => r.json());
360
- }
361
- ```
362
-
363
- ### Circular Dependencies
364
-
365
- **Detection:** Module A imports B, B imports A.
366
-
367
- ```python
368
- # ❌ Bad: Circular import
369
- # file: models.py
370
- from .services import UserService
371
-
372
- # file: services.py
373
- from .models import User # Circular!
374
- ```
375
-
376
- **Fix:** Move shared types to a separate module, use dependency injection, or use lazy imports.
377
-
378
- ---
379
-
380
- ## Code Quality
381
-
382
- ### Missing Type Annotations
383
-
384
- ```python
385
- # ❌ Bad: No types
386
- def process(data, options):
387
- return data
388
-
389
- # ✅ Good: Type hints
390
- def process(data: dict[str, Any], options: ProcessOptions) -> Result:
391
- return Result(data)
392
- ```
393
-
394
- ```javascript
395
- // TypeScript: ❌ Bad - any type
396
- function process(data: any): any { }
397
-
398
- // ✅ Good: Specific types
399
- function process(data: Record<string, unknown>): Result { }
400
- ```
401
-
402
- ### Deprecated API Usage
403
-
404
- **Detection patterns:**
405
- - Functions/methods marked with `@deprecated` decorators
406
- - Import of known deprecated modules
407
- - Usage of APIs removed in newer language versions
408
- - Compiler/linter warnings about deprecation
409
-
410
- ### Dead Code
411
-
412
- **Detection patterns:**
413
- - Functions never called (no references)
414
- - Unreachable code after `return`, `throw`, `break`
415
- - Commented-out code blocks (>5 lines)
416
- - Unused imports/variables
417
- - Feature flags always evaluating to same value
418
-
419
- ### Code Duplication
420
-
421
- **Detection:**
422
- - Identical or near-identical blocks (>10 lines) across files
423
- - Repeated patterns that could be extracted into a shared utility
424
- - Copy-pasted logic with minor variations
425
-
426
- ---
427
-
428
- ## Resource Management
429
-
430
- ### Resource Leaks
431
-
432
- ```python
433
- # ❌ Bad: Unclosed file handle
434
- f = open("data.txt")
435
- data = f.read()
436
- # f never closed if exception occurs
437
-
438
- # ✅ Good: Context manager
439
- with open("data.txt") as f:
440
- data = f.read()
441
- ```
442
-
443
- ```go
444
- // ❌ Bad: Unclosed response body
445
- resp, _ := http.Get(url)
446
- // resp.Body never closed
447
-
448
- // ✅ Good: Defer close
449
- resp, err := http.Get(url)
450
- if err != nil { return err }
451
- defer resp.Body.Close()
452
- ```
453
-
454
- ```java
455
- // ❌ Bad: Unclosed connection
456
- Connection conn = DriverManager.getConnection(url);
457
- // conn never closed
458
-
459
- // ✅ Good: Try-with-resources
460
- try (Connection conn = DriverManager.getConnection(url)) {
461
- // use connection
462
- }
463
- ```
464
-
465
- ### Missing Connection Pooling
466
-
467
- **Detection:** Database or HTTP connections created per request instead of shared pool.
468
-
469
- ---
470
-
471
- ## Severity Classification
472
-
473
- | Severity | Emoji | Universal Criteria |
474
- | ------------ | ----- | ----------------------------------------------------------------- |
475
- | Critical | 🔴 | Security vulnerabilities, data loss risks, crashes, auth bypasses |
476
- | Warning | 🟠 | Performance issues, design flaws, error handling gaps |
477
- | Optimization | 🟡 | Efficiency improvements, code duplication, missing caching |
478
- | Quality | 🔵 | Best practices, conventions, modern syntax, documentation |
479
-
480
- ## Detection Priority by Language
481
-
482
- | Language | Top Issues to Check |
483
- | -------------- | -------------------------------------------------------------------- |
484
- | Python | Type hints, injection, N+1 (Django/SQLAlchemy), async misuse |
485
- | JavaScript/TS | XSS, any types, blocking event loop, missing await, memory leaks |
486
- | PHP | SQL injection, XSS, mass assignment, type safety, deprecated APIs |
487
- | Go | Ignored errors, goroutine leaks, unclosed readers, race conditions |
488
- | Rust | Unsafe blocks, unwrap() abuse, clone() overhead, lifetime issues |
489
- | Java | Resource leaks, broad catches, null safety, generics misuse |
490
- | Ruby | N+1 (Rails), mass assignment, SQL injection, missing strong params |
491
- | C# | Over-posting, async void, IDisposable leaks, null reference |
492
- | Swift | Force unwrap abuse, retain cycles, main thread violations |
493
- | Kotlin | Platform types, coroutine scope leaks, null safety bypass |
494
-
495
- ````
@@ -1,34 +0,0 @@
1
- # Stitch Design System Documentation Skill
2
-
3
- ## Install
4
-
5
- ```bash
6
- npx skills add google-labs-code/stitch-skills --skill design-md --global
7
- ```
8
-
9
- ## Example Prompt
10
-
11
- ```text
12
- Analyze my Furniture Collection project's Home screen and generate a comprehensive DESIGN.md file documenting the design system.
13
- ```
14
-
15
- ## Skill Structure
16
-
17
- This repository follows the **Agent Skills** open standard. Each skill is self-contained with its own logic, workflow, and reference materials.
18
-
19
- ```text
20
- design-md/
21
- ├── SKILL.md — Core instructions & workflow
22
- ├── examples/ — Sample DESIGN.md outputs
23
- └── README.md — This file
24
- ```
25
-
26
- ## How it Works
27
-
28
- When activated, the agent follows a structured design analysis pipeline:
29
-
30
- 1. **Retrieval**: Uses the Stitch MCP Server to fetch project screens, HTML code, and design metadata.
31
- 2. **Extraction**: Identifies design tokens including colors, typography, spacing, and component patterns.
32
- 3. **Translation**: Converts technical CSS/Tailwind values into descriptive, natural design language.
33
- 4. **Synthesis**: Generates a comprehensive DESIGN.md following the semantic design system format.
34
- 5. **Alignment**: Ensures output follows Stitch Effective Prompting Guide principles for optimal screen generation.