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,623 @@
1
+ ---
2
+ id: jpa-postgres
3
+ name: jpa-postgres
4
+ description: >
5
+ Provides expert knowledge of JPA entity design, relationship mapping, Flyway
6
+ migrations, and PostgreSQL-specific optimizations.
7
+
8
+ user-invokable: true
9
+ license: MIT
10
+ metadata:
11
+ author: lgzarturo
12
+ category: database
13
+
14
+ compatibility:
15
+ tools: [claude, codex, gemini, agy, opencode]
16
+ stacks:
17
+ languages: [kotlin, java]
18
+ frameworks: [spring-boot, spring-data-jpa, hibernate]
19
+ databases: [postgresql]
20
+
21
+ risk:
22
+ level: high
23
+ can_execute_shell: false
24
+ can_modify_files: true
25
+ requires_network: false
26
+
27
+ inputs:
28
+ - source_files
29
+ - migration scripts
30
+ - entity classes
31
+ - repository interfaces
32
+
33
+ outputs:
34
+ - JPA entity classes
35
+ - repository interfaces
36
+ - Flyway migration scripts
37
+ - JPQL and native queries
38
+ - integration test classes
39
+
40
+ quality:
41
+ reviewed_by: codeconductor-core
42
+ version: 0.1.0
43
+ ---
44
+
45
+ # JPA + PostgreSQL
46
+
47
+ ## Entity Design
48
+
49
+ ### Primary Keys
50
+
51
+ Use UUIDs. Do not use auto-increment integers as public-facing identifiers.
52
+
53
+ ```kotlin
54
+ @Entity
55
+ @Table(name = "users")
56
+ class User(
57
+ @Id
58
+ @GeneratedValue(strategy = GenerationType.UUID)
59
+ val id: UUID = UUID.randomUUID(),
60
+
61
+ @Column(name = "email", nullable = false, unique = true, length = 255)
62
+ var email: String,
63
+
64
+ @Column(name = "name", nullable = false, length = 100)
65
+ var name: String
66
+ )
67
+ ```
68
+
69
+ UUID generation strategy `GenerationType.UUID` is available in Hibernate 6+
70
+ (Spring Boot 3+). For earlier versions, use `@UuidGenerator` from Hibernate or
71
+ generate manually.
72
+
73
+ ### Auditing
74
+
75
+ Enable automatic timestamp management with Spring Data auditing.
76
+
77
+ ```kotlin
78
+ // Enable in main application class or a @Configuration class
79
+ @EnableJpaAuditing
80
+ @SpringBootApplication
81
+ class Application
82
+
83
+ // Base class for auditable entities
84
+ @MappedSuperclass
85
+ @EntityListeners(AuditingEntityListener::class)
86
+ abstract class AuditableEntity {
87
+
88
+ @Column(name = "created_at", nullable = false, updatable = false)
89
+ @CreatedDate
90
+ lateinit var createdAt: Instant
91
+
92
+ @Column(name = "updated_at", nullable = false)
93
+ @LastModifiedDate
94
+ lateinit var updatedAt: Instant
95
+ }
96
+
97
+ // Entity extends the base class
98
+ @Entity
99
+ @Table(name = "users")
100
+ class User(
101
+ @Id @GeneratedValue(strategy = GenerationType.UUID)
102
+ val id: UUID = UUID.randomUUID(),
103
+
104
+ @Column(name = "email", nullable = false, unique = true)
105
+ var email: String,
106
+
107
+ var name: String
108
+ ) : AuditableEntity()
109
+ ```
110
+
111
+ ### Soft Delete
112
+
113
+ Do not delete rows — mark them as deleted and filter them transparently.
114
+
115
+ ```kotlin
116
+ @Entity
117
+ @Table(name = "users")
118
+ @SQLDelete(sql = "UPDATE users SET deleted_at = NOW() WHERE id = ?")
119
+ @FilterDef(name = "deletedFilter", parameters = [ParamDef(name = "isDeleted", type = Boolean::class)])
120
+ @Filter(name = "deletedFilter", condition = "deleted_at IS NULL")
121
+ class User(
122
+ @Id @GeneratedValue(strategy = GenerationType.UUID)
123
+ val id: UUID = UUID.randomUUID(),
124
+
125
+ @Column(name = "email", nullable = false, unique = true)
126
+ var email: String,
127
+
128
+ @Column(name = "deleted_at")
129
+ var deletedAt: Instant? = null
130
+ )
131
+ ```
132
+
133
+ Alternative using `@Where` (simpler, but applies globally without ability to
134
+ disable):
135
+
136
+ ```kotlin
137
+ @Entity
138
+ @Table(name = "users")
139
+ @SQLDelete(sql = "UPDATE users SET deleted_at = NOW() WHERE id = ?")
140
+ @Where(clause = "deleted_at IS NULL")
141
+ class User(...)
142
+ ```
143
+
144
+ ### Column Annotations
145
+
146
+ Always be explicit. Never rely on Hibernate defaults.
147
+
148
+ ```kotlin
149
+ @Column(
150
+ name = "email", // explicit column name
151
+ nullable = false, // maps to NOT NULL constraint
152
+ unique = true, // maps to UNIQUE constraint
153
+ length = 255 // VARCHAR(255) — ignored for TEXT type
154
+ )
155
+ var email: String
156
+ ```
157
+
158
+ For PostgreSQL `TEXT` type (unbounded), use `columnDefinition`:
159
+
160
+ ```kotlin
161
+ @Column(name = "description", nullable = false, columnDefinition = "TEXT")
162
+ var description: String
163
+ ```
164
+
165
+ ### Indexes
166
+
167
+ Define indexes on the entity, not in migration scripts, for searchable fields.
168
+
169
+ ```kotlin
170
+ @Entity
171
+ @Table(
172
+ name = "users",
173
+ indexes = [
174
+ Index(name = "idx_users_email", columnList = "email", unique = true),
175
+ Index(name = "idx_users_created_at", columnList = "created_at")
176
+ ]
177
+ )
178
+ class User(...)
179
+ ```
180
+
181
+ For partial indexes (e.g., soft-delete), use a migration script — JPA cannot
182
+ express partial indexes.
183
+
184
+ ## Relationship Mapping
185
+
186
+ ### One-to-Many
187
+
188
+ ```kotlin
189
+ @Entity
190
+ @Table(name = "orders")
191
+ class Order(
192
+ @Id @GeneratedValue(strategy = GenerationType.UUID)
193
+ val id: UUID = UUID.randomUUID(),
194
+
195
+ @OneToMany(
196
+ mappedBy = "order",
197
+ cascade = [CascadeType.ALL],
198
+ fetch = FetchType.LAZY, // ALWAYS lazy by default
199
+ orphanRemoval = true
200
+ )
201
+ val items: MutableList<OrderItem> = mutableListOf()
202
+ )
203
+
204
+ @Entity
205
+ @Table(name = "order_items")
206
+ class OrderItem(
207
+ @Id @GeneratedValue(strategy = GenerationType.UUID)
208
+ val id: UUID = UUID.randomUUID(),
209
+
210
+ @ManyToOne(fetch = FetchType.LAZY)
211
+ @JoinColumn(name = "order_id", nullable = false)
212
+ val order: Order,
213
+
214
+ @Column(name = "quantity", nullable = false)
215
+ var quantity: Int
216
+ )
217
+ ```
218
+
219
+ Rules:
220
+
221
+ - `fetch = FetchType.LAZY` is the default for `@OneToMany` — make it explicit
222
+ anyway
223
+ - `CascadeType.ALL` only when the child lifecycle is completely owned by the
224
+ parent
225
+ - `orphanRemoval = true` when removing an item from the collection should delete
226
+ the row
227
+
228
+ ### Many-to-One
229
+
230
+ ```kotlin
231
+ @ManyToOne(fetch = FetchType.LAZY) // LAZY — never EAGER
232
+ @JoinColumn(name = "user_id", nullable = false)
233
+ val user: User
234
+ ```
235
+
236
+ `FetchType.EAGER` on `@ManyToOne` causes N+1 problems. Always use `LAZY` and
237
+ fetch eagerly with `JOIN FETCH` when needed.
238
+
239
+ ### Many-to-Many
240
+
241
+ Do not use `@ManyToMany` directly. Use a join entity with explicit fields.
242
+
243
+ ```kotlin
244
+ // bad — opaque join table, no room for additional fields
245
+ @ManyToMany
246
+ @JoinTable(name = "user_roles")
247
+ val roles: MutableSet<Role>
248
+
249
+ // good — explicit join entity
250
+ @Entity
251
+ @Table(name = "user_roles")
252
+ class UserRole(
253
+ @Id @GeneratedValue(strategy = GenerationType.UUID)
254
+ val id: UUID = UUID.randomUUID(),
255
+
256
+ @ManyToOne(fetch = FetchType.LAZY)
257
+ @JoinColumn(name = "user_id", nullable = false)
258
+ val user: User,
259
+
260
+ @ManyToOne(fetch = FetchType.LAZY)
261
+ @JoinColumn(name = "role_id", nullable = false)
262
+ val role: Role,
263
+
264
+ @Column(name = "assigned_at", nullable = false)
265
+ val assignedAt: Instant = Instant.now()
266
+ )
267
+ ```
268
+
269
+ The join entity approach is more flexible — you can add fields like
270
+ `assignedAt`, `assignedBy`, and query through a repository.
271
+
272
+ ## N+1 Problem
273
+
274
+ The N+1 problem occurs when loading a collection results in one query for the
275
+ parent and N additional queries for each child, where N is the number of
276
+ parents.
277
+
278
+ **Detection:**
279
+
280
+ Enable SQL logging in tests:
281
+
282
+ ```yaml
283
+ # application-test.yml
284
+ spring:
285
+ jpa:
286
+ show-sql: true
287
+ properties:
288
+ hibernate:
289
+ format_sql: true
290
+ logging:
291
+ level:
292
+ org.hibernate.SQL: DEBUG
293
+ org.hibernate.type.descriptor.sql.BasicBinder: TRACE
294
+ ```
295
+
296
+ Count the queries. If you see `SELECT * FROM order_items WHERE order_id = ?`
297
+ executed once per order, you have N+1.
298
+
299
+ **Fix with `@EntityGraph`:**
300
+
301
+ ```kotlin
302
+ @Repository
303
+ interface OrderRepository : JpaRepository<Order, UUID> {
304
+
305
+ @EntityGraph(attributePaths = ["items", "items.product"])
306
+ fun findWithItemsById(id: UUID): Optional<Order>
307
+
308
+ @EntityGraph(attributePaths = ["items"])
309
+ fun findAllWithItems(): List<Order>
310
+ }
311
+ ```
312
+
313
+ **Fix with JPQL JOIN FETCH:**
314
+
315
+ ```kotlin
316
+ @Query("SELECT o FROM Order o JOIN FETCH o.items WHERE o.id = :id")
317
+ fun findByIdWithItems(@Param("id") id: UUID): Optional<Order>
318
+
319
+ @Query("SELECT DISTINCT o FROM Order o JOIN FETCH o.items WHERE o.status = :status")
320
+ fun findByStatusWithItems(@Param("status") status: OrderStatus): List<Order>
321
+ ```
322
+
323
+ Use `DISTINCT` with `JOIN FETCH` on collections to avoid duplicate parent rows
324
+ in the result.
325
+
326
+ **Rule:** never access a lazy collection outside a transaction. This causes
327
+ `LazyInitializationException`. If a service method needs related data, fetch it
328
+ within the same transaction using `@EntityGraph` or `JOIN FETCH`.
329
+
330
+ ## Projections for Read Queries
331
+
332
+ When you only need a subset of fields, do not load the full entity. Use
333
+ projections.
334
+
335
+ **Interface projection:**
336
+
337
+ ```kotlin
338
+ interface UserSummary {
339
+ val id: UUID
340
+ val email: String
341
+ val name: String
342
+ }
343
+
344
+ @Repository
345
+ interface UserRepository : JpaRepository<User, UUID> {
346
+ fun findAllProjectedBy(): List<UserSummary>
347
+ fun findProjectedById(id: UUID): UserSummary?
348
+ }
349
+ ```
350
+
351
+ **DTO projection with constructor expression:**
352
+
353
+ ```kotlin
354
+ data class UserDto(val id: UUID, val email: String)
355
+
356
+ @Query("SELECT new com.example.user.dto.UserDto(u.id, u.email) FROM User u WHERE u.active = true")
357
+ fun findActiveUserDtos(): List<UserDto>
358
+ ```
359
+
360
+ Use projections for list endpoints and reports. Load full entities only when you
361
+ need to modify them.
362
+
363
+ ## Flyway Migrations
364
+
365
+ ### Naming Convention
366
+
367
+ ```
368
+ V{timestamp}__{description}.sql
369
+ ```
370
+
371
+ Use a timestamp, not a sequential number, to avoid conflicts in parallel
372
+ branches.
373
+
374
+ ```
375
+ V20260507120000__create_users_table.sql
376
+ V20260507120001__add_users_email_index.sql
377
+ V20260508090000__add_orders_table.sql
378
+ ```
379
+
380
+ ### Migration Rules
381
+
382
+ - Never modify a migration that has already been applied in any environment
383
+ - Each migration must be forward-only — Flyway does not support automatic
384
+ rollbacks
385
+ - DDL changes and data migrations must be in separate files
386
+ - Destructive operations (DROP COLUMN, DROP TABLE) require a multi-step process:
387
+ 1. Migration 1: deploy code that no longer uses the column
388
+ 2. Migration 2: drop the column (safe once all instances are updated)
389
+
390
+ ### Schema Migration Example
391
+
392
+ ```sql
393
+ -- V20260507120000__create_users_table.sql
394
+ CREATE TABLE users (
395
+ id UUID NOT NULL PRIMARY KEY,
396
+ email VARCHAR(255) NOT NULL,
397
+ name VARCHAR(100) NOT NULL,
398
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
399
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
400
+ deleted_at TIMESTAMPTZ
401
+ );
402
+
403
+ CREATE UNIQUE INDEX idx_users_email ON users (email) WHERE deleted_at IS NULL;
404
+ ```
405
+
406
+ ### Rollback Strategy
407
+
408
+ Document rollback SQL in comments at the top of each migration file:
409
+
410
+ ```sql
411
+ -- V20260507120001__add_user_role_column.sql
412
+ -- Rollback: ALTER TABLE users DROP COLUMN role;
413
+
414
+ ALTER TABLE users ADD COLUMN role VARCHAR(50) NOT NULL DEFAULT 'USER';
415
+ ```
416
+
417
+ Automated rollback is not used. Manual rollback is applied only in emergencies.
418
+
419
+ ## PostgreSQL Specifics
420
+
421
+ ### Column Types
422
+
423
+ | Use case | PostgreSQL type | JPA mapping |
424
+ | ------------------------------- | --------------- | ------------------------------------- |
425
+ | Short text, known max length | `VARCHAR(n)` | `@Column(length = n)` |
426
+ | Long text, no known max | `TEXT` | `@Column(columnDefinition = "TEXT")` |
427
+ | Structured semi-structured data | `JSONB` | `@Column(columnDefinition = "JSONB")` |
428
+ | Timestamps with timezone | `TIMESTAMPTZ` | `Instant` |
429
+ | UUIDs | `UUID` | `UUID` |
430
+ | Money/currency | `NUMERIC(19,4)` | `BigDecimal` |
431
+
432
+ Use `TIMESTAMPTZ` (with timezone), not `TIMESTAMP`. Store all timestamps in UTC.
433
+
434
+ ### JSONB
435
+
436
+ Use `JSONB` for semi-structured data that does not warrant its own table.
437
+
438
+ ```kotlin
439
+ @Column(name = "metadata", columnDefinition = "JSONB")
440
+ @Type(JsonType::class) // requires hypersistence-utils dependency
441
+ var metadata: Map<String, Any> = emptyMap()
442
+ ```
443
+
444
+ JSONB is indexable. JSON is not. Always use JSONB.
445
+
446
+ ### Partial Indexes
447
+
448
+ Partial indexes cannot be expressed through JPA annotations. Use a migration:
449
+
450
+ ```sql
451
+ -- For soft-deleted tables: only index active (non-deleted) rows
452
+ CREATE UNIQUE INDEX idx_users_email_active ON users (email) WHERE deleted_at IS NULL;
453
+
454
+ -- For status-filtered queries
455
+ CREATE INDEX idx_orders_pending ON orders (created_at) WHERE status = 'PENDING';
456
+ ```
457
+
458
+ ### Native Queries with RETURNING
459
+
460
+ Use `RETURNING` to avoid an extra `SELECT` after an `INSERT` or `UPDATE`:
461
+
462
+ ```kotlin
463
+ @Modifying
464
+ @Query(
465
+ value = "INSERT INTO audit_log (user_id, action, created_at) VALUES (:userId, :action, NOW()) RETURNING id",
466
+ nativeQuery = true
467
+ )
468
+ fun insertAndReturnId(
469
+ @Param("userId") userId: UUID,
470
+ @Param("action") action: String
471
+ ): UUID
472
+ ```
473
+
474
+ ### Complex Queries
475
+
476
+ Use native queries when JPQL cannot express what you need:
477
+
478
+ ```kotlin
479
+ @Query(
480
+ value = """
481
+ SELECT u.id, u.email, COUNT(o.id) as order_count
482
+ FROM users u
483
+ LEFT JOIN orders o ON o.user_id = u.id AND o.deleted_at IS NULL
484
+ WHERE u.deleted_at IS NULL
485
+ GROUP BY u.id, u.email
486
+ HAVING COUNT(o.id) > :minOrders
487
+ ORDER BY order_count DESC
488
+ LIMIT :limit
489
+ """,
490
+ nativeQuery = true
491
+ )
492
+ fun findActiveUsersWithMinOrders(
493
+ @Param("minOrders") minOrders: Int,
494
+ @Param("limit") limit: Int
495
+ ): List<Map<String, Any>>
496
+ ```
497
+
498
+ ## Query Performance
499
+
500
+ ### Pagination
501
+
502
+ Always paginate. Never call `findAll()` on a large table.
503
+
504
+ ```kotlin
505
+ @Repository
506
+ interface UserRepository : JpaRepository<User, UUID> {
507
+ fun findAll(pageable: Pageable): Page<UserSummary>
508
+ fun findByRole(role: UserRole, pageable: Pageable): Page<UserSummary>
509
+ }
510
+
511
+ // In service
512
+ fun list(page: Int, size: Int): Page<UserSummary> {
513
+ val pageable = PageRequest.of(page, size, Sort.by("createdAt").descending())
514
+ return userRepository.findAll(pageable)
515
+ }
516
+ ```
517
+
518
+ Use `Slice<T>` instead of `Page<T>` when you do not need the total count
519
+ (cheaper — no COUNT query).
520
+
521
+ ### QueryHints for Fetch Control
522
+
523
+ ```kotlin
524
+ @QueryHints(
525
+ QueryHint(name = HINT_FETCHGRAPH, value = "User.withOrders")
526
+ )
527
+ fun findById(id: UUID): Optional<User>
528
+ ```
529
+
530
+ Requires a named entity graph:
531
+
532
+ ```kotlin
533
+ @Entity
534
+ @NamedEntityGraph(
535
+ name = "User.withOrders",
536
+ attributeNodes = [NamedAttributeNode("orders")]
537
+ )
538
+ class User(...)
539
+ ```
540
+
541
+ ## Testing
542
+
543
+ ### Unit — @DataJpaTest with H2
544
+
545
+ Fast. No server required.
546
+
547
+ ```kotlin
548
+ @DataJpaTest
549
+ class UserRepositoryTest {
550
+
551
+ @Autowired
552
+ private lateinit var userRepository: UserRepository
553
+
554
+ @Test
555
+ fun `should find user by email`() {
556
+ val saved = userRepository.save(User(email = "test@example.com", name = "Test User"))
557
+ val found = userRepository.findByEmail("test@example.com")
558
+ assertThat(found).isNotNull
559
+ assertThat(found?.id).isEqualTo(saved.id)
560
+ }
561
+
562
+ @Test
563
+ fun `should not find deleted user by email`() {
564
+ val user = userRepository.save(User(email = "deleted@example.com", name = "Gone"))
565
+ userRepository.delete(user) // triggers @SQLDelete — sets deleted_at
566
+ val found = userRepository.findByEmail("deleted@example.com")
567
+ assertThat(found).isNull()
568
+ }
569
+ }
570
+ ```
571
+
572
+ ### Integration — Testcontainers with PostgreSQL
573
+
574
+ Real database. Use for migrations, JSONB, partial indexes, and native queries.
575
+
576
+ ```kotlin
577
+ @SpringBootTest
578
+ @Testcontainers
579
+ class UserRepositoryIntegrationTest {
580
+
581
+ companion object {
582
+ @Container
583
+ @JvmStatic
584
+ val postgres = PostgreSQLContainer<Nothing>("postgres:16").apply {
585
+ withDatabaseName("testdb")
586
+ withUsername("test")
587
+ withPassword("test")
588
+ }
589
+
590
+ @DynamicPropertySource
591
+ @JvmStatic
592
+ fun registerProperties(registry: DynamicPropertyRegistry) {
593
+ registry.add("spring.datasource.url", postgres::getJdbcUrl)
594
+ registry.add("spring.datasource.username", postgres::getUsername)
595
+ registry.add("spring.datasource.password", postgres::getPassword)
596
+ }
597
+ }
598
+
599
+ @Autowired
600
+ private lateinit var userRepository: UserRepository
601
+
602
+ @Test
603
+ fun `should enforce unique email constraint at db level`() {
604
+ userRepository.save(User(email = "dup@example.com", name = "First"))
605
+ assertThrows<DataIntegrityViolationException> {
606
+ userRepository.save(User(email = "dup@example.com", name = "Second"))
607
+ }
608
+ }
609
+ }
610
+ ```
611
+
612
+ Use Testcontainers for:
613
+
614
+ - Flyway migration validation
615
+ - PostgreSQL-specific features (JSONB, partial indexes, native queries)
616
+ - Constraint enforcement (unique, foreign key, check constraints)
617
+ - Query performance checks that differ between H2 and PostgreSQL
618
+
619
+ Use `@DataJpaTest` with H2 for:
620
+
621
+ - Derived query methods
622
+ - Simple CRUD operations
623
+ - JPQL queries with standard JPA behavior
@@ -0,0 +1,35 @@
1
+ ---
2
+ id: livewire-alpine-bridge
3
+ name: livewire-alpine-bridge
4
+ description: >
5
+ Schedules reactive frontend states cleanly using entangle directives in PHP and JS.
6
+ user-invokable: true
7
+ license: MIT
8
+ metadata:
9
+ author: lgzarturo
10
+ category: frontend
11
+ compatibility:
12
+ tools: [claude, codex, gemini, agy, opencode]
13
+ stacks:
14
+ languages: [php, javascript]
15
+ frameworks: [laravel, livewire, alpinejs]
16
+ ---
17
+ # Livewire Alpine Bridge
18
+
19
+ ## Core Principles
20
+
21
+ 1. **State Entanglement**: Synchronize states between Livewire properties and Alpine.js states using the `@entangle` directive.
22
+ 2. **Minimize Network Roundtrips**: Handle purely UI-related reactive interactions (modals, dropdowns, tab switches) strictly in Alpine.js without sending requests to the server.
23
+ 3. **Lazy Syncing**: Use `.live` modifier selectively. Rely on `.defer` or deferred synchronization for inputs to prevent heavy server load.
24
+
25
+ ## Implementation Pattern
26
+
27
+ ```html
28
+ <div x-data="{ open: @entangle('showModal') }">
29
+ <button @click="open = true">Open Modal</button>
30
+
31
+ <div x-show="open" @click.away="open = false">
32
+ Modal Content
33
+ </div>
34
+ </div>
35
+ ```