@c0x12c/ai-toolkit 1.15.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 (255) hide show
  1. package/.claude-plugin/marketplace.json +16 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/README.md +439 -0
  4. package/VERSION +1 -0
  5. package/agents/design-critic.md +127 -0
  6. package/agents/idea-killer.md +72 -0
  7. package/agents/infrastructure-expert.md +49 -0
  8. package/agents/micronaut-backend-expert.md +45 -0
  9. package/agents/phase-reviewer.md +150 -0
  10. package/agents/research-planner.md +70 -0
  11. package/agents/solution-architect-cto.md +49 -0
  12. package/agents/sre-architect.md +49 -0
  13. package/agents/team-coordinator.md +111 -0
  14. package/bin/cli.js +780 -0
  15. package/claude-md/00-header.md +39 -0
  16. package/claude-md/01-core.md +105 -0
  17. package/claude-md/05-database.md +20 -0
  18. package/claude-md/11-backend-micronaut.md +19 -0
  19. package/claude-md/20-frontend-react.md +44 -0
  20. package/claude-md/25-ux-design.md +56 -0
  21. package/claude-md/30-infrastructure.md +24 -0
  22. package/claude-md/30-project-mgmt.md +119 -0
  23. package/claude-md/40-product.md +39 -0
  24. package/claude-md/50-ops.md +34 -0
  25. package/claude-md/60-research.md +27 -0
  26. package/claude-md/90-footer.md +21 -0
  27. package/commands/spartan/brainstorm.md +134 -0
  28. package/commands/spartan/brownfield.md +157 -0
  29. package/commands/spartan/build.md +435 -0
  30. package/commands/spartan/careful.md +94 -0
  31. package/commands/spartan/commit-message.md +112 -0
  32. package/commands/spartan/content.md +17 -0
  33. package/commands/spartan/context-save.md +161 -0
  34. package/commands/spartan/contribute.md +140 -0
  35. package/commands/spartan/daily.md +42 -0
  36. package/commands/spartan/debug.md +308 -0
  37. package/commands/spartan/deep-dive.md +55 -0
  38. package/commands/spartan/deploy.md +207 -0
  39. package/commands/spartan/e2e.md +264 -0
  40. package/commands/spartan/env-setup.md +166 -0
  41. package/commands/spartan/epic.md +199 -0
  42. package/commands/spartan/fe-review.md +181 -0
  43. package/commands/spartan/figma-to-code.md +260 -0
  44. package/commands/spartan/forensics.md +46 -0
  45. package/commands/spartan/freeze.md +84 -0
  46. package/commands/spartan/fundraise.md +53 -0
  47. package/commands/spartan/gate-review.md +229 -0
  48. package/commands/spartan/gsd-upgrade.md +376 -0
  49. package/commands/spartan/guard.md +42 -0
  50. package/commands/spartan/init-project.md +178 -0
  51. package/commands/spartan/init-rules.md +298 -0
  52. package/commands/spartan/interview.md +154 -0
  53. package/commands/spartan/kickoff.md +73 -0
  54. package/commands/spartan/kotlin-service.md +109 -0
  55. package/commands/spartan/lean-canvas.md +222 -0
  56. package/commands/spartan/lint-rules.md +122 -0
  57. package/commands/spartan/map-codebase.md +124 -0
  58. package/commands/spartan/migration.md +82 -0
  59. package/commands/spartan/next-app.md +317 -0
  60. package/commands/spartan/next-feature.md +212 -0
  61. package/commands/spartan/onboard.md +326 -0
  62. package/commands/spartan/outreach.md +16 -0
  63. package/commands/spartan/phase.md +142 -0
  64. package/commands/spartan/pitch.md +18 -0
  65. package/commands/spartan/plan.md +210 -0
  66. package/commands/spartan/pr-ready.md +202 -0
  67. package/commands/spartan/project.md +106 -0
  68. package/commands/spartan/qa.md +222 -0
  69. package/commands/spartan/research.md +254 -0
  70. package/commands/spartan/review.md +132 -0
  71. package/commands/spartan/scan-rules.md +173 -0
  72. package/commands/spartan/sessions.md +143 -0
  73. package/commands/spartan/spec.md +131 -0
  74. package/commands/spartan/startup.md +257 -0
  75. package/commands/spartan/team.md +570 -0
  76. package/commands/spartan/teardown.md +161 -0
  77. package/commands/spartan/testcontainer.md +97 -0
  78. package/commands/spartan/tf-cost.md +123 -0
  79. package/commands/spartan/tf-deploy.md +116 -0
  80. package/commands/spartan/tf-drift.md +100 -0
  81. package/commands/spartan/tf-import.md +107 -0
  82. package/commands/spartan/tf-module.md +121 -0
  83. package/commands/spartan/tf-plan.md +100 -0
  84. package/commands/spartan/tf-review.md +106 -0
  85. package/commands/spartan/tf-scaffold.md +109 -0
  86. package/commands/spartan/tf-security.md +147 -0
  87. package/commands/spartan/think.md +221 -0
  88. package/commands/spartan/unfreeze.md +13 -0
  89. package/commands/spartan/update.md +134 -0
  90. package/commands/spartan/ux.md +1233 -0
  91. package/commands/spartan/validate.md +193 -0
  92. package/commands/spartan/web-to-prd.md +706 -0
  93. package/commands/spartan/workstreams.md +109 -0
  94. package/commands/spartan/write.md +16 -0
  95. package/commands/spartan.md +386 -0
  96. package/frameworks/00-framework-comparison-guide.md +317 -0
  97. package/frameworks/01-lean-canvas.md +196 -0
  98. package/frameworks/02-design-sprint.md +304 -0
  99. package/frameworks/03-foundation-sprint.md +337 -0
  100. package/frameworks/04-business-model-canvas.md +391 -0
  101. package/frameworks/05-customer-development.md +426 -0
  102. package/frameworks/06-jobs-to-be-done.md +358 -0
  103. package/frameworks/07-mom-test.md +392 -0
  104. package/frameworks/08-value-proposition-canvas.md +488 -0
  105. package/frameworks/09-javelin-board.md +428 -0
  106. package/frameworks/10-build-measure-learn.md +467 -0
  107. package/frameworks/11-mvp-approaches.md +533 -0
  108. package/frameworks/think-before-build.md +593 -0
  109. package/lib/assembler.js +197 -0
  110. package/lib/assembler.test.js +159 -0
  111. package/lib/detector.js +166 -0
  112. package/lib/detector.test.js +221 -0
  113. package/lib/packs.js +16 -0
  114. package/lib/resolver.js +272 -0
  115. package/lib/resolver.test.js +298 -0
  116. package/lib/worktree.sh +104 -0
  117. package/package.json +50 -0
  118. package/packs/backend-micronaut.yaml +35 -0
  119. package/packs/backend-nodejs.yaml +15 -0
  120. package/packs/backend-python.yaml +15 -0
  121. package/packs/core.yaml +37 -0
  122. package/packs/database.yaml +21 -0
  123. package/packs/frontend-react.yaml +24 -0
  124. package/packs/infrastructure.yaml +40 -0
  125. package/packs/ops.yaml +16 -0
  126. package/packs/packs.compiled.json +371 -0
  127. package/packs/product.yaml +22 -0
  128. package/packs/project-mgmt.yaml +24 -0
  129. package/packs/research.yaml +39 -0
  130. package/packs/shared-backend.yaml +14 -0
  131. package/packs/ux-design.yaml +21 -0
  132. package/rules/backend-micronaut/API_DESIGN.md +313 -0
  133. package/rules/backend-micronaut/BATCH_PROCESSING.md +92 -0
  134. package/rules/backend-micronaut/CONTROLLERS.md +388 -0
  135. package/rules/backend-micronaut/KOTLIN.md +414 -0
  136. package/rules/backend-micronaut/RETROFIT_PLACEMENT.md +290 -0
  137. package/rules/backend-micronaut/SERVICES_AND_BEANS.md +325 -0
  138. package/rules/core/NAMING_CONVENTIONS.md +208 -0
  139. package/rules/core/SKILL_AUTHORING.md +174 -0
  140. package/rules/core/TIMEZONE.md +316 -0
  141. package/rules/database/ORM_AND_REPO.md +289 -0
  142. package/rules/database/SCHEMA.md +146 -0
  143. package/rules/database/TRANSACTIONS.md +311 -0
  144. package/rules/frontend-react/FRONTEND.md +344 -0
  145. package/rules/infrastructure/MODULES.md +260 -0
  146. package/rules/infrastructure/NAMING.md +196 -0
  147. package/rules/infrastructure/PROVIDERS.md +309 -0
  148. package/rules/infrastructure/SECURITY.md +310 -0
  149. package/rules/infrastructure/STATE_AND_BACKEND.md +237 -0
  150. package/rules/infrastructure/STRUCTURE.md +234 -0
  151. package/rules/infrastructure/VARIABLES.md +285 -0
  152. package/rules/shared-backend/ARCHITECTURE.md +46 -0
  153. package/rules/ux-design/DESIGN_PROCESS.md +176 -0
  154. package/skills/api-endpoint-creator/SKILL.md +455 -0
  155. package/skills/api-endpoint-creator/error-handling-guide.md +244 -0
  156. package/skills/api-endpoint-creator/examples.md +522 -0
  157. package/skills/api-endpoint-creator/testing-patterns.md +302 -0
  158. package/skills/article-writing/SKILL.md +109 -0
  159. package/skills/article-writing/examples.md +59 -0
  160. package/skills/backend-api-design/SKILL.md +84 -0
  161. package/skills/backend-api-design/code-patterns.md +138 -0
  162. package/skills/brainstorm/SKILL.md +95 -0
  163. package/skills/browser-qa/SKILL.md +87 -0
  164. package/skills/browser-qa/playwright-snippets.md +110 -0
  165. package/skills/ci-cd-patterns/SKILL.md +108 -0
  166. package/skills/ci-cd-patterns/workflows.md +149 -0
  167. package/skills/competitive-teardown/SKILL.md +93 -0
  168. package/skills/competitive-teardown/example-analysis.md +50 -0
  169. package/skills/content-engine/SKILL.md +131 -0
  170. package/skills/content-engine/examples.md +72 -0
  171. package/skills/database-patterns/SKILL.md +72 -0
  172. package/skills/database-patterns/code-templates.md +114 -0
  173. package/skills/database-table-creator/SKILL.md +141 -0
  174. package/skills/database-table-creator/examples.md +552 -0
  175. package/skills/database-table-creator/kotlin-templates.md +400 -0
  176. package/skills/database-table-creator/migration-template.sql +68 -0
  177. package/skills/database-table-creator/validation-checklist.md +337 -0
  178. package/skills/deep-research/SKILL.md +80 -0
  179. package/skills/design-intelligence/SKILL.md +268 -0
  180. package/skills/design-workflow/SKILL.md +127 -0
  181. package/skills/design-workflow/checklists.md +45 -0
  182. package/skills/idea-validation/SKILL.md +129 -0
  183. package/skills/idea-validation/example-report.md +50 -0
  184. package/skills/investor-materials/SKILL.md +122 -0
  185. package/skills/investor-materials/example-outline.md +70 -0
  186. package/skills/investor-outreach/SKILL.md +112 -0
  187. package/skills/investor-outreach/examples.md +76 -0
  188. package/skills/kotlin-best-practices/SKILL.md +58 -0
  189. package/skills/kotlin-best-practices/code-patterns.md +132 -0
  190. package/skills/market-research/SKILL.md +99 -0
  191. package/skills/security-checklist/SKILL.md +65 -0
  192. package/skills/security-checklist/audit-reference.md +95 -0
  193. package/skills/service-debugging/SKILL.md +116 -0
  194. package/skills/service-debugging/common-issues.md +65 -0
  195. package/skills/startup-pipeline/SKILL.md +152 -0
  196. package/skills/terraform-best-practices/SKILL.md +244 -0
  197. package/skills/terraform-module-creator/SKILL.md +284 -0
  198. package/skills/terraform-review/SKILL.md +222 -0
  199. package/skills/terraform-security-audit/SKILL.md +280 -0
  200. package/skills/terraform-service-scaffold/SKILL.md +574 -0
  201. package/skills/testing-strategies/SKILL.md +116 -0
  202. package/skills/testing-strategies/examples.md +103 -0
  203. package/skills/testing-strategies/integration-test-setup.md +71 -0
  204. package/skills/ui-ux-pro-max/SKILL.md +238 -0
  205. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  206. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  207. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  208. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  209. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  210. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  211. package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  212. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  213. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  214. package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  215. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  216. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  217. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  218. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  219. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  220. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  221. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  222. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  223. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  224. package/skills/ui-ux-pro-max/data/styles.csv +68 -0
  225. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  226. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  227. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  228. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  229. package/skills/ui-ux-pro-max/python-setup.md +146 -0
  230. package/skills/ui-ux-pro-max/scripts/core.py +253 -0
  231. package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  232. package/skills/ui-ux-pro-max/scripts/search.py +114 -0
  233. package/skills/web-to-prd/SKILL.md +478 -0
  234. package/templates/build-config.yaml +44 -0
  235. package/templates/commands-config.yaml +55 -0
  236. package/templates/competitor-analysis.md +60 -0
  237. package/templates/content/AGENT_TEMPLATE.md +47 -0
  238. package/templates/content/COMMAND_TEMPLATE.md +27 -0
  239. package/templates/content/RULE_TEMPLATE.md +40 -0
  240. package/templates/content/SKILL_TEMPLATE.md +41 -0
  241. package/templates/design-config.md +105 -0
  242. package/templates/design-doc.md +207 -0
  243. package/templates/epic.md +100 -0
  244. package/templates/feature-spec.md +181 -0
  245. package/templates/idea-canvas.md +47 -0
  246. package/templates/implementation-plan.md +159 -0
  247. package/templates/prd-template.md +86 -0
  248. package/templates/preamble.md +89 -0
  249. package/templates/project-readme.md +35 -0
  250. package/templates/quality-gates.md +230 -0
  251. package/templates/spartan-config.yaml +164 -0
  252. package/templates/user-interview.md +69 -0
  253. package/templates/validation-checklist.md +108 -0
  254. package/templates/workflow-backend-micronaut.md +409 -0
  255. package/templates/workflow-frontend-react.md +233 -0
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ """
4
+ UI/UX Pro Max Search - BM25 search engine for UI/UX style guides
5
+ Usage: python search.py "<query>" [--domain <domain>] [--stack <stack>] [--max-results 3]
6
+ python search.py "<query>" --design-system [-p "Project Name"]
7
+ python search.py "<query>" --design-system --persist [-p "Project Name"] [--page "dashboard"]
8
+
9
+ Domains: style, prompt, color, chart, landing, product, ux, typography
10
+ Stacks: html-tailwind, react, nextjs
11
+
12
+ Persistence (Master + Overrides pattern):
13
+ --persist Save design system to design-system/MASTER.md
14
+ --page Also create a page-specific override file in design-system/pages/
15
+ """
16
+
17
+ import argparse
18
+ import sys
19
+ import io
20
+ from core import CSV_CONFIG, AVAILABLE_STACKS, MAX_RESULTS, search, search_stack
21
+ from design_system import generate_design_system, persist_design_system
22
+
23
+ # Force UTF-8 for stdout/stderr to handle emojis on Windows (cp1252 default)
24
+ if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8':
25
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
26
+ if sys.stderr.encoding and sys.stderr.encoding.lower() != 'utf-8':
27
+ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
28
+
29
+
30
+ def format_output(result):
31
+ """Format results for Claude consumption (token-optimized)"""
32
+ if "error" in result:
33
+ return f"Error: {result['error']}"
34
+
35
+ output = []
36
+ if result.get("stack"):
37
+ output.append(f"## UI Pro Max Stack Guidelines")
38
+ output.append(f"**Stack:** {result['stack']} | **Query:** {result['query']}")
39
+ else:
40
+ output.append(f"## UI Pro Max Search Results")
41
+ output.append(f"**Domain:** {result['domain']} | **Query:** {result['query']}")
42
+ output.append(f"**Source:** {result['file']} | **Found:** {result['count']} results\n")
43
+
44
+ for i, row in enumerate(result['results'], 1):
45
+ output.append(f"### Result {i}")
46
+ for key, value in row.items():
47
+ value_str = str(value)
48
+ if len(value_str) > 300:
49
+ value_str = value_str[:300] + "..."
50
+ output.append(f"- **{key}:** {value_str}")
51
+ output.append("")
52
+
53
+ return "\n".join(output)
54
+
55
+
56
+ if __name__ == "__main__":
57
+ parser = argparse.ArgumentParser(description="UI Pro Max Search")
58
+ parser.add_argument("query", help="Search query")
59
+ parser.add_argument("--domain", "-d", choices=list(CSV_CONFIG.keys()), help="Search domain")
60
+ parser.add_argument("--stack", "-s", choices=AVAILABLE_STACKS, help="Stack-specific search (html-tailwind, react, nextjs)")
61
+ parser.add_argument("--max-results", "-n", type=int, default=MAX_RESULTS, help="Max results (default: 3)")
62
+ parser.add_argument("--json", action="store_true", help="Output as JSON")
63
+ # Design system generation
64
+ parser.add_argument("--design-system", "-ds", action="store_true", help="Generate complete design system recommendation")
65
+ parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name for design system output")
66
+ parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format for design system")
67
+ # Persistence (Master + Overrides pattern)
68
+ parser.add_argument("--persist", action="store_true", help="Save design system to design-system/MASTER.md (creates hierarchical structure)")
69
+ parser.add_argument("--page", type=str, default=None, help="Create page-specific override file in design-system/pages/")
70
+ parser.add_argument("--output-dir", "-o", type=str, default=None, help="Output directory for persisted files (default: current directory)")
71
+
72
+ args = parser.parse_args()
73
+
74
+ # Design system takes priority
75
+ if args.design_system:
76
+ result = generate_design_system(
77
+ args.query,
78
+ args.project_name,
79
+ args.format,
80
+ persist=args.persist,
81
+ page=args.page,
82
+ output_dir=args.output_dir
83
+ )
84
+ print(result)
85
+
86
+ # Print persistence confirmation
87
+ if args.persist:
88
+ project_slug = args.project_name.lower().replace(' ', '-') if args.project_name else "default"
89
+ print("\n" + "=" * 60)
90
+ print(f"✅ Design system persisted to design-system/{project_slug}/")
91
+ print(f" 📄 design-system/{project_slug}/MASTER.md (Global Source of Truth)")
92
+ if args.page:
93
+ page_filename = args.page.lower().replace(' ', '-')
94
+ print(f" 📄 design-system/{project_slug}/pages/{page_filename}.md (Page Overrides)")
95
+ print("")
96
+ print(f"📖 Usage: When building a page, check design-system/{project_slug}/pages/[page].md first.")
97
+ print(f" If exists, its rules override MASTER.md. Otherwise, use MASTER.md.")
98
+ print("=" * 60)
99
+ # Stack search
100
+ elif args.stack:
101
+ result = search_stack(args.query, args.stack, args.max_results)
102
+ if args.json:
103
+ import json
104
+ print(json.dumps(result, indent=2, ensure_ascii=False))
105
+ else:
106
+ print(format_output(result))
107
+ # Domain search
108
+ else:
109
+ result = search(args.query, args.domain, args.max_results)
110
+ if args.json:
111
+ import json
112
+ print(json.dumps(result, indent=2, ensure_ascii=False))
113
+ else:
114
+ print(format_output(result))
@@ -0,0 +1,478 @@
1
+ ---
2
+ name: web-to-prd
3
+ description: "Scan a live web app with Playwright, extract all features, generate PRD/epics/stories with priorities and dependencies, export to Notion. Checks required MCP servers before starting."
4
+ allowed_tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - WebSearch
11
+ - mcp__playwright__browser_navigate
12
+ - mcp__playwright__browser_click
13
+ - mcp__playwright__browser_snapshot
14
+ - mcp__playwright__browser_take_screenshot
15
+ - mcp__playwright__browser_type
16
+ - mcp__playwright__browser_tabs
17
+ - mcp__playwright__browser_close
18
+ - mcp__playwright__browser_hover
19
+ - mcp__playwright__browser_fill_form
20
+ - mcp__playwright__browser_select_option
21
+ - mcp__playwright__browser_press_key
22
+ - mcp__playwright__browser_navigate_back
23
+ - mcp__playwright__browser_wait_for
24
+ - mcp__playwright__browser_evaluate
25
+ - mcp__playwright__browser_resize
26
+ - mcp__playwright__browser_console_messages
27
+ - mcp__playwright__browser_network_requests
28
+ - mcp__playwright__browser_drag
29
+ - mcp__playwright__browser_file_upload
30
+ - mcp__playwright__browser_handle_dialog
31
+ - mcp__playwright__browser_run_code
32
+ ---
33
+
34
+ # Web-to-PRD Skill
35
+
36
+ Scan a live web app. Extract every feature. Turn it into a structured PRD with epics, stories, and tasks. Push it all to Notion.
37
+
38
+ ## When to Use
39
+
40
+ - Reverse-engineer a competitor's product
41
+ - Document an existing app you're taking over
42
+ - Create a PRD from a live product (yours or someone else's)
43
+ - Build a feature backlog from scratch by looking at what's already built
44
+
45
+ ## What This Skill Does
46
+
47
+ 1. **Checks prerequisites** — makes sure Playwright MCP and Notion MCP are connected
48
+ 2. **Crawls the web app** — navigates page by page, reads UI elements
49
+ 3. **Extracts features** — groups what it finds into feature areas
50
+ 4. **Generates PM artifacts** — PRD, epics, stories, tasks with priorities and dependencies
51
+ 5. **Exports to Notion** — creates linked databases, populates everything
52
+
53
+ ## Prerequisites
54
+
55
+ This skill needs 2 MCP servers. The command checks both before starting.
56
+
57
+ ### 1. Playwright MCP (browser control)
58
+
59
+ Claude uses Playwright to open a real browser, navigate pages, and read content.
60
+
61
+ #### Browser modes
62
+
63
+ | Mode | Install command | What it does |
64
+ |------|----------------|-------------|
65
+ | **Persistent profile (default)** | See setup below | Lightweight profile at `~/.playwright-profile`. Login once, remembered. Chrome stays open. No extensions bloat. |
66
+ | CDP (advanced) | `--cdp-endpoint='http://localhost:9222'` | Connects to running Chrome. Has your logins but also loads all extensions (can be slow). |
67
+ | Chrome profile (heavy) | `--user-data-dir="[Chrome path]" --browser=chrome` | Uses real Chrome profile. Has logins but loads ALL extensions — often causes timeouts. Not recommended. |
68
+ | Clean session | no extra flags | Fresh browser each time. No saved state. Public sites only. |
69
+
70
+ #### Default setup: Persistent profile (auto-installed by the command)
71
+
72
+ The `/spartan:web-to-prd` command handles installation itself. Uses a lightweight separate profile at `~/.playwright-profile` — no extensions, no bloat, fast startup.
73
+
74
+ **What the command does internally:**
75
+ ```bash
76
+ claude mcp remove playwright 2>/dev/null || true
77
+ claude mcp add playwright -- npx @playwright/mcp@latest --user-data-dir="$HOME/.playwright-profile" --browser=chrome
78
+ ```
79
+
80
+ **First run on a login-protected site:** Playwright opens Chrome with a clean profile. User logs in manually. Cookies are saved to `~/.playwright-profile`. Next runs are already logged in.
81
+
82
+ **Why not the real Chrome profile?** Real Chrome profiles load ALL extensions (AdBlock, LastPass, password managers, etc.). These add latency, block requests, and often cause Playwright to timeout or hang. A separate profile is faster and more reliable.
83
+
84
+ **Chrome can stay open.** Since we use a separate profile, there's no conflict.
85
+
86
+ #### Switching modes
87
+
88
+ To change mode, remove and re-add:
89
+ ```bash
90
+ claude mcp remove playwright
91
+ claude mcp add playwright -- npx @playwright/mcp@latest [flags]
92
+ ```
93
+
94
+ #### All Playwright MCP flags
95
+
96
+ | Flag | What it does |
97
+ |------|-------------|
98
+ | `--cdp-endpoint="http://localhost:9222"` | Connect to running Chrome via CDP |
99
+ | `--user-data-dir="/path"` | Persistent browser profile (keeps cookies) |
100
+ | `--storage-state="/path/to/state.json"` | Load saved cookies from file |
101
+ | `--isolated` | Fresh session, no persistent data |
102
+ | `--browser=chrome` | Use real Chrome instead of Chromium |
103
+ | `--headless` | No visible browser window |
104
+
105
+ All flags also work as env vars with `PLAYWRIGHT_MCP_` prefix (e.g., `PLAYWRIGHT_MCP_CDP_ENDPOINT`).
106
+
107
+ **How to verify Playwright MCP is installed:**
108
+ ```bash
109
+ claude mcp list | grep -i playwright
110
+ ```
111
+
112
+ **What it gives you:** `browser_navigate`, `browser_click`, `browser_snapshot`, `browser_type`, `browser_tab_list` and more.
113
+
114
+ ### 2. Notion MCP (export destination)
115
+
116
+ Claude uses Notion MCP to create databases, pages, and views in your workspace.
117
+
118
+ **How to install:**
119
+ The Notion MCP is available as a Claude.ai integration. Enable it from:
120
+ - Claude Code settings > MCP servers
121
+ - Or Claude Desktop > Settings > Integrations > Notion
122
+
123
+ **How to verify:**
124
+ ```bash
125
+ claude mcp list | grep -i notion
126
+ ```
127
+
128
+ **What it gives you:** `notion-create-database`, `notion-create-pages`, `notion-create-view`, `notion-search`, `notion-update-page`.
129
+
130
+ ### Optional: Firecrawl MCP (faster crawling)
131
+
132
+ If the user has Firecrawl, use it instead of Playwright for the initial crawl. It's faster but costs money.
133
+
134
+ ```bash
135
+ claude mcp add firecrawl -- npx firecrawl-mcp
136
+ ```
137
+
138
+ Firecrawl is optional. Playwright alone handles everything.
139
+
140
+ ---
141
+
142
+ ## Prerequisite Check Logic
143
+
144
+ Run this check at the start.
145
+
146
+ **IMPORTANT: `claude mcp add/remove` does NOT make tools available mid-session.** MCP tools only load when Claude Code starts. Never try to install or reconfigure MCP servers during a running session — it won't work and wastes time.
147
+
148
+ ```
149
+ CHECK 1: Playwright MCP
150
+ A) Try calling any Playwright tool (e.g., browser_snapshot or browser_navigate)
151
+
152
+ If tool works → check the config:
153
+ Read .claude.json for playwright args
154
+ If --user-data-dir points to ~/.playwright-profile → good, proceed
155
+ If --user-data-dir points to real Chrome profile → warn user (extensions cause timeouts)
156
+ If no --user-data-dir (clean mode) → OK for public sites
157
+ If --cdp-endpoint → good, proceed
158
+
159
+ If tool NOT found → Playwright MCP is not loaded. Show this message and STOP:
160
+
161
+ "Playwright MCP is not available. I need it to open a browser.
162
+
163
+ Run this in your terminal (outside Claude Code):
164
+ claude mcp add playwright -- npx @playwright/mcp@latest --user-data-dir=$HOME/.playwright-profile --browser=chrome
165
+
166
+ Then restart Claude Code and run /spartan:web-to-prd again."
167
+
168
+ NEVER run `claude mcp add` or `claude mcp remove` yourself during the session.
169
+ It changes the config file but won't load the tools until restart.
170
+
171
+ CHECK 2: Notion MCP (OPTIONAL — not a blocker)
172
+ Try calling notion-search with a simple query
173
+ If found → great, will export to Notion at the end
174
+ If not found → note it, will save PRD locally instead. Continue with crawl.
175
+
176
+ Playwright OK → proceed to crawl
177
+ ```
178
+
179
+ **Notion is optional.** The PRD is always saved locally. Notion export is a bonus step at the end.
180
+
181
+ ---
182
+
183
+ ## Crawl Strategy
184
+
185
+ ### Step 0: Clean up stale lock files (before every run)
186
+
187
+ Stale lock files from previous browser sessions can cause "Opening in existing browser session" errors. **Only remove lock files — never kill processes:**
188
+
189
+ ```bash
190
+ rm -f "$HOME/.playwright-profile/SingletonLock" \
191
+ "$HOME/.playwright-profile/SingletonCookie" \
192
+ "$HOME/.playwright-profile/SingletonSocket" 2>/dev/null
193
+ echo "Browser cleanup done"
194
+ ```
195
+
196
+ **WARNING:** Do NOT run `pkill -f "playwright-profile"` — it kills the Playwright MCP server process too, disconnecting all browser tools mid-session.
197
+
198
+ If navigate still fails after cleanup → retry once after 2 seconds. If still fails → user needs to restart Claude Code.
199
+
200
+ ### Step 1: Login FIRST (mandatory before crawling)
201
+
202
+ **Never start crawling without confirming access. Login is Step 1, not an afterthought.**
203
+
204
+ 1. Navigate to the target URL
205
+ 2. Take a snapshot — check for login signals (form fields, "Sign in" text, `/login` URL)
206
+ 3. **If login page:**
207
+ - STOP. Tell user: "Login page detected. Please log in in the browser window. Tell me when done."
208
+ - Wait for user confirmation
209
+ - Take snapshot to verify — still login page? Ask again. See dashboard? Proceed.
210
+ - **Repeat until logged in.** Do NOT start crawling from a login page.
211
+ 4. **If already logged in** (or public site):
212
+ - Show the user what sections are visible
213
+ - Ask: "Does this look like full access? Any sections I'm missing?"
214
+ - Wait for confirmation before crawling
215
+
216
+ **Session expiry during crawl:** If redirected to login mid-crawl → STOP, tell user to re-login in the browser, wait for confirmation, then continue where you left off.
217
+
218
+ **Security rules:**
219
+ - Never use `browser_type` to enter passwords — user types directly in the browser
220
+ - Never ask for credentials in chat
221
+ - Never screenshot login pages
222
+ - SSO/OAuth popups work normally — just wait for user to complete
223
+
224
+ **Cookies:** With persistent profile (`~/.playwright-profile`), logins are saved. Next run on the same site = already logged in.
225
+
226
+ ### Step 2: Two-pass crawl
227
+
228
+ **Pass 1 — Map all pages (breadth-first):**
229
+ Visit every nav link, take a screenshot, note the page type, go back. Build a complete sitemap. Don't explore features deeply yet. Go back to home between sections. Show the sitemap to user and ask if anything is missing.
230
+
231
+ **Pass 2 — Deep exploration (exhaust every feature):**
232
+ Go through each page from the sitemap. On each page: try EVERY interactive element until there's nothing left to try. Click a button → opens a modal? → what's in the modal? → has a form? → what fields? → has a submit button? → what happens after submit? → follow every path until you hit a dead end or a page you already explored. Only move to next page when you've exhausted all interactions on this page. The goal is to discover features that are 2-3 levels deep — hidden behind tabs, modals, sub-pages, or conditional UI.
233
+
234
+ ### Screenshots (mandatory)
235
+
236
+ Take a screenshot of every page and every important UI state. Save to `.planning/web-to-prd/screenshots/` with names like `01-homepage.png`, `02-dashboard.png`, `07-create-modal.png`. Include screenshot references in each Epic. Never screenshot login pages.
237
+
238
+ ### For SPAs (single page apps)
239
+
240
+ SPAs don't have traditional page URLs. Use this approach:
241
+ 1. Start at the root URL
242
+ 2. Read the navigation/sidebar for all sections
243
+ 3. Click each section, wait for content to load
244
+ 4. Take snapshot after each navigation
245
+ 5. Track visited states by URL hash or path changes
246
+
247
+ ### Crawl depth limits
248
+
249
+ | App size | Max pages | Estimated time |
250
+ |----------|-----------|----------------|
251
+ | Small (< 10 pages) | All pages | 2-5 min |
252
+ | Medium (10-50 pages) | All pages | 5-15 min |
253
+ | Large (50+ pages) | Top 50, then ask user | 15+ min |
254
+
255
+ After every 10 pages, show progress:
256
+ > "Scanned 10/~25 pages. Found 3 feature areas so far. Continue?"
257
+
258
+ ### Coverage Check (mandatory before generating PRD)
259
+
260
+ After crawling, show a coverage report: pages visited, screenshots taken, buttons clicked, modals found, forms found, tabs explored, filters tested. List all nav sections and mark which were explored vs skipped.
261
+
262
+ **Fail if:** any nav section not explored, fewer screenshots than pages, zero modals on a page with buttons (means you didn't click them), any section with only 1 interaction (you only looked, didn't try).
263
+
264
+ Ask user to confirm coverage before proceeding to PRD generation.
265
+
266
+ ---
267
+
268
+ ## Feature Extraction
269
+
270
+ ### What to extract from each page
271
+
272
+ For every page visited, capture:
273
+
274
+ ```yaml
275
+ page:
276
+ url: "/dashboard"
277
+ title: "Dashboard"
278
+ type: dashboard | list | detail | form | settings | landing | auth | empty
279
+ features:
280
+ - name: "Revenue Chart"
281
+ type: data-display | form | action | navigation | filter | notification
282
+ description: "Line chart showing monthly revenue with date range picker"
283
+ ui_elements:
284
+ - chart (line, with tooltips)
285
+ - date range picker
286
+ - export button
287
+ interactions:
288
+ - hover shows tooltip with exact value
289
+ - date range filters the data
290
+ - export downloads CSV
291
+ - name: "Quick Actions Bar"
292
+ type: action
293
+ description: "Row of shortcut buttons: New Invoice, New Client, Reports"
294
+ interactions:
295
+ - each button navigates to respective page
296
+ ```
297
+
298
+ ### Feature grouping rules
299
+
300
+ After crawling, group features into **feature areas** (these become Epics):
301
+
302
+ 1. **By navigation section** — sidebar/navbar sections are natural groupings
303
+ 2. **By user goal** — what is the user trying to do?
304
+ 3. **By data domain** — features that touch the same data belong together
305
+
306
+ Example groupings:
307
+ ```
308
+ Epic: User Management
309
+ - User list with search/filter
310
+ - User profile page
311
+ - User invite flow
312
+ - Role assignment
313
+ - User deactivation
314
+
315
+ Epic: Billing & Payments
316
+ - Invoice list
317
+ - Create invoice form
318
+ - Payment tracking
319
+ - Subscription management
320
+ - Billing settings
321
+ ```
322
+
323
+ ### Priority assignment
324
+
325
+ Assign priority based on visibility and complexity:
326
+
327
+ | Priority | Criteria |
328
+ |----------|----------|
329
+ | P0 - Must have | Core user flow, app doesn't work without it |
330
+ | P1 - Should have | Important but app is usable without it |
331
+ | P2 - Nice to have | Enhancement, polish, edge case handling |
332
+ | P3 - Future | Advanced feature, nice but not needed now |
333
+
334
+ **Heuristics:**
335
+ - Main navigation items → P0 or P1
336
+ - Settings/config pages → P1 or P2
337
+ - Empty states, onboarding → P2
338
+ - Social features, sharing → P2 or P3
339
+
340
+ ### Dependency mapping
341
+
342
+ Map dependencies between features:
343
+
344
+ ```
345
+ Epic: Authentication (must build first)
346
+ → Epic: User Management (needs auth)
347
+ → Epic: Team Management (needs users)
348
+ → Epic: Permissions (needs teams)
349
+
350
+ Epic: Product Catalog (independent)
351
+ → Epic: Shopping Cart (needs products)
352
+ → Epic: Checkout (needs cart)
353
+ → Epic: Order Management (needs checkout)
354
+ ```
355
+
356
+ Rules for dependencies:
357
+ - CRUD operations: Create before Read/List before Update before Delete
358
+ - Auth is always first
359
+ - Data display depends on data input
360
+ - Settings depend on the feature they configure
361
+
362
+ ---
363
+
364
+ ## PRD Generation
365
+
366
+ ### Structure
367
+
368
+ Generate a PRD with 8 sections. **Each Epic is a mini-PRD** — a developer reads one Epic and knows exactly what to build.
369
+
370
+ ```
371
+ 1. TL;DR — 2 sentences, what this app does
372
+ 2. Goals — Business goals, user goals, non-goals
373
+ 3. User Stories — Grouped by persona/role
374
+ 4. Epics (mini-PRDs) — THE MAIN SECTION. Each epic has full detail (see below)
375
+ 5. User Flows — End-to-end flows connecting stories across epics
376
+ 6. Narrative — 200-word story from user's POV
377
+ 7. Build Roadmap — Phased plan with dependency graph
378
+ 8. Open Questions — Things that need human input
379
+ ```
380
+
381
+ **Section 4 (Epics) is the core.** Epics are ordered by build priority (Epic 1 = build first).
382
+
383
+ **Each Epic is a FULL PRD with 6 sections:**
384
+
385
+ ```
386
+ Epic N: [Name]
387
+ ├── 1. TL;DR — what this epic solves, who it's for
388
+ ├── 2. Goals — business goals, user goals, non-goals
389
+ ├── 3. User Stories — As a [user], I want...
390
+ ├── 4. Functional Requirements — every feature with screenshots, UI detail, priority
391
+ ├── 5. User Experience — entry point, flow (step by step), edge cases, design notes
392
+ └── 6. Narrative — 100-word user story for this epic
393
+ ```
394
+
395
+ **No epic can skip any section.** Every epic gets all 6 sections. This is what makes the PRD actionable — a developer reads one Epic page and knows exactly what to build.
396
+
397
+ **Screenshots are embedded in Section 4** next to the features they show. Not at the end, not as links — inline with the content. In the markdown PRD, use `![Feature name](screenshots/NN-name.png)` for every feature that has a screenshot. The PRD must be self-contained — anyone opening the file sees screenshots right next to the features.
398
+
399
+ **Be as detailed as possible.** Describe every button, every form field, every table column, every filter option.
400
+
401
+ **Try EVERY feature.** Click every menu, open every modal, test every filter. Missing features = useless PRD.
402
+
403
+ See the command file (`web-to-prd.md`) for the full template with examples.
404
+
405
+ ---
406
+
407
+ ## Notion Export
408
+
409
+ ### Database Structure
410
+
411
+ Create a parent page with one sub-page per Epic:
412
+
413
+ ```
414
+ Parent page: "[App Name] — PRD"
415
+ ├── PRD overview (sections 1-3, 5-8)
416
+ ├── Epic 1: [Name] (full page with screenshots, features, acceptance criteria)
417
+ ├── Epic 2: [Name] (full page with screenshots, features, acceptance criteria)
418
+ ├── ...
419
+ └── Optional: Epics overview database (for filtering/sorting, links to pages)
420
+ ```
421
+
422
+ **Each Epic = a full Notion page**, not a database row with a Description field. Include:
423
+ - Full content from the PRD Section 4 format
424
+ - Screenshots embedded directly in the page (visible, not links)
425
+ - Every feature detail: user story, UI description, step-by-step, acceptance criteria
426
+
427
+ **Screenshots must be uploaded to Notion**, not just saved locally. Place them next to the features they document.
428
+
429
+ ### Export steps
430
+
431
+ 1. **Ask where to put it:**
432
+ > "Where should I create the backlog in Notion?
433
+ > A) Create a new page in your workspace root
434
+ > B) Add it under an existing page (I'll search for it)
435
+ > C) Just generate the PRD locally, don't push to Notion"
436
+
437
+ 2. **Create parent page** with the PRD content
438
+ 3. **Create Epics database** with all epics
439
+ 4. **Create Stories database** linked to Epics
440
+ 5. **Create Tasks database** linked to Stories
441
+ 6. **Create views:**
442
+ - Kanban view (by Status) for Stories
443
+ - Timeline view (by Phase) for Epics
444
+ - Table view (default) for Tasks
445
+
446
+ ### If Notion MCP is not available
447
+
448
+ Save everything locally:
449
+ ```
450
+ .planning/web-to-prd/
451
+ ├── prd.md # Full PRD document (screenshots embedded as ![name](screenshots/NN.png))
452
+ ├── epics.md # All epics with stories
453
+ ├── dependency-graph.md # Visual dependency map
454
+ └── screenshots/ # Page screenshots
455
+ ```
456
+
457
+ **Screenshots in the markdown are mandatory.** Every feature that has a screenshot must embed it inline using `![Feature name](screenshots/NN-name.png)`. Paths are relative to the PRD file.
458
+
459
+ User can import to Notion manually later.
460
+
461
+ ---
462
+
463
+ ## Rules
464
+
465
+ 1. **Always check prerequisites first.** Don't start crawling without confirming both MCP servers.
466
+ 2. **Login before crawling.** Never generate a PRD from a login page or public-only view. If the app has login, handle it first. Verify you see the full app before starting.
467
+ 3. **Confirm access level.** After login, show the user what sections are visible and ask if anything is missing. A PRD from a limited view is useless.
468
+ 4. **Handle session expiry.** If redirected to login mid-crawl, STOP and ask user to re-login. Don't crawl from a login page.
469
+ 5. **Show progress during crawl.** Every 10 pages or every major section, update the user.
470
+ 3. **Don't guess features you can't see.** Only document what's visible in the UI. Mark assumptions clearly.
471
+ 4. **Ask before clicking destructive actions.** If you see "Delete" or "Remove" buttons, don't click them during crawl.
472
+ 5. **Handle errors gracefully.** If a page fails to load, note it and move on. Don't stop the whole crawl.
473
+ 6. **Respect rate limits.** Add 1-2 second delays between page navigations to avoid being blocked.
474
+ 7. **Screenshots are mandatory.** Take them for every page and embed them in the markdown PRD using `![name](path)` syntax.
475
+ 8. **Login is the user's job.** Never store or ask for production credentials. Use headed mode for manual login.
476
+ 9. **Local save is always available.** Even if Notion export fails, the PRD is saved locally.
477
+ 10. **One app per run.** Don't crawl multiple domains in a single session.
478
+ 11. **NEVER point `--user-data-dir` to the real Chrome profile directory** (e.g., `~/Library/Application Support/Google/Chrome` on Mac, `~/.config/google-chrome` on Linux). This can corrupt Chrome profiles, delete saved logins, and break the user's browser. Always use a separate directory like `~/.playwright-profile`.
@@ -0,0 +1,44 @@
1
+ # .spartan/build.yaml — Project-level build config
2
+ # Copy this file to .spartan/build.yaml in your project and customize.
3
+ # All fields are optional. Omit a field to use the default.
4
+
5
+ # Branch prefix (default: "feature")
6
+ # Controls the branch name: [prefix]/[slug] (e.g., "feature/user-auth")
7
+ branch-prefix: "feature"
8
+
9
+ # Max review-fix cycles before asking the user (default: 3)
10
+ # max-review-rounds: 3
11
+
12
+ # Stages to skip (use carefully — most stages exist for a reason)
13
+ # Valid: spec, design, plan, ship
14
+ # Note: review can never be skipped — it's always enforced
15
+ # skip-stages: []
16
+
17
+ # Custom instructions injected into build stages.
18
+ # Claude reads these alongside the built-in workflow instructions.
19
+ # Use this to add project-specific rules, naming conventions, or checklists.
20
+ prompts:
21
+ # Injected after spec questions, before scope is finalized
22
+ # spec: |
23
+ # Always include performance requirements.
24
+ # Ask about expected load/traffic.
25
+
26
+ # Injected into the plan stage, after the task list is generated
27
+ # plan: |
28
+ # Every backend task must include a Flyway migration version check.
29
+ # Frontend tasks must reference the Figma frame URL.
30
+
31
+ # Injected during implementation
32
+ # implement: |
33
+ # Always add structured logging to new service methods.
34
+ # Use the project's error code registry for new error types.
35
+
36
+ # Injected into the review agent's prompt
37
+ # review: |
38
+ # Check that all API responses include request_id for tracing.
39
+ # Verify that new endpoints have rate limiting annotations.
40
+
41
+ # Injected before PR creation
42
+ # ship: |
43
+ # PR title must start with the Jira ticket number.
44
+ # Add "Tested on staging" to the test plan if it touches payments.
@@ -0,0 +1,55 @@
1
+ # .spartan/commands.yaml — Per-command overrides
2
+ # Inject custom prompts into ANY Spartan command. Claude reads these
3
+ # alongside the built-in instructions when the command runs.
4
+ # All fields are optional.
5
+
6
+ # --- Per-command prompt injection ---
7
+ # Key = command name (without "spartan:" prefix)
8
+ # Value = custom instructions appended to the command's prompt
9
+
10
+ # prompts:
11
+ # spec: |
12
+ # Always ask about performance requirements.
13
+ # Include acceptance criteria in BDD format.
14
+ #
15
+ # plan: |
16
+ # Tasks must reference Jira ticket numbers.
17
+ # Estimate hours per task.
18
+ #
19
+ # review: |
20
+ # Check that all new endpoints have OpenAPI annotations.
21
+ # Flag any function longer than 50 lines.
22
+ #
23
+ # pr-ready: |
24
+ # PR title format: [PROJ-123] Short description
25
+ # Always add "Reviewers: @backend-team" for backend changes.
26
+ #
27
+ # daily: |
28
+ # Include blockers section.
29
+ # Tag items by project area (auth, payments, infra).
30
+ #
31
+ # debug: |
32
+ # Always check CloudWatch logs first.
33
+ # Include the request_id in every investigation.
34
+ #
35
+ # migration: |
36
+ # Migration files must start with ticket number.
37
+ # Always add a rollback section.
38
+ #
39
+ # onboard: |
40
+ # Focus on the payments module first — it's the most complex.
41
+ # Skip the legacy admin/ directory.
42
+
43
+ # --- Command defaults ---
44
+ # Override default behavior for specific commands
45
+
46
+ # defaults:
47
+ # build:
48
+ # worktree: true
49
+ # branch-prefix: "feature"
50
+ # max-review-rounds: 3
51
+ # skip-stages: []
52
+ # spec:
53
+ # save-path: ".planning/specs" # where specs are saved
54
+ # review:
55
+ # parallel: true # use Agent Teams for parallel review if available