cc-codeconductor 1.4.2 → 1.5.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 (305) hide show
  1. package/README.md +52 -14
  2. package/dist/domain/product/entities.d.ts +1 -1
  3. package/dist/index.js +811 -354
  4. package/dist/library.js +47 -3
  5. package/dist/validation/schemas.d.ts +183 -21
  6. package/docs/generated/cli.md +16 -0
  7. package/package.json +1 -1
  8. package/presets/agy/README.md +1 -1
  9. package/presets/agy/hooks.json +1 -1
  10. package/presets/agy/scripts/invoke-hook.cjs +20 -5
  11. package/presets/agy/settings.json +1 -1
  12. package/presets/agy/skills/api-versioning/SKILL.md +394 -0
  13. package/presets/agy/skills/astro/SKILL.md +318 -0
  14. package/presets/agy/skills/auth-token-inspector/SKILL.md +30 -0
  15. package/presets/agy/skills/cc-pagespeed/SKILL.md +2 -3
  16. package/presets/agy/skills/code-review/SKILL.md +207 -0
  17. package/presets/agy/skills/django-orm/SKILL.md +460 -0
  18. package/presets/agy/skills/django-uv/SKILL.md +405 -0
  19. package/presets/agy/skills/drizzle-schema-architect/SKILL.md +50 -0
  20. package/presets/agy/skills/fastapi-pydantic-strict/SKILL.md +43 -0
  21. package/presets/agy/skills/jpa-nplusone-detector/SKILL.md +45 -0
  22. package/presets/agy/skills/jpa-postgres/SKILL.md +623 -0
  23. package/presets/agy/skills/livewire-alpine-bridge/SKILL.md +35 -0
  24. package/presets/agy/skills/nextjs-typescript/SKILL.md +390 -0
  25. package/presets/agy/skills/python/SKILL.md +611 -0
  26. package/presets/agy/skills/seo-analytics-injector/SKILL.md +43 -0
  27. package/presets/agy/skills/spring-auth-auditor/SKILL.md +29 -0
  28. package/presets/agy/skills/spring-boot-feature/SKILL.md +563 -0
  29. package/presets/agy/skills/spring-boot-testing-strategy/SKILL.md +475 -0
  30. package/presets/agy/skills/tailwind-responsive-auditor/SKILL.md +29 -0
  31. package/presets/agy/skills/tdd-mutation-tester/SKILL.md +27 -0
  32. package/presets/agy/workflows/cc-api-contract.md +4 -5
  33. package/presets/agy/workflows/cc-backlog.md +4 -5
  34. package/presets/agy/workflows/cc-clarify.md +4 -5
  35. package/presets/agy/workflows/cc-council.md +4 -5
  36. package/presets/agy/workflows/cc-db-migration.md +4 -5
  37. package/presets/agy/workflows/cc-explore.md +4 -5
  38. package/presets/agy/workflows/cc-feature.md +4 -5
  39. package/presets/agy/workflows/cc-fix.md +4 -5
  40. package/presets/agy/workflows/cc-handoff.md +8 -5
  41. package/presets/agy/workflows/cc-iterative.md +4 -5
  42. package/presets/agy/workflows/cc-odd.md +4 -3
  43. package/presets/agy/workflows/cc-openspec.md +5 -6
  44. package/presets/agy/workflows/cc-pagespeed.md +6 -8
  45. package/presets/agy/workflows/cc-prototype.md +4 -5
  46. package/presets/agy/workflows/cc-refactor.md +4 -5
  47. package/presets/agy/workflows/cc-review.md +35 -5
  48. package/presets/agy/workflows/cc-scorecard.md +4 -5
  49. package/presets/agy/workflows/cc-security.md +5 -6
  50. package/presets/agy/workflows/cc-spec-mutation.md +4 -5
  51. package/presets/agy/workflows/cc-tdd-cycle.md +4 -5
  52. package/presets/agy/workflows/cc-test-plan.md +4 -5
  53. package/presets/agy/workflows/cc-triage.md +4 -5
  54. package/presets/claude/CLAUDE.md +6 -5
  55. package/presets/claude/commands/cc/api-contract.md +4 -5
  56. package/presets/claude/commands/cc/backlog.md +4 -5
  57. package/presets/claude/commands/cc/clarify.md +4 -5
  58. package/presets/claude/commands/cc/council.md +4 -5
  59. package/presets/claude/commands/cc/db-migration.md +4 -5
  60. package/presets/claude/commands/cc/explore.md +4 -5
  61. package/presets/claude/commands/cc/feature.md +4 -5
  62. package/presets/claude/commands/cc/fix.md +4 -5
  63. package/presets/claude/commands/cc/handoff.md +8 -5
  64. package/presets/claude/commands/cc/iterative.md +4 -5
  65. package/presets/claude/commands/cc/odd.md +4 -3
  66. package/presets/claude/commands/cc/openspec.md +23 -7
  67. package/presets/claude/commands/cc/pagespeed.md +4 -5
  68. package/presets/claude/commands/cc/prototype.md +4 -5
  69. package/presets/claude/commands/cc/refactor.md +4 -5
  70. package/presets/claude/commands/cc/review.md +37 -5
  71. package/presets/claude/commands/cc/scorecard.md +4 -5
  72. package/presets/claude/commands/cc/security.md +4 -5
  73. package/presets/claude/commands/cc/spec-mutation.md +4 -5
  74. package/presets/claude/commands/cc/tdd-cycle.md +4 -5
  75. package/presets/claude/commands/cc/test-plan.md +4 -5
  76. package/presets/claude/commands/cc/triage.md +4 -5
  77. package/presets/claude/settings.json +33 -79
  78. package/presets/claude/skills/android/SKILL.md +1 -1
  79. package/presets/claude/skills/api-versioning/SKILL.md +1 -1
  80. package/presets/claude/skills/astro/SKILL.md +318 -0
  81. package/presets/claude/skills/auth-token-inspector/SKILL.md +30 -0
  82. package/presets/claude/skills/code-review/SKILL.md +207 -0
  83. package/presets/claude/skills/django-orm/SKILL.md +1 -1
  84. package/presets/claude/skills/django-testing/SKILL.md +1 -1
  85. package/presets/claude/skills/django-uv/SKILL.md +405 -0
  86. package/presets/claude/skills/drizzle-schema-architect/SKILL.md +50 -0
  87. package/presets/claude/skills/fastapi-pydantic-strict/SKILL.md +43 -0
  88. package/presets/claude/skills/jpa-nplusone-detector/SKILL.md +45 -0
  89. package/presets/claude/skills/jpa-postgres/SKILL.md +1 -1
  90. package/presets/claude/skills/livewire-alpine-bridge/SKILL.md +35 -0
  91. package/presets/claude/skills/nextjs-typescript/SKILL.md +390 -0
  92. package/presets/claude/skills/pagespeed-perf/SKILL.md +1 -1
  93. package/presets/claude/skills/python/SKILL.md +1 -1
  94. package/presets/claude/skills/python-django-stack/SKILL.md +1 -1
  95. package/presets/claude/skills/python-fastapi-stack/SKILL.md +1 -1
  96. package/presets/claude/skills/security/SKILL.md +1 -1
  97. package/presets/claude/skills/seo-analytics-injector/SKILL.md +43 -0
  98. package/presets/claude/skills/spring-auth-auditor/SKILL.md +29 -0
  99. package/presets/claude/skills/spring-boot-feature/SKILL.md +1 -1
  100. package/presets/claude/skills/spring-boot-kotlin/SKILL.md +1 -1
  101. package/presets/claude/skills/spring-boot-testing-strategy/SKILL.md +475 -0
  102. package/presets/claude/skills/sqlalchemy/SKILL.md +1 -1
  103. package/presets/claude/skills/tailwind-responsive-auditor/SKILL.md +29 -0
  104. package/presets/claude/skills/tdd-mutation-tester/SKILL.md +27 -0
  105. package/presets/claude/skills/testing-strategy/SKILL.md +1 -1
  106. package/presets/codex/config.toml +2 -0
  107. package/presets/codex/skills/android/SKILL.md +1 -1
  108. package/presets/codex/skills/api-versioning/SKILL.md +1 -1
  109. package/presets/codex/skills/astro/SKILL.md +318 -0
  110. package/presets/codex/skills/auth-token-inspector/SKILL.md +30 -0
  111. package/presets/codex/skills/cc-api-contract/SKILL.md +4 -5
  112. package/presets/codex/skills/cc-backlog/SKILL.md +4 -5
  113. package/presets/codex/skills/cc-clarify/SKILL.md +4 -5
  114. package/presets/codex/skills/cc-council/SKILL.md +10 -5
  115. package/presets/codex/skills/cc-db-migration/SKILL.md +4 -5
  116. package/presets/codex/skills/cc-explore/SKILL.md +4 -5
  117. package/presets/codex/skills/cc-feature/SKILL.md +4 -5
  118. package/presets/codex/skills/cc-fix/SKILL.md +4 -5
  119. package/presets/codex/skills/cc-handoff/SKILL.md +8 -5
  120. package/presets/codex/skills/cc-iterative/SKILL.md +4 -5
  121. package/presets/codex/skills/cc-odd/SKILL.md +4 -3
  122. package/presets/codex/skills/cc-openspec/SKILL.md +12 -7
  123. package/presets/codex/skills/cc-pagespeed/SKILL.md +6 -8
  124. package/presets/codex/skills/cc-prototype/SKILL.md +4 -5
  125. package/presets/codex/skills/cc-refactor/SKILL.md +4 -5
  126. package/presets/codex/skills/cc-review/SKILL.md +35 -5
  127. package/presets/codex/skills/cc-scorecard/SKILL.md +4 -5
  128. package/presets/codex/skills/cc-security/SKILL.md +5 -6
  129. package/presets/codex/skills/cc-spec-mutation/SKILL.md +4 -5
  130. package/presets/codex/skills/cc-tdd-cycle/SKILL.md +4 -5
  131. package/presets/codex/skills/cc-test-plan/SKILL.md +4 -5
  132. package/presets/codex/skills/cc-triage/SKILL.md +4 -5
  133. package/presets/codex/skills/code-review/SKILL.md +207 -0
  134. package/presets/codex/skills/django-orm/SKILL.md +1 -1
  135. package/presets/codex/skills/django-testing/SKILL.md +1 -1
  136. package/presets/codex/skills/django-uv/SKILL.md +405 -0
  137. package/presets/codex/skills/drizzle-schema-architect/SKILL.md +50 -0
  138. package/presets/codex/skills/fastapi-pydantic-strict/SKILL.md +43 -0
  139. package/presets/codex/skills/jpa-nplusone-detector/SKILL.md +45 -0
  140. package/presets/codex/skills/jpa-postgres/SKILL.md +1 -1
  141. package/presets/codex/skills/livewire-alpine-bridge/SKILL.md +35 -0
  142. package/presets/codex/skills/nextjs-typescript/SKILL.md +390 -0
  143. package/presets/codex/skills/pagespeed-perf/SKILL.md +1 -1
  144. package/presets/codex/skills/python/SKILL.md +1 -1
  145. package/presets/codex/skills/python-django-stack/SKILL.md +1 -1
  146. package/presets/codex/skills/python-fastapi-stack/SKILL.md +1 -1
  147. package/presets/codex/skills/security-ai-llm/SKILL.md +43 -0
  148. package/presets/codex/skills/security-blue-team/SKILL.md +43 -0
  149. package/presets/codex/skills/security-cloud/SKILL.md +43 -0
  150. package/presets/codex/skills/security-crypto/SKILL.md +43 -0
  151. package/presets/codex/skills/security-exploit-dev/SKILL.md +45 -0
  152. package/presets/codex/skills/security-grc/SKILL.md +43 -0
  153. package/presets/codex/skills/security-incident-response/SKILL.md +45 -0
  154. package/presets/codex/skills/security-log-analysis/SKILL.md +43 -0
  155. package/presets/codex/skills/security-malware-analysis/SKILL.md +44 -0
  156. package/presets/codex/skills/security-mobile/SKILL.md +43 -0
  157. package/presets/codex/skills/security-network/SKILL.md +43 -0
  158. package/presets/codex/skills/security-ot-ics/SKILL.md +43 -0
  159. package/presets/codex/skills/security-recon/SKILL.md +45 -0
  160. package/presets/codex/skills/security-red-team/SKILL.md +44 -0
  161. package/presets/codex/skills/security-reverse-engineering/SKILL.md +44 -0
  162. package/presets/codex/skills/security-soc-automation/SKILL.md +43 -0
  163. package/presets/codex/skills/security-threat-hunting/SKILL.md +43 -0
  164. package/presets/codex/skills/security-vuln-assessment/SKILL.md +45 -0
  165. package/presets/codex/skills/security-web/SKILL.md +44 -0
  166. package/presets/codex/skills/seo-analytics-injector/SKILL.md +43 -0
  167. package/presets/codex/skills/spring-auth-auditor/SKILL.md +29 -0
  168. package/presets/codex/skills/spring-boot-feature/SKILL.md +2 -2
  169. package/presets/codex/skills/spring-boot-kotlin/SKILL.md +1 -1
  170. package/presets/codex/skills/spring-boot-testing-strategy/SKILL.md +475 -0
  171. package/presets/codex/skills/sqlalchemy/SKILL.md +1 -1
  172. package/presets/codex/skills/tailwind-responsive-auditor/SKILL.md +29 -0
  173. package/presets/codex/skills/tdd-mutation-tester/SKILL.md +27 -0
  174. package/presets/codex/skills/testing-strategy/SKILL.md +1 -1
  175. package/presets/cursor/commands/cc/api-contract.md +4 -5
  176. package/presets/cursor/commands/cc/backlog.md +4 -5
  177. package/presets/cursor/commands/cc/clarify.md +4 -5
  178. package/presets/cursor/commands/cc/council.md +4 -5
  179. package/presets/cursor/commands/cc/db-migration.md +4 -5
  180. package/presets/cursor/commands/cc/explore.md +4 -5
  181. package/presets/cursor/commands/cc/feature.md +4 -5
  182. package/presets/cursor/commands/cc/fix.md +4 -5
  183. package/presets/cursor/commands/cc/handoff.md +8 -5
  184. package/presets/cursor/commands/cc/iterative.md +4 -5
  185. package/presets/cursor/commands/cc/odd.md +4 -3
  186. package/presets/cursor/commands/cc/openspec.md +6 -7
  187. package/presets/cursor/commands/cc/pagespeed.md +6 -8
  188. package/presets/cursor/commands/cc/prototype.md +4 -5
  189. package/presets/cursor/commands/cc/refactor.md +4 -5
  190. package/presets/cursor/commands/cc/review.md +35 -5
  191. package/presets/cursor/commands/cc/scorecard.md +4 -5
  192. package/presets/cursor/commands/cc/security.md +5 -6
  193. package/presets/cursor/commands/cc/spec-mutation.md +4 -5
  194. package/presets/cursor/commands/cc/tdd-cycle.md +4 -5
  195. package/presets/cursor/commands/cc/test-plan.md +4 -5
  196. package/presets/cursor/commands/cc/triage.md +4 -5
  197. package/presets/cursor/skills/android/SKILL.md +1 -1
  198. package/presets/cursor/skills/api-versioning/SKILL.md +2 -1
  199. package/presets/cursor/skills/astro/SKILL.md +1 -1
  200. package/presets/cursor/skills/auth-token-inspector/SKILL.md +1 -1
  201. package/presets/cursor/skills/code-review/SKILL.md +1 -1
  202. package/presets/cursor/skills/django-orm/SKILL.md +3 -5
  203. package/presets/cursor/skills/django-testing/SKILL.md +1 -1
  204. package/presets/cursor/skills/django-uv/SKILL.md +1 -1
  205. package/presets/cursor/skills/drizzle-schema-architect/SKILL.md +1 -1
  206. package/presets/cursor/skills/fastapi-pydantic-strict/SKILL.md +1 -1
  207. package/presets/cursor/skills/jpa-nplusone-detector/SKILL.md +1 -1
  208. package/presets/cursor/skills/jpa-postgres/SKILL.md +2 -4
  209. package/presets/cursor/skills/livewire-alpine-bridge/SKILL.md +1 -1
  210. package/presets/cursor/skills/nextjs-typescript/SKILL.md +1 -1
  211. package/presets/cursor/skills/pagespeed-perf/SKILL.md +1 -1
  212. package/presets/cursor/skills/python/SKILL.md +6 -7
  213. package/presets/cursor/skills/python-django-stack/SKILL.md +1 -1
  214. package/presets/cursor/skills/python-fastapi-stack/SKILL.md +1 -1
  215. package/presets/cursor/skills/security/SKILL.md +1 -1
  216. package/presets/cursor/skills/seo-analytics-injector/SKILL.md +1 -1
  217. package/presets/cursor/skills/spring-auth-auditor/SKILL.md +1 -1
  218. package/presets/cursor/skills/spring-boot-feature/SKILL.md +2 -4
  219. package/presets/cursor/skills/spring-boot-kotlin/SKILL.md +1 -1
  220. package/presets/cursor/skills/spring-boot-testing-strategy/SKILL.md +1 -1
  221. package/presets/cursor/skills/sqlalchemy/SKILL.md +1 -1
  222. package/presets/cursor/skills/tailwind-responsive-auditor/SKILL.md +1 -1
  223. package/presets/cursor/skills/tdd-mutation-tester/SKILL.md +1 -1
  224. package/presets/gemini/commands/cc/api-contract.toml +4 -5
  225. package/presets/gemini/commands/cc/backlog.toml +4 -5
  226. package/presets/gemini/commands/cc/clarify.toml +4 -5
  227. package/presets/gemini/commands/cc/council.toml +4 -5
  228. package/presets/gemini/commands/cc/db-migration.toml +4 -5
  229. package/presets/gemini/commands/cc/explore.toml +4 -5
  230. package/presets/gemini/commands/cc/feature.toml +4 -5
  231. package/presets/gemini/commands/cc/fix.toml +4 -5
  232. package/presets/gemini/commands/cc/handoff.toml +8 -5
  233. package/presets/gemini/commands/cc/iterative.toml +4 -5
  234. package/presets/gemini/commands/cc/odd.toml +4 -3
  235. package/presets/gemini/commands/cc/openspec.toml +6 -7
  236. package/presets/gemini/commands/cc/pagespeed.toml +6 -8
  237. package/presets/gemini/commands/cc/prototype.toml +4 -5
  238. package/presets/gemini/commands/cc/refactor.toml +4 -5
  239. package/presets/gemini/commands/cc/review.toml +35 -5
  240. package/presets/gemini/commands/cc/scorecard.toml +4 -5
  241. package/presets/gemini/commands/cc/security.toml +5 -6
  242. package/presets/gemini/commands/cc/spec-mutation.toml +4 -5
  243. package/presets/gemini/commands/cc/tdd-cycle.toml +4 -5
  244. package/presets/gemini/commands/cc/test-plan.toml +4 -5
  245. package/presets/gemini/commands/cc/triage.toml +4 -5
  246. package/presets/opencode/README.md +45 -52
  247. package/presets/opencode/commands/cc-api-contract.md +4 -5
  248. package/presets/opencode/commands/cc-backlog.md +4 -5
  249. package/presets/opencode/commands/cc-clarify.md +4 -5
  250. package/presets/opencode/commands/cc-council.md +4 -5
  251. package/presets/opencode/commands/cc-db-migration.md +4 -5
  252. package/presets/opencode/commands/cc-explore.md +4 -5
  253. package/presets/opencode/commands/cc-feature.md +4 -5
  254. package/presets/opencode/commands/cc-fix.md +4 -5
  255. package/presets/opencode/commands/cc-handoff.md +8 -5
  256. package/presets/opencode/commands/cc-iterative.md +4 -5
  257. package/presets/opencode/commands/cc-odd.md +4 -3
  258. package/presets/opencode/commands/cc-openspec.md +6 -7
  259. package/presets/opencode/commands/cc-pagespeed.md +6 -8
  260. package/presets/opencode/commands/cc-prototype.md +4 -5
  261. package/presets/opencode/commands/cc-refactor.md +4 -5
  262. package/presets/opencode/commands/cc-review.md +35 -5
  263. package/presets/opencode/commands/cc-scorecard.md +4 -5
  264. package/presets/opencode/commands/cc-security.md +5 -6
  265. package/presets/opencode/commands/cc-spec-mutation.md +4 -5
  266. package/presets/opencode/commands/cc-tdd-cycle.md +4 -5
  267. package/presets/opencode/commands/cc-test-plan.md +4 -5
  268. package/presets/opencode/commands/cc-triage.md +4 -5
  269. package/presets/opencode/opencode.jsonc +1 -1
  270. package/presets/opencode/skills/android/SKILL.md +1 -1
  271. package/presets/opencode/skills/api-versioning/SKILL.md +2 -1
  272. package/presets/opencode/skills/astro/SKILL.md +1 -1
  273. package/presets/opencode/skills/auth-token-inspector/SKILL.md +1 -1
  274. package/presets/opencode/skills/code-review/SKILL.md +1 -1
  275. package/presets/opencode/skills/django-orm/SKILL.md +3 -3
  276. package/presets/opencode/skills/django-testing/SKILL.md +1 -1
  277. package/presets/opencode/skills/django-uv/SKILL.md +1 -1
  278. package/presets/opencode/skills/drizzle-schema-architect/SKILL.md +1 -1
  279. package/presets/opencode/skills/fastapi-pydantic-strict/SKILL.md +1 -1
  280. package/presets/opencode/skills/jpa-nplusone-detector/SKILL.md +1 -1
  281. package/presets/opencode/skills/jpa-postgres/SKILL.md +2 -1
  282. package/presets/opencode/skills/livewire-alpine-bridge/SKILL.md +1 -1
  283. package/presets/opencode/skills/nextjs-typescript/SKILL.md +1 -1
  284. package/presets/opencode/skills/pagespeed-perf/SKILL.md +1 -1
  285. package/presets/opencode/skills/python/SKILL.md +6 -5
  286. package/presets/opencode/skills/python-django-stack/SKILL.md +1 -1
  287. package/presets/opencode/skills/python-fastapi-stack/SKILL.md +1 -1
  288. package/presets/opencode/skills/security/SKILL.md +1 -1
  289. package/presets/opencode/skills/seo-analytics-injector/SKILL.md +1 -1
  290. package/presets/opencode/skills/spring-auth-auditor/SKILL.md +1 -1
  291. package/presets/opencode/skills/spring-boot-feature/SKILL.md +2 -1
  292. package/presets/opencode/skills/spring-boot-kotlin/SKILL.md +1 -1
  293. package/presets/opencode/skills/spring-boot-testing-strategy/SKILL.md +1 -1
  294. package/presets/opencode/skills/sqlalchemy/SKILL.md +1 -1
  295. package/presets/opencode/skills/tailwind-responsive-auditor/SKILL.md +1 -1
  296. package/presets/opencode/skills/tdd-mutation-tester/SKILL.md +1 -1
  297. package/presets/seo-hotel/skills/astro-seo/SKILL.md +1 -1
  298. package/presets/seo-hotel/skills/geo-readiness/SKILL.md +1 -1
  299. package/presets/seo-hotel/skills/off-page/SKILL.md +1 -1
  300. package/presets/seo-hotel/skills/schema-validator/SKILL.md +1 -1
  301. package/presets/seo-hotel/skills/seo-audit/SKILL.md +1 -1
  302. package/presets/shared/invoke-hook.cjs +20 -5
  303. package/src/presets/manifests/codex.yml +3 -0
  304. package/src/presets/models/roles.yml +54 -56
  305. package/src/presets/shared-skills.yml +58 -22
