oh-my-customcodex 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +327 -0
  3. package/dist/cli/index.js +32054 -0
  4. package/dist/index.js +5469 -0
  5. package/package.json +89 -0
  6. package/templates/.claude/agents/arch-documenter.md +38 -0
  7. package/templates/.claude/agents/arch-speckit-agent.md +66 -0
  8. package/templates/.claude/agents/be-django-expert.md +47 -0
  9. package/templates/.claude/agents/be-express-expert.md +31 -0
  10. package/templates/.claude/agents/be-fastapi-expert.md +45 -0
  11. package/templates/.claude/agents/be-go-backend-expert.md +45 -0
  12. package/templates/.claude/agents/be-nestjs-expert.md +29 -0
  13. package/templates/.claude/agents/be-springboot-expert.md +42 -0
  14. package/templates/.claude/agents/db-alembic-expert.md +73 -0
  15. package/templates/.claude/agents/db-postgres-expert.md +38 -0
  16. package/templates/.claude/agents/db-redis-expert.md +38 -0
  17. package/templates/.claude/agents/db-supabase-expert.md +37 -0
  18. package/templates/.claude/agents/de-airflow-expert.md +48 -0
  19. package/templates/.claude/agents/de-dbt-expert.md +36 -0
  20. package/templates/.claude/agents/de-kafka-expert.md +83 -0
  21. package/templates/.claude/agents/de-pipeline-expert.md +34 -0
  22. package/templates/.claude/agents/de-snowflake-expert.md +38 -0
  23. package/templates/.claude/agents/de-spark-expert.md +38 -0
  24. package/templates/.claude/agents/fe-design-expert.md +120 -0
  25. package/templates/.claude/agents/fe-flutter-agent.md +48 -0
  26. package/templates/.claude/agents/fe-svelte-agent.md +33 -0
  27. package/templates/.claude/agents/fe-vercel-agent.md +40 -0
  28. package/templates/.claude/agents/fe-vuejs-agent.md +34 -0
  29. package/templates/.claude/agents/infra-aws-expert.md +49 -0
  30. package/templates/.claude/agents/infra-docker-expert.md +49 -0
  31. package/templates/.claude/agents/lang-golang-expert.md +46 -0
  32. package/templates/.claude/agents/lang-java21-expert.md +42 -0
  33. package/templates/.claude/agents/lang-kotlin-expert.md +45 -0
  34. package/templates/.claude/agents/lang-python-expert.md +45 -0
  35. package/templates/.claude/agents/lang-rust-expert.md +45 -0
  36. package/templates/.claude/agents/lang-typescript-expert.md +45 -0
  37. package/templates/.claude/agents/mgr-claude-code-bible.md +62 -0
  38. package/templates/.claude/agents/mgr-creator.md +57 -0
  39. package/templates/.claude/agents/mgr-gitnerd.md +50 -0
  40. package/templates/.claude/agents/mgr-sauron.md +163 -0
  41. package/templates/.claude/agents/mgr-supplier.md +39 -0
  42. package/templates/.claude/agents/mgr-updater.md +40 -0
  43. package/templates/.claude/agents/qa-engineer.md +36 -0
  44. package/templates/.claude/agents/qa-planner.md +78 -0
  45. package/templates/.claude/agents/qa-writer.md +32 -0
  46. package/templates/.claude/agents/sec-codeql-expert.md +56 -0
  47. package/templates/.claude/agents/slack-cli-expert.md +98 -0
  48. package/templates/.claude/agents/souls/lang-golang-expert.soul.md +21 -0
  49. package/templates/.claude/agents/sys-memory-keeper.md +123 -0
  50. package/templates/.claude/agents/sys-naggy.md +76 -0
  51. package/templates/.claude/agents/tool-bun-expert.md +26 -0
  52. package/templates/.claude/agents/tool-npm-expert.md +31 -0
  53. package/templates/.claude/agents/tool-optimizer.md +37 -0
  54. package/templates/.claude/agents/wiki-curator.md +72 -0
  55. package/templates/.claude/config/required-plugins.json +30 -0
  56. package/templates/.claude/contexts/dev.md +20 -0
  57. package/templates/.claude/contexts/ecomode.md +110 -0
  58. package/templates/.claude/contexts/index.yaml +41 -0
  59. package/templates/.claude/contexts/research.md +28 -0
  60. package/templates/.claude/contexts/review.md +23 -0
  61. package/templates/.claude/hooks/hooks.json +533 -0
  62. package/templates/.claude/hooks/scripts/adaptive-harness-scan.sh +45 -0
  63. package/templates/.claude/hooks/scripts/agent-start-recorder.sh +40 -0
  64. package/templates/.claude/hooks/scripts/agent-teams-advisor.sh +76 -0
  65. package/templates/.claude/hooks/scripts/audit-log.sh +64 -0
  66. package/templates/.claude/hooks/scripts/auto-continue-guard.sh +33 -0
  67. package/templates/.claude/hooks/scripts/content-hash-validator.sh +75 -0
  68. package/templates/.claude/hooks/scripts/context-budget-advisor.sh +107 -0
  69. package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +71 -0
  70. package/templates/.claude/hooks/scripts/cwd-change-detector.sh +36 -0
  71. package/templates/.claude/hooks/scripts/eval-core-batch-save.sh +46 -0
  72. package/templates/.claude/hooks/scripts/feedback-collector.sh +92 -0
  73. package/templates/.claude/hooks/scripts/file-change-validator.sh +26 -0
  74. package/templates/.claude/hooks/scripts/git-delegation-guard.sh +57 -0
  75. package/templates/.claude/hooks/scripts/model-escalation-advisor.sh +106 -0
  76. package/templates/.claude/hooks/scripts/omcodex-auto-update.sh +4 -0
  77. package/templates/.claude/hooks/scripts/omcustom-auto-update.sh +177 -0
  78. package/templates/.claude/hooks/scripts/rtk-intercept.sh +77 -0
  79. package/templates/.claude/hooks/scripts/rule-deletion-guard.sh +60 -0
  80. package/templates/.claude/hooks/scripts/schema-validator.sh +106 -0
  81. package/templates/.claude/hooks/scripts/secret-filter.sh +100 -0
  82. package/templates/.claude/hooks/scripts/session-autofix-prompt.sh +34 -0
  83. package/templates/.claude/hooks/scripts/session-autofix.sh +146 -0
  84. package/templates/.claude/hooks/scripts/session-env-check.sh +254 -0
  85. package/templates/.claude/hooks/scripts/skill-extractor-analyzer.sh +49 -0
  86. package/templates/.claude/hooks/scripts/stage-blocker.sh +16 -0
  87. package/templates/.claude/hooks/scripts/stale-todo-scanner.sh +91 -0
  88. package/templates/.claude/hooks/scripts/stall-detection-advisor.sh +112 -0
  89. package/templates/.claude/hooks/scripts/stop-console-audit.sh +46 -0
  90. package/templates/.claude/hooks/scripts/stuck-detector.sh +199 -0
  91. package/templates/.claude/hooks/scripts/task-outcome-recorder.sh +119 -0
  92. package/templates/.claude/hooks/scripts/task-state-precompact.sh +58 -0
  93. package/templates/.claude/hooks/scripts/user-prompt-preprocessor.sh +32 -0
  94. package/templates/.claude/hooks/skill-count-reminder.sh +34 -0
  95. package/templates/.claude/install-hooks.sh +100 -0
  96. package/templates/.claude/ontology/agents.yaml +546 -0
  97. package/templates/.claude/ontology/graphs/agent-skill.json +102 -0
  98. package/templates/.claude/ontology/graphs/full-graph.json +629 -0
  99. package/templates/.claude/ontology/graphs/routing.json +112 -0
  100. package/templates/.claude/ontology/graphs/skill-rule.json +78 -0
  101. package/templates/.claude/ontology/rules.yaml +251 -0
  102. package/templates/.claude/ontology/schema.yaml +144 -0
  103. package/templates/.claude/ontology/skills.yaml +575 -0
  104. package/templates/.claude/rules/MAY-optimization.md +42 -0
  105. package/templates/.claude/rules/MUST-agent-design.md +340 -0
  106. package/templates/.claude/rules/MUST-agent-identification.md +77 -0
  107. package/templates/.claude/rules/MUST-agent-teams.md +293 -0
  108. package/templates/.claude/rules/MUST-completion-verification.md +112 -0
  109. package/templates/.claude/rules/MUST-continuous-improvement.md +69 -0
  110. package/templates/.claude/rules/MUST-enforcement-policy.md +50 -0
  111. package/templates/.claude/rules/MUST-intent-transparency.md +74 -0
  112. package/templates/.claude/rules/MUST-language-policy.md +28 -0
  113. package/templates/.claude/rules/MUST-orchestrator-coordination.md +399 -0
  114. package/templates/.claude/rules/MUST-parallel-execution.md +184 -0
  115. package/templates/.claude/rules/MUST-permissions.md +32 -0
  116. package/templates/.claude/rules/MUST-safety.md +23 -0
  117. package/templates/.claude/rules/MUST-sync-verification.md +145 -0
  118. package/templates/.claude/rules/MUST-tool-identification.md +97 -0
  119. package/templates/.claude/rules/SHOULD-ecomode.md +123 -0
  120. package/templates/.claude/rules/SHOULD-error-handling.md +33 -0
  121. package/templates/.claude/rules/SHOULD-hud-statusline.md +51 -0
  122. package/templates/.claude/rules/SHOULD-interaction.md +77 -0
  123. package/templates/.claude/rules/SHOULD-memory-integration.md +371 -0
  124. package/templates/.claude/rules/SHOULD-ontology-rag-routing.md +49 -0
  125. package/templates/.claude/rules/SHOULD-wiki-sync.md +73 -0
  126. package/templates/.claude/rules/index.yaml +141 -0
  127. package/templates/.claude/schemas/tool-inputs.json +62 -0
  128. package/templates/.claude/skills/action-validator/SKILL.md +89 -0
  129. package/templates/.claude/skills/adaptive-harness/SKILL.md +335 -0
  130. package/templates/.claude/skills/adversarial-review/SKILL.md +80 -0
  131. package/templates/.claude/skills/agora/SKILL.md +194 -0
  132. package/templates/.claude/skills/airflow-best-practices/SKILL.md +94 -0
  133. package/templates/.claude/skills/alembic-best-practices/SKILL.md +295 -0
  134. package/templates/.claude/skills/ambiguity-gate/SKILL.md +94 -0
  135. package/templates/.claude/skills/analysis/SKILL.md +223 -0
  136. package/templates/.claude/skills/audit-agents/SKILL.md +118 -0
  137. package/templates/.claude/skills/aws-best-practices/SKILL.md +281 -0
  138. package/templates/.claude/skills/claude-code-bible/SKILL.md +93 -0
  139. package/templates/.claude/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
  140. package/templates/.claude/skills/claude-native/SKILL.md +215 -0
  141. package/templates/.claude/skills/codex-exec/SKILL.md +206 -0
  142. package/templates/.claude/skills/codex-exec/scripts/codex-wrapper.cjs +430 -0
  143. package/templates/.claude/skills/create-agent/SKILL.md +94 -0
  144. package/templates/.claude/skills/cve-triage/SKILL.md +91 -0
  145. package/templates/.claude/skills/dag-orchestration/SKILL.md +201 -0
  146. package/templates/.claude/skills/dbt-best-practices/SKILL.md +55 -0
  147. package/templates/.claude/skills/de-lead-routing/SKILL.md +230 -0
  148. package/templates/.claude/skills/deep-plan/SKILL.md +344 -0
  149. package/templates/.claude/skills/deep-verify/SKILL.md +111 -0
  150. package/templates/.claude/skills/dev-lead-routing/SKILL.md +161 -0
  151. package/templates/.claude/skills/dev-refactor/SKILL.md +234 -0
  152. package/templates/.claude/skills/dev-review/SKILL.md +172 -0
  153. package/templates/.claude/skills/django-best-practices/SKILL.md +334 -0
  154. package/templates/.claude/skills/docker-best-practices/SKILL.md +276 -0
  155. package/templates/.claude/skills/evaluator-optimizer/SKILL.md +421 -0
  156. package/templates/.claude/skills/fastapi-best-practices/SKILL.md +271 -0
  157. package/templates/.claude/skills/fix-refs/SKILL.md +109 -0
  158. package/templates/.claude/skills/flutter-best-practices/SKILL.md +325 -0
  159. package/templates/.claude/skills/gemini-exec/SKILL.md +215 -0
  160. package/templates/.claude/skills/gemini-exec/scripts/gemini-wrapper.cjs +485 -0
  161. package/templates/.claude/skills/go-backend-best-practices/SKILL.md +135 -0
  162. package/templates/.claude/skills/go-best-practices/SKILL.md +204 -0
  163. package/templates/.claude/skills/hada-scout/SKILL.md +92 -0
  164. package/templates/.claude/skills/harness-eval/SKILL.md +95 -0
  165. package/templates/.claude/skills/harness-synthesizer/SKILL.md +145 -0
  166. package/templates/.claude/skills/help/SKILL.md +127 -0
  167. package/templates/.claude/skills/idea/SKILL.md +88 -0
  168. package/templates/.claude/skills/impeccable-design/SKILL.md +173 -0
  169. package/templates/.claude/skills/intent-detection/SKILL.md +293 -0
  170. package/templates/.claude/skills/intent-detection/patterns/agent-triggers.yaml +438 -0
  171. package/templates/.claude/skills/java21-best-practices/SKILL.md +190 -0
  172. package/templates/.claude/skills/jinja2-prompts/SKILL.md +86 -0
  173. package/templates/.claude/skills/kafka-best-practices/SKILL.md +53 -0
  174. package/templates/.claude/skills/kotlin-best-practices/SKILL.md +257 -0
  175. package/templates/.claude/skills/lists/SKILL.md +80 -0
  176. package/templates/.claude/skills/memory-management/SKILL.md +196 -0
  177. package/templates/.claude/skills/memory-recall/SKILL.md +172 -0
  178. package/templates/.claude/skills/memory-save/SKILL.md +128 -0
  179. package/templates/.claude/skills/model-escalation/SKILL.md +62 -0
  180. package/templates/.claude/skills/monitoring-setup/SKILL.md +215 -0
  181. package/templates/.claude/skills/multi-model-verification/SKILL.md +130 -0
  182. package/templates/.claude/skills/npm-audit/SKILL.md +74 -0
  183. package/templates/.claude/skills/npm-publish/SKILL.md +65 -0
  184. package/templates/.claude/skills/npm-version/SKILL.md +104 -0
  185. package/templates/.claude/skills/omcodex-auto-improve/SKILL.md +136 -0
  186. package/templates/.claude/skills/omcodex-feedback/SKILL.md +205 -0
  187. package/templates/.claude/skills/omcodex-improve-report/SKILL.md +65 -0
  188. package/templates/.claude/skills/omcodex-loop/SKILL.md +45 -0
  189. package/templates/.claude/skills/omcodex-release-notes/SKILL.md +117 -0
  190. package/templates/.claude/skills/omcodex-takeover/SKILL.md +115 -0
  191. package/templates/.claude/skills/omcodex-web/SKILL.md +95 -0
  192. package/templates/.claude/skills/optimize-analyze/SKILL.md +57 -0
  193. package/templates/.claude/skills/optimize-bundle/SKILL.md +69 -0
  194. package/templates/.claude/skills/optimize-report/SKILL.md +76 -0
  195. package/templates/.claude/skills/peer-messaging/SKILL.md +59 -0
  196. package/templates/.claude/skills/pipeline/SKILL.md +103 -0
  197. package/templates/.claude/skills/pipeline-architecture-patterns/SKILL.md +84 -0
  198. package/templates/.claude/skills/pipeline-guards/SKILL.md +173 -0
  199. package/templates/.claude/skills/post-release-followup/SKILL.md +134 -0
  200. package/templates/.claude/skills/postgres-best-practices/SKILL.md +67 -0
  201. package/templates/.claude/skills/pr-auto-improve/SKILL.md +129 -0
  202. package/templates/.claude/skills/professor-triage/SKILL.md +321 -0
  203. package/templates/.claude/skills/python-best-practices/SKILL.md +223 -0
  204. package/templates/.claude/skills/qa-lead-routing/SKILL.md +104 -0
  205. package/templates/.claude/skills/react-best-practices/SKILL.md +102 -0
  206. package/templates/.claude/skills/reasoning-sandwich/SKILL.md +64 -0
  207. package/templates/.claude/skills/redis-best-practices/SKILL.md +84 -0
  208. package/templates/.claude/skills/release-plan/SKILL.md +207 -0
  209. package/templates/.claude/skills/research/SKILL.md +493 -0
  210. package/templates/.claude/skills/result-aggregation/SKILL.md +165 -0
  211. package/templates/.claude/skills/rtk-exec/SKILL.md +199 -0
  212. package/templates/.claude/skills/rtk-exec/scripts/rtk-wrapper.cjs +377 -0
  213. package/templates/.claude/skills/rust-best-practices/SKILL.md +268 -0
  214. package/templates/.claude/skills/sauron-watch/SKILL.md +239 -0
  215. package/templates/.claude/skills/scout/SKILL.md +250 -0
  216. package/templates/.claude/skills/sdd/SKILL.md +24 -0
  217. package/templates/.claude/skills/sdd-dev/SKILL.md +257 -0
  218. package/templates/.claude/skills/sdd-development/SKILL.md +24 -0
  219. package/templates/.claude/skills/secretary-routing/SKILL.md +132 -0
  220. package/templates/.claude/skills/skill-extractor/SKILL.md +155 -0
  221. package/templates/.claude/skills/skills-sh-search/SKILL.md +210 -0
  222. package/templates/.claude/skills/snowflake-best-practices/SKILL.md +66 -0
  223. package/templates/.claude/skills/spark-best-practices/SKILL.md +53 -0
  224. package/templates/.claude/skills/springboot-best-practices/SKILL.md +74 -0
  225. package/templates/.claude/skills/springboot-best-practices/examples/config-properties-example.java +22 -0
  226. package/templates/.claude/skills/springboot-best-practices/examples/controller-example.java +28 -0
  227. package/templates/.claude/skills/springboot-best-practices/examples/controller-test-example.java +33 -0
  228. package/templates/.claude/skills/springboot-best-practices/examples/entity-example.java +22 -0
  229. package/templates/.claude/skills/springboot-best-practices/examples/exception-handler-example.java +30 -0
  230. package/templates/.claude/skills/springboot-best-practices/examples/repository-example.java +17 -0
  231. package/templates/.claude/skills/springboot-best-practices/examples/repository-test-example.java +23 -0
  232. package/templates/.claude/skills/springboot-best-practices/examples/security-config-example.java +27 -0
  233. package/templates/.claude/skills/springboot-best-practices/examples/service-example.java +33 -0
  234. package/templates/.claude/skills/status/SKILL.md +155 -0
  235. package/templates/.claude/skills/structured-dev-cycle/SKILL.md +200 -0
  236. package/templates/.claude/skills/stuck-recovery/SKILL.md +80 -0
  237. package/templates/.claude/skills/supabase-postgres-best-practices/SKILL.md +100 -0
  238. package/templates/.claude/skills/systematic-debugging/SKILL.md +288 -0
  239. package/templates/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +278 -0
  240. package/templates/.claude/skills/systematic-debugging/condition-based-waiting.md +240 -0
  241. package/templates/.claude/skills/systematic-debugging/defense-in-depth.md +252 -0
  242. package/templates/.claude/skills/systematic-debugging/find-polluter.sh +147 -0
  243. package/templates/.claude/skills/systematic-debugging/root-cause-tracing.md +87 -0
  244. package/templates/.claude/skills/task-decomposition/SKILL.md +197 -0
  245. package/templates/.claude/skills/typescript-best-practices/SKILL.md +322 -0
  246. package/templates/.claude/skills/update-docs/SKILL.md +142 -0
  247. package/templates/.claude/skills/update-external/SKILL.md +169 -0
  248. package/templates/.claude/skills/vercel-deploy/SKILL.md +75 -0
  249. package/templates/.claude/skills/web-design-guidelines/SKILL.md +119 -0
  250. package/templates/.claude/skills/wiki/SKILL.md +426 -0
  251. package/templates/.claude/skills/wiki-rag/SKILL.md +154 -0
  252. package/templates/.claude/skills/worker-reviewer-pipeline/SKILL.md +165 -0
  253. package/templates/.claude/skills/writing-clearly-and-concisely/SKILL.md +66 -0
  254. package/templates/.claude/statusline.sh +380 -0
  255. package/templates/.claude/uninstall-hooks.sh +52 -0
  256. package/templates/.github/workflows/wiki-sync.yml +132 -0
  257. package/templates/AGENTS.md.en +255 -0
  258. package/templates/AGENTS.md.ko +255 -0
  259. package/templates/CLAUDE.md +263 -0
  260. package/templates/CLAUDE.md.en +256 -0
  261. package/templates/CLAUDE.md.ko +256 -0
  262. package/templates/deprecated-files.json +10 -0
  263. package/templates/guides/agents-md-quality/README.md +110 -0
  264. package/templates/guides/airflow/README.md +47 -0
  265. package/templates/guides/alembic/README.md +438 -0
  266. package/templates/guides/aws/common-patterns.md +169 -0
  267. package/templates/guides/aws/index.yaml +26 -0
  268. package/templates/guides/aws/well-architected.md +143 -0
  269. package/templates/guides/cc-token-saver/README.md +97 -0
  270. package/templates/guides/claude-code/01-overview.md +42 -0
  271. package/templates/guides/claude-code/03-tools.md +107 -0
  272. package/templates/guides/claude-code/04-agent-skills.md +90 -0
  273. package/templates/guides/claude-code/05-agent-sdk.md +129 -0
  274. package/templates/guides/claude-code/06-mcp.md +165 -0
  275. package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
  276. package/templates/guides/claude-code/08-testing.md +56 -0
  277. package/templates/guides/claude-code/09-guardrails.md +78 -0
  278. package/templates/guides/claude-code/10-monitoring.md +87 -0
  279. package/templates/guides/claude-code/11-sub-agents.md +159 -0
  280. package/templates/guides/claude-code/12-workflow-patterns.md +182 -0
  281. package/templates/guides/claude-code/13-cli-flags.md +151 -0
  282. package/templates/guides/claude-code/index.yaml +61 -0
  283. package/templates/guides/dbt/README.md +32 -0
  284. package/templates/guides/django-best-practices/README.md +476 -0
  285. package/templates/guides/docker/compose-best-practices.md +284 -0
  286. package/templates/guides/docker/dockerfile-best-practices.md +262 -0
  287. package/templates/guides/docker/index.yaml +26 -0
  288. package/templates/guides/drizzle-orm/README.md +69 -0
  289. package/templates/guides/elements-of-style/elements-of-style.html +2609 -0
  290. package/templates/guides/fastapi/best-practices.md +232 -0
  291. package/templates/guides/fastapi/index.yaml +21 -0
  292. package/templates/guides/flutter/architecture.md +141 -0
  293. package/templates/guides/flutter/fundamentals.md +119 -0
  294. package/templates/guides/flutter/index.yaml +44 -0
  295. package/templates/guides/flutter/performance.md +119 -0
  296. package/templates/guides/flutter/security.md +120 -0
  297. package/templates/guides/flutter/state-management.md +144 -0
  298. package/templates/guides/flutter/testing.md +155 -0
  299. package/templates/guides/git-worktree-workflow/README.md +138 -0
  300. package/templates/guides/go-backend/index.yaml +26 -0
  301. package/templates/guides/go-backend/project-layout.md +243 -0
  302. package/templates/guides/go-backend/uber-style.md +212 -0
  303. package/templates/guides/golang/concurrency.md +282 -0
  304. package/templates/guides/golang/effective-go.md +309 -0
  305. package/templates/guides/golang/error-handling.md +250 -0
  306. package/templates/guides/golang/index.yaml +27 -0
  307. package/templates/guides/hook-data-flow/README.md +135 -0
  308. package/templates/guides/iceberg/README.md +49 -0
  309. package/templates/guides/impeccable-design/color-and-contrast.md +278 -0
  310. package/templates/guides/impeccable-design/index.yaml +12 -0
  311. package/templates/guides/impeccable-design/motion-design.md +390 -0
  312. package/templates/guides/impeccable-design/typography.md +386 -0
  313. package/templates/guides/impeccable-design/ux-writing.md +400 -0
  314. package/templates/guides/index.yaml +265 -0
  315. package/templates/guides/java21/index.yaml +29 -0
  316. package/templates/guides/java21/java-style-guide.md +248 -0
  317. package/templates/guides/java21/modern-java21.md +303 -0
  318. package/templates/guides/kafka/README.md +32 -0
  319. package/templates/guides/kotlin/coding-conventions.md +247 -0
  320. package/templates/guides/kotlin/idioms.md +234 -0
  321. package/templates/guides/kotlin/index.yaml +26 -0
  322. package/templates/guides/multi-model-routing/README.md +101 -0
  323. package/templates/guides/multi-provider-exec/README.md +83 -0
  324. package/templates/guides/postgres/README.md +58 -0
  325. package/templates/guides/python/index.yaml +26 -0
  326. package/templates/guides/python/pep8-style-guide.md +202 -0
  327. package/templates/guides/python/zen-of-python.md +79 -0
  328. package/templates/guides/redis/README.md +50 -0
  329. package/templates/guides/rust/error-handling.md +262 -0
  330. package/templates/guides/rust/index.yaml +26 -0
  331. package/templates/guides/rust/ownership.md +180 -0
  332. package/templates/guides/skill-bundle-design/README.md +106 -0
  333. package/templates/guides/slack-cli/README.md +145 -0
  334. package/templates/guides/snowflake/README.md +32 -0
  335. package/templates/guides/spark/README.md +32 -0
  336. package/templates/guides/springboot/best-practices.md +361 -0
  337. package/templates/guides/springboot/index.yaml +22 -0
  338. package/templates/guides/supabase-postgres/README.md +32 -0
  339. package/templates/guides/supabase-postgres/index.yaml +19 -0
  340. package/templates/guides/typescript/advanced-types.md +225 -0
  341. package/templates/guides/typescript/index.yaml +26 -0
  342. package/templates/guides/typescript/type-system.md +219 -0
  343. package/templates/guides/web-design/accessibility.md +66 -0
  344. package/templates/guides/web-design/index.yaml +20 -0
  345. package/templates/guides/web-design/performance.md +102 -0
  346. package/templates/guides/web-scraping/README.md +926 -0
  347. package/templates/guides/web-scraping/index.yaml +19 -0
  348. package/templates/guides/worktree-lifecycle/README.md +104 -0
  349. package/templates/index.yaml +18 -0
  350. package/templates/manifest.json +49 -0
  351. package/templates/workflows/auto-dev.yaml +46 -0
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: skill-extractor
3
+ description: Analyze task trajectories to propose reusable SKILL.md candidates from successful patterns
4
+ scope: core
5
+ user-invocable: true
6
+ argument-hint: "[--threshold <n>] [--dry-run]"
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # Skill Extractor
11
+
12
+ Analyze completed task outcomes to identify reusable patterns and propose new SKILL.md candidates. Inspired by Hermes Agent's self-learning skill extraction — adapted for oh-my-customcodex's compilation metaphor.
13
+
14
+ ## Philosophy
15
+
16
+ In the compilation metaphor: task trajectories are runtime traces, and extracted skills are new source code. This skill turns successful execution patterns into reusable knowledge artifacts.
17
+
18
+ ```
19
+ Runtime traces (task outcomes) → Pattern analysis → SKILL.md proposal → User approval → mgr-creator
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ /skill-extractor # Analyze current session outcomes
26
+ /skill-extractor --threshold 2 # Lower success threshold (default: 3)
27
+ /skill-extractor --dry-run # Preview proposals without writing
28
+ ```
29
+
30
+ ## Options
31
+
32
+ ```
33
+ --threshold, -t Minimum success count for pattern qualification (default: 3)
34
+ --dry-run, -d Preview proposals to stdout only, no file writes
35
+ --all Include all sessions (not just current, requires task outcome history)
36
+ ```
37
+
38
+ ## Workflow
39
+
40
+ ### Phase 1: Collect Task Outcomes
41
+
42
+ Read task outcome data from the session:
43
+
44
+ ```bash
45
+ # Current session outcomes (from task-outcome-recorder hook)
46
+ OUTCOMES_FILE="/tmp/.codex-task-outcomes-${PPID}"
47
+ ```
48
+
49
+ If file doesn't exist or is empty: report "No task outcomes recorded in this session." and stop.
50
+
51
+ Parse JSONL entries. Each entry has:
52
+ ```json
53
+ {"agent_type": "lang-typescript-expert", "skill": "typescript-best-practices", "description": "Fix type error in auth module", "outcome": "success", "model": "sonnet", "timestamp": "2026-04-05T09:30:00Z", "duration_ms": 15000}
54
+ ```
55
+
56
+ ### Phase 2: Pattern Detection
57
+
58
+ Group outcomes by `(agent_type, skill)` tuple:
59
+
60
+ ```
61
+ Pattern: (lang-typescript-expert, typescript-best-practices)
62
+ → success: 5, failure: 1, total: 6
63
+ → success_rate: 0.83
64
+ → descriptions: ["Fix type error...", "Refactor module...", ...]
65
+ ```
66
+
67
+ Filter qualifying patterns:
68
+ - `success_count >= threshold` (default: 3)
69
+ - `success_rate >= 0.8`
70
+ - Not already an existing skill (check `.codex/skills/*/SKILL.md`)
71
+
72
+ ### Phase 3: Generate Proposals
73
+
74
+ For each qualifying pattern, generate a SKILL.md proposal:
75
+
76
+ ```markdown
77
+ ## Proposal: {proposed-skill-name}
78
+
79
+ **Source Pattern**: {agent_type} + {skill} ({success_count} successes, {success_rate}% rate)
80
+ **Confidence**: {low|medium|high} (based on count and rate)
81
+
82
+ ### Proposed SKILL.md
83
+
84
+ name: {proposed-name}
85
+ description: {inferred from common description patterns}
86
+ scope: core
87
+ user-invocable: false
88
+
89
+ ### Rationale
90
+ {Why this pattern should be extracted as a skill — based on frequency and success rate}
91
+
92
+ ### Overlap Check
93
+ {List any existing skills with >50% keyword overlap}
94
+ ```
95
+
96
+ **Confidence scoring**:
97
+ | Successes | Rate | Confidence |
98
+ |-----------|------|------------|
99
+ | 3-5 | >= 0.8 | low |
100
+ | 6-10 | >= 0.85 | medium |
101
+ | 10+ | >= 0.9 | high |
102
+
103
+ ### Phase 4: Present to User
104
+
105
+ Display proposals in ranked order (highest confidence first):
106
+
107
+ ```
108
+ [skill-extractor] {N} skill candidates detected
109
+
110
+ 1. [high] proposed-skill-name
111
+ Source: {agent_type} + {skill} (12 successes, 92%)
112
+ Description: {inferred description}
113
+
114
+ 2. [medium] another-skill-name
115
+ Source: {agent_type} + {skill} (7 successes, 86%)
116
+ Description: {inferred description}
117
+
118
+ Select [1-N] to create, "all" to create all, or "skip" to cancel:
119
+ ```
120
+
121
+ ### Phase 5: Create Skill (on approval)
122
+
123
+ Delegate to mgr-creator with the proposal context:
124
+ - Proposed name and description
125
+ - Source pattern data
126
+ - Confidence level
127
+ - Any overlap warnings
128
+
129
+ mgr-creator handles: SKILL.md creation, template sync, ontology registration.
130
+
131
+ ## Integration
132
+
133
+ | System | How |
134
+ |--------|-----|
135
+ | task-outcome-recorder | Reads JSONL outcomes as input data |
136
+ | feedback-collector | Complementary: feedback-collector extracts failure patterns, skill-extractor extracts success patterns |
137
+ | mgr-creator | Delegated skill creation on user approval |
138
+ | skills-sh-search | Check agentskills.io for existing equivalent before creating |
139
+ | R011 (memory) | User Model tracks extraction decisions in Override Decisions |
140
+
141
+ ## Hook Integration
142
+
143
+ The `skill-extractor-analyzer.sh` Stop hook provides a lightweight pre-analysis:
144
+ - Reads task outcomes file
145
+ - Counts qualifying patterns
146
+ - Emits advisory stderr message if candidates found
147
+ - Does NOT create skills (that requires user approval via the skill)
148
+
149
+ ## Safety
150
+
151
+ - **User approval required**: Never auto-creates skills
152
+ - **Overlap check**: Prevents duplicating existing skills
153
+ - **Dry-run mode**: Preview without side effects
154
+ - **Advisory hook**: Stop hook is advisory-only (exit 0)
155
+ - **Confidence transparency**: All proposals show confidence scores
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: skills-sh-search
3
+ description: Search and install skills from skills.sh marketplace when internal skills are insufficient
4
+ scope: core
5
+ argument-hint: "<query> [--install] [--global]"
6
+ user-invocable: true
7
+ ---
8
+
9
+ # Skills.sh Search Skill
10
+
11
+ Search the [skills.sh](https://skills.sh/) marketplace for reusable AI agent skills when no matching internal skill exists. Install discovered skills directly into the project.
12
+
13
+ ## Prerequisites
14
+
15
+ - Node.js and npx available in PATH
16
+ - Network access to skills.sh registry
17
+
18
+ ## Options
19
+
20
+ ```
21
+ <query> Required. Search query describing the capability needed
22
+ --install, -i Install selected skill after search
23
+ --global, -g Install to ~/.codex/skills/ instead of project .codex/skills/
24
+ --list, -l List currently installed skills.sh skills
25
+ --check, -c Check for updates on installed skills.sh skills
26
+ --source, -s Search source: "skills-sh" (default) | "agentskills" | "all"
27
+ ```
28
+
29
+ ## Workflow
30
+
31
+ ```
32
+ 1. Search skills.sh marketplace
33
+ ├── Run: npx --yes skills find "<query>"
34
+ ├── Review results (name, description, install count)
35
+ └── Present top candidates to user
36
+
37
+ 2. User selects skill
38
+ ├── Confirm selection with user
39
+ └── Check for namespace conflicts with existing skills
40
+
41
+ 3. Install skill
42
+ ├── Run: npx --yes skills add <source> [-g]
43
+ ├── Verify installation in .codex/skills/
44
+ └── Check installed SKILL.md frontmatter
45
+
46
+ 4. Post-install adaptation
47
+ ├── Review installed SKILL.md frontmatter
48
+ ├── Add oh-my-customcodex fields if missing:
49
+ │ ├── user-invocable: true|false
50
+ │ ├── model-invocable (if not present)
51
+ │ └── argument-hint (if applicable)
52
+ └── Add source metadata:
53
+ ├── source-type: skills-sh
54
+ └── source-origin: <owner/repo>
55
+
56
+ 5. Ontology sync
57
+ ├── Notify: run "omcodex ontology build" to register new skill
58
+ └── Or manually add to skills.yaml if ontology CLI unavailable
59
+ ```
60
+
61
+ ## Namespace Conflict Check
62
+
63
+ Before installing, verify no existing skill shares the same name:
64
+
65
+ ```bash
66
+ # Check for conflict
67
+ ls .codex/skills/ | grep -w "<skill-name>"
68
+ ```
69
+
70
+ If conflict exists:
71
+ - Warn user about the conflict
72
+ - Suggest renaming or skipping
73
+ - Never overwrite existing skills without explicit approval
74
+
75
+ ## Output Format
76
+
77
+ ### Search Results
78
+ ```
79
+ [skills-sh-search] Searching marketplace...
80
+
81
+ Query: "<query>"
82
+ Results: 5 found
83
+
84
+ 1. owner/skill-name (12.3K installs)
85
+ Description of the skill
86
+
87
+ 2. owner/another-skill (8.1K installs)
88
+ Description of the skill
89
+
90
+ 3. owner/third-skill (3.5K installs)
91
+ Description of the skill
92
+
93
+ Select [1-3] or "skip" to cancel:
94
+ ```
95
+
96
+ ### Install Success
97
+ ```
98
+ [skills-sh-search] Installed
99
+
100
+ Skill: <skill-name>
101
+ Source: <owner/repo>
102
+ Location: .codex/skills/<skill-name>/SKILL.md
103
+ Adapted: ✓ (added user-invocable, source metadata)
104
+
105
+ Next: Run "omcodex ontology build" to register in ontology.
106
+ ```
107
+
108
+ ### Install Failure
109
+ ```
110
+ [skills-sh-search] Failed
111
+
112
+ Error: <error_message>
113
+ Suggested Fix: <suggestion>
114
+ ```
115
+
116
+ ### No Results
117
+ ```
118
+ [skills-sh-search] No Results
119
+
120
+ Query: "<query>"
121
+ Suggestions:
122
+ - Try broader search terms
123
+ - Check https://skills.sh/ directly
124
+ - Consider creating a custom skill with /create-agent
125
+ ```
126
+
127
+ ## Alternative Sources
128
+
129
+ ### agentskills.io (opt-in)
130
+
131
+ Search the [agentskills.io](https://agentskills.io/) community skill registry as an alternative source.
132
+
133
+ **Search workflow:**
134
+ ```
135
+ 1. Try: npx --yes @agentskill.sh/cli search "<query>"
136
+ 2. If CLI unavailable: WebSearch "site:agentskills.io <query>"
137
+ 3. Present results with source attribution
138
+ ```
139
+
140
+ **Install workflow:**
141
+ ```
142
+ 1. Run: npx --yes @agentskill.sh/cli install <slug>
143
+ 2. Verify installation in .codex/skills/
144
+ 3. Add source metadata:
145
+ ├── source-type: agentskills-io
146
+ └── source-origin: <slug>
147
+ ```
148
+
149
+ **Usage:**
150
+ ```bash
151
+ # Search agentskills.io only
152
+ /skills-sh-search "memory management" --source agentskills
153
+
154
+ # Search both sources
155
+ /skills-sh-search "testing patterns" --source all
156
+ ```
157
+
158
+ **Fallback chain:**
159
+ | Step | Tool | Condition |
160
+ |------|------|-----------|
161
+ | 1 | `@agentskill.sh/cli search` | Primary — if CLI available |
162
+ | 2 | `WebSearch site:agentskills.io` | CLI unavailable or no results |
163
+ | 3 | Report no results | Both failed |
164
+
165
+ ## Examples
166
+
167
+ ```bash
168
+ # Search for Terraform skills
169
+ /skills-sh-search terraform infrastructure
170
+
171
+ # Search and install
172
+ /skills-sh-search "react testing patterns" --install
173
+
174
+ # Install globally
175
+ /skills-sh-search "git workflow" --install --global
176
+
177
+ # List installed skills.sh skills
178
+ /skills-sh-search --list
179
+
180
+ # Check for updates
181
+ /skills-sh-search --check
182
+
183
+ # Search agentskills.io
184
+ /skills-sh-search "agent memory" --source agentskills
185
+
186
+ # Search all sources
187
+ /skills-sh-search "code review" --source all --install
188
+ ```
189
+
190
+ ## Integration
191
+
192
+ ### With intent-detection
193
+ When intent-detection finds no matching agent and the domain is identifiable, this skill can be suggested as a fallback to find relevant external skills.
194
+
195
+ ### With update-external
196
+ Installed skills.sh skills are tracked with `source-type: skills-sh` metadata, enabling `update-external` to check for updates via `npx skills check`.
197
+
198
+ ### With create-agent
199
+ If a skills.sh skill provides domain knowledge, `create-agent` can reference it when building a new agent for that domain.
200
+
201
+ ### With agentskills.io
202
+ Installed agentskills.io skills are tracked with `source-type: agentskills-io` metadata, enabling `update-external` to check for updates. Default source remains skills.sh; agentskills.io is opt-in via `--source` flag.
203
+
204
+ ## Safety
205
+
206
+ - **Read-only by default**: Search does not modify anything
207
+ - **Explicit install**: Installation requires `--install` flag or user confirmation
208
+ - **No auto-execution**: Installed skills are not auto-invoked without ontology registration
209
+ - **Conflict protection**: Never overwrites existing skills
210
+ - **Telemetry opt-out**: Set `DISABLE_TELEMETRY=1` to disable skills CLI telemetry
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: snowflake-best-practices
3
+ description: Snowflake best practices for cloud data warehouse design, query optimization, and cost management
4
+ scope: core
5
+ user-invocable: false
6
+ ---
7
+
8
+ # Snowflake Best Practices
9
+
10
+ ## Warehouse Design
11
+
12
+ ### Sizing (CRITICAL)
13
+ - Start small (XS or S), scale up as needed
14
+ - Enable auto-scaling for concurrency
15
+ - Enable auto-suspend (1 minute idle)
16
+ - Separate warehouses for different workloads
17
+
18
+ ### Multi-Cluster Warehouses
19
+ - Use for high concurrency (many users)
20
+ - Set min/max clusters based on load
21
+ - Scaling policy: Standard (default) or Economy
22
+
23
+ ## Query Optimization
24
+
25
+ ### Clustering Keys (CRITICAL)
26
+ - Define clustering keys for frequently filtered columns
27
+ - Improves micro-partition pruning
28
+ - Monitor clustering depth
29
+ - Automatic clustering: `ALTER TABLE ... CLUSTER BY (...)`
30
+
31
+ ### Result Caching
32
+ - 24-hour cache for identical queries
33
+ - Use SHOW PARAMETERS to check cache status
34
+ - Bypass cache with query hint: `/*+ NO_RESULT_CACHE */`
35
+
36
+ ### Materialized Views
37
+ - For repeated aggregations
38
+ - Automatically refreshed on base table changes
39
+ - Cost: storage + refresh compute
40
+
41
+ ## Data Loading
42
+
43
+ ### COPY INTO (CRITICAL)
44
+ - Batch load from stages (S3/GCS/Azure)
45
+ - File size: 100-250MB compressed (optimal)
46
+ - Use pattern matching for multiple files
47
+
48
+ ### Snowpipe
49
+ - Continuous ingestion
50
+ - Event-driven (S3 notifications)
51
+ - Serverless compute
52
+
53
+ ## Cost Optimization
54
+
55
+ ### Resource Monitors
56
+ - Set credit quotas per warehouse
57
+ - Alerts and suspend actions
58
+ - Track consumption with WAREHOUSE_METERING_HISTORY
59
+
60
+ ### Storage
61
+ - Use zero-copy cloning for dev/test
62
+ - Time travel retention: 1 day (standard), 90 days (enterprise)
63
+ - Fail-safe: 7 days (not configurable)
64
+
65
+ ## References
66
+ - [Snowflake Best Practices](https://docs.snowflake.com/en/user-guide/best-practices)
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: spark-best-practices
3
+ description: Apache Spark best practices for PySpark and Scala distributed data processing
4
+ scope: core
5
+ user-invocable: false
6
+ ---
7
+
8
+ # Apache Spark Best Practices
9
+
10
+ ## Performance Optimization
11
+
12
+ ### Broadcast Joins (CRITICAL)
13
+ - Use `broadcast(small_df)` for small-large table joins
14
+ - Default broadcast threshold: 10MB (`spark.sql.autoBroadcastJoinThreshold`)
15
+ - Avoid broadcast for tables > 100MB
16
+
17
+ ### Shuffles (CRITICAL)
18
+ - Minimize shuffles: expensive operations
19
+ - Use `coalesce()` to reduce partitions without shuffle
20
+ - Use `repartition()` only when necessary (causes shuffle)
21
+ - Predicate pushdown: filter before joins
22
+
23
+ ### Caching
24
+ - Cache DataFrames used multiple times: `df.cache()` or `df.persist()`
25
+ - Choose storage level: MEMORY_ONLY, MEMORY_AND_DISK, DISK_ONLY
26
+ - Unpersist when done: `df.unpersist()`
27
+
28
+ ## Resource Management
29
+
30
+ ### Executor Configuration
31
+ - Executor memory: 80% of available memory per executor
32
+ - Executor cores: 4-5 cores per executor (optimal)
33
+ - Dynamic allocation: enable for varying workloads
34
+
35
+ ### Partitioning
36
+ - Optimal partition size: 100-200MB
37
+ - Too few partitions: underutilized cluster
38
+ - Too many partitions: task overhead
39
+
40
+ ## Data Processing
41
+
42
+ ### UDFs
43
+ - Prefer built-in functions over UDFs
44
+ - Use Pandas UDF for vectorized operations
45
+ - Avoid Python UDFs (serialization overhead)
46
+
47
+ ### Storage Formats
48
+ - Parquet: default for analytics (columnar, compression)
49
+ - ORC: alternative to Parquet
50
+ - Delta/Iceberg: ACID transactions, time travel
51
+
52
+ ## References
53
+ - [Spark Performance Tuning](https://spark.apache.org/docs/latest/tuning.html)
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: springboot-best-practices
3
+ description: Spring Boot patterns for enterprise Java applications
4
+ scope: core
5
+ user-invocable: false
6
+ ---
7
+
8
+ ## Rules
9
+
10
+ ### 1. Project Structure
11
+ Layered architecture: controller (REST), service (business logic), repository (data access), model/entity, dto, config, exception.
12
+
13
+ ### 2. Dependency Injection
14
+ Constructor injection preferred. Use @RequiredArgsConstructor with final fields. Avoid field injection with @Autowired.
15
+
16
+ ```java
17
+ // GOOD: Constructor injection
18
+ @Service
19
+ @RequiredArgsConstructor
20
+ public class UserService {
21
+ private final UserRepository userRepository;
22
+ private final EmailService emailService;
23
+ }
24
+ ```
25
+
26
+ ### 3. REST API Design
27
+ @RestController + @RequestMapping. Use @Validated for input, ResponseEntity for responses, proper HTTP status codes.
28
+
29
+ See `examples/controller-example.java` for reference implementation.
30
+
31
+ ### 4. Service Layer
32
+ Business logic in services. @Transactional boundaries at service level. Interface + implementation pattern.
33
+
34
+ See `examples/service-example.java` for reference implementation.
35
+
36
+ ### 5. Data Access
37
+ Spring Data JPA. @Query or method naming for custom queries. @Entity with proper JPA annotations.
38
+
39
+ See `examples/repository-example.java` and `examples/entity-example.java` for reference implementations.
40
+
41
+ ### 6. Exception Handling
42
+ @RestControllerAdvice for global handling. Domain-specific exceptions with proper HTTP status mapping.
43
+
44
+ See `examples/exception-handler-example.java` for reference implementation.
45
+
46
+ ### 7. Configuration
47
+ Profile-based: application-{profile}.yml. @ConfigurationProperties for type-safe config. Externalize sensitive values.
48
+
49
+ ```yaml
50
+ # application.yml
51
+ spring:
52
+ profiles:
53
+ active: ${SPRING_PROFILES_ACTIVE:local}
54
+ datasource:
55
+ url: ${DATABASE_URL}
56
+ username: ${DATABASE_USERNAME}
57
+ password: ${DATABASE_PASSWORD}
58
+ ```
59
+
60
+ See `examples/config-properties-example.java` for type-safe configuration properties.
61
+
62
+ ### 8. Security
63
+ Spring Security with SecurityFilterChain. Externalize secrets. Proper authentication/authorization patterns.
64
+
65
+ See `examples/security-config-example.java` for reference implementation.
66
+
67
+ ### 9. Testing
68
+ @WebMvcTest (controller), @DataJpaTest (repository), @SpringBootTest (integration), @MockBean for mocking.
69
+
70
+ See `examples/controller-test-example.java` and `examples/repository-test-example.java` for reference implementations.
71
+
72
+ ## Application
73
+
74
+ Always: constructor injection, layered architecture, DTOs, global exception handling, externalized config, proper security, layer-appropriate tests.
@@ -0,0 +1,22 @@
1
+ package com.example.demo.config;
2
+
3
+ import jakarta.validation.constraints.Min;
4
+ import jakarta.validation.constraints.NotBlank;
5
+ import lombok.Getter;
6
+ import lombok.Setter;
7
+ import org.springframework.boot.context.properties.ConfigurationProperties;
8
+ import org.springframework.context.annotation.Configuration;
9
+ import org.springframework.validation.annotation.Validated;
10
+
11
+ @Configuration
12
+ @ConfigurationProperties(prefix = "app")
13
+ @Validated
14
+ @Getter
15
+ @Setter
16
+ public class AppProperties {
17
+ @NotBlank
18
+ private String name;
19
+
20
+ @Min(1)
21
+ private int maxConnections;
22
+ }
@@ -0,0 +1,28 @@
1
+ package com.example.demo.controller;
2
+
3
+ import com.example.demo.dto.UserRequest;
4
+ import com.example.demo.dto.UserResponse;
5
+ import com.example.demo.service.UserService;
6
+ import jakarta.validation.Valid;
7
+ import lombok.RequiredArgsConstructor;
8
+ import org.springframework.http.HttpStatus;
9
+ import org.springframework.http.ResponseEntity;
10
+ import org.springframework.web.bind.annotation.*;
11
+
12
+ @RestController
13
+ @RequestMapping("/api/v1/users")
14
+ @RequiredArgsConstructor
15
+ public class UserController {
16
+ private final UserService userService;
17
+
18
+ @GetMapping("/{id}")
19
+ public ResponseEntity<UserResponse> getUser(@PathVariable Long id) {
20
+ return ResponseEntity.ok(userService.findById(id));
21
+ }
22
+
23
+ @PostMapping
24
+ @ResponseStatus(HttpStatus.CREATED)
25
+ public UserResponse createUser(@Valid @RequestBody UserRequest request) {
26
+ return userService.create(request);
27
+ }
28
+ }
@@ -0,0 +1,33 @@
1
+ package com.example.demo.controller;
2
+
3
+ import com.example.demo.dto.UserResponse;
4
+ import com.example.demo.service.UserService;
5
+ import org.junit.jupiter.api.Test;
6
+ import org.springframework.beans.factory.annotation.Autowired;
7
+ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
8
+ import org.springframework.boot.test.mock.mockito.MockBean;
9
+ import org.springframework.test.web.servlet.MockMvc;
10
+
11
+ import static org.mockito.BDDMockito.given;
12
+ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
13
+ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
14
+ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
15
+
16
+ @WebMvcTest(UserController.class)
17
+ class UserControllerTest {
18
+ @Autowired
19
+ private MockMvc mockMvc;
20
+
21
+ @MockBean
22
+ private UserService userService;
23
+
24
+ @Test
25
+ void getUser_shouldReturnUser() throws Exception {
26
+ given(userService.findById(1L))
27
+ .willReturn(new UserResponse(1L, "test@example.com"));
28
+
29
+ mockMvc.perform(get("/api/v1/users/1"))
30
+ .andExpect(status().isOk())
31
+ .andExpect(jsonPath("$.email").value("test@example.com"));
32
+ }
33
+ }
@@ -0,0 +1,22 @@
1
+ package com.example.demo.entity;
2
+
3
+ import jakarta.persistence.*;
4
+ import lombok.AccessLevel;
5
+ import lombok.Getter;
6
+ import lombok.NoArgsConstructor;
7
+
8
+ @Entity
9
+ @Table(name = "users")
10
+ @Getter
11
+ @NoArgsConstructor(access = AccessLevel.PROTECTED)
12
+ public class User {
13
+ @Id
14
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
15
+ private Long id;
16
+
17
+ @Column(nullable = false, unique = true)
18
+ private String email;
19
+
20
+ @Enumerated(EnumType.STRING)
21
+ private UserStatus status;
22
+ }
@@ -0,0 +1,30 @@
1
+ package com.example.demo.exception;
2
+
3
+ import com.example.demo.dto.ErrorResponse;
4
+ import org.springframework.http.HttpStatus;
5
+ import org.springframework.web.bind.MethodArgumentNotValidException;
6
+ import org.springframework.web.bind.annotation.ExceptionHandler;
7
+ import org.springframework.web.bind.annotation.ResponseStatus;
8
+ import org.springframework.web.bind.annotation.RestControllerAdvice;
9
+
10
+ import java.util.List;
11
+
12
+ @RestControllerAdvice
13
+ public class GlobalExceptionHandler {
14
+ @ExceptionHandler(UserNotFoundException.class)
15
+ @ResponseStatus(HttpStatus.NOT_FOUND)
16
+ public ErrorResponse handleUserNotFound(UserNotFoundException ex) {
17
+ return new ErrorResponse("USER_NOT_FOUND", ex.getMessage());
18
+ }
19
+
20
+ @ExceptionHandler(MethodArgumentNotValidException.class)
21
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
22
+ public ErrorResponse handleValidation(MethodArgumentNotValidException ex) {
23
+ List<String> errors = ex.getBindingResult()
24
+ .getFieldErrors()
25
+ .stream()
26
+ .map(e -> e.getField() + ": " + e.getDefaultMessage())
27
+ .toList();
28
+ return new ErrorResponse("VALIDATION_ERROR", errors);
29
+ }
30
+ }