@paulojalowyj/openkit 0.1.1

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 (281) hide show
  1. package/.opencode/ARCHITECTURE.md +150 -0
  2. package/.opencode/LICENSE +21 -0
  3. package/.opencode/bin/cli.js +213 -0
  4. package/.opencode/commands/README.md +273 -0
  5. package/.opencode/commands/analyze.md +64 -0
  6. package/.opencode/commands/brainstorm.md +186 -0
  7. package/.opencode/commands/checklist.md +62 -0
  8. package/.opencode/commands/clarify.md +40 -0
  9. package/.opencode/commands/context.md +68 -0
  10. package/.opencode/commands/create.md +70 -0
  11. package/.opencode/commands/debug.md +160 -0
  12. package/.opencode/commands/deploy.md +244 -0
  13. package/.opencode/commands/doc.md +45 -0
  14. package/.opencode/commands/engineer.md +483 -0
  15. package/.opencode/commands/impl.md +242 -0
  16. package/.opencode/commands/plan.md +250 -0
  17. package/.opencode/commands/preview.md +87 -0
  18. package/.opencode/commands/specify.md +66 -0
  19. package/.opencode/commands/status.md +103 -0
  20. package/.opencode/commands/tasks.md +58 -0
  21. package/.opencode/commands/test.md +104 -0
  22. package/.opencode/commands/ui-ux.md +216 -0
  23. package/.opencode/prompts/backend-specialist.md +315 -0
  24. package/.opencode/prompts/chat.md +36 -0
  25. package/.opencode/prompts/database-architect.md +244 -0
  26. package/.opencode/prompts/debugger.md +244 -0
  27. package/.opencode/prompts/devops-engineer.md +259 -0
  28. package/.opencode/prompts/documentation-writer.md +121 -0
  29. package/.opencode/prompts/explorer-agent.md +92 -0
  30. package/.opencode/prompts/frontend-specialist.md +608 -0
  31. package/.opencode/prompts/mobile-developer.md +393 -0
  32. package/.opencode/prompts/orchestrator.md +472 -0
  33. package/.opencode/prompts/penetration-tester.md +205 -0
  34. package/.opencode/prompts/performance-optimizer.md +204 -0
  35. package/.opencode/prompts/product-owner.md +113 -0
  36. package/.opencode/prompts/project-planner.md +413 -0
  37. package/.opencode/prompts/security-auditor.md +187 -0
  38. package/.opencode/prompts/seo-specialist.md +128 -0
  39. package/.opencode/prompts/test-engineer.md +190 -0
  40. package/.opencode/rules/AGENT_TEMPLATE.md +391 -0
  41. package/.opencode/rules/MASTER.md +272 -0
  42. package/.opencode/rules/README.md +266 -0
  43. package/.opencode/rules/TODOLIST_EXAMPLES.md +675 -0
  44. package/.opencode/rules/TODOLIST_PROTOCOL.md +495 -0
  45. package/.opencode/rules/TOOL_USAGE.md +731 -0
  46. package/.opencode/scripts/auto_preview.py +100 -0
  47. package/.opencode/scripts/checklist.py +217 -0
  48. package/.opencode/scripts/session_manager.py +225 -0
  49. package/.opencode/scripts/verify_all.py +403 -0
  50. package/.opencode/skills/api-patterns/SKILL.md +80 -0
  51. package/.opencode/skills/api-patterns/api-style.md +42 -0
  52. package/.opencode/skills/api-patterns/auth.md +24 -0
  53. package/.opencode/skills/api-patterns/documentation.md +26 -0
  54. package/.opencode/skills/api-patterns/graphql.md +41 -0
  55. package/.opencode/skills/api-patterns/rate-limiting.md +31 -0
  56. package/.opencode/skills/api-patterns/response.md +37 -0
  57. package/.opencode/skills/api-patterns/rest.md +40 -0
  58. package/.opencode/skills/api-patterns/scripts/api_validator.py +211 -0
  59. package/.opencode/skills/api-patterns/security-testing.md +122 -0
  60. package/.opencode/skills/api-patterns/trpc.md +41 -0
  61. package/.opencode/skills/api-patterns/versioning.md +22 -0
  62. package/.opencode/skills/app-builder/SKILL.md +101 -0
  63. package/.opencode/skills/app-builder/agent-coordination.md +71 -0
  64. package/.opencode/skills/app-builder/feature-building.md +53 -0
  65. package/.opencode/skills/app-builder/project-detection.md +34 -0
  66. package/.opencode/skills/app-builder/scaffolding.md +116 -0
  67. package/.opencode/skills/app-builder/tech-stack.md +40 -0
  68. package/.opencode/skills/app-builder/templates/SKILL.md +39 -0
  69. package/.opencode/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  70. package/.opencode/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  71. package/.opencode/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  72. package/.opencode/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  73. package/.opencode/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  74. package/.opencode/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  75. package/.opencode/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  76. package/.opencode/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +81 -0
  77. package/.opencode/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
  78. package/.opencode/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
  79. package/.opencode/skills/app-builder/templates/nuxt-app/TEMPLATE.md +100 -0
  80. package/.opencode/skills/app-builder/templates/python-fastapi/TEMPLATE.md +82 -0
  81. package/.opencode/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
  82. package/.opencode/skills/architecture/SKILL.md +55 -0
  83. package/.opencode/skills/architecture/context-discovery.md +43 -0
  84. package/.opencode/skills/architecture/examples.md +94 -0
  85. package/.opencode/skills/architecture/pattern-selection.md +68 -0
  86. package/.opencode/skills/architecture/patterns-reference.md +50 -0
  87. package/.opencode/skills/architecture/trade-off-analysis.md +77 -0
  88. package/.opencode/skills/bash-linux/SKILL.md +199 -0
  89. package/.opencode/skills/behavioral-modes/SKILL.md +242 -0
  90. package/.opencode/skills/brainstorming/SKILL.md +163 -0
  91. package/.opencode/skills/brainstorming/dynamic-questioning.md +350 -0
  92. package/.opencode/skills/clean-code/SKILL.md +201 -0
  93. package/.opencode/skills/code-review-checklist/SKILL.md +109 -0
  94. package/.opencode/skills/database-design/SKILL.md +73 -0
  95. package/.opencode/skills/database-design/database-selection.md +43 -0
  96. package/.opencode/skills/database-design/indexing.md +39 -0
  97. package/.opencode/skills/database-design/migrations.md +48 -0
  98. package/.opencode/skills/database-design/optimization.md +36 -0
  99. package/.opencode/skills/database-design/orm-selection.md +30 -0
  100. package/.opencode/skills/database-design/schema-design.md +56 -0
  101. package/.opencode/skills/database-design/scripts/schema_validator.py +172 -0
  102. package/.opencode/skills/deployment-procedures/SKILL.md +241 -0
  103. package/.opencode/skills/documentation-templates/SKILL.md +279 -0
  104. package/.opencode/skills/frontend-design/SKILL.md +446 -0
  105. package/.opencode/skills/frontend-design/animation-guide.md +331 -0
  106. package/.opencode/skills/frontend-design/color-system.md +311 -0
  107. package/.opencode/skills/frontend-design/data/charts.csv +26 -0
  108. package/.opencode/skills/frontend-design/data/colors.csv +97 -0
  109. package/.opencode/skills/frontend-design/data/icons.csv +101 -0
  110. package/.opencode/skills/frontend-design/data/landing.csv +31 -0
  111. package/.opencode/skills/frontend-design/data/products.csv +97 -0
  112. package/.opencode/skills/frontend-design/data/prompts.csv +24 -0
  113. package/.opencode/skills/frontend-design/data/react-performance.csv +45 -0
  114. package/.opencode/skills/frontend-design/data/stacks/flutter.csv +53 -0
  115. package/.opencode/skills/frontend-design/data/stacks/html-tailwind.csv +56 -0
  116. package/.opencode/skills/frontend-design/data/stacks/jetpack-compose.csv +53 -0
  117. package/.opencode/skills/frontend-design/data/stacks/nextjs.csv +53 -0
  118. package/.opencode/skills/frontend-design/data/stacks/nuxt-ui.csv +51 -0
  119. package/.opencode/skills/frontend-design/data/stacks/nuxtjs.csv +59 -0
  120. package/.opencode/skills/frontend-design/data/stacks/react-native.csv +52 -0
  121. package/.opencode/skills/frontend-design/data/stacks/react.csv +54 -0
  122. package/.opencode/skills/frontend-design/data/stacks/shadcn.csv +61 -0
  123. package/.opencode/skills/frontend-design/data/stacks/svelte.csv +54 -0
  124. package/.opencode/skills/frontend-design/data/stacks/swiftui.csv +51 -0
  125. package/.opencode/skills/frontend-design/data/stacks/vue.csv +50 -0
  126. package/.opencode/skills/frontend-design/data/styles.csv +59 -0
  127. package/.opencode/skills/frontend-design/data/typography.csv +58 -0
  128. package/.opencode/skills/frontend-design/data/ui-reasoning.csv +101 -0
  129. package/.opencode/skills/frontend-design/data/ux-guidelines.csv +100 -0
  130. package/.opencode/skills/frontend-design/data/web-interface.csv +31 -0
  131. package/.opencode/skills/frontend-design/decision-trees.md +418 -0
  132. package/.opencode/skills/frontend-design/motion-graphics.md +306 -0
  133. package/.opencode/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  134. package/.opencode/skills/frontend-design/scripts/core.py +258 -0
  135. package/.opencode/skills/frontend-design/scripts/design_system.py +1067 -0
  136. package/.opencode/skills/frontend-design/scripts/search.py +106 -0
  137. package/.opencode/skills/frontend-design/scripts/ux_audit.py +735 -0
  138. package/.opencode/skills/frontend-design/typography-system.md +345 -0
  139. package/.opencode/skills/frontend-design/ux-psychology.md +541 -0
  140. package/.opencode/skills/frontend-design/visual-effects.md +383 -0
  141. package/.opencode/skills/geo-fundamentals/SKILL.md +156 -0
  142. package/.opencode/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  143. package/.opencode/skills/i18n-localization/SKILL.md +154 -0
  144. package/.opencode/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  145. package/.opencode/skills/intelligent-routing/SKILL.md +335 -0
  146. package/.opencode/skills/lint-and-validate/SKILL.md +45 -0
  147. package/.opencode/skills/lint-and-validate/scripts/lint_runner.py +172 -0
  148. package/.opencode/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  149. package/.opencode/skills/mobile-design/SKILL.md +394 -0
  150. package/.opencode/skills/mobile-design/decision-trees.md +516 -0
  151. package/.opencode/skills/mobile-design/mobile-backend.md +491 -0
  152. package/.opencode/skills/mobile-design/mobile-color-system.md +420 -0
  153. package/.opencode/skills/mobile-design/mobile-debugging.md +122 -0
  154. package/.opencode/skills/mobile-design/mobile-design-thinking.md +357 -0
  155. package/.opencode/skills/mobile-design/mobile-navigation.md +458 -0
  156. package/.opencode/skills/mobile-design/mobile-performance.md +767 -0
  157. package/.opencode/skills/mobile-design/mobile-testing.md +356 -0
  158. package/.opencode/skills/mobile-design/mobile-typography.md +433 -0
  159. package/.opencode/skills/mobile-design/platform-android.md +666 -0
  160. package/.opencode/skills/mobile-design/platform-ios.md +561 -0
  161. package/.opencode/skills/mobile-design/scripts/mobile_audit.py +670 -0
  162. package/.opencode/skills/mobile-design/touch-psychology.md +537 -0
  163. package/.opencode/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
  164. package/.opencode/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  165. package/.opencode/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  166. package/.opencode/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  167. package/.opencode/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  168. package/.opencode/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  169. package/.opencode/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  170. package/.opencode/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  171. package/.opencode/skills/nextjs-react-expert/SKILL.md +267 -0
  172. package/.opencode/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  173. package/.opencode/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
  174. package/.opencode/skills/parallel-agents/SKILL.md +175 -0
  175. package/.opencode/skills/performance-profiling/SKILL.md +143 -0
  176. package/.opencode/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  177. package/.opencode/skills/plan-writing/SKILL.md +176 -0
  178. package/.opencode/skills/python-patterns/SKILL.md +462 -0
  179. package/.opencode/skills/red-team-tactics/SKILL.md +199 -0
  180. package/.opencode/skills/seo-fundamentals/SKILL.md +129 -0
  181. package/.opencode/skills/seo-fundamentals/scripts/seo_checker.py +222 -0
  182. package/.opencode/skills/server-management/SKILL.md +161 -0
  183. package/.opencode/skills/stack-selection/SKILL.md +448 -0
  184. package/.opencode/skills/systematic-debugging/SKILL.md +109 -0
  185. package/.opencode/skills/tailwind-patterns/SKILL.md +269 -0
  186. package/.opencode/skills/tdd-workflow/SKILL.md +149 -0
  187. package/.opencode/skills/testing-patterns/SKILL.md +178 -0
  188. package/.opencode/skills/testing-patterns/scripts/test_runner.py +219 -0
  189. package/.opencode/skills/vulnerability-scanner/SKILL.md +276 -0
  190. package/.opencode/skills/vulnerability-scanner/checklists.md +121 -0
  191. package/.opencode/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  192. package/.opencode/skills/web-design-guidelines/SKILL.md +57 -0
  193. package/.opencode/skills/webapp-testing/SKILL.md +187 -0
  194. package/.opencode/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  195. package/.opencode/templates/DOCS-ACTION_ITEMS.md +5 -0
  196. package/.opencode/templates/DOCS-API.md +11 -0
  197. package/.opencode/templates/DOCS-BACKEND.md +10 -0
  198. package/.opencode/templates/DOCS-CONTEXT.md +25 -0
  199. package/.opencode/templates/DOCS-DATABASE.md +10 -0
  200. package/.opencode/templates/DOCS-FRONTEND.md +11 -0
  201. package/.opencode/templates/DOCS-QUALITY_GATES.md +20 -0
  202. package/.opencode/templates/DOCS-SECURITY.md +17 -0
  203. package/.opencode/templates/SDD-AcceptanceCriteria.md +21 -0
  204. package/.opencode/templates/SDD-Checklist.md +27 -0
  205. package/.opencode/templates/SDD-Contracts.md +21 -0
  206. package/.opencode/templates/SDD-Plan.md +45 -0
  207. package/.opencode/templates/SDD-ProblemStatement.md +25 -0
  208. package/.opencode/templates/SDD-Quickstart.md +23 -0
  209. package/.opencode/templates/SDD-Research.md +24 -0
  210. package/.opencode/templates/SDD-Risks.md +16 -0
  211. package/.opencode/templates/SDD-Tasks.md +41 -0
  212. package/.opencode/templates/SDD-UserStories.md +45 -0
  213. package/.opencode/templates/TechStack.md +111 -0
  214. package/LICENSE +21 -0
  215. package/PACKAGE_STATUS.md +97 -0
  216. package/README.md +251 -0
  217. package/README.pt-BR.md +192 -0
  218. package/bin/cli.js +505 -0
  219. package/blueprints/fullstack/.env.example +15 -0
  220. package/blueprints/fullstack/AGENTS.md +3 -0
  221. package/blueprints/fullstack/README.md +65 -0
  222. package/blueprints/fullstack/backend/.dockerignore +10 -0
  223. package/blueprints/fullstack/backend/.python-version +1 -0
  224. package/blueprints/fullstack/backend/Dockerfile +33 -0
  225. package/blueprints/fullstack/backend/alembic.ini +40 -0
  226. package/blueprints/fullstack/backend/app/__init__.py +0 -0
  227. package/blueprints/fullstack/backend/app/api/README.md +3 -0
  228. package/blueprints/fullstack/backend/app/api/__init__.py +0 -0
  229. package/blueprints/fullstack/backend/app/celery_app.py +5 -0
  230. package/blueprints/fullstack/backend/app/core/README.md +3 -0
  231. package/blueprints/fullstack/backend/app/core/__init__.py +0 -0
  232. package/blueprints/fullstack/backend/app/database.py +14 -0
  233. package/blueprints/fullstack/backend/app/main.py +16 -0
  234. package/blueprints/fullstack/backend/app/models/README.md +3 -0
  235. package/blueprints/fullstack/backend/app/models/__init__.py +3 -0
  236. package/blueprints/fullstack/backend/app/models/item.py +10 -0
  237. package/blueprints/fullstack/backend/app/routers/__init__.py +0 -0
  238. package/blueprints/fullstack/backend/app/routers/items.py +20 -0
  239. package/blueprints/fullstack/backend/app/schemas/README.md +3 -0
  240. package/blueprints/fullstack/backend/app/schemas/__init__.py +0 -0
  241. package/blueprints/fullstack/backend/app/schemas/item.py +15 -0
  242. package/blueprints/fullstack/backend/app/services/item_service.py +23 -0
  243. package/blueprints/fullstack/backend/app/settings.py +36 -0
  244. package/blueprints/fullstack/backend/app/tasks/README.md +3 -0
  245. package/blueprints/fullstack/backend/app/tasks/__init__.py +0 -0
  246. package/blueprints/fullstack/backend/migrations/env.py +47 -0
  247. package/blueprints/fullstack/backend/migrations/versions/0001_initial_sample_data.py +31 -0
  248. package/blueprints/fullstack/backend/pyproject.toml +45 -0
  249. package/blueprints/fullstack/docker-compose.dev.yml +114 -0
  250. package/blueprints/fullstack/docker-compose.prod.yml +90 -0
  251. package/blueprints/fullstack/docs/README.md +29 -0
  252. package/blueprints/fullstack/docs/engineering/api/README.md +3 -0
  253. package/blueprints/fullstack/docs/engineering/architecture/README.md +3 -0
  254. package/blueprints/fullstack/docs/engineering/backend/README.md +3 -0
  255. package/blueprints/fullstack/docs/engineering/frontend/README.md +3 -0
  256. package/blueprints/fullstack/docs/engineering/security/README.md +3 -0
  257. package/blueprints/fullstack/docs/engineering/standards/README.md +3 -0
  258. package/blueprints/fullstack/frontend/.dockerignore +4 -0
  259. package/blueprints/fullstack/frontend/Dockerfile +23 -0
  260. package/blueprints/fullstack/frontend/components.json +17 -0
  261. package/blueprints/fullstack/frontend/index.html +12 -0
  262. package/blueprints/fullstack/frontend/package.json +28 -0
  263. package/blueprints/fullstack/frontend/src/components/README.md +3 -0
  264. package/blueprints/fullstack/frontend/src/components/ui/.keep +4 -0
  265. package/blueprints/fullstack/frontend/src/index.css +57 -0
  266. package/blueprints/fullstack/frontend/src/lib/README.md +3 -0
  267. package/blueprints/fullstack/frontend/src/lib/api.ts +1 -0
  268. package/blueprints/fullstack/frontend/src/lib/utils.ts +6 -0
  269. package/blueprints/fullstack/frontend/src/main.tsx +66 -0
  270. package/blueprints/fullstack/frontend/src/routes/README.md +3 -0
  271. package/blueprints/fullstack/frontend/src/routes/root.tsx +7 -0
  272. package/blueprints/fullstack/frontend/src/vite-env.d.ts +1 -0
  273. package/blueprints/fullstack/frontend/tailwind.config.ts +12 -0
  274. package/blueprints/fullstack/frontend/tsconfig.json +13 -0
  275. package/blueprints/fullstack/frontend/tsconfig.node.json +12 -0
  276. package/blueprints/fullstack/frontend/vite.config.ts +12 -0
  277. package/index.js +14 -0
  278. package/opencode.json +306 -0
  279. package/package.json +57 -0
  280. package/scripts/prepare.js +65 -0
  281. package/scripts/update-version.js +29 -0
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: plan-writing
3
+ description: Structured task planning with clear breakdowns, dependencies, and verification criteria. Use when implementing features, refactoring, or any multi-step work.
4
+ allowed-tools: Read, Glob, Grep
5
+ ---
6
+
7
+ # Plan Writing
8
+
9
+ > Source: obra/superpowers
10
+
11
+ ## Overview
12
+ This skill provides a framework for breaking down work into clear, actionable tasks with verification criteria.
13
+
14
+ ## Task Breakdown Principles
15
+
16
+ ### 1. Small, Focused Tasks
17
+ - Each task should take 2-5 minutes
18
+ - One clear outcome per task
19
+ - Independently verifiable
20
+
21
+ ### 2. Clear Verification
22
+ - How do you know it's done?
23
+ - What can you check/test?
24
+ - What's expected output?
25
+
26
+ ### 3. Logical Ordering
27
+ - Dependencies identified
28
+ - Parallel work where possible
29
+ - Critical path highlighted
30
+ - **Phase X: Verification is always LAST**
31
+
32
+ ### 4. Planning Lives in docs/
33
+
34
+ ### 5. Question Tool Usage (MANDATORY)
35
+
36
+ When planning requires user input or decisions:
37
+ - Use `question` tool for all multi-option scenarios
38
+ - Provide clear options with descriptions
39
+ - For tech stack decisions, structure choices properly
40
+
41
+ **Example:**
42
+ ```javascript
43
+ question({
44
+ questions: [{
45
+ question: "What tech stack?",
46
+ header: "Stack",
47
+ options: [
48
+ { label: "React + FastAPI", description: "Full-stack modern" },
49
+ { label: "Next.js + Node", description: "All-in-one" }
50
+ ]
51
+ }]
52
+ })
53
+ ```
54
+
55
+ See `.opencode/rules/MASTER.md` for complete Question Tool Protocol.
56
+ - Planning artifacts live under `docs/requirements/` and `docs/sprint/`
57
+ - **Discovery** outputs go to `docs/requirements/<feature>/`
58
+ - **Sprint planning** outputs go to `docs/sprint/Sprint-XX/`
59
+ - If `docs/` does not exist, create it before writing
60
+
61
+ ## Planning Principles (NOT Templates!)
62
+
63
+ > **NO fixed templates. Each plan is UNIQUE to the task.**
64
+
65
+ ### Principle 1: Keep It SHORT
66
+
67
+ | Wrong | Right |
68
+ |----------|----------|
69
+ | 50 tasks with sub-sub-tasks | 5-10 clear tasks max |
70
+ | Every micro-step listed | Only actionable items |
71
+ | Verbose descriptions | One-line per task |
72
+
73
+ > **Rule:** If plan is longer than 1 page, it's too long. Simplify.
74
+
75
+ ---
76
+
77
+ ### Principle 2: Be SPECIFIC, Not Generic
78
+
79
+ | Wrong | Right |
80
+ |----------|----------|
81
+ | "Set up project" | "Run `npx create-next-app`" |
82
+ | "Add authentication" | "Install next-auth, create `/api/auth/[...nextauth].ts`" |
83
+ | "Style the UI" | "Add Tailwind classes to `Header.tsx`" |
84
+
85
+ > **Rule:** Each task should have a clear, verifiable outcome.
86
+
87
+ ---
88
+
89
+ ### Principle 3: Dynamic Content Based on Project Type
90
+
91
+ **For NEW PROJECT:**
92
+ - What tech stack? (decide first)
93
+ - What's the MVP? (minimal features)
94
+ - What's the file structure?
95
+
96
+ **For FEATURE ADDITION:**
97
+ - Which files are affected?
98
+ - What dependencies needed?
99
+ - How to verify it works?
100
+
101
+ **For BUG FIX:**
102
+ - What's the root cause?
103
+ - What file/line to change?
104
+ - How to test the fix?
105
+
106
+ ---
107
+
108
+ ### Principle 4: Scripts Are Project-Specific
109
+
110
+ > **DO NOT copy-paste script commands. Choose based on project type.**
111
+
112
+ | Project Type | Relevant Scripts |
113
+ |--------------|------------------|
114
+ | Frontend/React | `ux_audit.py`, `accessibility_checker.py` |
115
+ | Backend/API | `api_validator.py`, `security_scan.py` |
116
+ | Mobile | `mobile_audit.py` |
117
+ | Database | `schema_validator.py` |
118
+ | Full-stack | Mix of above based on what you touched |
119
+
120
+ **Wrong:** Adding all scripts to every plan
121
+ **Right:** Only scripts relevant to THIS task
122
+
123
+ ---
124
+
125
+ ### Principle 5: Verification is Simple
126
+
127
+ | Wrong | Right |
128
+ |----------|----------|
129
+ | "Verify the component works correctly" | "Run `npm run dev`, click button, see toast" |
130
+ | "Test the API" | "curl localhost:3000/api/users returns 200" |
131
+ | "Check styles" | "Open browser, verify dark mode toggle works" |
132
+
133
+ ---
134
+
135
+ ## Plan Structure (Flexible, Not Fixed!)
136
+
137
+ ```
138
+ # [Task Name]
139
+
140
+ ## Goal
141
+ One sentence: What are we building/fixing?
142
+
143
+ ## Tasks
144
+ - [ ] Task 1: [Specific action] → Verify: [How to check]
145
+ - [ ] Task 2: [Specific action] → Verify: [How to check]
146
+ - [ ] Task 3: [Specific action] → Verify: [How to check]
147
+
148
+ ## Done When
149
+ - [ ] [Main success criteria]
150
+ ```
151
+
152
+ > **That's it.** No phases, no sub-sections unless truly needed.
153
+ > Keep it minimal. Add complexity only when required.
154
+
155
+ ## Notes
156
+ [Any important considerations]
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Best Practices (Quick Reference)
162
+
163
+ 1. **Start with goal** - What are we building/fixing?
164
+ 2. **Max 10 tasks** - If more, break into multiple plans
165
+ 3. **Each task verifiable** - Clear "done" criteria
166
+ 4. **Docs-first** - Requirements in `docs/requirements/`, sprint tasks in `docs/sprint/`
167
+ 5. **Update as you go** - Mark `[x]` when complete in sprint Tasks
168
+
169
+ ---
170
+
171
+ ## When to Use
172
+
173
+ - New project from scratch
174
+ - Adding a feature
175
+ - Fixing a bug (if complex)
176
+ - Refactoring multiple files
@@ -0,0 +1,462 @@
1
+ ---
2
+ name: python-patterns
3
+ description: Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.
4
+ allowed-tools: Read, Write, Edit, Glob, Grep
5
+ ---
6
+
7
+ # Python Patterns
8
+
9
+ > Python development principles and decision-making for 2025.
10
+ > **Learn to THINK, not memorize patterns.**
11
+
12
+ ---
13
+
14
+ ## How to Use This Skill
15
+
16
+ This skill teaches **decision-making principles**, not fixed code to copy.
17
+
18
+ ### Question Tool Usage (MANDATORY)
19
+
20
+ When this skill requires user input or choices:
21
+ - Use `question` tool for all multi-option scenarios
22
+ - Present trade-offs clearly in option descriptions
23
+ - Never ask inline questions with alternatives
24
+
25
+ **Example usage:**
26
+ ```javascript
27
+ question({
28
+ questions: [{
29
+ question: "Which framework?",
30
+ header: "Framework",
31
+ options: [
32
+ { label: "FastAPI", description: "Async, modern, fast" },
33
+ { label: "Django", description: "Full-stack, batteries-included" },
34
+ { label: "Flask", description: "Minimal, flexible" }
35
+ ]
36
+ }]
37
+ })
38
+ ```
39
+
40
+ - Choose async vs sync based on CONTEXT
41
+ - Don't default to same framework every time
42
+
43
+ ---
44
+
45
+ ## 1. Framework Selection (2025)
46
+
47
+ ### Decision Tree
48
+
49
+ ```
50
+ What are you building?
51
+
52
+ ├── API-first / Microservices
53
+ │ └── FastAPI (async, modern, fast)
54
+
55
+ ├── Full-stack web / CMS / Admin
56
+ │ └── Django (batteries-included)
57
+
58
+ ├── Simple / Script / Learning
59
+ │ └── Flask (minimal, flexible)
60
+
61
+ ├── AI/ML API serving
62
+ │ └── FastAPI (Pydantic, async, uvicorn)
63
+
64
+ └── Background workers
65
+ └── Celery + any framework
66
+ ```
67
+
68
+ ### Comparison Principles
69
+
70
+ | Factor | FastAPI | Django | Flask |
71
+ |--------|---------|--------|-------|
72
+ | **Best for** | APIs, microservices | Full-stack, CMS | Simple, learning |
73
+ | **Async** | Native | Django 5.0+ | Via extensions |
74
+ | **Admin** | Manual | Built-in | Via extensions |
75
+ | **ORM** | Choose your own | Django ORM | Choose your own |
76
+ | **Learning curve** | Low | Medium | Low |
77
+
78
+ ### Selection Questions to Ask:
79
+ 1. Is this API-only or full-stack?
80
+ 2. Need admin interface?
81
+ 3. Team familiar with async?
82
+ 4. Existing infrastructure?
83
+
84
+ ---
85
+
86
+ ## 2. Async vs Sync Decision
87
+
88
+ ### When to Use Async
89
+
90
+ ```
91
+ async def is better when:
92
+ ├── I/O-bound operations (database, HTTP, file)
93
+ ├── Many concurrent connections
94
+ ├── Real-time features
95
+ ├── Microservices communication
96
+ └── FastAPI/Starlette/Django ASGI
97
+
98
+ def (sync) is better when:
99
+ ├── CPU-bound operations
100
+ ├── Simple scripts
101
+ ├── Legacy codebase
102
+ ├── Team unfamiliar with async
103
+ └── Blocking libraries (no async version)
104
+ ```
105
+
106
+ ### The Golden Rule
107
+
108
+ ```
109
+ I/O-bound → async (waiting for external)
110
+ CPU-bound → sync + multiprocessing (computing)
111
+
112
+ Don't:
113
+ ├── Mix sync and async carelessly
114
+ ├── Use sync libraries in async code
115
+ └── Force async for CPU work
116
+ ```
117
+
118
+ ### Async Library Selection
119
+
120
+ | Need | Async Library |
121
+ |------|---------------|
122
+ | HTTP client | httpx |
123
+ | PostgreSQL | asyncpg |
124
+ | Redis | aioredis / redis-py async |
125
+ | File I/O | aiofiles |
126
+ | Database ORM | SQLAlchemy 2.0 async, Tortoise |
127
+
128
+ ---
129
+
130
+ ## 3. Type Hints Strategy
131
+
132
+ ### When to Type
133
+
134
+ ```
135
+ Always type:
136
+ ├── Function parameters
137
+ ├── Return types
138
+ ├── Class attributes
139
+ ├── Public APIs
140
+
141
+ Can skip:
142
+ ├── Local variables (let inference work)
143
+ ├── One-off scripts
144
+ ├── Tests (usually)
145
+ ```
146
+
147
+ ### Common Type Patterns
148
+
149
+ ```python
150
+ # These are patterns, understand them:
151
+
152
+ # Optional → might be None
153
+ from typing import Optional
154
+ def find_user(id: int) -> Optional[User]: ...
155
+
156
+ # Union → one of multiple types
157
+ def process(data: str | dict) -> None: ...
158
+
159
+ # Generic collections
160
+ def get_items() -> list[Item]: ...
161
+ def get_mapping() -> dict[str, int]: ...
162
+
163
+ # Callable
164
+ from typing import Callable
165
+ def apply(fn: Callable[[int], str]) -> str: ...
166
+ ```
167
+
168
+ ### Pydantic for Validation
169
+
170
+ ```
171
+ When to use Pydantic:
172
+ ├── API request/response models
173
+ ├── Configuration/settings
174
+ ├── Data validation
175
+ ├── Serialization
176
+
177
+ Benefits:
178
+ ├── Runtime validation
179
+ ├── Auto-generated JSON schema
180
+ ├── Works with FastAPI natively
181
+ └── Clear error messages
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 4. Project Structure Principles
187
+
188
+ ### Structure Selection
189
+
190
+ ```
191
+ Small project / Script:
192
+ ├── main.py
193
+ ├── utils.py
194
+ └── requirements.txt
195
+
196
+ Medium API:
197
+ ├── app/
198
+ │ ├── __init__.py
199
+ │ ├── main.py
200
+ │ ├── models/
201
+ │ ├── routes/
202
+ │ ├── services/
203
+ │ └── schemas/
204
+ ├── tests/
205
+ └── pyproject.toml
206
+
207
+ Large application:
208
+ ├── src/
209
+ │ └── myapp/
210
+ │ ├── core/
211
+ │ ├── api/
212
+ │ ├── services/
213
+ │ ├── models/
214
+ │ └── ...
215
+ ├── tests/
216
+ └── pyproject.toml
217
+ ```
218
+
219
+ ### FastAPI Structure Principles
220
+
221
+ ```
222
+ Organize by feature or layer:
223
+
224
+ By layer:
225
+ ├── routes/ (API endpoints)
226
+ ├── services/ (business logic)
227
+ ├── models/ (database models)
228
+ ├── schemas/ (Pydantic models)
229
+ └── dependencies/ (shared deps)
230
+
231
+ By feature:
232
+ ├── users/
233
+ │ ├── routes.py
234
+ │ ├── service.py
235
+ │ └── schemas.py
236
+ └── products/
237
+ └── ...
238
+ ```
239
+
240
+ ---
241
+
242
+ ## 5. Django Principles (2025)
243
+
244
+ ### Django Async (Django 5.0+)
245
+
246
+ ```
247
+ Django supports async:
248
+ ├── Async views
249
+ ├── Async middleware
250
+ ├── Async ORM (limited)
251
+ └── ASGI deployment
252
+
253
+ When to use async in Django:
254
+ ├── External API calls
255
+ ├── WebSocket (Channels)
256
+ ├── High-concurrency views
257
+ └── Background task triggering
258
+ ```
259
+
260
+ ### Django Best Practices
261
+
262
+ ```
263
+ Model design:
264
+ ├── Fat models, thin views
265
+ ├── Use managers for common queries
266
+ ├── Abstract base classes for shared fields
267
+
268
+ Views:
269
+ ├── Class-based for complex CRUD
270
+ ├── Function-based for simple endpoints
271
+ ├── Use viewsets with DRF
272
+
273
+ Queries:
274
+ ├── select_related() for FKs
275
+ ├── prefetch_related() for M2M
276
+ ├── Avoid N+1 queries
277
+ └── Use .only() for specific fields
278
+ ```
279
+
280
+ ---
281
+
282
+ ## 6. FastAPI Principles
283
+
284
+ ### async def vs def in FastAPI
285
+
286
+ ```
287
+ Use async def when:
288
+ ├── Using async database drivers
289
+ ├── Making async HTTP calls
290
+ ├── I/O-bound operations
291
+ └── Want to handle concurrency
292
+
293
+ Use def when:
294
+ ├── Blocking operations
295
+ ├── Sync database drivers
296
+ ├── CPU-bound work
297
+ └── FastAPI runs in threadpool automatically
298
+ ```
299
+
300
+ ### Dependency Injection
301
+
302
+ ```
303
+ Use dependencies for:
304
+ ├── Database sessions
305
+ ├── Current user / Auth
306
+ ├── Configuration
307
+ ├── Shared resources
308
+
309
+ Benefits:
310
+ ├── Testability (mock dependencies)
311
+ ├── Clean separation
312
+ ├── Automatic cleanup (yield)
313
+ ```
314
+
315
+ ### Pydantic v2 Integration
316
+
317
+ ```python
318
+ # FastAPI + Pydantic are tightly integrated:
319
+
320
+ # Request validation
321
+ @app.post("/users")
322
+ async def create(user: UserCreate) -> UserResponse:
323
+ # user is already validated
324
+ ...
325
+
326
+ # Response serialization
327
+ # Return type becomes response schema
328
+ ```
329
+
330
+ ---
331
+
332
+ ## 7. Background Tasks
333
+
334
+ ### Selection Guide
335
+
336
+ | Solution | Best For |
337
+ |----------|----------|
338
+ | **BackgroundTasks** | Simple, in-process tasks |
339
+ | **Celery** | Distributed, complex workflows |
340
+ | **ARQ** | Async, Redis-based |
341
+ | **RQ** | Simple Redis queue |
342
+ | **Dramatiq** | Actor-based, simpler than Celery |
343
+
344
+ ### When to Use Each
345
+
346
+ ```
347
+ FastAPI BackgroundTasks:
348
+ ├── Quick operations
349
+ ├── No persistence needed
350
+ ├── Fire-and-forget
351
+ └── Same process
352
+
353
+ Celery/ARQ:
354
+ ├── Long-running tasks
355
+ ├── Need retry logic
356
+ ├── Distributed workers
357
+ ├── Persistent queue
358
+ └── Complex workflows
359
+ ```
360
+
361
+ ---
362
+
363
+ ## 8. Error Handling Principles
364
+
365
+ ### Exception Strategy
366
+
367
+ ```
368
+ In FastAPI:
369
+ ├── Create custom exception classes
370
+ ├── Register exception handlers
371
+ ├── Return consistent error format
372
+ └── Log without exposing internals
373
+
374
+ Pattern:
375
+ ├── Raise domain exceptions in services
376
+ ├── Catch and transform in handlers
377
+ └── Client gets clean error response
378
+ ```
379
+
380
+ ### Error Response Philosophy
381
+
382
+ ```
383
+ Include:
384
+ ├── Error code (programmatic)
385
+ ├── Message (human readable)
386
+ ├── Details (field-level when applicable)
387
+ └── NOT stack traces (security)
388
+ ```
389
+
390
+ ---
391
+
392
+ ## 9. Testing Principles
393
+
394
+ ### Testing Strategy
395
+
396
+ | Type | Purpose | Tools |
397
+ |------|---------|-------|
398
+ | **Unit** | Business logic | pytest |
399
+ | **Integration** | API endpoints | pytest + httpx/TestClient |
400
+ | **E2E** | Full workflows | pytest + DB |
401
+
402
+ ### Async Testing
403
+
404
+ ```python
405
+ # Use pytest-asyncio for async tests
406
+
407
+ import pytest
408
+ from httpx import AsyncClient
409
+
410
+ @pytest.mark.asyncio
411
+ async def test_endpoint():
412
+ async with AsyncClient(app=app, base_url="http://test") as client:
413
+ response = await client.get("/users")
414
+ assert response.status_code == 200
415
+ ```
416
+
417
+ ### Fixtures Strategy
418
+
419
+ ```
420
+ Common fixtures:
421
+ ├── db_session → Database connection
422
+ ├── client → Test client
423
+ ├── authenticated_user → User with token
424
+ └── sample_data → Test data setup
425
+ ```
426
+
427
+ ---
428
+
429
+ ## 10. Decision Checklist
430
+
431
+ Before implementing:
432
+
433
+ - [ ] **Asked user about framework preference?**
434
+ - [ ] **Chosen framework for THIS context?** (not just default)
435
+ - [ ] **Decided async vs sync?**
436
+ - [ ] **Planned type hint strategy?**
437
+ - [ ] **Defined project structure?**
438
+ - [ ] **Planned error handling?**
439
+ - [ ] **Considered background tasks?**
440
+
441
+ ---
442
+
443
+ ## 11. Anti-Patterns to Avoid
444
+
445
+ ### DON'T:
446
+ - Default to Django for simple APIs (FastAPI may be better)
447
+ - Use sync libraries in async code
448
+ - Skip type hints for public APIs
449
+ - Put business logic in routes/views
450
+ - Ignore N+1 queries
451
+ - Mix async and sync carelessly
452
+
453
+ ### DO:
454
+ - Choose framework based on context
455
+ - Ask about async requirements
456
+ - Use Pydantic for validation
457
+ - Separate concerns (routes → services → repos)
458
+ - Test critical paths
459
+
460
+ ---
461
+
462
+ > **Remember**: Python patterns are about decision-making for YOUR specific context. Don't copy code—think about what serves your application best.