moai-adk 0.25.4__py3-none-any.whl → 0.32.8__py3-none-any.whl

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.

Potentially problematic release.


This version of moai-adk might be problematic. Click here for more details.

Files changed (378) hide show
  1. moai_adk/__init__.py +2 -5
  2. moai_adk/__main__.py +114 -82
  3. moai_adk/cli/__init__.py +6 -1
  4. moai_adk/cli/commands/__init__.py +1 -3
  5. moai_adk/cli/commands/analyze.py +5 -16
  6. moai_adk/cli/commands/doctor.py +6 -18
  7. moai_adk/cli/commands/init.py +56 -125
  8. moai_adk/cli/commands/language.py +14 -35
  9. moai_adk/cli/commands/status.py +9 -15
  10. moai_adk/cli/commands/update.py +1555 -190
  11. moai_adk/cli/prompts/init_prompts.py +112 -56
  12. moai_adk/cli/spec_status.py +263 -0
  13. moai_adk/cli/ui/__init__.py +44 -0
  14. moai_adk/cli/ui/progress.py +422 -0
  15. moai_adk/cli/ui/prompts.py +389 -0
  16. moai_adk/cli/ui/theme.py +129 -0
  17. moai_adk/cli/worktree/__init__.py +27 -0
  18. moai_adk/cli/worktree/__main__.py +31 -0
  19. moai_adk/cli/worktree/cli.py +672 -0
  20. moai_adk/cli/worktree/exceptions.py +89 -0
  21. moai_adk/cli/worktree/manager.py +490 -0
  22. moai_adk/cli/worktree/models.py +65 -0
  23. moai_adk/cli/worktree/registry.py +128 -0
  24. moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
  25. moai_adk/core/analysis/session_analyzer.py +17 -56
  26. moai_adk/core/claude_integration.py +26 -54
  27. moai_adk/core/command_helpers.py +10 -10
  28. moai_adk/core/comprehensive_monitoring_system.py +1183 -0
  29. moai_adk/core/config/auto_spec_config.py +5 -11
  30. moai_adk/core/config/migration.py +19 -9
  31. moai_adk/core/config/unified.py +436 -0
  32. moai_adk/core/context_manager.py +6 -12
  33. moai_adk/core/enterprise_features.py +1404 -0
  34. moai_adk/core/error_recovery_system.py +725 -112
  35. moai_adk/core/event_driven_hook_system.py +1371 -0
  36. moai_adk/core/git/__init__.py +8 -0
  37. moai_adk/core/git/branch_manager.py +3 -11
  38. moai_adk/core/git/checkpoint.py +1 -3
  39. moai_adk/core/git/conflict_detector.py +413 -0
  40. moai_adk/core/git/manager.py +91 -1
  41. moai_adk/core/hooks/post_tool_auto_spec_completion.py +56 -80
  42. moai_adk/core/input_validation_middleware.py +1006 -0
  43. moai_adk/core/integration/engine.py +6 -18
  44. moai_adk/core/integration/integration_tester.py +10 -9
  45. moai_adk/core/integration/utils.py +1 -1
  46. moai_adk/core/issue_creator.py +10 -28
  47. moai_adk/core/jit_context_loader.py +956 -0
  48. moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
  49. moai_adk/core/language_config_resolver.py +485 -0
  50. moai_adk/core/language_validator.py +28 -41
  51. moai_adk/core/mcp/setup.py +15 -12
  52. moai_adk/core/merge/__init__.py +9 -0
  53. moai_adk/core/merge/analyzer.py +481 -0
  54. moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
  55. moai_adk/core/migration/backup_manager.py +78 -9
  56. moai_adk/core/migration/custom_element_scanner.py +358 -0
  57. moai_adk/core/migration/file_migrator.py +8 -17
  58. moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
  59. moai_adk/core/migration/selective_restorer.py +470 -0
  60. moai_adk/core/migration/template_utils.py +74 -0
  61. moai_adk/core/migration/user_selection_ui.py +338 -0
  62. moai_adk/core/migration/version_detector.py +6 -10
  63. moai_adk/core/migration/version_migrator.py +3 -3
  64. moai_adk/core/performance/cache_system.py +8 -10
  65. moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
  66. moai_adk/core/project/checker.py +2 -4
  67. moai_adk/core/project/detector.py +1 -3
  68. moai_adk/core/project/initializer.py +135 -23
  69. moai_adk/core/project/phase_executor.py +54 -81
  70. moai_adk/core/project/validator.py +6 -12
  71. moai_adk/core/quality/trust_checker.py +9 -27
  72. moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
  73. moai_adk/core/robust_json_parser.py +611 -0
  74. moai_adk/core/rollback_manager.py +73 -148
  75. moai_adk/core/session_manager.py +10 -26
  76. moai_adk/core/skill_loading_system.py +579 -0
  77. moai_adk/core/spec/confidence_scoring.py +31 -100
  78. moai_adk/core/spec/ears_template_engine.py +351 -286
  79. moai_adk/core/spec/quality_validator.py +35 -69
  80. moai_adk/core/spec_status_manager.py +64 -74
  81. moai_adk/core/template/backup.py +45 -20
  82. moai_adk/core/template/config.py +112 -39
  83. moai_adk/core/template/merger.py +11 -19
  84. moai_adk/core/template/processor.py +253 -149
  85. moai_adk/core/template_engine.py +73 -40
  86. moai_adk/core/template_variable_synchronizer.py +417 -0
  87. moai_adk/core/unified_permission_manager.py +745 -0
  88. moai_adk/core/user_behavior_analytics.py +851 -0
  89. moai_adk/core/version_sync.py +429 -0
  90. moai_adk/foundation/__init__.py +56 -0
  91. moai_adk/foundation/backend.py +1027 -0
  92. moai_adk/foundation/database.py +1115 -0
  93. moai_adk/foundation/devops.py +1585 -0
  94. moai_adk/foundation/ears.py +431 -0
  95. moai_adk/foundation/frontend.py +870 -0
  96. moai_adk/foundation/git/commit_templates.py +4 -12
  97. moai_adk/foundation/git.py +376 -0
  98. moai_adk/foundation/langs.py +484 -0
  99. moai_adk/foundation/ml_ops.py +1162 -0
  100. moai_adk/foundation/testing.py +1524 -0
  101. moai_adk/foundation/trust/trust_principles.py +23 -72
  102. moai_adk/foundation/trust/validation_checklist.py +57 -162
  103. moai_adk/project/__init__.py +0 -0
  104. moai_adk/project/configuration.py +1084 -0
  105. moai_adk/project/documentation.py +566 -0
  106. moai_adk/project/schema.py +447 -0
  107. moai_adk/statusline/alfred_detector.py +1 -3
  108. moai_adk/statusline/config.py +13 -4
  109. moai_adk/statusline/enhanced_output_style_detector.py +23 -15
  110. moai_adk/statusline/main.py +51 -15
  111. moai_adk/statusline/renderer.py +104 -48
  112. moai_adk/statusline/update_checker.py +3 -9
  113. moai_adk/statusline/version_reader.py +140 -46
  114. moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +549 -0
  115. moai_adk/templates/.claude/agents/moai/builder-agent.md +445 -0
  116. moai_adk/templates/.claude/agents/moai/builder-command.md +1132 -0
  117. moai_adk/templates/.claude/agents/moai/builder-skill.md +601 -0
  118. moai_adk/templates/.claude/agents/moai/expert-backend.md +831 -0
  119. moai_adk/templates/.claude/agents/moai/expert-database.md +774 -0
  120. moai_adk/templates/.claude/agents/moai/expert-debug.md +396 -0
  121. moai_adk/templates/.claude/agents/moai/expert-devops.md +711 -0
  122. moai_adk/templates/.claude/agents/moai/expert-frontend.md +666 -0
  123. moai_adk/templates/.claude/agents/moai/expert-security.md +474 -0
  124. moai_adk/templates/.claude/agents/moai/expert-uiux.md +1038 -0
  125. moai_adk/templates/.claude/agents/moai/manager-claude-code.md +429 -0
  126. moai_adk/templates/.claude/agents/moai/manager-docs.md +570 -0
  127. moai_adk/templates/.claude/agents/moai/manager-git.md +937 -0
  128. moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
  129. moai_adk/templates/.claude/agents/moai/manager-quality.md +598 -0
  130. moai_adk/templates/.claude/agents/moai/manager-spec.md +713 -0
  131. moai_adk/templates/.claude/agents/moai/manager-strategy.md +600 -0
  132. moai_adk/templates/.claude/agents/moai/manager-tdd.md +603 -0
  133. moai_adk/templates/.claude/agents/moai/mcp-context7.md +369 -0
  134. moai_adk/templates/.claude/agents/moai/mcp-figma.md +1567 -0
  135. moai_adk/templates/.claude/agents/moai/mcp-notion.md +749 -0
  136. moai_adk/templates/.claude/agents/moai/mcp-playwright.md +427 -0
  137. moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +994 -0
  138. moai_adk/templates/.claude/commands/moai/0-project.md +1143 -0
  139. moai_adk/templates/.claude/commands/moai/1-plan.md +1435 -0
  140. moai_adk/templates/.claude/commands/moai/2-run.md +883 -0
  141. moai_adk/templates/.claude/commands/moai/3-sync.md +993 -0
  142. moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
  143. moai_adk/templates/.claude/hooks/__init__.py +8 -0
  144. moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
  145. moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
  146. moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
  147. moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
  148. moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
  149. moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
  150. moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
  151. moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
  152. moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
  153. moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
  154. moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
  155. moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
  156. moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
  157. moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
  158. moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
  159. moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
  160. moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +921 -0
  161. moai_adk/templates/.claude/output-styles/moai/r2d2.md +380 -0
  162. moai_adk/templates/.claude/output-styles/moai/yoda.md +338 -0
  163. moai_adk/templates/.claude/settings.json +172 -0
  164. moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +247 -0
  165. moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
  166. moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
  167. moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
  168. moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
  169. moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
  170. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +319 -0
  171. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +320 -0
  172. moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
  173. moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
  174. moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
  175. moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
  176. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +496 -0
  177. moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +453 -0
  178. moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
  179. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
  180. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
  181. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/design-system-tokens.md +405 -0
  182. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
  183. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
  184. moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
  185. moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +491 -0
  186. moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
  187. moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
  188. moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
  189. moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
  190. moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
  191. moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
  192. moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +201 -0
  193. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
  194. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
  195. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
  196. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
  197. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
  198. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
  199. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
  200. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
  201. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
  202. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
  203. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
  204. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
  205. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
  206. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
  207. moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +438 -0
  208. moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +515 -0
  209. moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
  210. moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +346 -0
  211. moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
  212. moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
  213. moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
  214. moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
  215. moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
  216. moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
  217. moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
  218. moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
  219. moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +362 -0
  220. moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
  221. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
  222. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
  223. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
  224. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
  225. moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
  226. moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
  227. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
  228. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
  229. moai_adk/templates/.claude/skills/moai-integration-mcp/SKILL.md +352 -0
  230. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/README.md +52 -0
  231. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/error-handling.md +334 -0
  232. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/integration-patterns.md +310 -0
  233. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/security-authentication.md +256 -0
  234. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/server-architecture.md +253 -0
  235. moai_adk/templates/.claude/skills/moai-lang-unified/README.md +133 -0
  236. moai_adk/templates/.claude/skills/moai-lang-unified/SKILL.md +296 -0
  237. moai_adk/templates/.claude/skills/moai-lang-unified/examples.md +1269 -0
  238. moai_adk/templates/.claude/skills/moai-lang-unified/reference.md +331 -0
  239. moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +298 -0
  240. moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
  241. moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
  242. moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
  243. moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
  244. moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +316 -0
  245. moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
  246. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
  247. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
  248. moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
  249. moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
  250. moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
  251. moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
  252. moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
  253. moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
  254. moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
  255. moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +370 -0
  256. moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
  257. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
  258. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
  259. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
  260. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
  261. moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
  262. moai_adk/templates/.claude/skills/moai-platform-baas/README.md +186 -0
  263. moai_adk/templates/.claude/skills/moai-platform-baas/SKILL.md +290 -0
  264. moai_adk/templates/.claude/skills/moai-platform-baas/examples.md +1225 -0
  265. moai_adk/templates/.claude/skills/moai-platform-baas/reference.md +567 -0
  266. moai_adk/templates/.claude/skills/moai-platform-baas/scripts/provider-selector.py +323 -0
  267. moai_adk/templates/.claude/skills/moai-platform-baas/templates/stack-config.yaml +204 -0
  268. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +446 -0
  269. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
  270. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
  271. moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
  272. moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +387 -0
  273. moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
  274. moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
  275. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
  276. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
  277. moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
  278. moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +135 -0
  279. moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
  280. moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
  281. moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
  282. moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
  283. moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
  284. moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
  285. moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
  286. moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
  287. moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
  288. moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
  289. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
  290. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1362 -0
  291. moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
  292. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
  293. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
  294. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +71 -0
  295. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
  296. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
  297. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
  298. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
  299. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
  300. moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
  301. moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +374 -0
  302. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
  303. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
  304. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
  305. moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
  306. moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +453 -0
  307. moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
  308. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
  309. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
  310. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
  311. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
  312. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
  313. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
  314. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
  315. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
  316. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
  317. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
  318. moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
  319. moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
  320. moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
  321. moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
  322. moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
  323. moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +410 -0
  324. moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
  325. moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
  326. moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
  327. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
  328. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
  329. moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
  330. moai_adk/templates/.git-hooks/pre-commit +103 -41
  331. moai_adk/templates/.git-hooks/pre-push +116 -21
  332. moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
  333. moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
  334. moai_adk/templates/.gitignore +184 -44
  335. moai_adk/templates/.mcp.json +7 -9
  336. moai_adk/templates/.moai/cache/personalization.json +10 -0
  337. moai_adk/templates/.moai/config/config.yaml +344 -0
  338. moai_adk/templates/.moai/config/presets/manual.yaml +28 -0
  339. moai_adk/templates/.moai/config/presets/personal.yaml +30 -0
  340. moai_adk/templates/.moai/config/presets/team.yaml +33 -0
  341. moai_adk/templates/.moai/config/questions/_schema.yaml +79 -0
  342. moai_adk/templates/.moai/config/questions/tab1-user.yaml +108 -0
  343. moai_adk/templates/.moai/config/questions/tab2-project.yaml +122 -0
  344. moai_adk/templates/.moai/config/questions/tab3-git.yaml +542 -0
  345. moai_adk/templates/.moai/config/questions/tab4-quality.yaml +167 -0
  346. moai_adk/templates/.moai/config/questions/tab5-system.yaml +152 -0
  347. moai_adk/templates/.moai/config/sections/git-strategy.yaml +40 -0
  348. moai_adk/templates/.moai/config/sections/language.yaml +11 -0
  349. moai_adk/templates/.moai/config/sections/project.yaml +13 -0
  350. moai_adk/templates/.moai/config/sections/quality.yaml +15 -0
  351. moai_adk/templates/.moai/config/sections/system.yaml +14 -0
  352. moai_adk/templates/.moai/config/sections/user.yaml +5 -0
  353. moai_adk/templates/.moai/config/statusline-config.yaml +86 -0
  354. moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
  355. moai_adk/templates/CLAUDE.md +382 -501
  356. moai_adk/utils/__init__.py +24 -1
  357. moai_adk/utils/banner.py +7 -10
  358. moai_adk/utils/common.py +16 -30
  359. moai_adk/utils/link_validator.py +4 -12
  360. moai_adk/utils/safe_file_reader.py +2 -6
  361. moai_adk/utils/timeout.py +160 -0
  362. moai_adk/utils/toon_utils.py +256 -0
  363. moai_adk/version.py +22 -0
  364. moai_adk-0.32.8.dist-info/METADATA +2478 -0
  365. moai_adk-0.32.8.dist-info/RECORD +396 -0
  366. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/WHEEL +1 -1
  367. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/entry_points.txt +1 -0
  368. moai_adk/cli/commands/backup.py +0 -82
  369. moai_adk/cli/commands/improve_user_experience.py +0 -348
  370. moai_adk/cli/commands/migrate.py +0 -158
  371. moai_adk/cli/commands/validate_links.py +0 -118
  372. moai_adk/templates/.github/workflows/moai-gitflow.yml +0 -413
  373. moai_adk/templates/.github/workflows/moai-release-create.yml +0 -100
  374. moai_adk/templates/.github/workflows/moai-release-pipeline.yml +0 -188
  375. moai_adk/utils/user_experience.py +0 -531
  376. moai_adk-0.25.4.dist-info/METADATA +0 -2279
  377. moai_adk-0.25.4.dist-info/RECORD +0 -112
  378. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,1674 @@
