@cubocicloide/stack-react-fastapi 13.0.6

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 (295) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +66 -0
  3. package/dist/commands/lint/checks/BE/001.d.ts +6 -0
  4. package/dist/commands/lint/checks/BE/001.js +95 -0
  5. package/dist/commands/lint/checks/BE/001.js.map +1 -0
  6. package/dist/commands/lint/checks/BE/002.d.ts +6 -0
  7. package/dist/commands/lint/checks/BE/002.js +30 -0
  8. package/dist/commands/lint/checks/BE/002.js.map +1 -0
  9. package/dist/commands/lint/checks/BE/003.d.ts +11 -0
  10. package/dist/commands/lint/checks/BE/003.js +46 -0
  11. package/dist/commands/lint/checks/BE/003.js.map +1 -0
  12. package/dist/commands/lint/checks/BE/004.d.ts +6 -0
  13. package/dist/commands/lint/checks/BE/004.js +27 -0
  14. package/dist/commands/lint/checks/BE/004.js.map +1 -0
  15. package/dist/commands/lint/checks/BE/005.d.ts +6 -0
  16. package/dist/commands/lint/checks/BE/005.js +107 -0
  17. package/dist/commands/lint/checks/BE/005.js.map +1 -0
  18. package/dist/commands/lint/checks/BE/006.d.ts +6 -0
  19. package/dist/commands/lint/checks/BE/006.js +27 -0
  20. package/dist/commands/lint/checks/BE/006.js.map +1 -0
  21. package/dist/commands/lint/checks/BE/007.d.ts +31 -0
  22. package/dist/commands/lint/checks/BE/007.js +109 -0
  23. package/dist/commands/lint/checks/BE/007.js.map +1 -0
  24. package/dist/commands/lint/checks/BE/008.d.ts +12 -0
  25. package/dist/commands/lint/checks/BE/008.js +57 -0
  26. package/dist/commands/lint/checks/BE/008.js.map +1 -0
  27. package/dist/commands/lint/checks/BE/009.d.ts +12 -0
  28. package/dist/commands/lint/checks/BE/009.js +104 -0
  29. package/dist/commands/lint/checks/BE/009.js.map +1 -0
  30. package/dist/commands/lint/checks/BE/010.d.ts +12 -0
  31. package/dist/commands/lint/checks/BE/010.js +54 -0
  32. package/dist/commands/lint/checks/BE/010.js.map +1 -0
  33. package/dist/commands/lint/checks/BE/011.d.ts +16 -0
  34. package/dist/commands/lint/checks/BE/011.js +46 -0
  35. package/dist/commands/lint/checks/BE/011.js.map +1 -0
  36. package/dist/commands/lint/checks/E2E/001.d.ts +6 -0
  37. package/dist/commands/lint/checks/E2E/001.js +35 -0
  38. package/dist/commands/lint/checks/E2E/001.js.map +1 -0
  39. package/dist/commands/lint/checks/E2E/002.d.ts +6 -0
  40. package/dist/commands/lint/checks/E2E/002.js +37 -0
  41. package/dist/commands/lint/checks/E2E/002.js.map +1 -0
  42. package/dist/commands/lint/checks/E2E/003.d.ts +6 -0
  43. package/dist/commands/lint/checks/E2E/003.js +42 -0
  44. package/dist/commands/lint/checks/E2E/003.js.map +1 -0
  45. package/dist/commands/lint/checks/E2E/004.d.ts +6 -0
  46. package/dist/commands/lint/checks/E2E/004.js +37 -0
  47. package/dist/commands/lint/checks/E2E/004.js.map +1 -0
  48. package/dist/commands/lint/checks/E2E/005.d.ts +6 -0
  49. package/dist/commands/lint/checks/E2E/005.js +47 -0
  50. package/dist/commands/lint/checks/E2E/005.js.map +1 -0
  51. package/dist/commands/lint/checks/E2E/006.d.ts +6 -0
  52. package/dist/commands/lint/checks/E2E/006.js +28 -0
  53. package/dist/commands/lint/checks/E2E/006.js.map +1 -0
  54. package/dist/commands/lint/checks/E2E/007.d.ts +6 -0
  55. package/dist/commands/lint/checks/E2E/007.js +47 -0
  56. package/dist/commands/lint/checks/E2E/007.js.map +1 -0
  57. package/dist/commands/lint/checks/FE/001.d.ts +6 -0
  58. package/dist/commands/lint/checks/FE/001.js +56 -0
  59. package/dist/commands/lint/checks/FE/001.js.map +1 -0
  60. package/dist/commands/lint/checks/FE/002.d.ts +6 -0
  61. package/dist/commands/lint/checks/FE/002.js +80 -0
  62. package/dist/commands/lint/checks/FE/002.js.map +1 -0
  63. package/dist/commands/lint/checks/FE/003.d.ts +6 -0
  64. package/dist/commands/lint/checks/FE/003.js +65 -0
  65. package/dist/commands/lint/checks/FE/003.js.map +1 -0
  66. package/dist/commands/lint/checks/FE/004.d.ts +6 -0
  67. package/dist/commands/lint/checks/FE/004.js +72 -0
  68. package/dist/commands/lint/checks/FE/004.js.map +1 -0
  69. package/dist/commands/lint/checks/FE/005.d.ts +6 -0
  70. package/dist/commands/lint/checks/FE/005.js +103 -0
  71. package/dist/commands/lint/checks/FE/005.js.map +1 -0
  72. package/dist/commands/lint/checks/FE/006.d.ts +6 -0
  73. package/dist/commands/lint/checks/FE/006.js +102 -0
  74. package/dist/commands/lint/checks/FE/006.js.map +1 -0
  75. package/dist/commands/lint/checks/FE/007.d.ts +6 -0
  76. package/dist/commands/lint/checks/FE/007.js +60 -0
  77. package/dist/commands/lint/checks/FE/007.js.map +1 -0
  78. package/dist/commands/lint/checks/FE/008.d.ts +6 -0
  79. package/dist/commands/lint/checks/FE/008.js +115 -0
  80. package/dist/commands/lint/checks/FE/008.js.map +1 -0
  81. package/dist/commands/lint/checks/FE/009.d.ts +6 -0
  82. package/dist/commands/lint/checks/FE/009.js +83 -0
  83. package/dist/commands/lint/checks/FE/009.js.map +1 -0
  84. package/dist/commands/lint/checks/FE/010.d.ts +6 -0
  85. package/dist/commands/lint/checks/FE/010.js +105 -0
  86. package/dist/commands/lint/checks/FE/010.js.map +1 -0
  87. package/dist/commands/lint/checks/FE/011.d.ts +6 -0
  88. package/dist/commands/lint/checks/FE/011.js +43 -0
  89. package/dist/commands/lint/checks/FE/011.js.map +1 -0
  90. package/dist/commands/lint/checks/FE/012.d.ts +6 -0
  91. package/dist/commands/lint/checks/FE/012.js +150 -0
  92. package/dist/commands/lint/checks/FE/012.js.map +1 -0
  93. package/dist/index.d.ts +5 -0
  94. package/dist/index.js +3491 -0
  95. package/dist/index.js.map +1 -0
  96. package/dude.stack.json +7 -0
  97. package/package.json +43 -0
  98. package/templates/aws-eks/backend/Dockerfile.prod.hbs +22 -0
  99. package/templates/aws-eks/docs/docs/deploy.md.hbs +159 -0
  100. package/templates/aws-eks/frontend/Dockerfile.prod +28 -0
  101. package/templates/aws-eks/frontend/nginx.conf +19 -0
  102. package/templates/aws-eks/iac/README.md.hbs +311 -0
  103. package/templates/aws-eks/iac/_gitignore +24 -0
  104. package/templates/aws-eks/iac/helm/app/.helmignore +7 -0
  105. package/templates/aws-eks/iac/helm/app/Chart.yaml.hbs +6 -0
  106. package/templates/aws-eks/iac/helm/app/templates/NOTES.txt +23 -0
  107. package/templates/aws-eks/iac/helm/app/templates/backend-deployment.yaml +44 -0
  108. package/templates/aws-eks/iac/helm/app/templates/backend-service.yaml +16 -0
  109. package/templates/aws-eks/iac/helm/app/templates/celery-beat-deployment.yaml +34 -0
  110. package/templates/aws-eks/iac/helm/app/templates/celery-worker-deployment.yaml +31 -0
  111. package/templates/aws-eks/iac/helm/app/templates/configmap.yaml +15 -0
  112. package/templates/aws-eks/iac/helm/app/templates/flower-deployment.yaml +28 -0
  113. package/templates/aws-eks/iac/helm/app/templates/flower-service.yaml +19 -0
  114. package/templates/aws-eks/iac/helm/app/templates/frontend-deployment.yaml +34 -0
  115. package/templates/aws-eks/iac/helm/app/templates/frontend-service.yaml +16 -0
  116. package/templates/aws-eks/iac/helm/app/templates/helpers.tpl +90 -0
  117. package/templates/aws-eks/iac/helm/app/templates/hpa.yaml +23 -0
  118. package/templates/aws-eks/iac/helm/app/templates/ingress.yaml +30 -0
  119. package/templates/aws-eks/iac/helm/app/templates/migration-job.yaml +38 -0
  120. package/templates/aws-eks/iac/helm/app/templates/redis-deployment.yaml +33 -0
  121. package/templates/aws-eks/iac/helm/app/templates/redis-service.yaml +18 -0
  122. package/templates/aws-eks/iac/helm/app/templates/secret.yaml +17 -0
  123. package/templates/aws-eks/iac/helm/app/templates/serviceaccount.yaml +12 -0
  124. package/templates/aws-eks/iac/helm/app/values-dev.yaml.hbs +35 -0
  125. package/templates/aws-eks/iac/helm/app/values.yaml.hbs +130 -0
  126. package/templates/aws-eks/iac/runner/Dockerfile +53 -0
  127. package/templates/aws-eks/iac/terraform/bootstrap/main.tf.hbs +101 -0
  128. package/templates/aws-eks/iac/terraform/bootstrap/outputs.tf +19 -0
  129. package/templates/aws-eks/iac/terraform/bootstrap/variables.tf.hbs +17 -0
  130. package/templates/aws-eks/iac/terraform/environments/dev/backend.hcl.hbs +12 -0
  131. package/templates/aws-eks/iac/terraform/environments/dev/terraform.tfvars.hbs +32 -0
  132. package/templates/aws-eks/iac/terraform/main.tf.hbs +305 -0
  133. package/templates/aws-eks/iac/terraform/outputs.tf.hbs +52 -0
  134. package/templates/aws-eks/iac/terraform/providers.tf +47 -0
  135. package/templates/aws-eks/iac/terraform/variables.tf.hbs +181 -0
  136. package/templates/aws-eks/iac/terraform/versions.tf +27 -0
  137. package/templates/base/.claude/agents/issue-fixer.md +190 -0
  138. package/templates/base/.claude/agents/security-fixer.md +250 -0
  139. package/templates/base/.claude/rules/BE/001.md +25 -0
  140. package/templates/base/.claude/rules/BE/002.md +15 -0
  141. package/templates/base/.claude/rules/BE/003.md +18 -0
  142. package/templates/base/.claude/rules/BE/004.md +14 -0
  143. package/templates/base/.claude/rules/BE/005.md +15 -0
  144. package/templates/base/.claude/rules/BE/006.md +17 -0
  145. package/templates/base/.claude/rules/BE/007.md +21 -0
  146. package/templates/base/.claude/rules/BE/008.md +19 -0
  147. package/templates/base/.claude/rules/BE/009.md +27 -0
  148. package/templates/base/.claude/rules/BE/010.md +16 -0
  149. package/templates/base/.claude/rules/BE/011.md +15 -0
  150. package/templates/base/.claude/rules/E2E/001.md +13 -0
  151. package/templates/base/.claude/rules/E2E/002.md +14 -0
  152. package/templates/base/.claude/rules/E2E/003.md +10 -0
  153. package/templates/base/.claude/rules/E2E/004.md +23 -0
  154. package/templates/base/.claude/rules/E2E/005.md +15 -0
  155. package/templates/base/.claude/rules/E2E/006.md +13 -0
  156. package/templates/base/.claude/rules/E2E/007.md +18 -0
  157. package/templates/base/.claude/rules/FE/001.md +22 -0
  158. package/templates/base/.claude/rules/FE/002.md +39 -0
  159. package/templates/base/.claude/rules/FE/003.md +19 -0
  160. package/templates/base/.claude/rules/FE/004.md +21 -0
  161. package/templates/base/.claude/rules/FE/005.md +33 -0
  162. package/templates/base/.claude/rules/FE/006.md +24 -0
  163. package/templates/base/.claude/rules/FE/007.md +19 -0
  164. package/templates/base/.claude/rules/FE/008.md +26 -0
  165. package/templates/base/.claude/rules/FE/009.md +30 -0
  166. package/templates/base/.claude/rules/FE/010.md +25 -0
  167. package/templates/base/.claude/rules/FE/011.md +22 -0
  168. package/templates/base/.claude/rules/FE/012.md +32 -0
  169. package/templates/base/.claude/settings.json +53 -0
  170. package/templates/base/.claude/skills/clean-branches/SKILL.md +100 -0
  171. package/templates/base/.claude/skills/create/SKILL.md +47 -0
  172. package/templates/base/.claude/skills/create-jira-issue/SKILL.md +174 -0
  173. package/templates/base/.claude/skills/create-page/SKILL.md +195 -0
  174. package/templates/base/.claude/skills/create-route/SKILL.md +199 -0
  175. package/templates/base/.claude/skills/draft-email/SKILL.md +104 -0
  176. package/templates/base/.claude/skills/fix-issues/SKILL.md +238 -0
  177. package/templates/base/.claude/skills/security-scan/SKILL.md +297 -0
  178. package/templates/base/.claude/skills/verify-security-fixes/SKILL.md +180 -0
  179. package/templates/base/.dude/commands/README.md +85 -0
  180. package/templates/base/.dude/commands/hello.ts +34 -0
  181. package/templates/base/.dude/lint/checks/PRJ/001.ts +26 -0
  182. package/templates/base/.dude/lint/checks/README.md +69 -0
  183. package/templates/base/.vscode/tasks.json +44 -0
  184. package/templates/base/.worktreeinclude +2 -0
  185. package/templates/base/CLAUDE.md.hbs +364 -0
  186. package/templates/base/README.md.hbs +187 -0
  187. package/templates/base/_env.example.hbs +29 -0
  188. package/templates/base/_env.hbs +25 -0
  189. package/templates/base/_gitignore +31 -0
  190. package/templates/base/_npmrc +2 -0
  191. package/templates/base/backend/Dockerfile.hbs +22 -0
  192. package/templates/base/backend/README.md.hbs +74 -0
  193. package/templates/base/backend/_dockerignore +11 -0
  194. package/templates/base/backend/app/__init__.py +1 -0
  195. package/templates/base/backend/app/core/__init__.py +0 -0
  196. package/templates/base/backend/app/core/config.py.hbs +23 -0
  197. package/templates/base/backend/app/fixtures/__init__.py +0 -0
  198. package/templates/base/backend/app/main.py.hbs +41 -0
  199. package/templates/base/backend/app/management/__init__.py +0 -0
  200. package/templates/base/backend/app/models/__init__.py +0 -0
  201. package/templates/base/backend/app/queries/__init__.py +0 -0
  202. package/templates/base/backend/app/routers/__init__.py +0 -0
  203. package/templates/base/backend/app/routers/health.py +13 -0
  204. package/templates/base/backend/app/schemas/__init__.py +0 -0
  205. package/templates/base/backend/app/schemas/health.py +7 -0
  206. package/templates/base/backend/app/tasks/__init__.py +1 -0
  207. package/templates/base/backend/app/tests/__init__.py +0 -0
  208. package/templates/base/backend/app/tests/conftest.py +13 -0
  209. package/templates/base/backend/app/tests/models/__init__.py +0 -0
  210. package/templates/base/backend/app/tests/queries/__init__.py +0 -0
  211. package/templates/base/backend/app/tests/routers/__init__.py +0 -0
  212. package/templates/base/backend/app/tests/routers/test_health.py +10 -0
  213. package/templates/base/backend/app/tests/tasks/__init__.py +1 -0
  214. package/templates/base/backend/app/tests/utils/__init__.py +0 -0
  215. package/templates/base/backend/app/utils/__init__.py +0 -0
  216. package/templates/base/backend/pyproject.toml.hbs +40 -0
  217. package/templates/base/docker-compose.yml.hbs +128 -0
  218. package/templates/base/docs/docs/api.md +21 -0
  219. package/templates/base/docs/docs/dude.md.hbs +316 -0
  220. package/templates/base/docs/docs/index.md.hbs +100 -0
  221. package/templates/base/docs/docs/mkdocs.md +238 -0
  222. package/templates/base/docs/mkdocs.yml.hbs +52 -0
  223. package/templates/base/e2e/.prettierrc.json +1 -0
  224. package/templates/base/e2e/_prettierignore +3 -0
  225. package/templates/base/e2e/cucumber.js +21 -0
  226. package/templates/base/e2e/eslint.config.mjs +14 -0
  227. package/templates/base/e2e/features/example.feature +13 -0
  228. package/templates/base/e2e/package.json.hbs +30 -0
  229. package/templates/base/e2e/pages/ExamplePage.ts +16 -0
  230. package/templates/base/e2e/playwright.config.ts +27 -0
  231. package/templates/base/e2e/steps/common.steps.ts +32 -0
  232. package/templates/base/e2e/steps/example.steps.ts +4 -0
  233. package/templates/base/e2e/support/hooks.ts +72 -0
  234. package/templates/base/e2e/support/world.ts +24 -0
  235. package/templates/base/e2e/tsconfig.json +22 -0
  236. package/templates/base/frontend/.prettierrc.json +6 -0
  237. package/templates/base/frontend/Dockerfile +10 -0
  238. package/templates/base/frontend/_dockerignore +4 -0
  239. package/templates/base/frontend/eslint.config.js +32 -0
  240. package/templates/base/frontend/index.html.hbs +13 -0
  241. package/templates/base/frontend/package.json.hbs +38 -0
  242. package/templates/base/frontend/public/favicon.svg +5 -0
  243. package/templates/base/frontend/src/$components/Layout/$assets/logo.svg +5 -0
  244. package/templates/base/frontend/src/$components/Layout/constants.tsx.hbs +10 -0
  245. package/templates/base/frontend/src/$components/Layout/index.tsx +80 -0
  246. package/templates/base/frontend/src/$components/Layout/types.tsx +9 -0
  247. package/templates/base/frontend/src/$components/index.tsx +1 -0
  248. package/templates/base/frontend/src/$hooks/index.tsx +2 -0
  249. package/templates/base/frontend/src/$hooks/useCounterStore/index.tsx +28 -0
  250. package/templates/base/frontend/src/$hooks/useCounterStore/types.tsx +7 -0
  251. package/templates/base/frontend/src/$hooks/usePageTitle/index.tsx +21 -0
  252. package/templates/base/frontend/src/$types/vite-env.d.ts +10 -0
  253. package/templates/base/frontend/src/App.tsx.hbs +40 -0
  254. package/templates/base/frontend/src/main.tsx +10 -0
  255. package/templates/base/frontend/src/openapi/utils/openapi.yaml.hbs +28 -0
  256. package/templates/base/frontend/src/pages/constants.tsx +31 -0
  257. package/templates/base/frontend/src/pages/index.tsx +192 -0
  258. package/templates/base/frontend/src/pages/types.tsx +6 -0
  259. package/templates/base/frontend/src/styles.module.css +7 -0
  260. package/templates/base/frontend/src/utils/constants.tsx +11 -0
  261. package/templates/base/frontend/src/utils/formatters/index.tsx +49 -0
  262. package/templates/base/frontend/src/utils/functions.tsx +70 -0
  263. package/templates/base/frontend/src/utils/index.tsx +3 -0
  264. package/templates/base/frontend/tsconfig.json +24 -0
  265. package/templates/base/frontend/vite.config.ts +20 -0
  266. package/templates/base/package.json.hbs +11 -0
  267. package/templates/base/security/baseline.json +4 -0
  268. package/templates/celery/backend/app/tasks/__init__.py +1 -0
  269. package/templates/celery/backend/app/tasks/example.py +21 -0
  270. package/templates/celery/backend/app/tests/tasks/test_example.py +7 -0
  271. package/templates/celery/backend/app/worker.py.hbs +33 -0
  272. package/templates/celerybeat/backend/app/tasks/scheduled.py +16 -0
  273. package/templates/celerybeat/backend/app/tests/tasks/test_scheduled.py +7 -0
  274. package/templates/postgres/.dude/commands/reset.ts +76 -0
  275. package/templates/postgres/backend/alembic/env.py +55 -0
  276. package/templates/postgres/backend/alembic/script.py.mako +27 -0
  277. package/templates/postgres/backend/alembic/versions/0001_create_user_table.py +38 -0
  278. package/templates/postgres/backend/alembic.ini +42 -0
  279. package/templates/postgres/backend/app/core/database.py +15 -0
  280. package/templates/postgres/backend/app/models/__init__.py +5 -0
  281. package/templates/postgres/backend/app/models/user.py +15 -0
  282. package/templates/postgres/backend/app/queries/__init__.py +5 -0
  283. package/templates/postgres/backend/app/queries/users.py +18 -0
  284. package/templates/postgres/backend/app/routers/users.py +19 -0
  285. package/templates/postgres/backend/app/routers/users__id.py +20 -0
  286. package/templates/postgres/backend/app/tests/conftest.py +33 -0
  287. package/templates/postgres/backend/app/tests/models/test_user.py +12 -0
  288. package/templates/postgres/backend/app/tests/queries/test_users.py +12 -0
  289. package/templates/postgres/backend/app/tests/routers/test_users.py +10 -0
  290. package/templates/postgres/backend/app/tests/routers/test_users__id.py +9 -0
  291. package/templates/postgres/backend/start.sh +32 -0
  292. package/templates/postgres/frontend/src/openapi/utils/openapi.yaml.hbs +138 -0
  293. package/templates/postgres/frontend/src/pages/users/[id]/index.tsx +51 -0
  294. package/templates/postgres/frontend/src/pages/users/index.tsx +54 -0
  295. package/templates/postgres/frontend/src/pages/users/types.tsx +4 -0
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: create-route
3
+ description: Scaffold a new backend API route (FastAPI). Asks for the path, HTTP method(s) and response shape, surveys existing schemas/queries/routers for reuse, then creates the router file, registers it in main.py, adds any model/query/schema, writes the 1-to-1 tests, and regenerates the typed frontend client — all enforcing the backend BE rules.
4
+ disable-model-invocation: false
5
+ allowed-tools: "Read Write Edit Glob Grep Bash(dude *) Bash(find *) Bash(cat *) Bash(grep *) Bash(ls *)"
6
+ ---
7
+
8
+ # Create Route
9
+
10
+ Guided creation of a backend API endpoint that satisfies every backend rule in
11
+ `.claude/rules/BE/`. The skill **inspects the existing codebase first** so new
12
+ code reuses existing schemas, query classes and router patterns instead of
13
+ duplicating them.
14
+
15
+ > Read `.claude/rules/BE/001.md`–`011.md` once at the start — they are the
16
+ > source of truth. The summary below tracks them but the rule files win.
17
+
18
+ ---
19
+
20
+ ## Step 0 — Locate the project
21
+
22
+ ```bash
23
+ find . -maxdepth 3 -name "dude.json" | head -1
24
+ ```
25
+
26
+ Set `PROJECT_ROOT` to the directory containing `dude.json`. If missing, stop
27
+ with _"No dude.json found — are you inside a dude project?"_.
28
+
29
+ Detect whether a database layer exists (needed for model/query work):
30
+
31
+ ```bash
32
+ test -f "$PROJECT_ROOT/backend/app/core/database.py" && echo "db: yes" || echo "db: no"
33
+ ```
34
+
35
+ If `db: no` and the route needs persistence, tell the user this is a
36
+ non-postgres project — the route can still be created but without model/query
37
+ files (or they should re-scaffold with `--database postgres`).
38
+
39
+ ---
40
+
41
+ ## Step 1 — Gather requirements
42
+
43
+ Ask only for what the user hasn't already provided:
44
+
45
+ 1. **HTTP path** — e.g. `/todos`, `/todos/{id}`, `/users/me`.
46
+ 2. **Method(s)** — `GET` / `POST` / `PUT` / `PATCH` / `DELETE` (one route file may
47
+ hold several methods that share the same path prefix).
48
+ 3. **Response shape** — a single resource, a list, or a plain dict.
49
+ 4. **Request body** (for POST/PUT/PATCH) — which fields.
50
+ 5. **Persistence?** — does it read/write the database, or is it stateless?
51
+
52
+ ---
53
+
54
+ ## Step 2 — Survey the existing code (reuse before create)
55
+
56
+ Run these and **read the relevant matches** before proposing anything:
57
+
58
+ ```bash
59
+ ls "$PROJECT_ROOT"/backend/app/routers/*.py
60
+ ls "$PROJECT_ROOT"/backend/app/schemas/*.py 2>/dev/null
61
+ ls "$PROJECT_ROOT"/backend/app/models/*.py 2>/dev/null
62
+ ls "$PROJECT_ROOT"/backend/app/queries/*.py 2>/dev/null
63
+ ```
64
+
65
+ - **Similar router** — find the closest existing router (same resource family or
66
+ same method) and mirror its structure, imports and style.
67
+ - **Existing schema** — if a schema already models this resource
68
+ (`schemas/<resource>.py`), reuse it. Only create a new one if none fits (BE003).
69
+ - **Existing model / query** — if the resource already has a model and a query
70
+ class, reuse them; add a new query method rather than a new class when the
71
+ operation fits an existing class (BE011).
72
+
73
+ Report what you found and what you intend to reuse.
74
+
75
+ ---
76
+
77
+ ## Step 3 — Derive the router filename (BE006)
78
+
79
+ The filename **determines** the URL prefix — never hard-code the prefix in the
80
+ route decorator (BE007).
81
+
82
+ | Path | Router file | Decorator path |
83
+ |------|-------------|----------------|
84
+ | `/todos` | `routers/todos.py` | `@router.get("")` / `@router.post("")` |
85
+ | `/todos/{id}` | `routers/todos__id.py` | `@router.get("/{id}")` |
86
+ | `/users/me` | `routers/users_me.py` | `@router.get("/me")` |
87
+ | `/keycloak/token` | `routers/keycloak_token.py` | `@router.post("/token")` |
88
+
89
+ Rules: lowercase alphanumeric segments; `_` joins a literal sub-segment; `__`
90
+ introduces a path parameter (`__id` → `/{id}`).
91
+
92
+ ---
93
+
94
+ ## Step 4 — Plan the file set (confirm before writing)
95
+
96
+ Present the full list of files to **create** and **modify**, then wait for an OK.
97
+ A typical persistent route touches:
98
+
99
+ | File | Rule | Purpose |
100
+ |------|------|---------|
101
+ | `routers/<file>.py` | BE004, BE007 | the route(s); module-level `router = APIRouter(...)`, only `@router.METHOD` async/def handlers |
102
+ | `app/main.py` | BE005 | `from app.routers import <file>` + `api_router.include_router(<file>.router)` |
103
+ | `models/<resource>.py` | BE002, BE010 | one SQLModel class, PascalCase of filename — only if a new entity is introduced |
104
+ | `queries/<resource>.py` | BE011 | query class(es) named with the PascalCase prefix — only for DB access |
105
+ | `schemas/<resource>.py` | BE003 | request/response Pydantic/SQLModel schemas — only if no existing schema fits |
106
+ | `tests/routers/test_<file>.py` | BE008 | 1-to-1 test for the router |
107
+ | `tests/models/test_<resource>.py` | BE008 | 1-to-1 test for a new model |
108
+ | `tests/queries/test_<resource>.py` | BE008 | 1-to-1 test for a new query |
109
+ | `core/config.py` | BE009 | any new env var, added to `Settings` in **alphabetical** order |
110
+
111
+ Skip rows that don't apply. Every new source file under `models/ queries/
112
+ routers/ tasks/ utils/` **must** get its matching test in the same change (BE008).
113
+
114
+ ---
115
+
116
+ ## Step 5 — Implement
117
+
118
+ Follow the existing patterns exactly. Reference shapes:
119
+
120
+ ```python
121
+ # routers/todos__id.py → prefix /todos/{id} (BE004/006/007)
122
+ """Todos by ID router."""
123
+
124
+ from fastapi import APIRouter, Depends, HTTPException
125
+ from sqlmodel import Session
126
+
127
+ from app.core.database import get_db
128
+ from app.models.todo import Todo
129
+ from app.queries.todos import TodosQueries
130
+
131
+ router = APIRouter(tags=["todos"])
132
+ _todos = TodosQueries()
133
+
134
+
135
+ @router.get("/{id}", response_model=Todo)
136
+ def get_todos__id(id: int, db: Session = Depends(get_db)) -> Todo:
137
+ """Return a single todo by ID."""
138
+ todo = _todos.get_by_id(db, id)
139
+ if todo is None:
140
+ raise HTTPException(status_code=404, detail="Todo not found")
141
+ return todo
142
+ ```
143
+
144
+ ```python
145
+ # main.py registration (BE005) — alphabetical import block, one include per file
146
+ from app.routers import (
147
+ health,
148
+ todos,
149
+ todos__id,
150
+ )
151
+ ...
152
+ api_router.include_router(todos.router)
153
+ api_router.include_router(todos__id.router)
154
+ ```
155
+
156
+ Constraints to honour while writing:
157
+ - Router files contain **only** `@router.*` handlers — helpers go in `utils/` (BE007).
158
+ - The router variable is named exactly `router` (BE004).
159
+ - No `os.getenv`/`os.environ` outside `core/config.py` (BE009).
160
+ - One class per model file, named after the file (BE010/BE002).
161
+ - Schemas extend `BaseModel`/`SQLModel`, prefixed with the PascalCase resource
162
+ name (`TodoCreate`, `TodoRead`, …); enums/mixins go in `utils/` (BE003).
163
+ - Write meaningful tests (don't just assert 200) mirroring
164
+ `tests/routers/test_health.py` / `test_users.py` style.
165
+
166
+ ---
167
+
168
+ ## Step 6 — Validate
169
+
170
+ ```bash
171
+ cd "$PROJECT_ROOT"
172
+ dude lint # must pass — fixes any BE rule violations
173
+ dude api sync # regenerate frontend/src/openapi/ from the new route
174
+ dude test --backend # if available — run the new tests
175
+ ```
176
+
177
+ If `dude lint` reports a violation, fix it and re-run before continuing. After
178
+ `dude api sync` the new endpoint is available to the frontend as
179
+ `@/openapi/api/<resource>` (`$get`, `$post`, …).
180
+
181
+ ---
182
+
183
+ ## Step 7 — Report
184
+
185
+ ```
186
+ Route created
187
+ ═════════════════════════════════════════
188
+ Path <METHOD> /api<path>
189
+ Router backend/app/routers/<file>.py
190
+ Registered main.py (api_router.include_router)
191
+ Model <created | reused | n/a>
192
+ Query <created | reused | n/a>
193
+ Schema <created | reused | n/a>
194
+ Tests tests/routers/test_<file>.py (+ model/query tests)
195
+ ─────────────────────────────────────────
196
+ dude lint: ✓
197
+ dude api sync: ✓ → @/openapi/api/<resource>
198
+ Next: wire it into a page with /create-page
199
+ ```
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: draft-email
3
+ description: Draft a formal email and save it as a Markdown file in private/messages/. Use when asked to write, draft, or compose an email.
4
+ disable-model-invocation: false
5
+ allowed-tools: "Write Read Bash(date) Bash(ls *) Bash(git *)"
6
+ ---
7
+
8
+ # Draft Formal Email
9
+
10
+ ## Context
11
+
12
+ !`date "+%Y-%m-%d"`
13
+ !`git branch --show-current`
14
+ !`ls private/messages/ 2>/dev/null || echo "(no existing messages)"`
15
+
16
+ ## Conventions
17
+
18
+ **File format:**
19
+ ```markdown
20
+ # Email — <short description of the email>
21
+
22
+ ---
23
+
24
+ **To:** <recipient name or role>
25
+ **Cc:** <if applicable — omit line if not needed>
26
+ **Subject:** <Project name — concise subject>
27
+ **Date:** <YYYY-MM-DD>
28
+
29
+ ---
30
+
31
+ <body>
32
+
33
+ Best regards,
34
+ <Your Name>
35
+ ```
36
+
37
+ **Filename:** `private/messages/<kebab-case-description>.md`
38
+ - Descriptive, not generic: `api-handover.md`, `deploy-blocker.md`
39
+ - No date prefix in filename
40
+
41
+ **Tone and style:**
42
+ - Formal but not stiff — direct, professional, collegial
43
+ - English
44
+ - No filler phrases ("I hope this email finds you well", "Please feel free to")
45
+ - Lead with the main point, provide context after
46
+ - Use Markdown formatting (bold, bullet lists) where it aids clarity
47
+
48
+ **Signature:** always `Best regards,\n<Your Name>`
49
+
50
+ > **Note**: replace `<Your Name>` with your actual name the first time you use this skill in a new project — or update this file to hardcode it.
51
+
52
+ ---
53
+
54
+ ## Step 1 — Gather information
55
+
56
+ Before drafting, make sure you have:
57
+ - **Recipient** (name, role, or team)
58
+ - **Purpose** (what action or information is this email for?)
59
+ - **Key points** to cover (listed by the user, or inferred from context)
60
+ - **Tone** (default: formal — adjust if user says "friendly" or "assertive")
61
+ - **Attachments or references** to mention (links, docs, issues)
62
+
63
+ If any of these is unclear and cannot be inferred from context, ask before drafting.
64
+
65
+ ## Step 2 — Draft the email
66
+
67
+ Write the full email following the format above. Apply these structural rules by purpose:
68
+
69
+ **Informational / handover email** (sharing deliverables, status updates):
70
+ - Open with what you are sharing and why
71
+ - Provide relevant context or background the recipient needs
72
+ - List key details, constraints, or next steps clearly
73
+ - Close with an offer to clarify or reconnect
74
+
75
+ **Request / action required email** (asking for something, flagging a blocker):
76
+ - Open with the specific request or issue — one sentence
77
+ - Explain why it is needed and the impact if not addressed
78
+ - Provide all information the recipient needs to act (no back-and-forth)
79
+ - State a deadline or urgency level if applicable
80
+ - Close with a clear call to action
81
+
82
+ **Follow-up / reminder email**:
83
+ - Reference the previous communication briefly
84
+ - State what is still pending and why it matters now
85
+ - Keep it short — no need to repeat full context already shared
86
+
87
+ **Technical clarification email** (explaining architecture, processes, decisions):
88
+ - Lead with the conclusion or recommendation, then explain
89
+ - Use structured sections (##) for complex topics
90
+ - Include concrete examples, file paths, or command references where helpful
91
+ - Anticipate follow-up questions and address them proactively
92
+
93
+ ## Step 3 — Review
94
+
95
+ Show the drafted email in full. Ask the user:
96
+ > "Does this look right, or would you like to adjust the tone, add/remove points, or change any details?"
97
+
98
+ Wait for explicit confirmation or edits before saving.
99
+
100
+ ## Step 4 — Save
101
+
102
+ Save the file to `private/messages/<kebab-case-description>.md`.
103
+
104
+ Confirm: show the filename and the first line of the saved content.
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: fix-issues
3
+ description: Fix 1–5 Jira issues. Single-issue uses a standard flow; multiple issues run parallel agents in isolated git worktrees, then consolidate into one branch and open a PR.
4
+ disable-model-invocation: false
5
+ allowed-tools: "Bash(git *) Bash(dude *) Bash(docker *) Bash(cat *) Bash(find *) Read Write mcp__atlassian__getJiraIssue mcp__atlassian__getTransitionsForJiraIssue mcp__atlassian__transitionJiraIssue mcp__atlassian__addCommentToJiraIssue mcp__atlassian__createPullRequest mcp__atlassian__getRepository PushNotification"
6
+ ---
7
+
8
+ # Fix Issues (Router + Parallel + Consolidation)
9
+
10
+ Fixes 1–5 Jira issues. For a single issue a standard single-agent flow is
11
+ used. For multiple issues, agents run in parallel using isolated git worktrees
12
+ and their branches are merged into one consolidated branch before the PR is
13
+ created.
14
+
15
+ Each issue is routed to the appropriate agent based on its labels:
16
+ - Issues labelled `security` → **`security-fixer`** agent
17
+ - All other issues (features, bugs, tasks) → **`issue-fixer`** agent
18
+
19
+ ## Usage
20
+
21
+ ```
22
+ /fix-issues PROJ-52
23
+ /fix-issues PROJ-52 PROJ-55 PROJ-59
24
+ /fix-issues PROJ-52 PROJ-53 PROJ-54 PROJ-57 PROJ-60
25
+ ```
26
+
27
+ ## Validation
28
+
29
+ If more than 5 issue IDs are provided, stop and ask the user to split the
30
+ request into batches of at most 5.
31
+
32
+ ---
33
+
34
+ ## Step 0 — Autodiscovery
35
+
36
+ ### Project root
37
+
38
+ ```bash
39
+ find . -maxdepth 3 -name "dude.json" | head -1
40
+ ```
41
+
42
+ If not found, report: _"No dude.json found — are you inside a dude project?"_ and stop.
43
+
44
+ ### Jira + Bitbucket configuration
45
+
46
+ Read `## Saved configuration` at the bottom of this file.
47
+
48
+ - If `workspace`, `repo`, and `jira-project` keys are present, use them silently.
49
+ - If any are absent, ask:
50
+ - **"What is the Bitbucket workspace slug?"** (e.g. `myteam`)
51
+ - **"What is the repository slug?"** (e.g. `my-project`)
52
+ - **"What is the Jira project key?"** (e.g. `PROJ`)
53
+ - Then offer to save all three in this file's `## Saved configuration` section.
54
+
55
+ Resolve automatically:
56
+ - **Jira URL**: `getAccessibleAtlassianResources` → first site URL
57
+ - **Current user**: `atlassianUserInfo` → display name (used in PR description)
58
+
59
+ ---
60
+
61
+ ## Phase 0 — Route: fetch issues and pick agents
62
+
63
+ Before launching any fix agent, fetch all issues with `getJiraIssue`
64
+ (in parallel if N>1) and read `labels` for each.
65
+
66
+ For each issue, select the agent:
67
+ - `labels` contains `security` → `security-fixer`
68
+ - otherwise → `issue-fixer`
69
+
70
+ Build a per-issue map: `{ issue_id: agent_type }`.
71
+
72
+ ### Branch naming
73
+
74
+ - **Single issue (N=1)**: branch = lowercase issue key (e.g. `proj-52`)
75
+ - **Multiple issues (N>1)**:
76
+ - Individual branches: lowercase issue key per agent
77
+ - Consolidated branch: `fix/<key1>-<key2>-...` (keys sorted numerically)
78
+ - If **all** issues are security-labelled: `security/<key1>-<key2>-...`
79
+
80
+ ---
81
+
82
+ ## Phase 1 — Fix agents (parallel for N>1, single for N=1)
83
+
84
+ Launch one agent **per issue** in the **same message** (so they run in parallel
85
+ when N>1), using the agent type determined in Phase 0. Each agent uses
86
+ `isolation: "worktree"` to get its own isolated git checkout.
87
+
88
+ Prompt template for each agent:
89
+
90
+ > Fix Jira issue `<ISSUE_ID>` in PARALLEL MODE.
91
+ >
92
+ > Project root: `<PROJECT_ROOT>`
93
+ > Jira URL: `<JIRA_URL>`
94
+ > Bitbucket workspace: `<workspace>`, repo: `<repo>`
95
+ >
96
+ > PARALLEL MODE: create branch `<issue-id>` from `develop`, apply fix, push.
97
+ > Do NOT create a PR. Do NOT transition the Jira issue.
98
+
99
+ Wait for **all agents** to finish before proceeding.
100
+
101
+ Collect from each agent:
102
+ - Branch name pushed
103
+ - Files changed
104
+ - Commit hash
105
+ - Any `BLOCKED: <reason>` if the agent could not complete the fix
106
+
107
+ ---
108
+
109
+ ## Phase 2 — Consolidation (N>1 only)
110
+
111
+ For a **single issue**, skip this phase — go directly to Phase 3 using the
112
+ agent's own branch.
113
+
114
+ For **multiple issues**, collect branch names, then:
115
+
116
+ ```bash
117
+ git fetch origin
118
+ git checkout develop && git pull origin develop --rebase
119
+ git checkout -b fix/<key1>-<key2>-...
120
+
121
+ git merge --no-ff <key1>
122
+ git merge --no-ff <key2>
123
+ # … one per agent branch
124
+ ```
125
+
126
+ If any merge produces a conflict:
127
+ - Report which branch caused it and the conflicting files.
128
+ - Stop — do **not** force-push or discard changes.
129
+ - Ask the user how to proceed.
130
+
131
+ ---
132
+
133
+ ## Phase 3 — Tests
134
+
135
+ Run on the consolidated branch (or the single agent branch):
136
+
137
+ ```bash
138
+ dude lint
139
+ ```
140
+
141
+ If the project has a test command (check `Makefile`, `package.json` scripts, or
142
+ `dude help`), run it next:
143
+
144
+ ```bash
145
+ dude test # if available
146
+ # or:
147
+ cd backend && python -m pytest
148
+ cd frontend && pnpm test
149
+ ```
150
+
151
+ If any step fails, report the output and stop — do **not** create a PR.
152
+
153
+ ---
154
+
155
+ ## Phase 4 — Push and create one PR
156
+
157
+ ```bash
158
+ git push -u origin <source-branch>
159
+ ```
160
+
161
+ Create a pull request via `createPullRequest`:
162
+
163
+ - **Title**:
164
+ - N=1: `[<ISSUE_ID>] <issue summary>`
165
+ - N>1: `[<KEY1>, <KEY2>, …] <short batch description>`
166
+ - **Source branch**: `<source-branch>`
167
+ - **Destination branch**: `develop`
168
+ - **Description**:
169
+ ```
170
+ ## Summary
171
+ <bullet points per issue: what was changed and why>
172
+
173
+ ## Issues
174
+ - [<ISSUE_ID>] <summary> — <Jira URL>/<ISSUE_ID>
175
+ - …
176
+
177
+ ## Test plan
178
+ - [ ] dude lint: ✓
179
+ - [ ] tests: ✓
180
+ ```
181
+ - **Close source branch**: `true`
182
+
183
+ ---
184
+
185
+ ## Phase 5 — Transition all Jira issues
186
+
187
+ For each issue, call `getTransitionsForJiraIssue` → find a transition whose
188
+ name contains "Review" or "Peer review" (case-insensitive) →
189
+ `transitionJiraIssue`.
190
+
191
+ If no matching transition is found (the workflow may differ), skip silently.
192
+
193
+ ---
194
+
195
+ ## Phase 6 — Report
196
+
197
+ ```
198
+ Fix complete
199
+ ══════════════════════════════════════════════════════
200
+
201
+ Branch
202
+ <branch-name>
203
+
204
+ Issues (N)
205
+ <KEY> [issue-fixer] — commit <hash> — <description>
206
+ <KEY> [security-fixer] — commit <hash> — <description>
207
+
208
+ Tests
209
+ dude lint: ✓
210
+ dude test: ✓
211
+
212
+ Pull request
213
+ <PR URL>
214
+
215
+ Jira
216
+ <KEY> → In Review
217
+ <KEY> → In Review
218
+ ```
219
+
220
+ ---
221
+
222
+ ## Notes
223
+
224
+ - Each agent runs in its own git worktree (`isolation: "worktree"`) — git
225
+ operations never conflict during Phase 1.
226
+ - `security/baseline.json` is **not** touched by individual agents. Baseline
227
+ cleanup is handled by `verify-security-fixes` after the PR is merged.
228
+ - Each agent calls `PushNotification` when it completes so you are notified
229
+ immediately as each fix lands.
230
+ - Agents marked `BLOCKED` are reported in Phase 6 but do not prevent the PR
231
+ from being created for the remaining issues.
232
+
233
+ ---
234
+
235
+ <!-- ------------------------------------------------------------------ -->
236
+ <!-- Everything below this line is written automatically by the skill. -->
237
+ <!-- Do not edit manually. -->
238
+ <!-- ------------------------------------------------------------------ -->