@@ -0,0 +1,30 @@
1
+ ---
2
+ id: auth-token-inspector
3
+ name: auth-token-inspector
4
+ description: >
5
+ Audits token storage mechanisms to prevent XSS-based JWT theft.
6
+ user-invokable: true
7
+ license: MIT
8
+ metadata:
9
+ author: lgzarturo
10
+ category: security
11
+ compatibility:
12
+ tools: [claude, codex, gemini, agy, opencode]
13
+ stacks:
14
+ languages: [typescript, javascript, python, kotlin, java, php]
15
+ ---
16
+ # Auth Token Inspector
17
+
18
+ ## Core Principles
19
+
20
+ 1. **Secure Storage**: JWTs or session tokens must NOT be stored in `localStorage` or `sessionStorage` due to vulnerability to Cross-Site Scripting (XSS).
21
+ 2. **HttpOnly Cookies**: Deliver tokens via `HttpOnly`, `Secure`, and `SameSite=Strict` (or `Lax`) cookies to protect them from client-side JS access.
22
+ 3. **Short Expiration**: Ensure access tokens have short expiration times, and implement secure, rotation-enabled refresh tokens stored in cookies.
23
+
24
+ ## Storage Comparison
25
+
26
+ | Storage Mode | Vulnerable to XSS | Vulnerable to CSRF | Recommended |
27
+ | :--- | :--- | :--- | :--- |
28
+ | **localStorage** | Yes (High Risk) | No | **NO** |
29
+ | **sessionStorage** | Yes (High Risk) | No | **NO** |
30
+ | **HttpOnly Cookie** | No (Secure) | Yes (Mitigated via SameSite/Tokens) | **YES** |
@@ -28,9 +28,8 @@ without a key, but CrUX field data requires it.
28
28
  Call the PageSpeed Insights API for the URL provided above.