1
+ # Claude Code Skills Examples Collection
2
+
3
+ Comprehensive collection of real-world skill examples covering various domains and complexity levels, all following official Claude Code standards.
4
+
5
+ Purpose: Practical examples and templates for skill creation
6
+ Target: Skill developers and Claude Code users
7
+ Last Updated: 2025-11-25
8
+ Version: 2.0.0
9
+
10
+ ---
11
+
12
+ ## Quick Reference (30 seconds)
13
+
14
+ Examples Cover: Documentation skills, language-specific patterns, domain expertise, integration patterns. Complexity Levels: Simple utilities, intermediate workflows, advanced orchestration. All Examples: Follow official formatting standards with proper frontmatter and progressive disclosure.
15
+
16
+ ---
17
+
18
+ ## Example Categories
19
+
20
+ ### 1. Documentation and Analysis Skills
21
+
22
+ #### Example 1: API Documentation Generator
23
+
24
+ ```yaml
25
+ ---
26
+ name: moai-docs-api-generator
27
+ description: Generate comprehensive API documentation from OpenAPI specifications and code comments. Use when you need to create, update, or analyze API documentation for REST/GraphQL services.
28
+ allowed-tools: Read, Write, Edit, Grep, Glob, WebFetch, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
29
+ version: 1.2.0
30
+ tags: [documentation, api, openapi, graphql]
31
+ updated: 2025-11-25
32
+ status: active
33
+ ---
34
+
35
+ # API Documentation Generator
36
+
37
+ Automated API documentation generation from OpenAPI specs, code comments, and GraphQL schemas with markdown output and interactive examples.
38
+
39
+ ## Quick Reference (30 seconds)
40
+
41
+ Parse OpenAPI/GraphQL specifications and generate comprehensive documentation with examples, authentication guides, and interactive testing instructions.
42
+
43
+ ## Implementation Guide
44
+
45
+ ### Core Capabilities
46
+ - OpenAPI Processing: Parse and validate OpenAPI 3.0+ specifications
47
+ - GraphQL Schema Analysis: Extract documentation from GraphQL schemas
48
+ - Code Comment Extraction: Generate docs from JSDoc and docstring comments
49
+ - Interactive Examples: Create runnable code examples for each endpoint
50
+
51
+ ### When to Use
52
+ - New API Projects: Generate initial documentation structure from specifications
53
+ - Documentation Updates: Sync existing docs with API changes
54
+ - API Reviews: Analyze API completeness and consistency
55
+ - Developer Portals: Create comprehensive API reference sites
56
+
57
+ ### Essential Patterns
58
+ ```python
59
+ # Parse OpenAPI specification
60
+ def parse_openapi_spec(spec_path):
61
+ """Parse and validate OpenAPI 3.0+ specification."""
62
+ with open(spec_path, 'r') as f:
63
+ spec = yaml.safe_load(f)
64
+
65
+ validate_openapi(spec)
66
+ return spec
67
+
68
+ # Generate endpoint documentation
69
+ def generate_endpoint_docs(endpoint_spec):
70
+ """Generate markdown documentation for API endpoint."""
71
+ return f"""
72
+ ## {endpoint_spec['method'].upper()} {endpoint_spec['path']}
73
+
74
+ Description: {endpoint_spec.get('summary', 'No description')}
75
+
76
+ Parameters:
77
+ {format_parameters(endpoint_spec.get('parameters', []))}
78
+
79
+ Response:
80
+ {format_response(endpoint_spec.get('responses', {}))}
81
+ """
82
+ ```
83
+
84
+ ```bash
85
+ # Generate documentation from codebase
86
+ find ./src -name "*.py" -exec grep -l "def.*api_" {} \; | \
87
+ xargs python extract_docs.py --output ./docs/api/
88
+ ```
89
+
90
+ ## Best Practices
91
+
92
+ DO:
93
+ - Include authentication examples for all security schemes
94
+ - Provide curl and client library examples for each endpoint
95
+ - Validate all generated examples against actual API
96
+ - Include error response documentation
97
+
98
+ DON'T:
99
+ - Generate documentation without example responses
100
+ - Skip authentication and authorization details
101
+ - Use deprecated OpenAPI specification versions
102
+ - Forget to document rate limiting and quotas
103
+
104
+ ## Works Well With
105
+
106
+ - [`moai-docs-toolkit`](../moai-docs-toolkit/SKILL.md) - General documentation patterns
107
+ - [`moai-domain-backend`](../moai-domain-backend/SKILL.md) - Backend API expertise
108
+ - [`moai-context7-integration`](../moai-context7-integration/SKILL.md) - Latest framework docs
109
+
110
+ ## Advanced Features
111
+
112
+ ### Interactive Documentation
113
+ Generate interactive API documentation with embedded testing tools:
114
+ ```html
115
+ <!-- Interactive API tester -->
116
+ <div class="api-tester">
117
+ <input type="text" id="endpoint-url" placeholder="/api/users">
118
+ <select id="http-method">
119
+ <option value="GET">GET</option>
120
+ <option value="POST">POST</option>
121
+ </select>
122
+ <button onclick="testEndpoint()">Test</button>
123
+ <pre id="response"></pre>
124
+ </div>
125
+ ```
126
+
127
+ ### Multi-language Client Examples
128
+ Automatically generate client library examples in multiple languages:
129
+ ```javascript
130
+ // JavaScript/Node.js Example
131
+ const response = await fetch('/api/users', {
132
+ method: 'GET',
133
+ headers: {
134
+ 'Authorization': `Bearer ${token}`,
135
+ 'Content-Type': 'application/json'
136
+ }
137
+ });
138
+ const users = await response.json();
139
+ ```
140
+
141
+ ```python
142
+ # Python Example
143
+ import requests
144
+
145
+ response = requests.get('/api/users', headers={
146
+ 'Authorization': f'Bearer {token}',
147
+ 'Content-Type': 'application/json'
148
+ })
149
+ users = response.json()
150
+ ```
151
+ ```
152
+
153
+ #### Example 2: Code Comment Analyzer
154
+
155
+ ```yaml
156
+ ---
157
+ name: moai-code-comment-analyzer
158
+ description: Extract and analyze code comments, documentation, and annotations from source code across multiple programming languages. Use when you need to audit code documentation quality or generate documentation from code.
159
+ allowed-tools: Read, Grep, Glob, Write, Edit
160
+ version: 1.0.0
161
+ tags: [documentation, code-analysis, quality]
162
+ updated: 2025-11-25
163
+ status: active
164
+ ---
165
+
166
+ # Code Comment Analyzer
167
+
168
+ Extract and analyze code comments, docstrings, and documentation patterns to assess documentation quality and generate structured documentation.
169
+
170
+ ## Quick Reference (30 seconds)
171
+
172
+ Parse source code files to extract comments, docstrings, and annotations, then analyze documentation coverage and quality across multiple programming languages.
173
+
174
+ ## Implementation Guide
175
+
176
+ ### Core Capabilities
177
+ - Multi-language Parsing: Support for Python, JavaScript, Java, Go, Rust
178
+ - Documentation Coverage: Calculate percentage of documented functions/classes
179
+ - Quality Assessment: Analyze comment quality and completeness
180
+ - Missing Documentation: Identify undocumented code elements
181
+
182
+ ### When to Use
183
+ - Code Reviews: Assess documentation quality before merging
184
+ - Documentation Audits: Comprehensive analysis of project documentation
185
+ - Onboarding: Generate documentation summaries for new team members
186
+ - Compliance: Ensure documentation meets organizational standards
187
+
188
+ ### Essential Patterns
189
+ ```python
190
+ # Extract docstrings from Python code
191
+ def extract_python_docstrings(file_path):
192
+ """Extract all docstrings from Python source file."""
193
+ with open(file_path, 'r') as f:
194
+ tree = ast.parse(f.read())
195
+
196
+ docstrings = []
197
+ for node in ast.walk(tree):
198
+ if isinstance(node, (ast.FunctionDef, ast.ClassDef, ast.Module)):
199
+ if ast.get_docstring(node):
200
+ docstrings.append({
201
+ 'type': type(node).__name__,
202
+ 'name': node.name,
203
+ 'docstring': ast.get_docstring(node),
204
+ 'line': node.lineno
205
+ })
206
+
207
+ return docstrings
208
+
209
+ # Calculate documentation coverage
210
+ def calculate_coverage(docstrings, total_elements):
211
+ """Calculate percentage of documented code elements."""
212
+ documented = len(docstrings)
213
+ coverage = (documented / total_elements) * 100
214
+ return {
215
+ 'documented': documented,
216
+ 'total': total_elements,
217
+ 'coverage_percentage': round(coverage, 2)
218
+ }
219
+ ```
220
+
221
+ ## Best Practices
222
+
223
+ DO:
224
+ - Analyze documentation completeness for all public APIs
225
+ - Check for outdated or incorrect documentation
226
+ - Consider comment quality, not just quantity
227
+ - Generate reports with actionable recommendations
228
+
229
+ DON'T:
230
+ - Count comments without assessing their quality
231
+ Ignore different documentation styles across languages
232
+ - Focus only on function-level documentation
233
+ - Assume all comments are accurate or current
234
+
235
+ ## Works Well With
236
+
237
+ - [`moai-lang-python`](../moai-lang-python/SKILL.md) - Python-specific patterns
238
+ - [`moai-code-quality`](../moai-code-quality/SKILL.md) - General code quality assessment
239
+ - [`moai-cc-claude-md`](../moai-cc-claude-md/SKILL.md) - Documentation generation
240
+
241
+ ## Advanced Features
242
+
243
+ ### Documentation Quality Scoring
244
+ Implement sophisticated quality assessment:
245
+ ```python
246
+ def assess_docstring_quality(docstring, context):
247
+ """Assess docstring quality on multiple dimensions."""
248
+ score = 0
249
+ factors = []
250
+
251
+ # Check for description
252
+ if docstring.strip():
253
+ score += 20
254
+ factors.append("Has description")
255
+
256
+ # Check for parameters documentation
257
+ if "Args:" in docstring or "Parameters:" in docstring:
258
+ score += 25
259
+ factors.append("Documents parameters")
260
+
261
+ # Check for return value documentation
262
+ if "Returns:" in docstring or "Return:" in docstring:
263
+ score += 20
264
+ factors.append("Documents return value")
265
+
266
+ # Check for examples
267
+ if "Example:" in docstring or "Usage:" in docstring:
268
+ score += 20
269
+ factors.append("Includes examples")
270
+
271
+ # Check for error documentation
272
+ if "Raises:" in docstring or "Exceptions:" in docstring:
273
+ score += 15
274
+ factors.append("Documents exceptions")
275
+
276
+ return score, factors
277
+ ```
278
+
279
+ ### Multi-language Standardization
280
+ Normalize documentation patterns across languages:
281
+ ```javascript
282
+ // JavaScript JSDoc standardization
283
+ function standardizeJSDoc(comment) {
284
+ // Ensure consistent JSDoc format
285
+ return comment
286
+ .replace(/\/\*\*?\s*\n/g, '/\n * ')
287
+ .replace(/\*\s*@\w+/g, ' * @')
288
+ .replace(/\s*\*\//g, ' */');
289
+ }
290
+ ```
291
+ ```
292
+
293
+ ### 2. Language-Specific Skills
294
+
295
+ #### Example 3: Python Testing Expert
296
+
297
+ ```yaml
298
+ ---
299
+ name: moai-python-testing-expert
300
+ description: Comprehensive Python testing expertise covering pytest, unittest, mocking, and test-driven development patterns. Use when writing tests, setting up test infrastructure, or improving test coverage and quality.
301
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
302
+ version: 1.1.0
303
+ tags: [python, testing, pytest, tdd, quality]
304
+ updated: 2025-11-25
305
+ status: active
306
+ ---
307
+
308
+ # Python Testing Expert
309
+
310
+ Complete Python testing solution with pytest expertise, mocking strategies, test automation, and TDD patterns for production-ready code quality.
311
+
312
+ ## Quick Reference (30 seconds)
313
+
314
+ Design and implement comprehensive Python test suites using pytest, unittest, mocking frameworks, and TDD methodologies for reliable, maintainable code.
315
+
316
+ ## Implementation Guide
317
+
318
+ ### Core Capabilities
319
+ - Pytest Mastery: Advanced pytest features, fixtures, and plugins
320
+ - Mocking Strategies: unittest.mock and pytest-mock best practices
321
+ - Test Organization: Structure tests for maintainability and scalability
322
+ - Coverage Analysis: Achieve and maintain high test coverage
323
+
324
+ ### When to Use
325
+ - New Projects: Set up comprehensive testing infrastructure from scratch
326
+ - Test Improvement: Enhance existing test suites with better patterns
327
+ - Code Reviews: Validate test quality and coverage
328
+ - CI/CD Integration: Implement automated testing pipelines
329
+
330
+ ### Essential Patterns
331
+ ```python
332
+ # Advanced pytest fixture with factory pattern
333
+ @pytest.fixture
334
+ def user_factory():
335
+ """Factory fixture for creating test users with different attributes."""
336
+ created_users = []
337
+
338
+ def create_user(kwargs):
339
+ defaults = {
340
+ 'username': 'testuser',
341
+ 'email': 'test@example.com',
342
+ 'is_active': True
343
+ }
344
+ defaults.update(kwargs)
345
+
346
+ user = User(defaults)
347
+ created_users.append(user)
348
+ return user
349
+
350
+ yield create_user
351
+
352
+ # Cleanup
353
+ User.objects.filter(id__in=[u.id for u in created_users]).delete()
354
+
355
+ # Parametrized test with multiple scenarios
356
+ @pytest.mark.parametrize("input_data,expected_status", [
357
+ ({"username": "valid"}, 201),
358
+ ({"username": ""}, 400),
359
+ ({"email": "invalid"}, 400),
360
+ ])
361
+ def test_user_creation_validation(client, user_factory, input_data, expected_status):
362
+ """Test user creation with various input validation scenarios."""
363
+ response = client.post('/api/users', json=input_data)
364
+ assert response.status_code == expected_status
365
+
366
+ # Mock external service with realistic behavior
367
+ @patch('requests.get')
368
+ def test_external_api_integration(mock_get, sample_responses):
369
+ """Test integration with external API service."""
370
+ mock_get.return_value.json.return_value = sample_responses['success']
371
+ mock_get.return_value.status_code = 200
372
+
373
+ result = external_service.get_data()
374
+
375
+ assert result['status'] == 'success'
376
+ mock_get.assert_called_once_with(
377
+ 'https://api.example.com/data',
378
+ headers={'Authorization': 'Bearer token123'}
379
+ )
380
+ ```
381
+
382
+ ```bash
383
+ # pytest configuration and execution
384
+ # pytest.ini
385
+ [tool:pytest]
386
+ testpaths = tests
387
+ python_files = test_*.py
388
+ python_classes = Test*
389
+ python_functions = test_*
390
+ addopts =
391
+ --strict-markers
392
+ --strict-config
393
+ --cov=src
394
+ --cov-report=html
395
+ --cov-report=term-missing
396
+ --cov-fail-under=85
397
+ markers =
398
+ slow: marks tests as slow (deselect with '-m "not slow"')
399
+ integration: marks tests as integration tests
400
+ unit: marks tests as unit tests
401
+
402
+ # Run specific test categories
403
+ pytest -m unit # Unit tests only
404
+ pytest -m integration # Integration tests only
405
+ pytest -m "not slow" # Skip slow tests
406
+ pytest --cov=src --cov-report=html # With coverage report
407
+ ```
408
+
409
+ ## Best Practices
410
+
411
+ DO:
412
+ - Use descriptive test names that explain the scenario
413
+ - Write independent tests that don't rely on execution order
414
+ - Create realistic test data with factories or fixtures
415
+ - Mock external dependencies but test integration points
416
+ - Aim for 85%+ coverage with meaningful tests
417
+
418
+ DON'T:
419
+ - Write tests that depend on external services or real databases
420
+ - Use hardcoded test data that makes tests brittle
421
+ - Skip error handling and edge case testing
422
+ - Write tests that are too complex or test multiple things
423
+ - Ignore test performance and execution time
424
+
425
+ ## Works Well With
426
+
427
+ - [`moai-lang-python`](../moai-lang-python/SKILL.md) - Python language patterns
428
+ - [`moai-tdd-implementer`](../moai-tdd-implementer/SKILL.md) - TDD methodology
429
+ - [`moai-quality-gate`](../moai-quality-gate/SKILL.md) - Quality validation
430
+
431
+ ## Advanced Features
432
+
433
+ ### Property-Based Testing
434
+ Use Hypothesis for sophisticated testing:
435
+ ```python
436
+ from hypothesis import given, strategies as st
437
+
438
+ @given(st.text(min_size=1), st.text(min_size=1))
439
+ def test_string_concatenation_properties(str1, str2):
440
+ """Test properties of string concatenation."""
441
+ result = str1 + str2
442
+
443
+ # Property: Length is sum of lengths
444
+ assert len(result) == len(str1) + len(str2)
445
+
446
+ # Property: Contains both strings
447
+ assert str1 in result
448
+ assert str2 in result
449
+
450
+ # Property: Order is preserved
451
+ assert result.index(str1) < result.index(str2) if str1 and str2 else True
452
+ ```
453
+
454
+ ### Performance Testing
455
+ Integrate performance testing with pytest:
456
+ ```python
457
+ import time
458
+ import pytest
459
+
460
+ @pytest.mark.performance
461
+ def test_api_response_time(client):
462
+ """Test API response time meets requirements."""
463
+ start_time = time.time()
464
+ response = client.get('/api/users')
465
+ end_time = time.time()
466
+
467
+ response_time = end_time - start_time
468
+
469
+ assert response.status_code == 200
470
+ assert response_time < 0.5 # Should respond in under 500ms
471
+ ```
472
+
473
+ ### Database Transaction Testing
474
+ Test database transaction behavior:
475
+ ```python
476
+ @pytest.mark.django_db
477
+ class TestUserCreationTransaction:
478
+ """Test user creation with database transactions."""
479
+
480
+ def test_successful_creation(self):
481
+ """Test successful user creation commits transaction."""
482
+ user_count_before = User.objects.count()
483
+
484
+ user = User.objects.create_user(
485
+ username='testuser',
486
+ email='test@example.com'
487
+ )
488
+
489
+ user_count_after = User.objects.count()
490
+ assert user_count_after == user_count_before + 1
491
+ assert User.objects.filter(username='testuser').exists()
492
+
493
+ def test_rollback_on_error(self):
494
+ """Test transaction rollback on validation error."""
495
+ user_count_before = User.objects.count()
496
+
497
+ with pytest.raises(ValidationError):
498
+ User.objects.create_user(
499
+ username='', # Invalid: empty username
500
+ email='test@example.com'
501
+ )
502
+
503
+ user_count_after = User.objects.count()
504
+ assert user_count_after == user_count_before
505
+ ```
506
+ ```
507
+
508
+ #### Example 4: JavaScript/TypeScript Modern Patterns
509
+
510
+ ```yaml
511
+ ---
512
+ name: moai-modern-javascript-patterns
513
+ description: Modern JavaScript and TypeScript patterns including ES2023+, async programming, functional programming, and type-safe development. Use when implementing modern web applications or libraries.
514
+ allowed-tools: Read, Write, Edit, Grep, Glob, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
515
+ version: 1.3.0
516
+ tags: [javascript, typescript, es2023, patterns, web]
517
+ updated: 2025-11-25
518
+ status: active
519
+ ---
520
+
521
+ # Modern JavaScript & TypeScript Patterns
522
+
523
+ Contemporary JavaScript and TypeScript development patterns with ES2023+ features, type-safe programming, and modern web development best practices.
524
+
525
+ ## Quick Reference (30 seconds)
526
+
527
+ Implement modern JavaScript applications using TypeScript, ES2023+ features, async/await patterns, functional programming, and type-safe development for scalable web applications.
528
+
529
+ ## Implementation Guide
530
+
531
+ ### Core Capabilities
532
+ - TypeScript Mastery: Advanced types, generics, and utility types
533
+ - Modern JavaScript: ES2023+ features and best practices
534
+ - Async Patterns: Promises, async/await, and concurrent programming
535
+ - Functional Programming: Immutability, pure functions, and composition
536
+
537
+ ### When to Use
538
+ - Web Applications: Modern frontend and full-stack development
539
+ - Node.js Services: Backend services with type safety
540
+ - Library Development: Reusable components and utilities
541
+ - API Integration: Type-safe client-server communication
542
+
543
+ ### Essential Patterns
544
+ ```typescript
545
+ // Advanced TypeScript utility types
546
+ type DeepPartial<T> = {
547
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
548
+ };
549
+
550
+ type OptionalKeys<T> = {
551
+ [K in keyof T]-?: {} extends Pick<T, K> ? K : never
552
+ }[keyof T];
553
+
554
+ type RequiredKeys<T> = Exclude<keyof T, OptionalKeys<T>>;
555
+
556
+ // Type-safe API client with generics
557
+ interface ApiResponse<T> {
558
+ data: T;
559
+ status: number;
560
+ message?: string;
561
+ }
562
+
563
+ class ApiClient {
564
+ async get<T>(url: string): Promise<ApiResponse<T>> {
565
+ const response = await fetch(url);
566
+ const data = await response.json();
567
+
568
+ return {
569
+ data,
570
+ status: response.status,
571
+ message: response.statusText
572
+ };
573
+ }
574
+
575
+ async post<T>(url: string, payload: unknown): Promise<ApiResponse<T>> {
576
+ const response = await fetch(url, {
577
+ method: 'POST',
578
+ headers: {
579
+ 'Content-Type': 'application/json',
580
+ },
581
+ body: JSON.stringify(payload),
582
+ });
583
+
584
+ const data = await response.json();
585
+
586
+ return {
587
+ data,
588
+ status: response.status,
589
+ message: response.statusText
590
+ };
591
+ }
592
+ }
593
+
594
+ // Modern async patterns with error handling
595
+ class AsyncResourceLoader<T> {
596
+ private cache = new Map<string, Promise<T>>();
597
+ private loading = new Map<string, boolean>();
598
+
599
+ async load(id: string, loader: () => Promise<T>): Promise<T> {
600
+ // Return cached promise if loading
601
+ if (this.cache.has(id)) {
602
+ return this.cache.get(id)!;
603
+ }
604
+
605
+ // Prevent duplicate loads
606
+ if (this.loading.get(id)) {
607
+ throw new Error(`Resource ${id} is already being loaded`);
608
+ }
609
+
610
+ this.loading.set(id, true);
611
+
612
+ const promise = loader()
613
+ .then(result => {
614
+ this.loading.delete(id);
615
+ return result;
616
+ })
617
+ .catch(error => {
618
+ this.loading.delete(id);
619
+ this.cache.delete(id);
620
+ throw error;
621
+ });
622
+
623
+ this.cache.set(id, promise);
624
+ return promise;
625
+ }
626
+
627
+ isLoaded(id: string): boolean {
628
+ return this.cache.has(id) && !this.loading.get(id);
629
+ }
630
+ }
631
+
632
+ // Functional programming patterns
633
+ type Predicate<T> = (value: T) => boolean;
634
+ type Mapper<T, U> = (value: T) => U;
635
+ type Reducer<T, U> = (accumulator: U, value: T) => U;
636
+
637
+ class FunctionalArray<T> extends Array<T> {
638
+ static from<T>(array: T[]): FunctionalArray<T> {
639
+ return Object.setPrototypeOf(array, FunctionalArray.prototype);
640
+ }
641
+
642
+ filter(predicate: Predicate<T>): FunctionalArray<T> {
643
+ return FunctionalArray.from(Array.prototype.filter.call(this, predicate));
644
+ }
645
+
646
+ map<U>(mapper: Mapper<T, U>): FunctionalArray<U> {
647
+ return FunctionalArray.from(Array.prototype.map.call(this, mapper));
648
+ }
649
+
650
+ reduce<U>(reducer: Reducer<T, U>, initialValue: U): U {
651
+ return Array.prototype.reduce.call(this, reducer, initialValue);
652
+ }
653
+
654
+ // Custom functional methods
655
+ partition(predicate: Predicate<T>): [FunctionalArray<T>, FunctionalArray<T>] {
656
+ const truthy: T[] = [];
657
+ const falsy: T[] = [];
658
+
659
+ for (const item of this) {
660
+ if (predicate(item)) {
661
+ truthy.push(item);
662
+ } else {
663
+ falsy.push(item);
664
+ }
665
+ }
666
+
667
+ return [FunctionalArray.from(truthy), FunctionalArray.from(falsy)];
668
+ }
669
+
670
+ async mapAsync<U>(mapper: Mapper<T, Promise<U>>): Promise<FunctionalArray<U>> {
671
+ const promises = this.map(mapper);
672
+ const results = await Promise.all(promises);
673
+ return FunctionalArray.from(results);
674
+ }
675
+ }
676
+
677
+ // Usage examples
678
+ const numbers = FunctionalArray.from([1, 2, 3, 4, 5, 6]);
679
+ const [even, odd] = numbers.partition(n => n % 2 === 0);
680
+
681
+ const doubled = even.map(n => n * 2); // [4, 8, 12]
682
+ const sum = doubled.reduce((acc, n) => acc + n, 0); // 24
683
+ ```
684
+
685
+ ## Best Practices
686
+
687
+ DO:
688
+ - Use strict TypeScript configuration for better type safety
689
+ - Leverage utility types for type transformations
690
+ - Implement proper error handling with typed exceptions
691
+ - Use async/await consistently for asynchronous operations
692
+ - Write pure functions when possible for better testability
693
+
694
+ DON'T:
695
+ - Use `any` type without justification
696
+ - Mix callbacks and promises in the same codebase
697
+ - Ignore TypeScript compilation errors or warnings
698
+ - Create deeply nested callback structures
699
+ - Skip proper error boundaries in React applications
700
+
701
+ ## Works Well With
702
+
703
+ - [`moai-domain-frontend`](../moai-domain-frontend/SKILL.md) - Frontend development patterns
704
+ - [`moai-context7-integration`](../moai-context7-integration/SKILL.md) - Latest framework docs
705
+ - [`moai-web-performance`](../moai-web-performance/SKILL.md) - Performance optimization
706
+
707
+ ## Advanced Features
708
+
709
+ ### Advanced Type Manipulation
710
+ ```typescript
711
+ // Type-safe event emitter
712
+ interface EventEmitterEvents {
713
+ 'user:login': (user: User) => void;
714
+ 'user:logout': () => void;
715
+ 'error': (error: Error) => void;
716
+ }
717
+
718
+ type EventHandler<T> = (payload: T) => void;
719
+
720
+ class TypedEventEmitter<T extends Record<string, any>> {
721
+ private listeners = {} as Record<keyof T, Set<EventHandler<any>>>;
722
+
723
+ on<K extends keyof T>(event: K, handler: EventHandler<T[K]>): void {
724
+ if (!this.listeners[event]) {
725
+ this.listeners[event] = new Set();
726
+ }
727
+ this.listeners[event].add(handler);
728
+ }
729
+
730
+ off<K extends keyof T>(event: K, handler: EventHandler<T[K]>): void {
731
+ this.listeners[event]?.delete(handler);
732
+ }
733
+
734
+ emit<K extends keyof T>(event: K, payload: T[K]): void {
735
+ this.listeners[event]?.forEach(handler => {
736
+ try {
737
+ handler(payload);
738
+ } catch (error) {
739
+ console.error(`Error in event handler for ${String(event)}:`, error);
740
+ }
741
+ });
742
+ }
743
+ }
744
+
745
+ // Usage
746
+ const emitter = new TypedEventEmitter<EventEmitterEvents>();
747
+ emitter.on('user:login', (user) => {
748
+ console.log(`User logged in: ${user.name}`);
749
+ });
750
+ emitter.emit('user:login', { id: 1, name: 'John' });
751
+ ```
752
+
753
+ ### Concurrent Programming Patterns
754
+ ```typescript
755
+ // Concurrent execution with error handling
756
+ class ConcurrentExecutor {
757
+ async executeAll<T, U>(
758
+ tasks: Array<() => Promise<T>>,
759
+ concurrency: number = 3
760
+ ): Promise<Array<T | U>> {
761
+ const results: Array<T | U> = [];
762
+ const executing: Promise<void>[] = [];
763
+
764
+ for (const task of tasks) {
765
+ const promise = task()
766
+ .then(result => {
767
+ results.push(result);
768
+ })
769
+ .catch(error => {
770
+ results.push(error as U);
771
+ })
772
+ .finally(() => {
773
+ executing.splice(executing.indexOf(promise), 1);
774
+ });
775
+
776
+ executing.push(promise);
777
+
778
+ if (executing.length >= concurrency) {
779
+ await Promise.race(executing);
780
+ }
781
+ }
782
+
783
+ await Promise.all(executing);
784
+ return results;
785
+ }
786
+ }
787
+
788
+ // Rate-limited API calls
789
+ class RateLimitedApi {
790
+ private queue: Array<() => Promise<any>> = [];
791
+ private processing = false;
792
+ private lastExecution = 0;
793
+ private readonly minInterval: number;
794
+
795
+ constructor(requestsPerSecond: number) {
796
+ this.minInterval = 1000 / requestsPerSecond;
797
+ }
798
+
799
+ async execute<T>(task: () => Promise<T>): Promise<T> {
800
+ return new Promise((resolve, reject) => {
801
+ this.queue.push(async () => {
802
+ try {
803
+ const result = await task();
804
+ resolve(result);
805
+ } catch (error) {
806
+ reject(error);
807
+ }
808
+ });
809
+
810
+ this.processQueue();
811
+ });
812
+ }
813
+
814
+ private async processQueue(): Promise<void> {
815
+ if (this.processing || this.queue.length === 0) {
816
+ return;
817
+ }
818
+
819
+ this.processing = true;
820
+
821
+ while (this.queue.length > 0) {
822
+ const now = Date.now();
823
+ const elapsed = now - this.lastExecution;
824
+
825
+ if (elapsed < this.minInterval) {
826
+ await new Promise(resolve =>
827
+ setTimeout(resolve, this.minInterval - elapsed)
828
+ );
829
+ }
830
+
831
+ const task = this.queue.shift()!;
832
+ await task();
833
+ this.lastExecution = Date.now();
834
+ }
835
+
836
+ this.processing = false;
837
+ }
838
+ }
839
+ ```
840
+ ```
841
+
842
+ ### 3. Domain-Specific Skills
843
+
844
+ #### Example 5: Security Analysis Expert
845
+
846
+ ```yaml
847
+ ---
848
+ name: moai-security-analysis-expert
849
+ description: Comprehensive security analysis expertise covering OWASP Top 10, vulnerability assessment, secure coding practices, and compliance validation. Use when conducting security audits, implementing security controls, or validating security measures.
850
+ allowed-tools: Read, Write, Edit, Grep, Glob, Bash, WebFetch, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
851
+ version: 1.2.0
852
+ tags: [security, owasp, vulnerability, compliance, audit]
853
+ updated: 2025-11-25
854
+ status: active
855
+ ---
856
+
857
+ # Security Analysis Expert
858
+
859
+ Complete security analysis solution with OWASP Top 10 expertise, vulnerability assessment, secure coding practices, and compliance validation for production-ready security.
860
+
861
+ ## Quick Reference (30 seconds)
862
+
863
+ Conduct comprehensive security analysis using OWASP Top 10 standards, vulnerability scanning, secure code review, and compliance validation for robust application security.
864
+
865
+ ## Implementation Guide
866
+
867
+ ### Core Capabilities
868
+ - OWASP Top 10 Analysis: Comprehensive coverage of current security threats
869
+ - Vulnerability Assessment: Automated and manual security testing
870
+ - Secure Code Review: Static and dynamic analysis for security issues
871
+ - Compliance Validation: SOC 2, ISO 27001, and regulatory compliance
872
+
873
+ ### When to Use
874
+ - Security Audits: Comprehensive security assessment of applications
875
+ - Code Reviews: Security-focused analysis of new code
876
+ - Compliance Checks: Validate against security standards and regulations
877
+ - Incident Response: Security breach analysis and remediation
878
+
879
+ ### Essential Patterns
880
+ ```python
881
+ # OWASP Top 10 vulnerability detection
882
+ class OWASPVulnerabilityScanner:
883
+ def __init__(self):
884
+ self.vulnerability_patterns = {
885
+ 'A01_2021_Broken_Access_Control': [
886
+ r'authorization.*==.*None',
887
+ r'@login_required.*decorator.*missing',
888
+ r'if.*user\.is_admin.*else.*pass'
889
+ ],
890
+ 'A02_2021_Cryptographic_Failures': [
891
+ r'hash.*without.*salt',
892
+ r'MD5\(',
893
+ r'SHA1\(',
894
+ r'password.*==.*text'
895
+ ],
896
+ 'A03_2021_Injection': [
897
+ r'execute\(',
898
+ r'eval\(',
899
+ r'\.format\(',
900
+ r'\%.*s.*format',
901
+ r'SQL.*string.*concatenation'
902
+ ]
903
+ }
904
+
905
+ def scan_file(self, file_path: str) -> List[Dict]:
906
+ """Scan source file for security vulnerabilities."""
907
+ vulnerabilities = []
908
+
909
+ with open(file_path, 'r') as f:
910
+ content = f.read()
911
+ lines = content.split('\n')
912
+
913
+ for category, patterns in self.vulnerability_patterns.items():
914
+ for pattern in patterns:
915
+ for line_num, line in enumerate(lines, 1):
916
+ if re.search(pattern, line, re.IGNORECASE):
917
+ vulnerabilities.append({
918
+ 'category': category,
919
+ 'severity': self._assess_severity(category),
920
+ 'line': line_num,
921
+ 'code': line.strip(),
922
+ 'pattern': pattern,
923
+ 'recommendation': self._get_recommendation(category)
924
+ })
925
+
926
+ return vulnerabilities
927
+
928
+ def _assess_severity(self, category: str) -> str:
929
+ """Assess vulnerability severity based on category."""
930
+ high_severity = [
931
+ 'A01_2021_Broken_Access_Control',
932
+ 'A02_2021_Cryptographic_Failures',
933
+ 'A03_2021_Injection'
934
+ ]
935
+ return 'HIGH' if category in high_severity else 'MEDIUM'
936
+
937
+ def _get_recommendation(self, category: str) -> str:
938
+ """Get security recommendation for vulnerability category."""
939
+ recommendations = {
940
+ 'A01_2021_Broken_Access_Control':
941
+ 'Implement proper authorization checks and validate user permissions on all sensitive operations.',
942
+ 'A02_2021_Cryptographic_Failures':
943
+ 'Use strong cryptographic algorithms with proper key management and salt for password hashing.',
944
+ 'A03_2021_Injection':
945
+ 'Use parameterized queries, prepared statements, or ORMs to prevent injection attacks.'
946
+ }
947
+ return recommendations.get(category, 'Review OWASP guidelines for this vulnerability category.')
948
+
949
+ # Security compliance validator
950
+ class SecurityComplianceValidator:
951
+ def __init__(self, framework: str = 'OWASP'):
952
+ self.framework = framework
953
+ self.compliance_rules = self._load_compliance_rules()
954
+
955
+ def validate_application(self, app_path: str) -> Dict:
956
+ """Validate application security compliance."""
957
+ results = {
958
+ 'compliant': True,
959
+ 'violations': [],
960
+ 'score': 0,
961
+ 'total_checks': 0
962
+ }
963
+
964
+ for rule in self.compliance_rules:
965
+ results['total_checks'] += 1
966
+
967
+ if not self._check_rule(app_path, rule):
968
+ results['compliant'] = False
969
+ results['violations'].append({
970
+ 'rule': rule['name'],
971
+ 'description': rule['description'],
972
+ 'severity': rule['severity']
973
+ })
974
+ else:
975
+ results['score'] += rule['weight']
976
+
977
+ results['compliance_percentage'] = (results['score'] / results['total_checks']) * 100
978
+ return results
979
+
980
+ def _check_rule(self, app_path: str, rule: Dict) -> bool:
981
+ """Check individual compliance rule."""
982
+ if rule['type'] == 'file_exists':
983
+ return os.path.exists(os.path.join(app_path, rule['path']))
984
+ elif rule['type'] == 'code_scan':
985
+ scanner = OWASPVulnerabilityScanner()
986
+ vulnerabilities = scanner.scan_file(os.path.join(app_path, rule['file']))
987
+ return len(vulnerabilities) == 0
988
+ elif rule['type'] == 'configuration':
989
+ return self._check_configuration(app_path, rule)
990
+
991
+ return False
992
+
993
+ # Secure coding patterns generator
994
+ class SecureCodingGenerator:
995
+ def generate_secure_code(self, template: str, context: Dict) -> str:
996
+ """Generate secure code from templates with security best practices."""
997
+ secure_patterns = {
998
+ 'database_access': self._generate_secure_db_access,
999
+ 'authentication': self._generate_secure_auth,
1000
+ 'input_validation': self._generate_input_validation,
1001
+ 'error_handling': self._generate_secure_error_handling
1002
+ }
1003
+
1004
+ if template in secure_patterns:
1005
+ return secure_patterns[template](context)
1006
+
1007
+ return self._apply_security_measures(template, context)
1008
+
1009
+ def _generate_secure_db_access(self, context: Dict) -> str:
1010
+ """Generate secure database access code."""
1011
+ return f"""
1012
+ # Secure database access with parameterized queries
1013
+ def get_user_by_id(user_id: int) -> Optional[User]:
1014
+ \"\"\"Get user by ID with secure database access.\"\"\"
1015
+ try:
1016
+ with get_db_connection() as conn:
1017
+ cursor = conn.cursor()
1018
+
1019
+ # Use parameterized query to prevent SQL injection
1020
+ cursor.execute(
1021
+ "SELECT id, username, email, created_at FROM users WHERE id = %s",
1022
+ (user_id,)
1023
+ )
1024
+
1025
+ result = cursor.fetchone()
1026
+ if result:
1027
+ return User(
1028
+ id=result[0],
1029
+ username=result[1],
1030
+ email=result[2],
1031
+ created_at=result[3]
1032
+ )
1033
+ return None
1034
+
1035
+ except DatabaseError as e:
1036
+ logger.error(f"Database error when fetching user {{user_id}}: {{e}}")
1037
+ return None
1038
+ """
1039
+ ```
1040
+
1041
+ ## Best Practices
1042
+
1043
+ DO:
1044
+ - Follow defense-in-depth principle with multiple security layers
1045
+ - Implement proper logging and monitoring for security events
1046
+ - Use secure coding frameworks and libraries
1047
+ - Regularly update dependencies and security patches
1048
+ - Conduct periodic security assessments and penetration testing
1049
+
1050
+ DON'T:
1051
+ - Roll your own cryptography or security implementations
1052
+ - Store sensitive data in plaintext or weak encryption
1053
+ - Trust client-side input without proper validation
1054
+ - Ignore security warnings from automated tools
1055
+ Assume security through obscurity is sufficient
1056
+
1057
+ ## Works Well With
1058
+
1059
+ - [`moai-cc-security`](../moai-cc-security/SKILL.md) - General security patterns
1060
+ - [`moai-quality-gate`](../moai-quality-gate/SKILL.md) - Quality validation
1061
+ - [`moai-domain-backend`](../moai-domain-backend/SKILL.md) - Backend security
1062
+
1063
+ ## Advanced Features
1064
+
1065
+ ### Threat Modeling Integration
1066
+ ```python
1067
+ # Automated threat modeling
1068
+ class ThreatModelAnalyzer:
1069
+ def __init__(self):
1070
+ self.threat_categories = {
1071
+ 'spoofing': self._analyze_spoofing_threats,
1072
+ 'tampering': self._analyze_tampering_threats,
1073
+ 'repudiation': self._analyze_repudiation_threats,
1074
+ 'information_disclosure': self._analyze_information_disclosure,
1075
+ 'denial_of_service': self._analyze_dos_threats,
1076
+ 'elevation_of_privilege': self._analyze_elevation_threats
1077
+ }
1078
+
1079
+ def analyze_application(self, app_spec: Dict) -> Dict:
1080
+ """Analyze application using STRIDE threat model."""
1081
+ threats = {}
1082
+
1083
+ for category, analyzer in self.threat_categories.items():
1084
+ threats[category] = analyzer(app_spec)
1085
+
1086
+ return {
1087
+ 'threats': threats,
1088
+ 'risk_score': self._calculate_risk_score(threats),
1089
+ 'mitigations': self._generate_mitigations(threats)
1090
+ }
1091
+
1092
+ def _analyze_spoofing_threats(self, app_spec: Dict) -> List[Dict]:
1093
+ """Analyze spoofing threats."""
1094
+ threats = []
1095
+
1096
+ # Check authentication mechanisms
1097
+ if 'authentication' in app_spec:
1098
+ auth_spec = app_spec['authentication']
1099
+ if auth_spec.get('method') == 'password_only':
1100
+ threats.append({
1101
+ 'threat': 'Credential spoofing',
1102
+ 'likelihood': 'MEDIUM',
1103
+ 'impact': 'HIGH',
1104
+ 'description': 'Password-only authentication is vulnerable to credential spoofing'
1105
+ })
1106
+
1107
+ return threats
1108
+ ```
1109
+
1110
+ ### Continuous Security Monitoring
1111
+ ```python
1112
+ # Real-time security monitoring
1113
+ class SecurityMonitor:
1114
+ def __init__(self):
1115
+ self.alert_thresholds = {
1116
+ 'failed_login_attempts': 5,
1117
+ 'unusual_access_patterns': 10,
1118
+ 'data_access_anomalies': 3
1119
+ }
1120
+
1121
+ async def monitor_security_events(self):
1122
+ """Monitor security events and detect anomalies."""
1123
+ while True:
1124
+ events = await self.collect_security_events()
1125
+ anomalies = self.detect_anomalies(events)
1126
+
1127
+ if anomalies:
1128
+ await self.handle_security_anomalies(anomalies)
1129
+
1130
+ await asyncio.sleep(60) # Check every minute
1131
+
1132
+ def detect_anomalies(self, events: List[Dict]) -> List[Dict]:
1133
+ """Detect security anomalies using pattern analysis."""
1134
+ anomalies = []
1135
+
1136
+ # Check for brute force attacks
1137
+ failed_logins = [e for e in events if e['type'] == 'failed_login']
1138
+ if len(failed_logins) > self.alert_thresholds['failed_login_attempts']:
1139
+ anomalies.append({
1140
+ 'type': 'brute_force_attack',
1141
+ 'severity': 'HIGH',
1142
+ 'events': failed_logins,
1143
+ 'recommendation': 'Implement rate limiting and account lockout'
1144
+ })
1145
+
1146
+ return anomalies
1147
+ ```
1148
+ ```
1149
+
1150
+ ### 4. Integration and Workflow Skills
1151
+
1152
+ #### Example 6: Workflow Automation Expert
1153
+
1154
+ ```yaml
1155
+ ---
1156
+ name: moai-workflow-automation-expert
1157
+ description: Workflow automation expertise covering CI/CD pipelines, DevOps automation, infrastructure as code, and deployment strategies. Use when setting up automated workflows, CI/CD pipelines, or infrastructure management.
1158
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebFetch, mcp__context7__resolve-library-id, mcp__context7__get-library-docs
1159
+ version: 1.1.0
1160
+ tags: [automation, cicd, devops, infrastructure, workflow]
1161
+ updated: 2025-11-25
1162
+ status: active
1163
+ ---
1164
+
1165
+ # Workflow Automation Expert
1166
+
1167
+ Complete workflow automation solution with CI/CD pipeline expertise, DevOps automation, infrastructure as code, and deployment strategies for modern software development.
1168
+
1169
+ ## Quick Reference (30 seconds)
1170
+
1171
+ Design and implement automated workflows using CI/CD pipelines, infrastructure as code, deployment automation, and monitoring for efficient software development and deployment.
1172
+
1173
+ ## Implementation Guide
1174
+
1175
+ ### Core Capabilities
1176
+ - CI/CD Pipeline Design: GitHub Actions, GitLab CI, Jenkins automation
1177
+ - Infrastructure as Code: Terraform, CloudFormation, Ansible expertise
1178
+ - Deployment Automation: Blue-green, canary, and rolling deployments
1179
+ - Monitoring Integration: Automated testing, quality gates, and alerting
1180
+
1181
+ ### When to Use
1182
+ - New Projects: Set up comprehensive CI/CD from scratch
1183
+ - Pipeline Optimization: Improve existing automation workflows
1184
+ - Infrastructure Management: Automate infrastructure provisioning and management
1185
+ - Deployment Strategies: Implement advanced deployment patterns
1186
+
1187
+ ### Essential Patterns
1188
+ ```yaml
1189
+ # GitHub Actions workflow template
1190
+ name: CI/CD Pipeline
1191
+ on:
1192
+ push:
1193
+ branches: [main, develop]
1194
+ pull_request:
1195
+ branches: [main]
1196
+
1197
+ env:
1198
+ NODE_VERSION: '18'
1199
+ PYTHON_VERSION: '3.11'
1200
+
1201
+ jobs:
1202
+ test:
1203
+ name: Test Suite
1204
+ runs-on: ubuntu-latest
1205
+ strategy:
1206
+ matrix:
1207
+ node-version: [16, 18, 20]
1208
+
1209
+ steps:
1210
+ - name: Checkout code
1211
+ uses: actions/checkout@v4
1212
+
1213
+ - name: Setup Node.js
1214
+ uses: actions/setup-node@v4
1215
+ with:
1216
+ node-version: ${{ matrix.node-version }}
1217
+ cache: 'npm'
1218
+
1219
+ - name: Install dependencies
1220
+ run: npm ci
1221
+
1222
+ - name: Run linting
1223
+ run: npm run lint
1224
+
1225
+ - name: Run tests
1226
+ run: npm run test:coverage
1227
+
1228
+ - name: Upload coverage reports
1229
+ uses: codecov/codecov-action@v3
1230
+ with:
1231
+ file: ./coverage/lcov.info
1232
+
1233
+ security:
1234
+ name: Security Scan
1235
+ runs-on: ubuntu-latest
1236
+ steps:
1237
+ - name: Checkout code
1238
+ uses: actions/checkout@v4
1239
+
1240
+ - name: Run security audit
1241
+ run: npm audit --audit-level high
1242
+
1243
+ - name: Run dependency check
1244
+ uses: snyk/actions/node@master
1245
+ env:
1246
+ SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
1247
+
1248
+ build:
1249
+ name: Build Application
1250
+ runs-on: ubuntu-latest
1251
+ needs: [test, security]
1252
+ steps:
1253
+ - name: Checkout code
1254
+ uses: actions/checkout@v4
1255
+
1256
+ - name: Setup Node.js
1257
+ uses: actions/setup-node@v4
1258
+ with:
1259
+ node-version: ${{ env.NODE_VERSION }}
1260
+ cache: 'npm'
1261
+
1262
+ - name: Install dependencies
1263
+ run: npm ci
1264
+
1265
+ - name: Build application
1266
+ run: npm run build
1267
+
1268
+ - name: Build Docker image
1269
+ run: |
1270
+ docker build -t myapp:${{ github.sha }} .
1271
+ docker tag myapp:${{ github.sha }} myapp:latest
1272
+
1273
+ - name: Push to registry
1274
+ if: github.ref == 'refs/heads/main'
1275
+ run: |
1276
+ echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
1277
+ docker push myapp:${{ github.sha }}
1278
+ docker push myapp:latest
1279
+
1280
+ deploy:
1281
+ name: Deploy to Production
1282
+ runs-on: ubuntu-latest
1283
+ needs: [build]
1284
+ if: github.ref == 'refs/heads/main'
1285
+ environment: production
1286
+
1287
+ steps:
1288
+ - name: Deploy to Kubernetes
1289
+ run: |
1290
+ kubectl set image deployment/myapp myapp=myapp:${{ github.sha }}
1291
+ kubectl rollout status deployment/myapp
1292
+
1293
+ - name: Run smoke tests
1294
+ run: |
1295
+ npm run test:smoke
1296
+ ```
1297
+
1298
+ ```python
1299
+ # Terraform infrastructure as code
1300
+ # main.tf
1301
+ terraform {
1302
+ required_version = ">= 1.0"
1303
+ required_providers {
1304
+ aws = {
1305
+ source = "hashicorp/aws"
1306
+ version = "~> 5.0"
1307
+ }
1308
+ }
1309
+
1310
+ backend "s3" {
1311
+ bucket = "my-terraform-state"
1312
+ key = "production/terraform.tfstate"
1313
+ region = "us-west-2"
1314
+ }
1315
+ }
1316
+
1317
+ provider "aws" {
1318
+ region = var.aws_region
1319
+ }
1320
+
1321
+ # VPC configuration
1322
+ resource "aws_vpc" "main" {
1323
+ cidr_block = var.vpc_cidr
1324
+ enable_dns_hostnames = true
1325
+ enable_dns_support = true
1326
+
1327
+ tags = {
1328
+ Name = "main-vpc"
1329
+ Environment = var.environment
1330
+ }
1331
+ }
1332
+
1333
+ # Security groups
1334
+ resource "aws_security_group" "web" {
1335
+ name_prefix = "web-sg"
1336
+ vpc_id = aws_vpc.main.id
1337
+
1338
+ ingress {
1339
+ from_port = 80
1340
+ to_port = 80
1341
+ protocol = "tcp"
1342
+ cidr_blocks = ["0.0.0.0/0"]
1343
+ }
1344
+
1345
+ ingress {
1346
+ from_port = 443
1347
+ to_port = 443
1348
+ protocol = "tcp"
1349
+ cidr_blocks = ["0.0.0.0/0"]
1350
+ }
1351
+
1352
+ egress {
1353
+ from_port = 0
1354
+ to_port = 0
1355
+ protocol = "-1"
1356
+ cidr_blocks = ["0.0.0.0/0"]
1357
+ }
1358
+
1359
+ tags = {
1360
+ Name = "web-sg"
1361
+ Environment = var.environment
1362
+ }
1363
+ }
1364
+
1365
+ # ECS cluster and service
1366
+ resource "aws_ecs_cluster" "main" {
1367
+ name = "${var.project_name}-cluster"
1368
+
1369
+ setting {
1370
+ name = "containerInsights"
1371
+ value = "enabled"
1372
+ }
1373
+ }
1374
+
1375
+ resource "aws_ecs_task_definition" "app" {
1376
+ family = "${var.project_name}-app"
1377
+ network_mode = "awsvpc"
1378
+ requires_compatibilities = ["FARGATE"]
1379
+ cpu = "256"
1380
+ memory = "512"
1381
+
1382
+ container_definitions = jsonencode([
1383
+ {
1384
+ name = "app"
1385
+ image = "${var.aws_account_id}.dkr.ecr.${var.aws_region}.amazonaws.com/${var.project_name}:${var.image_tag}"
1386
+
1387
+ port_mappings = [
1388
+ {
1389
+ containerPort = 80
1390
+ protocol = "tcp"
1391
+ }
1392
+ ]
1393
+
1394
+ environment = [
1395
+ {
1396
+ name = "NODE_ENV"
1397
+ value = var.environment
1398
+ }
1399
+ ]
1400
+
1401
+ log_configuration = {
1402
+ log_driver = "awslogs"
1403
+ options = {
1404
+ "awslogs-group" = "/ecs/${var.project_name}"
1405
+ "awslogs-region" = var.aws_region
1406
+ "awslogs-stream-prefix" = "ecs"
1407
+ }
1408
+ }
1409
+ }
1410
+ ])
1411
+ }
1412
+
1413
+ # Auto Scaling
1414
+ resource "aws_appautoscaling_target" "ecs_target" {
1415
+ max_capacity = 10
1416
+ min_capacity = 2
1417
+ resource_id = "service/${aws_ecs_cluster.main.name}/${aws_ecs_service.app.name}"
1418
+ scalable_dimension = "ecs:service:DesiredCount"
1419
+ service_namespace = "ecs"
1420
+ }
1421
+
1422
+ resource "aws_appautoscaling_policy" "ecs_policy_cpu" {
1423
+ name = "cpu-autoscaling"
1424
+ policy_type = "TargetTrackingScaling"
1425
+ resource_id = aws_appautoscaling_target.ecs_target.resource_id
1426
+ scalable_dimension = aws_appautoscaling_target.ecs_target.scalable_dimension
1427
+ service_namespace = aws_appautoscaling_target.ecs_target.service_namespace
1428
+
1429
+ target_tracking_scaling_policy_configuration {
1430
+ predefined_metric_specification {
1431
+ predefined_metric_type = "ECSServiceAverageCPUUtilization"
1432
+ }
1433
+
1434
+ target_value = 70.0
1435
+ }
1436
+ }
1437
+ ```
1438
+
1439
+ ## Best Practices
1440
+
1441
+ DO:
1442
+ - Implement proper secrets management using environment variables or secret stores
1443
+ - Use infrastructure as code for reproducible deployments
1444
+ - Implement proper monitoring and alerting for all services
1445
+ - Use blue-green or canary deployments for zero-downtime releases
1446
+ - Implement proper rollback mechanisms for failed deployments
1447
+
1448
+ DON'T:
1449
+ - Hardcode credentials or sensitive information in configuration
1450
+ Skip proper testing and validation in CI/CD pipelines
1451
+ - Deploy directly to production without staging validation
1452
+ - Ignore security scanning and vulnerability assessment
1453
+ - Use manual processes for repetitive deployment tasks
1454
+
1455
+ ## Works Well With
1456
+
1457
+ - [`moai-devops-expert`](../moai-devops-expert/SKILL.md) - DevOps best practices
1458
+ - [`moai-monitoring-expert`](../moai-monitoring-expert/SKILL.md) - Monitoring strategies
1459
+ - [`moai-security-expert`](../moai-security-expert/SKILL.md) - Security automation
1460
+
1461
+ ## Advanced Features
1462
+
1463
+ ### Multi-Environment Deployment
1464
+ ```python
1465
+ # Environment-specific configuration management
1466
+ class DeploymentManager:
1467
+ def __init__(self, config_file: str):
1468
+ self.config = self._load_config(config_file)
1469
+ self.environments = self.config['environments']
1470
+
1471
+ def deploy_to_environment(self, environment: str, version: str):
1472
+ """Deploy application to specific environment with validation."""
1473
+ if environment not in self.environments:
1474
+ raise ValueError(f"Unknown environment: {environment}")
1475
+
1476
+ env_config = self.environments[environment]
1477
+
1478
+ # Pre-deployment validation
1479
+ self._validate_environment(environment)
1480
+
1481
+ # Deploy with environment-specific configuration
1482
+ self._apply_configuration(environment)
1483
+ self._deploy_application(version, env_config)
1484
+
1485
+ # Post-deployment validation
1486
+ self._validate_deployment(environment, version)
1487
+
1488
+ def _validate_environment(self, environment: str):
1489
+ """Validate environment is ready for deployment."""
1490
+ env_config = self.environments[environment]
1491
+
1492
+ # Check required services are running
1493
+ for service in env_config.get('required_services', []):
1494
+ if not self._check_service_health(service):
1495
+ raise RuntimeError(f"Required service {service} is not healthy")
1496
+
1497
+ # Check resource availability
1498
+ if not self._check_resource_availability(environment):
1499
+ raise RuntimeError(f"Insufficient resources in {environment}")
1500
+
1501
+ def _validate_deployment(self, environment: str, version: str):
1502
+ """Validate deployment was successful."""
1503
+ env_config = self.environments[environment]
1504
+
1505
+ # Run health checks
1506
+ for health_check in env_config.get('health_checks', []):
1507
+ if not self._run_health_check(health_check):
1508
+ raise RuntimeError(f"Health check failed: {health_check}")
1509
+
1510
+ # Run smoke tests
1511
+ if 'smoke_tests' in env_config:
1512
+ self._run_smoke_tests(env_config['smoke_tests'])
1513
+ ```
1514
+
1515
+ ### Automated Rollback
1516
+ ```yaml
1517
+ # Deployment with automatic rollback
1518
+ name: Deploy with Rollback
1519
+ on:
1520
+ push:
1521
+ branches: [main]
1522
+
1523
+ jobs:
1524
+ deploy:
1525
+ runs-on: ubuntu-latest
1526
+ steps:
1527
+ - name: Deploy application
1528
+ id: deploy
1529
+ run: |
1530
+ # Deploy and get new version
1531
+ NEW_VERSION=$(deploy.sh)
1532
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
1533
+
1534
+ - name: Health check
1535
+ run: |
1536
+ # Wait for deployment to be ready
1537
+ sleep 30
1538
+
1539
+ # Run health checks
1540
+ if ! health-check.sh; then
1541
+ echo "Health check failed, initiating rollback"
1542
+ echo "needs_rollback=true" >> $GITHUB_ENV
1543
+ fi
1544
+
1545
+ - name: Rollback on failure
1546
+ if: env.needs_rollback == 'true'
1547
+ run: |
1548
+ # Get previous version
1549
+ PREVIOUS_VERSION=$(get-previous-version.sh)
1550
+
1551
+ # Rollback to previous version
1552
+ rollback.sh $PREVIOUS_VERSION
1553
+
1554
+ # Notify team
1555
+ notify-rollback.sh ${{ steps.deploy.outputs.new_version }} $PREVIOUS_VERSION
1556
+ ```
1557
+ ```
1558
+
1559
+ ---
1560
+
1561
+ ## Skill Creation Process
1562
+
1563
+ ### 1. Planning Phase
1564
+
1565
+ Identify Need:
1566
+ - What specific problem does this skill solve?
1567
+ - Who are the target users?
1568
+ - What are the trigger scenarios?
1569
+
1570
+ Define Scope:
1571
+ - Single responsibility principle
1572
+ - Clear boundaries and limitations
1573
+ - Integration points with other skills
1574
+
1575
+ ### 2. Design Phase
1576
+
1577
+ Architecture Design:
1578
+ - Progressive disclosure structure
1579
+ - Tool permission requirements
1580
+ - Error handling strategies
1581
+
1582
+ Content Planning:
1583
+ - Quick Reference (30-second value)
1584
+ - Implementation Guide structure
1585
+ - Best Practices and examples
1586
+
1587
+ ### 3. Implementation Phase
1588
+
1589
+ Frontmatter Creation:
1590
+ ```yaml
1591
+ ---
1592
+ name: skill-name
1593
+ description: Specific description with trigger scenarios
1594
+ allowed-tools: minimal, specific, tools
1595
+ version: 1.0.0
1596
+ tags: [relevant, tags]
1597
+ updated: 2025-11-25
1598
+ status: active
1599
+ ---
1600
+ ```
1601
+
1602
+ Content Development:
1603
+ - Start with Quick Reference
1604
+ - Build Implementation Guide with examples
1605
+ - Add Best Practices with DO/DON'T
1606
+ - Include Works Well With section
1607
+
1608
+ ### 4. Validation Phase
1609
+
1610
+ Technical Validation:
1611
+ - YAML syntax validation
1612
+ - Code example testing
1613
+ - Link verification
1614
+ - Line count compliance
1615
+
1616
+ Quality Validation:
1617
+ - Content clarity and specificity
1618
+ - Technical accuracy
1619
+ - User experience optimization
1620
+ - Standards compliance
1621
+
1622
+ ### 5. Publication Phase
1623
+
1624
+ File Structure:
1625
+ ```
1626
+ skill-name/
1627
+ SKILL.md (≤500 lines)
1628
+ reference.md (if needed)
1629
+ examples.md (if needed)
1630
+ scripts/ (if needed)
1631
+ ```
1632
+
1633
+ Version Control:
1634
+ - Semantic versioning
1635
+ - Change documentation
1636
+ - Update tracking
1637
+ - Compatibility notes
1638
+
1639
+ ---
1640
+
1641
+ ## Maintenance and Updates
1642
+
1643
+ ### Regular Review Schedule
1644
+
1645
+ Monthly Reviews:
1646
+ - Check for official standards updates
1647
+ - Review example code for currency
1648
+ - Validate external links and references
1649
+ - Update best practices based on community feedback
1650
+
1651
+ Quarterly Updates:
1652
+ - Major version compatibility checks
1653
+ - Performance optimization reviews
1654
+ - Integration testing with other skills
1655
+ - User feedback incorporation
1656
+
1657
+ ### Update Process
1658
+
1659
+ 1. Assessment: Determine update scope and impact
1660
+ 2. Planning: Plan changes with backward compatibility
1661
+ 3. Implementation: Update content and examples
1662
+ 4. Testing: Validate all functionality and examples
1663
+ 5. Documentation: Update changelog and version info
1664
+ 6. Publication: Deploy with proper version bumping
1665
+
1666
+ ---
1667
+
1668
+ Version: 2.0.0
1669
+ Compliance: Claude Code Official Standards
1670
+ Last Updated: 2025-11-25
1671
+ Examples Count: 6 comprehensive examples
1672
+ Skill Categories: Documentation, Language, Domain, Integration
1673
+
1674
+ Generated with Claude Code using official documentation and best practices.