29
29
 
30
30
  - Strategy: `both` (mobile + desktop) unless the user specified otherwise.
31
- - If Bun is available, use `~/.claude/skills/pagespeed-perf/scripts/run.ts`.
32
- - If Bun is unavailable, call PSI directly via WebFetch and fetch the HTML
33
- source for manual resource-hint analysis.
31
+ - Call PSI directly via WebFetch and fetch the HTML source for manual
32
+ resource-hint analysis.
34
33
 
35
34
  ---
36
35
 
@@ -0,0 +1,207 @@
1
+ ---
2
+ id: code-review
3
+ name: code-review
4
+ description: >
5
+ Provides a structured framework for conducting thorough code reviews covering correctness, security, architecture alignment, performance, and technical debt.
6
+
7
+ user-invokable: true
8
+ license: MIT
9
+ metadata:
10
+ author: lgzarturo
11
+ category: review
12
+
13
+ compatibility:
14
+ tools: [claude, codex, gemini, agy, opencode]
15
+ stacks:
16
+ languages: []
17
+ frameworks: []
18
+
19
+ risk:
20
+ level: low
21
+ can_execute_shell: false
22
+ can_modify_files: true
23
+ requires_network: false
24
+
25
+ inputs: []
26
+
27
+ outputs: []
28
+
29
+ quality:
30
+ reviewed_by: codeconductor-core
31
+ version: 0.1.0
32
+ ---
33
+
34
+
35
+
36
+ # Code Review
37
+
38
+ ## Review Axes
39
+
40
+ Every finding must reference exactly one axis. This prevents vague feedback and
41
+ makes it actionable.
42
+
43
+ | Axis | What to check |
44
+ |------|--------------|
45
+ | **Correctness** | Does the logic handle all cases in the acceptance criteria? |
46
+ | **Security** | Injection vectors, secret exposure, auth bypasses, insecure defaults |
47
+ | **Architecture** | Does the code follow existing patterns and module boundaries? |
48
+ | **Performance** | N+1 queries, unnecessary allocations, blocking I/O in hot paths |
49
+ | **Error handling** | Are failure cases handled explicitly and safely? |
50
+ | **Test coverage** | Do tests verify the acceptance criteria, not just happy paths? |
51
+ | **Scope** | Are there changes outside the stated task boundary? |
52
+ | **Technical debt** | Does the implementation introduce debt without acknowledging it? |
53
+
54
+ ## Finding Categories
55
+
56
+ ### CRITICAL — must be resolved before merge
57
+
58
+ - Logic failures that violate acceptance criteria
59
+ - Security vulnerabilities (injection, auth bypass, secret exposure)
60
+ - Data loss or corruption risk
61
+ - Breaking changes to public API or shared contracts
62
+ - Missing error handling that causes silent failures
63
+
64
+ ### WARNING — should be resolved before merge
65
+
66
+ - Missing edge case coverage in tests
67
+ - Scope creep (changes outside the task boundary)
68
+ - Pattern inconsistency that will confuse future maintainers
69
+ - Performance issue that will degrade under load
70
+ - Missing input validation at system boundaries
71
+
72
+ ### SUGGESTION — optional improvement
73
+
74
+ - Naming clarity improvements
75
+ - Extracting a reusable abstraction
76
+ - Test readability
77
+ - Documentation gaps on non-obvious behavior
78
+
79
+ ## Review Report Format
80
+
81
+ ```markdown
82
+ ## Review Report
83
+
84
+ **Task**: [objective from task card]
85
+ **Verdict**: [approved | approved with warnings | blocked]
86
+
87
+ ---
88
+
89
+ ### CRITICAL
90
+
91
+ - [ ] [C1] `path/to/file:line` — [description]
92
+ Axis: [axis] | Evidence: `[quoted code]` | Required action: [what must change]
93
+
94
+ _(none)_ if no critical findings
95
+
96
+ ### WARNING
97
+
98
+ - [ ] [W1] `path/to/file:line` — [description]
99
+ Axis: [axis] | Recommended action: [what should change]
100
+
101
+ _(none)_ if no warning findings
102
+
103
+ ### SUGGESTION
104
+
105
+ - [ ] [S1] — [description] | Rationale: [brief reason]
106
+
107
+ _(none)_ if no suggestions
108
+
109
+ ### Summary
110
+
111
+ - Critical: [count] | Warning: [count] | Suggestion: [count]
112
+ - **Verdict justification**: [one sentence]
113
+ ```
114
+
115
+ **Verdict rules:**
116
+
117
+ - `blocked` — any CRITICAL finding present
118
+ - `approved with warnings` — no CRITICAL, at least one WARNING
119
+ - `approved` — no CRITICAL, no WARNING
120
+
121
+ ## What to Check — by Axis
122
+
123
+ ### Correctness
124
+
125
+ - Does every acceptance criterion have a corresponding code path?
126
+ - Are null/empty/zero values handled explicitly?
127
+ - Are boundary conditions checked (off-by-one, empty collections, max values)?
128
+ - Do conditional branches cover all cases (exhaustive when/switch)?
129
+
130
+ ### Security
131
+
132
+ ```text
133
+ Injection: SQL, command, LDAP, XML — is input sanitized or parameterized?
134
+ Auth: is the endpoint protected? are role checks correct?
135
+ Secrets: no hardcoded credentials, tokens, or keys in source
136
+ Headers: are security headers set (CSP, HSTS, X-Frame-Options)?
137
+ CORS: is the origin whitelist explicit, not wildcard?
138
+ Dependencies: are new dependencies from trusted sources?
139
+ ```
140
+
141
+ ### Performance
142
+
143
+ ```text
144
+ N+1 queries: does a loop call the database per iteration?
145
+ Eager loading: are JOINs or includes used where needed?
146
+ Pagination: are all list endpoints paginated?
147
+ Caching: is expensive computation cached at an appropriate layer?
148
+ Index: do new query filters have corresponding DB indexes?
149
+ ```
150
+
151
+ ### Error Handling
152
+
153
+ ```text
154
+ Are exceptions caught at the right layer (not swallowed silently)?
155
+ Is the error response format consistent with the rest of the API?
156
+ Is the original exception logged before translating to a user-facing error?
157
+ Are transient failures retried with backoff, or propagated immediately?
158
+ ```
159
+
160
+ ## What NOT to Flag
161
+
162
+ **Personal style preferences.** If the code follows the project's established
163
+ conventions, do not flag it because you would have written it differently.
164
+
165
+ **Trivial naming.** Variable names are a SUGGESTION at most, never a WARNING.
166
+ Do not block a PR over naming unless the name is genuinely misleading.
167
+
168
+ **Tests for trivial code.** Do not demand tests for getters, setters, or data
169
+ class construction. Test behavior, not boilerplate.
170
+
171
+ **Refactors not in scope.** If you notice an improvement opportunity outside
172
+ the task boundary, log it as a SUGGESTION. Do not block the PR for work that
173
+ was not requested.
174
+
175
+ **Framework defaults.** Do not second-guess framework conventions (Spring
176
+ dependency injection, Next.js file-based routing). Trust the framework.
177
+
178
+ ## Exact Diff Recommendations
179
+
180
+ When a finding requires a code change, provide the exact replacement:
181
+
182
+ ```text
183
+ # Current code (path/to/file:42)
184
+ val user = userRepository.findById(id)
185
+ return user.name // NPE if not found
186
+
187
+ # Recommended fix
188
+ val user = userRepository.findById(id)
189
+ ?: throw NotFoundException("User $id not found")
190
+ return user.name
191
+ ```
192
+
193
+ Vague instructions ("handle the null case") force the author to guess your
194
+ intent. Exact diffs remove ambiguity and speed up the review cycle.
195
+
196
+ ## Prioritization Order
197
+
198
+ When multiple findings exist, address them in this order:
199
+
200
+ 1. Security — security issues can silently compromise users or data
201
+ 2. Correctness — broken behavior defeats the purpose of the change
202
+ 3. Error handling — silent failures are hard to debug in production
203
+ 4. Test coverage — gaps mean regressions will be invisible
204
+ 5. Performance — degrade gradually; fix before it causes incidents
205
+ 6. Architecture — inconsistency compounds over time
206
+ 7. Technical debt — acknowledge and track; do not always block for it
207
+ 8. Suggestions — apply at author's discretion
@@ -0,0 +1,460 @@
1
+ ---
2
+ id: django-orm
3
+ name: django-orm
4
+ description: >
5
+ Django ORM patterns for multi-tenant POS projects: efficient queries,
6
+ bulk operations, transactions, and multi-schema upload paths.
7
+ Trigger: When writing queryset logic, model saves, or DB-touching service code.
8
+
9
+ user-invokable: true
10
+ license: MIT
11
+ metadata:
12
+ author: lgzarturo
13
+ category: django
14
+
15
+ compatibility:
16
+ tools: [claude, codex, gemini, agy, opencode]
17
+ stacks:
18
+ languages: [python]
19
+ frameworks: [django, django-tenants]
20
+
21
+ risk:
22
+ level: medium
23
+ can_execute_shell: true
24
+ can_modify_files: true
25
+ requires_network: false
26
+
27
+ inputs:
28
+ - model files (models.py)
29
+ - service files (services.py)
30
+ - view files with queryset logic
31
+ - existing queryset or bulk-operation code
32
+
33
+ outputs:
34
+ - optimized queryset patterns with select_related / prefetch_related
35
+ - bulk_create and bulk_update implementations
36
+ - transaction-safe service methods
37
+ - annotated and aggregated querysets
38
+ - migration commands for multi-schema projects
39
+
40
+ quality:
41
+ reviewed_by: codeconductor-core
42
+ version: 0.1.0
43
+ ---
44
+
45
+ ## When to Use
46
+
47
+ - Writing or reviewing queryset code in any `apps/*/`
48
+ - Adding aggregations, filters, or annotations to a queryset
49
+ - Writing model `save()` overrides or signals
50
+ - Implementing service-layer DB operations
51
+ - Optimizing queries that traverse FK relationships
52
+
53
+ ## Performance Fundamentals
54
+
55
+ ### The N+1 Problem
56
+
57
+ The most common Django mistake: iterating over a queryset and accessing FK
58
+ fields without `select_related`. Each access generates a separate DB query.
59
+
60
+ ```
61
+ # Initial query: 1 query
62
+ products = Product.objects.all()
63
+
64
+ # In the loop: N additional queries (one per product)
65
+ for p in products:
66
+ print(p.category.name) # category_id → SELECT * FROM category WHERE id = ?
67
+
68
+ # Total: 1 + N queries
69
+ ```
70
+
71
+ ### Solution: select_related and prefetch_related
72
+
73
+ | Method | Use | SQL Query |
74
+ | ---------------------------------- | -------------------------- | ------------------------ |
75
+ | `select_related` | FK one-to-one or ManyToOne | Automatic JOIN |
76
+ | `prefetch_related` | Reverse FK or ManyToMany | 2 separate queries |
77
+ | `prefetch_related` with `Prefetch` | Custom queryset | Filtered in nested query |
78
+
79
+ ```python
80
+ # FK traversal — use select_related
81
+ products = Product.objects.select_related("category", "tax")
82
+
83
+ # Multiple FK
84
+ products = Product.objects.select_related("category", "tax", "supplier")
85
+
86
+ # Reverse FK (one-to-many) — use prefetch_related
87
+ categories = Category.objects.prefetch_related("products")
88
+
89
+ # ManyToMany — prefetch_related
90
+ product = Product.objects.prefetch_related("tags").first()
91
+
92
+ # Custom prefetch with filter
93
+ from django.db.models import Prefetch
94
+
95
+ products = Product.objects.prefetch_related(
96
+ Prefetch(
97
+ "order_items",
98
+ queryset=OrderItem.objects.filter(order__status="paid")
99
+ )
100
+ )
101
+ ```
102
+
103
+ ## Query Patterns
104
+
105
+ ### 1. Efficient Filtering
106
+
107
+ ```python
108
+ # Basic filtering
109
+ Product.objects.filter(is_active=True, stock__gt=0)
110
+
111
+ # Filtering with Q objects — OR and negations
112
+ from django.db.models import Q
113
+
114
+ Product.objects.filter(
115
+ Q(is_active=True) & (Q(stock__gt=0) | Q(is_service=True))
116
+ )
117
+
118
+ # Exclusion
119
+ Product.objects.exclude(status="draft")
120
+
121
+ # Filter by nested FK
122
+ Order.objects.filter(employee__store=store)
123
+ ```
124
+
125
+ ### 2. Annotations and Aggregations
126
+
127
+ ```python
128
+ from django.db.models import Count, Sum, Avg, Max, Min, F, Q, Case, When, Value, CharField
129
+ from django.db.models.functions import Coalesce, Concat
130
+
131
+ # Conditional sum with Coalesce (avoids None)
132
+ Product.objects.annotate(
133
+ total_sold=Coalesce(
134
+ Sum(
135
+ "order_items__quantity",
136
+ filter=Q(
137
+ order_items__order__status__in=["paid", "shipped"],
138
+ order_items__order__created_at__gte=cutoff,
139
+ ),
140
+ ),
141
+ 0,
142
+ ),
143
+ )
144
+
145
+ # Use F for arithmetic operations
146
+ Product.objects.update(stock=F("stock") - 1)
147
+
148
+ # Annotation with Case/When for conditional logic
149
+ Product.objects.annotate(
150
+ status_flag=Case(
151
+ When(stock__lte=0, then=Value("out_of_stock")),
152
+ When(stock__lte=10, then=Value("low_stock")),
153
+ default=Value("available"),
154
+ output_field=CharField(),
155
+ ),
156
+ )
157
+
158
+ # Aggregation with filter
159
+ Store.objects.annotate(
160
+ paid_orders=Count("orders", filter=Q(orders__status="paid")),
161
+ )
162
+ ```
163
+
164
+ ### 3. Exists vs Count
165
+
166
+ **Golden rule**: For existence checks, use `Exists`, never `Count`.
167
+
168
+ ```python
169
+ from django.db.models import Exists, OuterRef, Count
170
+
171
+ # WRONG — loads full count
172
+ products = Product.objects.annotate(
173
+ order_count=Count("order_items")
174
+ ).filter(order_count__gt=0)
175
+
176
+ # CORRECT — short-circuits at first match
177
+ products = Product.objects.annotate(
178
+ has_orders=Exists(OrderItem.objects.filter(product=OuterRef("pk")))
179
+ ).filter(has_orders=True)
180
+
181
+ # With more complex subquery
182
+ from django.db.models import Subquery
183
+
184
+ latest_order = Order.objects.filter(
185
+ customer=OuterRef("customer_id")
186
+ ).order_by("-created_at")
187
+
188
+ Customer.objects.annotate(
189
+ last_order_date=Subquery(
190
+ latest_order.values("created_at")[:1]
191
+ )
192
+ )
193
+ ```
194
+
195
+ ### 4. Ordering
196
+
197
+ ```python
198
+ # Basic ordering
199
+ Product.objects.order_by("name")
200
+
201
+ # Ordering with NullsFirst/NullsLast
202
+ Product.objects.order_by(F("price").nulls_last())
203
+
204
+ # Ordering by annotation
205
+ Store.objects.annotate(
206
+ order_count=Count("orders")
207
+ ).order_by("-order_count")
208
+ ```
209
+
210
+ ## Write Operations
211
+
212
+ ### 5. Bulk Operations — Anti-N+1
213
+
214
+ **Never do `save()` inside a loop.** Build lists and use bulk operations:
215
+
216
+ ```python
217
+ # Get with lock once
218
+ products = {p.id: p for p in Product.objects.select_for_update().filter(id__in=ids)}
219
+
220
+ order_items_to_create = []
221
+ products_to_update = []
222
+
223
+ for item in cart:
224
+ product = products[item["id"]]
225
+ product.stock -= item["quantity"]
226
+ order_items_to_create.append(
227
+ OrderItem(order=order, product=product, quantity=item["quantity"], ...)
228
+ )
229
+ products_to_update.append(product)
230
+
231
+ # Bulk create and update
232
+ OrderItem.objects.bulk_create(order_items_to_create)
233
+ Product.objects.bulk_update(products_to_update, ["stock", "updated_at"])
234
+ ```
235
+
236
+ **Bulk operation table:**
237
+
238
+ | Method | Use case | Returns |
239
+ | ------------------------------------------- | -------------------------- | ----------------- |
240
+ | `bulk_create(items)` | Create multiple records | List of objects |
241
+ | `bulk_update(items, fields)` | Update multiple records | None (in-place) |
242
+ | `bulk_create(items, ignore_conflicts=True)` | Ignore duplicates | List (IDs only) |
243
+ | `update()` | Mass update without return | Count of affected |
244
+
245
+ ```python
246
+ # bulk_create with ignore_conflicts
247
+ Product.objects.bulk_create(new_products, ignore_conflicts=True)
248
+
249
+ # bulk update
250
+ Product.objects.filter(category=cat).update(is_active=False)
251
+
252
+ # update with F expressions
253
+ Product.objects.update(stock=F("stock") - 1)
254
+ ```
255
+
256
+ ### 6. Surgical Saves — update_fields
257
+
258
+ **Always pass `update_fields`** when saving a subset of fields:
259
+
260
+ ```python
261
+ # Update single field
262
+ product.stock -= 1
263
+ product.save(update_fields=["stock"])
264
+
265
+ # Update multiple fields
266
+ order.status = "paid"
267
+ order.paid_at = timezone.now()
268
+ order.save(update_fields=["status", "paid_at", "updated_at"])
269
+
270
+ # Don't use in migrations — that uses reconstructor
271
+ # DO use in application code
272
+ ```
273
+
274
+ **Why?** Prevents:
275
+
276
+ - Accidental image reprocessing
277
+ - Unnecessary signals
278
+ - Race conditions on unrelated fields
279
+
280
+ ### 7. Transactions
281
+
282
+ Use `transaction.atomic()` as a context manager, never as a decorator:
283
+
284
+ ```python
285
+ from django.db import transaction
286
+
287
+ # CORRECT — clear context, automatic error handling
288
+ with transaction.atomic():
289
+ order.save()
290
+ OrderItem.objects.bulk_create(items)
291
+ Product.objects.bulk_update(products, ["stock"])
292
+ cart.clear()
293
+
294
+ # With select_for_update inside the transaction
295
+ with transaction.atomic():
296
+ product = Product.objects.select_for_update().get(pk=product_id)
297
+ product.stock -= quantity
298
+ product.save(update_fields=["stock", "updated_at"])
299
+
300
+ # WRONG — decorator hides intent
301
+ @transaction.atomic
302
+ def create_order(...):
303
+ ...
304
+ ```
305
+
306
+ **Isolation levels:**
307
+
308
+ ```python
309
+ from django.db import transaction
310
+
311
+ # Serializable — maximum isolation
312
+ with transaction.atomic():
313
+ ...
314
+
315
+ # Read committed (default) — may cause dirty reads on Edge
316
+ ```
317
+
318
+ ## Multi-Tenant and Upload Paths
319
+
320
+ ### 8. Upload Paths with Schema
321
+
322
+ Every `FileField`/`ImageField` must include `connection.schema_name` to isolate
323
+ files per tenant:
324
+
325
+ ```python
326
+ import os
327
+ from django.db import connection
328
+
329
+ def get_upload_path(instance, filename):
330
+ schema = connection.schema_name
331
+ ext = filename.split(".")[-1].lower()
332
+ safe_name = f"{uuid4().hex}.{ext}"
333
+ return os.path.join(schema, "products", safe_name)
334
+
335
+ def get_thumb_path(instance, filename):
336
+ schema = connection.schema_name
337
+ return os.path.join(schema, "products", "thumbs", filename)
338
+
339
+ class Product(models.Model):
340
+ image = models.ImageField(upload_to=get_upload_path, storage=S3Storage())
341
+ thumbnail = models.ImageField(upload_to=get_thumb_path, blank=True)
342
+ ```
343
+
344
+ ## Advanced Queries
345
+
346
+ ### 9. Subqueries
347
+
348
+ ```python
349
+ from django.db.models import Subquery, OuterRef
350
+
351
+ # Subquery to get last value
352
+ latest_price = ProductPrice.objects.filter(
353
+ product=OuterRef("pk")
354
+ ).order_by("-valid_from").values("price")[:1]
355
+
356
+ Product.objects.annotate(current_price=Subquery(latest_price))
357
+
358
+ # Subquery with aggregate
359
+ order_total = OrderItem.objects.filter(
360
+ order=OuterRef("pk")
361
+ ).values("order").annotate(total=Sum("subtotal")).values("total")
362
+
363
+ Order.objects.annotate(order_total=Subquery(order_total))
364
+ ```
365
+
366
+ ### 10. Raw Queries — WHEN TO USE
367
+
368
+ Avoid raw queries unless necessary. Use when:
369
+
370
+ - Complex aggregation functions not supported by ORM
371
+ - Queries with multiple JOINs manually optimized
372
+ - Very complex queries where ORM generates inefficient SQL
373
+
374
+ ```python
375
+ # With safe parameters (never string interpolation!)
376
+ Product.objects.raw(
377
+ "SELECT * FROM catalog_product WHERE tsvector @@ plainto_tsquery(%s)",
378
+ [search_term]
379
+ )
380
+
381
+ # With cursor for complex cases
382
+ from django.db import connection
383
+
384
+ with connection.cursor() as cursor:
385
+ cursor.execute("SELECT ...", [params])
386
+ results = cursor.fetchall()
387
+ ```
388
+
389
+ ## Migration Commands
390
+
391
+ ```bash
392
+ # Always migrate both schemas
393
+ uv run python manage.py migrate_schemas --shared
394
+ uv run python manage.py migrate_schemas --tenant
395
+
396
+ # Check for pending migrations
397
+ make verifymigrations
398
+
399
+ # Create specific migration
400
+ uv run python manage.py makemigrations catalog --name add_thumbnail
401
+
402
+ # Shows SQL without running
403
+ uv run python manage.py migrate --fake catalog 0003
404
+ ```
405
+
406
+ ## Common Mistakes and How to Avoid Them
407
+
408
+ ### N+1 in templates
409
+
410
+ ```python
411
+ # WRONG — N queries
412
+ {% for product in products %}
413
+ {{ product.category.name }}
414
+ {% endfor %}
415
+
416
+ # CORRECT — 1 query with select_related
417
+ products = Product.objects.select_related("category")
418
+ ```
419
+
420
+ ### ForeignKey without related_name
421
+
422
+ ```python
423
+ # WRONG
424
+ class Order(models.Model):
425
+ customer = models.ForeignKey("users.User", on_delete=...)
426
+
427
+ # CORRECT — always add related_name
428
+ class Order(models.Model):
429
+ customer = models.ForeignKey(
430
+ "users.User",
431
+ on_delete=models.CASCADE,
432
+ related_name="orders",
433
+ )
434
+ ```
435
+
436
+ ### Queries in signals
437
+
438
+ ```python
439
+ # WRONG — signal makes additional query
440
+ @receiver(post_save, sender=Order)
441
+ def on_order_save(sender, instance, **kwargs):
442
+ customer = instance.customer # Additional query!
443
+ send_email(customer.email, ...)
444
+
445
+ # CORRECT — pass the object, not the ID
446
+ @receiver(post_save, sender=Order)
447
+ def on_order_save(sender, instance, created, **kwargs):
448
+ if created:
449
+ customer = instance.customer
450
+ send_email(customer.email, ...)
451
+ ```
452
+
453
+ ## Resources
454
+
455
+ - **Bulk write pattern**: `apps/orders/services.py`, `apps/pos/views.py` lines
456
+ 216-246
457
+ - **Annotation examples**: `apps/pos/views.py` lines 59-75
458
+ - **Exists usage**: `apps/catalog/views.py` line 112
459
+ - **Upload paths**: `apps/catalog/models.py`
460
+ - **Django ORM docs**: https://docs.djangoproject.com/en/5.2/topics/db/queries/