prizmkit 1.1.57 → 1.1.60

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 (188) hide show
  1. package/bin/create-prizmkit.js +8 -6
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/codex/agent-adapter.js +38 -0
  4. package/bundled/adapters/codex/paths.js +27 -0
  5. package/bundled/adapters/codex/rules-adapter.js +30 -0
  6. package/bundled/adapters/codex/settings-adapter.js +27 -0
  7. package/bundled/adapters/codex/skill-adapter.js +65 -0
  8. package/bundled/adapters/codex/team-adapter.js +37 -0
  9. package/bundled/dev-pipeline/.env.example +2 -1
  10. package/bundled/dev-pipeline/README.md +10 -7
  11. package/bundled/dev-pipeline/lib/common.sh +278 -37
  12. package/bundled/dev-pipeline/run-bugfix.sh +10 -61
  13. package/bundled/dev-pipeline/run-feature.sh +10 -78
  14. package/bundled/dev-pipeline/run-recovery.sh +10 -46
  15. package/bundled/dev-pipeline/run-refactor.sh +10 -61
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +17 -7
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +9 -3
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +9 -3
  19. package/bundled/dev-pipeline/scripts/utils.py +6 -4
  20. package/bundled/dev-pipeline-windows/.env.example +28 -0
  21. package/bundled/dev-pipeline-windows/README.md +30 -0
  22. package/bundled/dev-pipeline-windows/SCHEMA_ANALYSIS.md +525 -0
  23. package/bundled/dev-pipeline-windows/assets/feature-list-example.json +146 -0
  24. package/bundled/dev-pipeline-windows/assets/prizm-dev-team-integration.md +138 -0
  25. package/bundled/dev-pipeline-windows/launch-bugfix-daemon.ps1 +9 -0
  26. package/bundled/dev-pipeline-windows/launch-feature-daemon.ps1 +9 -0
  27. package/bundled/dev-pipeline-windows/launch-refactor-daemon.ps1 +9 -0
  28. package/bundled/dev-pipeline-windows/lib/common.ps1 +432 -0
  29. package/bundled/dev-pipeline-windows/lib/daemon.ps1 +140 -0
  30. package/bundled/dev-pipeline-windows/lib/pipeline.ps1 +446 -0
  31. package/bundled/dev-pipeline-windows/lib/reset.ps1 +87 -0
  32. package/bundled/dev-pipeline-windows/reset-bug.ps1 +9 -0
  33. package/bundled/dev-pipeline-windows/reset-feature.ps1 +9 -0
  34. package/bundled/dev-pipeline-windows/reset-refactor.ps1 +9 -0
  35. package/bundled/dev-pipeline-windows/run-bugfix.ps1 +9 -0
  36. package/bundled/dev-pipeline-windows/run-feature.ps1 +9 -0
  37. package/bundled/dev-pipeline-windows/run-recovery.ps1 +76 -0
  38. package/bundled/dev-pipeline-windows/run-refactor.ps1 +9 -0
  39. package/bundled/dev-pipeline-windows/scripts/check-session-status.py +228 -0
  40. package/bundled/dev-pipeline-windows/scripts/cleanup-logs.py +192 -0
  41. package/bundled/dev-pipeline-windows/scripts/detect-stuck.py +530 -0
  42. package/bundled/dev-pipeline-windows/scripts/generate-bootstrap-prompt.py +1737 -0
  43. package/bundled/dev-pipeline-windows/scripts/generate-bugfix-prompt.py +685 -0
  44. package/bundled/dev-pipeline-windows/scripts/generate-recovery-prompt.py +805 -0
  45. package/bundled/dev-pipeline-windows/scripts/generate-refactor-prompt.py +763 -0
  46. package/bundled/dev-pipeline-windows/scripts/init-bugfix-pipeline.py +316 -0
  47. package/bundled/dev-pipeline-windows/scripts/init-dev-team.py +134 -0
  48. package/bundled/dev-pipeline-windows/scripts/init-pipeline.py +380 -0
  49. package/bundled/dev-pipeline-windows/scripts/init-refactor-pipeline.py +399 -0
  50. package/bundled/dev-pipeline-windows/scripts/parse-stream-progress.py +388 -0
  51. package/bundled/dev-pipeline-windows/scripts/patch-completion-notes.py +191 -0
  52. package/bundled/dev-pipeline-windows/scripts/update-bug-status.py +864 -0
  53. package/bundled/dev-pipeline-windows/scripts/update-checkpoint.py +173 -0
  54. package/bundled/dev-pipeline-windows/scripts/update-feature-status.py +1501 -0
  55. package/bundled/dev-pipeline-windows/scripts/update-refactor-status.py +1073 -0
  56. package/bundled/dev-pipeline-windows/scripts/utils.py +542 -0
  57. package/bundled/dev-pipeline-windows/templates/agent-prompts/critic-plan-challenge.md +7 -0
  58. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-fix.md +7 -0
  59. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-implement.md +30 -0
  60. package/bundled/dev-pipeline-windows/templates/agent-prompts/dev-resume.md +5 -0
  61. package/bundled/dev-pipeline-windows/templates/agent-prompts/reviewer-review.md +7 -0
  62. package/bundled/dev-pipeline-windows/templates/bootstrap-prompt.md +46 -0
  63. package/bundled/dev-pipeline-windows/templates/bootstrap-tier1.md +43 -0
  64. package/bundled/dev-pipeline-windows/templates/bootstrap-tier2.md +43 -0
  65. package/bundled/dev-pipeline-windows/templates/bootstrap-tier3.md +43 -0
  66. package/bundled/dev-pipeline-windows/templates/bug-fix-list-schema.json +263 -0
  67. package/bundled/dev-pipeline-windows/templates/bugfix-bootstrap-prompt.md +320 -0
  68. package/bundled/dev-pipeline-windows/templates/feature-list-schema.json +237 -0
  69. package/bundled/dev-pipeline-windows/templates/refactor-bootstrap-prompt.md +331 -0
  70. package/bundled/dev-pipeline-windows/templates/refactor-list-schema.json +270 -0
  71. package/bundled/dev-pipeline-windows/templates/sections/ac-verification-checklist.md +13 -0
  72. package/bundled/dev-pipeline-windows/templates/sections/checkpoint-system.md +91 -0
  73. package/bundled/dev-pipeline-windows/templates/sections/context-budget-rules.md +33 -0
  74. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-agent.md +10 -0
  75. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-full.md +12 -0
  76. package/bundled/dev-pipeline-windows/templates/sections/critical-paths-lite.md +7 -0
  77. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-agent.md +8 -0
  78. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-full.md +9 -0
  79. package/bundled/dev-pipeline-windows/templates/sections/directory-convention-lite.md +6 -0
  80. package/bundled/dev-pipeline-windows/templates/sections/failure-capture.md +21 -0
  81. package/bundled/dev-pipeline-windows/templates/sections/feature-context.md +31 -0
  82. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-auto.md +72 -0
  83. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification-opencli.md +63 -0
  84. package/bundled/dev-pipeline-windows/templates/sections/phase-browser-verification.md +62 -0
  85. package/bundled/dev-pipeline-windows/templates/sections/phase-commit-full.md +71 -0
  86. package/bundled/dev-pipeline-windows/templates/sections/phase-commit.md +64 -0
  87. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-agent-suffix.md +23 -0
  88. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-base.md +24 -0
  89. package/bundled/dev-pipeline-windows/templates/sections/phase-context-snapshot-lite-suffix.md +12 -0
  90. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan-full.md +53 -0
  91. package/bundled/dev-pipeline-windows/templates/sections/phase-critic-plan.md +32 -0
  92. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-agent.md +37 -0
  93. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-full.md +50 -0
  94. package/bundled/dev-pipeline-windows/templates/sections/phase-implement-lite.md +52 -0
  95. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-agent.md +27 -0
  96. package/bundled/dev-pipeline-windows/templates/sections/phase-plan-lite.md +27 -0
  97. package/bundled/dev-pipeline-windows/templates/sections/phase-review-agent.md +27 -0
  98. package/bundled/dev-pipeline-windows/templates/sections/phase-review-full.md +29 -0
  99. package/bundled/dev-pipeline-windows/templates/sections/phase-specify-plan-full.md +77 -0
  100. package/bundled/dev-pipeline-windows/templates/sections/phase0-init.md +13 -0
  101. package/bundled/dev-pipeline-windows/templates/sections/phase0-test-baseline.md +23 -0
  102. package/bundled/dev-pipeline-windows/templates/sections/session-context.md +5 -0
  103. package/bundled/dev-pipeline-windows/templates/sections/subagent-timeout-recovery.md +6 -0
  104. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-agent.md +67 -0
  105. package/bundled/dev-pipeline-windows/templates/sections/test-failure-recovery-lite.md +58 -0
  106. package/bundled/dev-pipeline-windows/templates/session-status-schema.json +83 -0
  107. package/bundled/skills/_metadata.json +1 -1
  108. package/bundled/skills/app-planner/SKILL.md +26 -18
  109. package/bundled/skills/app-planner/references/architecture-decisions.md +9 -5
  110. package/bundled/skills/app-planner/references/frontend-design-guide.md +1 -1
  111. package/bundled/skills/feature-planner/SKILL.md +9 -2
  112. package/bundled/skills/prizmkit-init/SKILL.md +7 -6
  113. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +2 -0
  114. package/bundled/skills-windows/app-planner/SKILL.md +639 -0
  115. package/bundled/skills-windows/app-planner/assets/app-design-guide.md +101 -0
  116. package/bundled/skills-windows/app-planner/references/architecture-decisions.md +52 -0
  117. package/bundled/skills-windows/app-planner/references/brainstorm-guide.md +101 -0
  118. package/bundled/skills-windows/app-planner/references/frontend-design-guide.md +71 -0
  119. package/bundled/skills-windows/app-planner/references/project-brief-guide.md +82 -0
  120. package/bundled/skills-windows/app-planner/references/red-team-checklist.md +40 -0
  121. package/bundled/skills-windows/app-planner/references/rules/backend/derivation-rules.md +609 -0
  122. package/bundled/skills-windows/app-planner/references/rules/backend/fixed-rules.md +285 -0
  123. package/bundled/skills-windows/app-planner/references/rules/backend/question-bank.md +249 -0
  124. package/bundled/skills-windows/app-planner/references/rules/backend/template.md +173 -0
  125. package/bundled/skills-windows/app-planner/references/rules/database/derivation-rules.md +373 -0
  126. package/bundled/skills-windows/app-planner/references/rules/database/fixed-rules.md +211 -0
  127. package/bundled/skills-windows/app-planner/references/rules/database/question-bank.md +184 -0
  128. package/bundled/skills-windows/app-planner/references/rules/database/template.md +158 -0
  129. package/bundled/skills-windows/app-planner/references/rules/frontend/derivation-rules.md +810 -0
  130. package/bundled/skills-windows/app-planner/references/rules/frontend/fixed-rules.md +188 -0
  131. package/bundled/skills-windows/app-planner/references/rules/frontend/question-bank.md +302 -0
  132. package/bundled/skills-windows/app-planner/references/rules/frontend/template.md +320 -0
  133. package/bundled/skills-windows/app-planner/references/rules/mobile/derivation-rules.md +639 -0
  134. package/bundled/skills-windows/app-planner/references/rules/mobile/fixed-rules.md +290 -0
  135. package/bundled/skills-windows/app-planner/references/rules/mobile/question-bank.md +232 -0
  136. package/bundled/skills-windows/app-planner/references/rules/mobile/template.md +175 -0
  137. package/bundled/skills-windows/bug-fix-workflow/SKILL.md +415 -0
  138. package/bundled/skills-windows/bug-planner/SKILL.md +395 -0
  139. package/bundled/skills-windows/bug-planner/assets/bug-confirmation-template.md +43 -0
  140. package/bundled/skills-windows/bug-planner/references/critic-and-verification.md +44 -0
  141. package/bundled/skills-windows/bug-planner/references/error-recovery.md +73 -0
  142. package/bundled/skills-windows/bug-planner/references/input-formats.md +53 -0
  143. package/bundled/skills-windows/bug-planner/references/schema-validation.md +25 -0
  144. package/bundled/skills-windows/bug-planner/references/severity-rules.md +16 -0
  145. package/bundled/skills-windows/bug-planner/scripts/validate-bug-list.py +322 -0
  146. package/bundled/skills-windows/bugfix-pipeline-launcher/SKILL.md +380 -0
  147. package/bundled/skills-windows/feature-pipeline-launcher/SKILL.md +441 -0
  148. package/bundled/skills-windows/feature-pipeline-launcher/scripts/preflight-check.py +462 -0
  149. package/bundled/skills-windows/feature-planner/SKILL.md +401 -0
  150. package/bundled/skills-windows/feature-planner/assets/evaluation-guide.md +64 -0
  151. package/bundled/skills-windows/feature-planner/assets/planning-guide.md +214 -0
  152. package/bundled/skills-windows/feature-planner/references/browser-interaction.md +59 -0
  153. package/bundled/skills-windows/feature-planner/references/completeness-review.md +57 -0
  154. package/bundled/skills-windows/feature-planner/references/decomposition-patterns.md +75 -0
  155. package/bundled/skills-windows/feature-planner/references/error-recovery.md +90 -0
  156. package/bundled/skills-windows/feature-planner/references/incremental-feature-planning.md +112 -0
  157. package/bundled/skills-windows/feature-planner/references/new-project-planning.md +85 -0
  158. package/bundled/skills-windows/feature-planner/scripts/validate-and-generate.py +1029 -0
  159. package/bundled/skills-windows/feature-workflow/SKILL.md +531 -0
  160. package/bundled/skills-windows/prizmkit-init/SKILL.md +356 -0
  161. package/bundled/skills-windows/prizmkit-init/assets/project-brief-template.md +82 -0
  162. package/bundled/skills-windows/prizmkit-init/references/config-schema.md +68 -0
  163. package/bundled/skills-windows/prizmkit-init/references/rules/layer-detection.md +41 -0
  164. package/bundled/skills-windows/prizmkit-init/references/tech-stack-catalog.md +13 -0
  165. package/bundled/skills-windows/prizmkit-init/references/update-supplement.md +9 -0
  166. package/bundled/skills-windows/recovery-workflow/SKILL.md +456 -0
  167. package/bundled/skills-windows/recovery-workflow/evals/evals.json +46 -0
  168. package/bundled/skills-windows/recovery-workflow/scripts/detect-recovery-state.py +544 -0
  169. package/bundled/skills-windows/refactor-pipeline-launcher/SKILL.md +406 -0
  170. package/bundled/skills-windows/refactor-planner/SKILL.md +540 -0
  171. package/bundled/skills-windows/refactor-planner/assets/planning-guide.md +292 -0
  172. package/bundled/skills-windows/refactor-planner/references/behavior-preservation.md +301 -0
  173. package/bundled/skills-windows/refactor-planner/references/refactor-scoping-guide.md +221 -0
  174. package/bundled/skills-windows/refactor-planner/scripts/validate-and-generate-refactor.py +858 -0
  175. package/bundled/skills-windows/refactor-workflow/SKILL.md +503 -0
  176. package/package.json +3 -2
  177. package/src/clean.js +73 -2
  178. package/src/config.js +159 -50
  179. package/src/detect-platform.js +16 -8
  180. package/src/external-skills.js +26 -19
  181. package/src/index.js +31 -9
  182. package/src/manifest.js +6 -2
  183. package/src/metadata.js +43 -5
  184. package/src/platforms.js +36 -0
  185. package/src/prompts.js +31 -6
  186. package/src/runtimes.js +20 -0
  187. package/src/scaffold.js +314 -110
  188. package/src/upgrade.js +81 -41
@@ -0,0 +1,639 @@
1
+ ---
2
+ name: "app-planner"
3
+ description: "Plan an application through interactive conversation — capture vision, tech stack, constraints, dev rules, and project brief. Works for both new (greenfield) and existing (brownfield) projects that need app-level planning. Also use for configuring per-layer development rules (frontend/backend/database/mobile) that AI coding assistants should follow. Use this skill when users say 'plan an app', 'design a new project', 'start from scratch', 'build a new application', 'set up dev rules', 'configure frontend rules', 'configure backend rules', or discuss app-level architecture and design. Also use for existing projects that need a project brief or app-level context. For adding features to existing projects that already have a project brief, use feature-planner instead."
4
+ ---
5
+
6
+ # app planner
7
+
8
+ Plan an application from idea to actionable project context through interactive conversation. Works for both **greenfield** (new) and **brownfield** (existing) projects:
9
+ - Vision and problem statement
10
+ - Tech stack selection (or confirmation of existing stack)
11
+ - Constraints and design direction
12
+ - Architecture decision capture
13
+ - Project brief accumulation (`.prizmkit/plans/project-brief.md`)
14
+
15
+ This skill captures **project-level context only**: vision, tech stack, conventions, architecture decisions, and project brief. It does NOT do feature decomposition or generate `feature-list.json` — that is `feature-planner`'s job.
16
+
17
+ For adding features to an **existing** project that already has a project brief, use `feature-planner` directly.
18
+
19
+ ## Invocation Commitment (Hard Rule)
20
+ You must NEVER:
21
+ - Bypass the interactive phases because you judge the task to be "simple"
22
+
23
+ If you believe the task is better suited for a different workflow, you MUST:
24
+ 1. **Explain why** you think a different path is more appropriate
25
+ 2. **Ask the user explicitly** whether they want to switch
26
+ 3. **Only switch if the user confirms**
27
+
28
+ ## Scope Boundary (Hard Rule)
29
+
30
+ **This skill is PLANNING ONLY.** You must NEVER:
31
+ - Create, modify, or delete source code files (*.js, *.ts, *.py, *.go, *.html, *.css, etc.)
32
+ - Create project scaffolding, directories, or boilerplate (exception: `.prizmkit/rules/` and `.prizmkit/prizm-docs/` directories may be created for dev rules and root.prizm output)
33
+ - Run build/install/test commands (npm init, pip install, etc.)
34
+ - Execute any implementation action beyond writing planning artifacts
35
+
36
+ **Your ONLY writable outputs are:**
37
+ 1. `.prizmkit/plans/project-brief.md` (`.prizmkit/plans/` — accumulated project context brief)
38
+ 2. Project conventions and architecture decisions appended to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` (with user consent)
39
+ 3. Infrastructure configuration (database conventions, deployment config, **cloud services**) appended to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Infrastructure` section
40
+ 4. `.prizmkit/rules/<layer>-rules.md` — per-layer development rules generated by Rules Configuration
41
+ 5. `.prizmkit/prizm-docs/root.prizm` — `RULES:` pointer line only (not other root.prizm content; created minimally if absent)
42
+
43
+ **Project instruction file selection**:
44
+ - If `.prizmkit/manifest.json` exists, use its `platform` field as the source of truth.
45
+ - Codex → `AGENTS.md`
46
+ - Claude Code → `CLAUDE.md`
47
+ - CodeBuddy → `CODEBUDDY.md`
48
+ - `both` → `CLAUDE.md` and `CODEBUDDY.md`; `all` → all three files.
49
+ - Only when the manifest is missing, fall back to installed PrizmKit-owned platform files such as `.codex/agents/*.toml`, `.claude/commands/prizm-kit.md`, or `.codebuddy/skills/prizm-kit/SKILL.md`. Do not treat a generic `.agents/` directory as Codex.
50
+
51
+ **After planning is complete**, you MUST:
52
+ 1. Present the summary of captured project-level context (vision, conventions, architecture decisions, project brief)
53
+ 2. List the artifacts produced and suggest possible next steps (e.g., `feature-planner`, `prizmkit-plan`, etc.) — but do NOT auto-invoke any of them
54
+ 3. **NEVER auto-execute** the pipeline, feature-planner, or any implementation step
55
+ 4. **NEVER generate `feature-list.json`** — that is exclusively `feature-planner`'s responsibility
56
+
57
+ ## When to Use
58
+
59
+ Trigger this skill for requests like:
60
+ - "Plan an app", "Design a project", "Design a new application"
61
+ - "Start from scratch", "Build something new", "Create a new product"
62
+ - "Help me figure out what to build", "Brainstorm an app idea"
63
+ - "What tech stack should I use?", "Help me choose frameworks"
64
+ - "Create a project brief for my existing project"
65
+ - "Help me document what this project is about"
66
+ - "I have a codebase but no project plan yet"
67
+
68
+ Do NOT use this skill when:
69
+ - The user already has a project brief and wants to add features → use `feature-planner`
70
+ - The user wants to run the pipeline → use `feature-pipeline-launcher`
71
+ - The user is debugging/refactoring or wants to write source code directly
72
+
73
+ ## Resource Loading Rules (Mandatory)
74
+
75
+ 1. **App design reference** — always load at session start:
76
+ - Read `${SKILL_DIR}/assets/app-design-guide.md` for vision templates and tech stack matrix
77
+
78
+ 2. **Load on-demand references when triggered**:
79
+ - Architecture decisions emerged → read `${SKILL_DIR}/references/architecture-decisions.md`
80
+ - Frontend/UI project detected → read `${SKILL_DIR}/references/frontend-design-guide.md`
81
+ - User wants to explore ideas before committing → read `${SKILL_DIR}/references/brainstorm-guide.md`
82
+ - During brainstorm Phase C → also read `${SKILL_DIR}/references/red-team-checklist.md`
83
+
84
+ 3. **Project conventions discovery** — after Intent Confirmation, before brainstorm or vision work:
85
+ → Read `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` and check for `### Project Conventions` section
86
+ → If section exists and covers the project well → skip silently
87
+ → If section is missing or incomplete → run the **AI-driven convention discovery** below:
88
+
89
+ **Do NOT follow any fixed checklist.** Every project is different. You must analyze the project first, then reason about what system-level conventions this specific project needs.
90
+
91
+ **Step 1: Analyze the project**
92
+ - Read tech stack, dependencies, existing code, config files, README, any existing style guides or linter configs
93
+ - For brownfield: also read actual source code patterns (naming, file structure, error handling, etc.)
94
+ - For greenfield: use the user's stated goals and intended tech stack
95
+
96
+ **Step 2: Reason about what conventions matter for THIS project**
97
+ Think about what decisions, if left unstandardized, would cause inconsistency as the project grows. Consider all dimensions relevant to the project — these might include (but are NOT limited to):
98
+ - Language and localization choices
99
+ - Code style and naming patterns
100
+ - Architecture and communication patterns
101
+ - Data format and storage decisions
102
+ - Security and auth approaches
103
+ - UI/UX patterns
104
+ - Testing strategies
105
+ - Deployment and environment patterns
106
+ - ...anything else you observe that needs a project-level decision
107
+
108
+ The point is: YOU decide what's relevant based on what you see. A Next.js SaaS app needs completely different conventions than a Python data pipeline or a Go microservice.
109
+
110
+ **Step 3: Present findings via `AskUserQuestion`**
111
+
112
+ First, show "Already decided" conventions as text:
113
+ > **Already decided** (detected from your codebase):
114
+ > - [convention]: [value] (source: [where you found it])
115
+ > - [convention]: [value] (source: [where you found it])
116
+
117
+ Then use `AskUserQuestion` for conventions that need user input (up to 4 questions per call, use multiple calls as needed — no limit on total rounds). Each question:
118
+ - Question text includes the convention name AND why it matters for this project
119
+ - Options are the reasonable choices (2-4 per question)
120
+ - Mark the recommended option first with "(Recommended)" in its label
121
+ - Use `description` field to explain trade-offs
122
+
123
+ After each batch of `AskUserQuestion` calls, reassess: are there more project-level conventions to cover? If yes, continue with more `AskUserQuestion` calls. Keep going until ALL project-level conventions are fully addressed.
124
+
125
+ Then ask in text: "Anything I missing that you'd like to standardize?" — if the user adds more, continue the discovery loop.
126
+
127
+ **Rules:**
128
+ - **No interaction limit** — keep asking until every project-level convention is covered. Do NOT stop early or batch-skip to save rounds.
129
+ - Every proposed convention must be justified by something you observed in the project — explain WHY it matters
130
+ - Auto-confirm anything already evident from the codebase (show as "detected", let user override)
131
+ - Propose as many conventions as the project genuinely needs, but don't pad with irrelevant ones
132
+ - The "Anything I missing?" question is NOT the end — if the user adds items, ask follow-up `AskUserQuestion` calls to clarify those too
133
+
134
+ → Save answers to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` under `### Project Conventions` section (format: one bullet per convention)
135
+ → Output format will naturally vary per project — that is the intended behavior
136
+
137
+ **Infrastructure Convention Discovery (Database + Deployment)**
138
+
139
+ After project conventions are captured, check `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` for `### Infrastructure` section:
140
+
141
+ - If `### Infrastructure` section does not exist → this project was not initialized with prizmkit-init's Phase 4.6. Treat as if both database and deployment are undecided — run full inquiry below.
142
+ - If `<!-- infrastructure: deferred -->` → user explicitly skipped at init time. Ask: "During project init you deferred infrastructure decisions. Would you like to configure them now?" (options: "Yes — configure now (Recommended)", "Skip — decide later")
143
+ - If `<!-- database: deferred -->` → only database was deferred, run database inquiry only
144
+ - If `<!-- deployment: deferred -->` or deployment section is missing → run deployment inquiry only
145
+ - If both sections exist with real values → read existing config, present as "Already decided", ask: "Anything to change?" If no → skip to next phase.
146
+
147
+ **Database Convention Deep Inquiry** (AI-driven, context-aware — select from pool based on project):
148
+
149
+ AI analyzes the detected database type, ORM, and tech stack, then selects relevant questions from this pool. Do NOT ask all questions — only those that matter for THIS project:
150
+
151
+ 1. **Table naming convention**: snake_case / camelCase / PascalCase; prefix convention (e.g., `t_`, `tbl_`, none). For brownfield: detect from existing migration files or schema and present as "Already decided" with override option.
152
+ 2. **Field naming convention**: snake_case / camelCase; common fields convention — are `created_at`, `updated_at`, `deleted_at` (soft delete) required on all tables? What about `id` vs `uuid` column naming?
153
+ 3. **Migration conventions**:
154
+ - File storage directory (e.g., `db/migrations/`, `prisma/migrations/`, `alembic/versions/`)
155
+ - Naming rule (timestamp prefix `20240101_create_users`, sequence prefix `001_create_users`, ORM auto-generated)
156
+ - Migration tool (ORM built-in / Flyway / Liquibase / golang-migrate / manual SQL)
157
+ - For brownfield: detect existing migration directory and naming pattern, present as "Already decided"
158
+ 4. **Primary key strategy**: Auto-increment integer / UUID v4 / ULID / Snowflake ID / Other
159
+ 5. **Index naming convention**: e.g., `idx_{table}_{column}`, `ix_{table}_{column}`, or ORM default
160
+ 6. **Environment separation**: dev/test/prod database separation strategy; connection config management (env vars / config files / secret manager)
161
+
162
+ Use `AskUserQuestion` for each batch (up to 4 questions per call). For brownfield projects, show detected patterns as recommended options. Each question MUST include a "Skip — decide later" option.
163
+
164
+ **Deployment Configuration Deep Inquiry** (AI-driven, context-aware):
165
+
166
+ Read the existing `### Infrastructure` → `#### Deployment` section for the deployment target, then ask relevant follow-up questions:
167
+
168
+ 1. **Deployment target refinement**:
169
+ - Own server: SSH access method (key-based / password), OS (Ubuntu / CentOS / other), Docker installed?
170
+ - SaaS platform: specific platform confirmation, existing account and project? Already deployed before?
171
+ - Container: orchestration method (Docker Compose / K8s / ECS / Cloud Run)
172
+ 2. **Existing infrastructure**:
173
+ - Remote machine availability — IP/domain? Existing server configuration?
174
+ - Existing CI/CD pipeline — GitHub Actions / GitLab CI / Jenkins / other? Already configured?
175
+ - Domain name and SSL — already owned? DNS provider? SSL management (Let's Encrypt / platform-managed / other)?
176
+ 3. **AI-assisted deployment**:
177
+ - Whether AI should help execute deploy commands (via SaaS CLI like `vercel deploy`, `fly deploy`, `railway up`, `docker push`, or SSH remote commands)
178
+ - If yes: collect necessary info — API token storage method (env var name, e.g., `VERCEL_TOKEN`), project name/ID on the platform, target environment (production / staging)
179
+ - Explicitly inform: "AI will show each command and wait for your confirmation before executing"
180
+ 4. **Environment variable management**: production env var strategy (SaaS platform dashboard / `.env.production` committed to repo / secret manager like AWS Secrets Manager, Vault / CI/CD secrets)
181
+
182
+ Use `AskUserQuestion` for each batch. Each question MUST include a "Skip — decide later" option.
183
+
184
+ **Cloud Services Deep Inquiry** (Two-round AskUserQuestion):
185
+
186
+ Many projects depend on third-party cloud services (object storage, CDN, managed DB, auth, domain, email, SMS, payment, AI APIs). Capture them now so feature-planner and prizmkit-deploy can reference them later.
187
+
188
+ *Round 1 — Cloud Vendors* (multi-select via `AskUserQuestion`):
189
+ - "Which cloud vendors will this project integrate with?"
190
+ - Options: `AWS`, `Aliyun`, `Tencent Cloud`, `Cloudflare`, `Vercel`, `Other` (free text), `None — skip`
191
+ - If `None — skip`, write `<!-- cloud-services: none -->` to the `#### Cloud Services` subsection and exit this inquiry.
192
+
193
+ *Round 2 — Service Types* (multi-select, only if Round 1 returned any vendor):
194
+ - "Which types of cloud services will you use?"
195
+ - Options: `Object Storage (COS/S3/OSS)`, `CDN`, `Managed Database`, `Functions/Serverless`, `Auth (OAuth/JWT/IDaaS)`, `Domain & DNS`, `Email`, `SMS`, `Payment`, `AI API (OpenAI/Anthropic/...)`, `Other`
196
+ - The list is multi-select. Skip the question entirely if user picks "None" in Round 1.
197
+
198
+ *After both rounds, write to `#### Cloud Services`*:
199
+ - For each chosen (vendor × service) pair, append a row to the subsection (see template below)
200
+ - **Do NOT** prompt for env var names, credentials, region, or SDK details — those belong to `prizmkit-deploy`'s scope, not planning
201
+ - If the user is unsure of the mapping, store the vendors and service types separately; deploy skill can refine later
202
+
203
+ Use `AskUserQuestion` for both rounds. Each question MUST include a "Skip — decide later" option.
204
+
205
+ **After infrastructure inquiry**:
206
+ - Update `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Infrastructure` section with all collected information. Replace `<!-- deferred -->` markers with real values. Preserve any existing values that were confirmed unchanged. Full format:
207
+ ```markdown
208
+ ### Infrastructure
209
+
210
+ #### Database
211
+ - **Type**: [database type]
212
+ - **ORM**: [ORM name]
213
+ - **Table naming**: [convention, e.g., snake_case, no prefix]
214
+ - **Field naming**: [convention]; common fields: [list]
215
+ - **Primary key**: [strategy]
216
+ - **Migration directory**: [path]
217
+ - **Migration naming**: [rule]
218
+ - **Index naming**: [convention]
219
+ - **Environment separation**: [strategy]
220
+
221
+ #### Deployment
222
+ - **Target**: [platform/method]
223
+ - **AI-assisted deploy**: [yes/no]
224
+ - **Domain**: [domain or "not configured"]
225
+ - **SSL**: [management method]
226
+ - **CI/CD**: [tool or "not configured"]
227
+ - **Env var management**: [strategy]
228
+
229
+ #### Deployment Credentials Reference
230
+ - [platform]: [token/auth method description]
231
+
232
+ #### Cloud Services
233
+ - **Vendors**: [comma-separated list, e.g., "AWS, Cloudflare" or "none"]
234
+ - **Services**:
235
+ - [vendor]: [service type] — [optional one-line note, e.g., "user-upload images"]
236
+ - [vendor]: [service type]
237
+ <!-- If user picked "None" in Round 1, replace this block with: cloud-services: none -->
238
+ ```
239
+ - Items still marked "Skip — decide later" remain as `<!-- [topic]: deferred -->` in the selected project instruction file for `prizmkit-deploy` to pick up later.
240
+
241
+ 4. **Project brief accumulation** — throughout all interactive phases:
242
+ → Read `${SKILL_DIR}/references/project-brief-guide.md` for template and rules
243
+ → Update after each meaningful user response containing business intent, constraints, or design decisions
244
+
245
+ ## Rules Configuration (after Infrastructure)
246
+
247
+ After Infrastructure configuration is complete (CP-AP-1.5), check whether the project's development layers have custom rules configured. Rules are per-layer documents (frontend-rules.md, backend-rules.md, database-rules.md, mobile-rules.md) that tell AI coding assistants how to generate code for that layer — UI framework, state management, naming conventions, etc.
248
+
249
+ Rules are optional. If the user skips, AI uses general best practices freely — no reminders, no blocking.
250
+
251
+ ### Step 1: Detect which layers need rules
252
+
253
+ 1. Read `.prizmkit/config.json` to get `detected_layers` (written by `prizmkit-init` Phase 4.5).
254
+ - If `detected_layers` is present and non-empty → use it directly, jump to step 3.
255
+ - If `detected_layers` is absent or empty → run self-detection (step 2). Do NOT skip rules configuration just because this field is missing — the project may still have layers that need rules.
256
+
257
+ 2. **Self-detection** (only when `detected_layers` is absent/empty from config.json):
258
+
259
+ Scan the project to determine which development layers exist. Combine signal matching with your own judgment — the signals below are a guide, not exhaustive.
260
+
261
+ | Layer | Where to Look | Signals |
262
+ |-------|---------------|---------|
263
+ | **frontend** | `package.json` deps | `react`, `vue`, `angular`, `next`, `nuxt`, `svelte`, `solid-js`, `preact`, `remix`, `astro`, `qwik` |
264
+ | **frontend** | `package.json` devDeps | `vite`, `webpack`, `parcel`, `turbo` |
265
+ | **frontend** | Directory | `src/components/`, `pages/`, `app/` with `.tsx`/`.jsx`/`.vue` files |
266
+ | **backend** | `package.json` deps | `express`, `fastify`, `koa`, `hono`, `nest` |
267
+ | **backend** | `pyproject.toml`/`requirements.txt` | `fastapi`, `django`, `flask`, `sanic`, `litestar` |
268
+ | **backend** | `go.mod` | `gin-gonic`, `echo`, `fiber`, `chi` |
269
+ | **backend** | `pom.xml`/`build.gradle` | `spring-boot`, `quarkus`, `micronaut`, `ktor` |
270
+ | **backend** | Directory | `routes/`, `controllers/`, `handlers/`, `api/` with server code |
271
+ | **database** | `package.json` deps | `prisma`, `typeorm`, `sequelize`, `mongoose`, `knex`, `drizzle-orm`, `kysely` |
272
+ | **database** | `pyproject.toml`/`requirements.txt` | `sqlalchemy`, `pony`, `peewee`, `tortoise-orm` |
273
+ | **database** | `go.mod` | `gorm`, `sqlx`, `sqlc`, `ent`, `bun` |
274
+ | **database** | Directory/Env | `migrations/`, `prisma/`, `alembic/`; `.env*` with `DATABASE_URL`, `DB_HOST`, `MONGO_URI` |
275
+ | **mobile** | File | `pubspec.yaml` (Flutter) |
276
+ | **mobile** | `package.json` deps | `react-native`, `expo` |
277
+ | **mobile** | Directory | Both `ios/*.xcodeproj` + `android/build.gradle` simultaneously |
278
+
279
+ **Apply your own judgment**: if you see clear evidence of a layer not covered above, include it. If a signal matches but context suggests it's misleading (e.g., a dependency present but not used as the primary tech), downgrade or ignore it.
280
+
281
+ After scanning, present findings via `AskUserQuestion`:
282
+
283
+ **Question**: "I detected these development layers: [list with brief evidence]. Is this correct?"
284
+ - **Yes, looks correct (Recommended)** — use detected layers
285
+ - **Mostly correct, adjust** — I'll note changes
286
+ - **No layers apply** — skip rules configuration (library/CLI project)
287
+
288
+ If user picks "No layers apply" → skip this entire section, proceed to Prerequisites.
289
+ If user picks "Mostly correct, adjust" → ask what to add, remove, or change, then reassemble `detected_layers`. Continue to step 3.
290
+ If user confirms → assemble `detected_layers` array and continue to step 3.
291
+
292
+ 3. For each layer in `detected_layers`, check if `.prizmkit/rules/<layer>-rules.md` exists:
293
+ - `frontend` → `.prizmkit/rules/frontend-rules.md`
294
+ - `backend` → `.prizmkit/rules/backend-rules.md`
295
+ - `database` → `.prizmkit/rules/database-rules.md`
296
+ - `mobile` → `.prizmkit/rules/mobile-rules.md`
297
+
298
+ 4. Display status:
299
+
300
+ ```
301
+ Rules Status Check:
302
+ [missing] frontend-rules.md — frontend code detected, no rules configured
303
+ [exists] backend-rules.md — already configured
304
+ [missing] database-rules.md — database interaction detected, no rules configured
305
+ ```
306
+
307
+ 5. If all detected layers already have rules → skip to Prerequisites.
308
+ 6. If missing rules found, proceed to Step 2.
309
+
310
+ ### Step 2: Ask configuration mode
311
+
312
+ Use `AskUserQuestion`:
313
+
314
+ **Question**: "{N} layer(s) without custom dev rules. How would you like to configure?"
315
+ - **Quick setup (only core decisions, rest use recommended defaults)** — covers essential architecture, core technology decisions, and testing questions specific to each layer. Detailed configuration topics (design-system, i18n, performance tuning, deployment details, AI constraints) adopt recommended defaults. See Step 4 for exact per-layer coverage.
316
+ - **Full setup (customize every detail)** — 15-25 questions per layer
317
+ - **Skip — no custom rules needed**
318
+
319
+ If user picks "Skip" → proceed to Prerequisites.
320
+
321
+ ### Step 3: Select layers to configure
322
+
323
+ Use `AskUserQuestion` (multiSelect):
324
+
325
+ **Question**: "Which layers do you want to configure?"
326
+ - Options: the missing layers from Step 1, each with a brief description
327
+ - All pre-selected by default
328
+
329
+ ### Step 4: Configure each selected layer
330
+
331
+ For each selected layer, run the rules Q&A workflow. This follows the 4-phase rule generation pattern:
332
+
333
+ **Phase A — Load layer resources:**
334
+ - Read `${SKILL_DIR}/references/rules/<layer>/fixed-rules.md` — industry-consensus rules injected without asking
335
+ - Read `${SKILL_DIR}/references/rules/<layer>/question-bank.md` — interactive questions organized in groups (G1→G10)
336
+
337
+ **Phase B — Interactive Q&A:**
338
+ - Ask questions one group at a time (max 3 questions per message), as defined in question-bank.md
339
+ - Each question shows a "Recommended" option to reduce decision cost
340
+ - **Quick mode**: ask only the following groups per layer. All other groups adopt recommended defaults silently.
341
+ - **Frontend**: G1 (Tech Stack), G2 (Styling), G3 (State & Data Fetching), G7 (Testing & Quality). Skip: G4 (Design System), G5 (Responsive), G6 (i18n), G8 (AI Vibecoding), G9 (Performance).
342
+ - **Backend**: G1 (Language & Runtime), G2 (Framework & Architecture), G3 (API Style), G4 (Data Layer), G7 (Testing & Quality). Skip: G5 (Auth), G6 (Infrastructure), G8 (Observability), G9 (AI Constraints).
343
+ - **Database**: G1 (Database Selection), G2 (Data Modeling), G3 (Migration), G7 (AI Constraints). Skip: G4 (Index & Performance), G5 (Security & Compliance), G6 (High Availability & Ops).
344
+ - **Mobile**: G1 (Platform & Language), G2 (Architecture), G3 (UI Framework), G4 (Navigation & State), G7 (Testing). Skip: G5 (Networking & Data), G6 (Platform Features), G8 (App Distribution), G9 (Performance & Accessibility), G10 (AI Constraints).
345
+ - **Full mode**: ask all groups in order (G1→G9 for frontend/backend, G1→G7 for database, G1→G10 for mobile)
346
+ - Shortcut commands work at any point:
347
+ - `recommended` / `default` → adopt all recommended for current group
348
+ - `all recommended` → adopt all recommended for all remaining groups
349
+ - `skip` → mark current group as "Not required at this stage"
350
+ - Record answers in memory after each group.
351
+
352
+ **Phase C — Auto-derivation:**
353
+ - Read `${SKILL_DIR}/references/rules/<layer>/derivation-rules.md`
354
+ - Match user answers against the trigger map using keyword matching
355
+ - Derive platform-specific rules without asking the user (e.g., choosing Flutter → auto-inject Flutter widget/persistence/navigation rules)
356
+
357
+ **Phase D — Render and write:**
358
+ - Read `${SKILL_DIR}/references/rules/<layer>/template.md`
359
+ - Fill all template placeholders with accumulated content from Phases A+B+C
360
+ - **Post-render self-check**: scan for residual `{{ ` or ` }}` — count must be 0 before writing
361
+ - Generate Appendix A (Deny List) and Appendix B (Recommended Tools) per template instructions
362
+ - Create `.prizmkit/rules/` directory if it doesn't exist
363
+ - Write `.prizmkit/rules/<layer>-rules.md`
364
+
365
+ ### Step 5: Update root.prizm
366
+
367
+ After all selected layers are configured:
368
+ 1. Check if `.prizmkit/prizm-docs/root.prizm` exists.
369
+ 2. **If root.prizm exists**:
370
+ - Read the file.
371
+ - Check if `RULES:` line exists:
372
+ - If present: append new rules file paths to the existing line (check for duplicates first — skip paths already on the line).
373
+ - If absent: add `RULES: .prizmkit/rules/<layer>-rules.md, ...` at the end (after PROJECT_BRIEF line).
374
+ 3. **If root.prizm does not exist** (e.g., project without prizm-docs init):
375
+ - Create a minimal `root.prizm` with:
376
+ ```
377
+ PRIZM_VERSION: 2
378
+ PROJECT: <name> — from package.json name, directory name, or git repo name
379
+ MODULE_INDEX:
380
+ RULES: .prizmkit/rules/<layer>-rules.md, ...
381
+ ```
382
+ - The file will be expanded when the project later runs `prizmkit-prizm-docs init`.
383
+ 4. The RULES pointer tells every AI session where to find custom dev rules — AI reads rules via this pointer on session start
384
+
385
+ ### After rules configuration
386
+
387
+ Proceed to Prerequisites and continue the app-planner workflow.
388
+
389
+ ## Prerequisites
390
+
391
+ Before questions, check optional context files (never block if absent):
392
+ - `.prizmkit/prizm-docs/root.prizm` (architecture/project context)
393
+ - `.prizmkit/config.json` (existing stack preferences and detected tech stack)
394
+ - `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Project Conventions` section (previously answered project conventions)
395
+ - `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Infrastructure` section (database and deployment config from prizmkit-init or previous app-planner run)
396
+
397
+ **Tech stack auto-population from config.json:**
398
+ - If `.prizmkit/config.json` contains a `tech_stack` object, use it to pre-fill tech assumptions.
399
+ - Map config fields: `language`, `runtime`, `frontend_framework`, `frontend_styling`, `backend_framework`, `database`, `orm`, `testing`, `bundler`, `project_type`.
400
+ - Do NOT re-ask for tech stack info already in config.json. Show the detected stack and ask: "Is this correct? Any changes?"
401
+ - If config.json has no `tech_stack`, fall back to asking during Phase 2.
402
+
403
+ Note:
404
+ - This skill **reads** `.prizmkit/config.json` if present.
405
+ - This skill does **not** create `.prizmkit/config.json` directly.
406
+ - Creation/update is handled by bootstrap/init flows (e.g., `prizmkit-init`, `.prizmkit/dev-pipeline/scripts/init-dev-team.py`).
407
+
408
+ ## Interaction Style (Hard Rule)
409
+
410
+ **ALL decision points MUST use the `AskUserQuestion` tool** to present interactive, selectable options. Do NOT render options as plain text (e.g., `[A] option [B] option`) — the user must be able to click/select, not type a letter.
411
+
412
+ This applies to:
413
+ - Intent confirmation
414
+ - Project conventions
415
+ - Tech stack selection
416
+ - Architecture decisions
417
+ - Session exit gates
418
+ - Brownfield prerequisite check
419
+ - Any other decision point
420
+
421
+ **How to use `AskUserQuestion`:**
422
+ - Each decision point → one `AskUserQuestion` call with 1-4 questions. Use multiple calls as needed — there is NO limit on total rounds for project-level convention discovery. Keep going until everything is covered.
423
+ - Each question has 2-4 selectable options (the tool auto-adds "Other" for custom input)
424
+ - Use `multiSelect: true` when the user can pick more than one
425
+ - Mark the recommended option first and append "(Recommended)" to its label
426
+ - Use the `description` field to explain trade-offs or implications
427
+ - **Every non-essential question MUST include a "Skip" option** (e.g., "Skip — decide later"). Users should never be forced to answer something they want to defer. Skipped items are simply not written to conventions — they can be added in a future session.
428
+
429
+ **What can be skipped vs. what cannot:**
430
+ - **Cannot skip**: Intent confirmation (must know the session goal)
431
+ - **Everything else can be skipped**: conventions, tech stack choices, architecture decisions, design direction, etc. If the user skips, move on — do not re-ask or block progress.
432
+
433
+ **When gathering open-ended information** (e.g., "describe your app idea"), use regular text questions — but follow up with `AskUserQuestion`-based clarifications wherever possible.
434
+
435
+ ## Intent Confirmation (Mandatory First Step)
436
+
437
+ After initial greeting, use `AskUserQuestion` to confirm intent:
438
+
439
+ **Question**: "What would you like to do?"
440
+ - **Explore ideas first (Recommended)** — brainstorm and refine ideas before committing to a plan
441
+ - **Produce a project plan** — define vision, tech stack, and constraints → generates project-brief.md for pipeline use
442
+ - **Generate project context only** — for an existing project that needs a project brief without full planning
443
+
444
+ Route by answer:
445
+ - **Produce a project plan** → Continue to Core Workflow. Set session goal = `produce`.
446
+ - **Explore ideas first** → Enter **Exploration Mode**:
447
+ - Run project conventions check first
448
+ - Load `${SKILL_DIR}/references/brainstorm-guide.md` and follow its structured ideation process (Phases A-D)
449
+ - Brainstorm Phase D output serves as the Vision Summary (CP-AP-2)
450
+ - After brainstorm completes, use `AskUserQuestion`: "Ideas are taking shape. What's next?"
451
+ - **Continue to project planning (Recommended)** — capture tech stack, conventions, and architecture decisions
452
+ - **Continue refining** — keep brainstorming
453
+ - **Save draft & exit** — save progress to .prizmkit/planning/
454
+ - **Checkpoints in explore mode**: CP-AP-0 (required), CP-AP-1 (required), CP-AP-2 (from brainstorm output), CP-AP-3 (only if user proceeds to Phase 2), CP-AP-4 and CP-AP-5 (only if user transitions to produce mode)
455
+ - **Generate project context only** → Enter **Quick Context Mode** (brownfield only):
456
+ - Run Project State Detection → if greenfield, redirect to produce mode
457
+ - Proactively scan the project (same as brownfield behavior)
458
+ - Generate project-brief.md from inferred context
459
+ - Skip extensive brainstorming and constraint phases
460
+ - Present brief for user confirmation → write → done
461
+
462
+ Session goal tracking: Track the intent (`produce`, `explore`, or `quick_context`) throughout the session. If `explore`, always re-prompt before ending.
463
+
464
+ ## Project State Detection (after Intent Confirmation)
465
+
466
+ Detect whether this is a **greenfield** (new) or **brownfield** (existing) project and adapt the workflow accordingly.
467
+
468
+ ### Detection Signals
469
+
470
+ | Signal | Greenfield | Brownfield |
471
+ |--------|-----------|------------|
472
+ | `package.json` / `pyproject.toml` / `go.mod` / `Cargo.toml` / `pom.xml` | absent | present |
473
+ | `src/` or `app/` directory with source files | absent | present |
474
+ | `.git` with commit history | absent or initial commit only | present with history |
475
+ | Empty or near-empty directory | yes | no |
476
+
477
+ ### Greenfield Behavior (default)
478
+
479
+ Proceed with the standard Core Workflow — ask all questions from scratch.
480
+
481
+ ### Brownfield Behavior
482
+
483
+ When an existing project is detected:
484
+
485
+ **Step 1: Prerequisite Check (Mandatory)**
486
+
487
+ Before ANY planning work, check if AI-essential project context files exist:
488
+
489
+ | File | Purpose | Status |
490
+ |------|---------|--------|
491
+ | `.prizmkit/prizm-docs/root.prizm` | Project architecture context for AI | exists / missing |
492
+ | `.prizmkit/config.json` | Tech stack + runtime config | exists / missing |
493
+ | `.prizmkit/plans/project-brief.md` | Product vision checklist | exists / missing |
494
+
495
+ **If ANY are missing**, show the status table, then use `AskUserQuestion`:
496
+
497
+ **Question**: "Some AI context files are missing. These help AI understand your project — making planning much more effective. How would you like to proceed?"
498
+ - **Run project init first (Recommended)** — invoke `prizmkit-init` to scan your codebase and generate these files, then return to planning
499
+ - **Continue without init** — I'll scan the project manually during this session (less thorough)
500
+ - **Skip, I'll set these up later** — proceed with planning using only what's available
501
+
502
+ - **Run project init first** → Invoke `prizmkit-init`, then resume app-planner from where it left off
503
+ - **Continue without init** → Continue with Step 2 below (manual scan)
504
+ - **Skip** → Continue with Step 3, skip scanning
505
+
506
+ **Step 2: Proactive Project Scanning**
507
+
508
+ Do NOT ask the user to describe their project — read it yourself first:
509
+
510
+ 1. **Scan project structure** to understand the codebase layout:
511
+ ```powershell
512
+ Get-ChildItem -Path . -Directory -Recurse -Depth 2 -ErrorAction SilentlyContinue |
513
+ Where-Object { $_.FullName -notmatch '\\(node_modules|\.git|dist|build|__pycache__|vendor)(\\|$)' } |
514
+ Select-Object -ExpandProperty FullName
515
+ ```
516
+
517
+ 2. **Read existing project metadata** to infer tech stack and purpose:
518
+ - `package.json` → name, description, dependencies, scripts
519
+ - `pyproject.toml` / `requirements.txt` → Python dependencies
520
+ - `go.mod` → Go module info
521
+ - `README.md` → project description and goals
522
+ - `.prizmkit/config.json` → previously detected tech stack
523
+ - `.prizmkit/prizm-docs/root.prizm` → existing architecture context
524
+
525
+ 3. **Read key source files** (entry points, main routes, core models) to understand what the project actually does — don't rely solely on metadata.
526
+
527
+ **Step 3: Present inferred summary with confirmation**
528
+
529
+ Show the summary as text, then use `AskUserQuestion`:
530
+
531
+ > Based on my analysis of your codebase:
532
+ >
533
+ > **Project**: [name] — [inferred description]
534
+ > **Tech Stack**: [framework] + [language] + [key dependencies]
535
+ > **Key Features Found**: [list 3-5 detected capabilities]
536
+ > **Architecture**: [e.g., monolithic, microservices, serverless]
537
+
538
+ **Question**: "Does this look correct?"
539
+ - **Yes, looks correct (Recommended)** — proceed with planning
540
+ - **Mostly correct, with changes** — I'll note corrections
541
+ - **This is off** — let me describe the project
542
+
543
+ **Step 4: Pre-fill and focus**
544
+
545
+ - Phase 2 tech stack selection → largely pre-filled from dependencies
546
+ - Vision/problem statement → inferred from README or package description (user confirms)
547
+ - Existing features → note them as `[x]` items in project brief
548
+
549
+ **Focus remaining questions** (as options where possible) on what CANNOT be inferred:
550
+ - Target users and core value proposition
551
+ - Future direction and planned capabilities
552
+ - Non-functional requirements (performance, scale, security)
553
+ - Design direction (for frontend projects)
554
+
555
+ ## Core Workflow
556
+
557
+ Execute the planning workflow in conversation mode with mandatory checkpoints:
558
+
559
+ ### Interactive Phases
560
+ 1. Clarify business goal and scope
561
+ 1.1 Confirm deliverable intent (→ Intent Confirmation — option-based)
562
+ 1.2 **Requirement clarification** — for ANY unclear aspect of the user's vision, goals, target users, or scope, use option-based questions where possible. When common patterns exist, present them as choices. Only use open-ended questions for truly unique input (e.g., "describe your app idea"). Follow up with option-based clarifications.
563
+ 2. Confirm constraints and tech assumptions
564
+ 2.1 Tech stack selection — use `${SKILL_DIR}/assets/app-design-guide.md` §2 decision matrix. Use `AskUserQuestion` for each major tech decision (framework, database, styling, etc.)
565
+ 2.2 **Frontend design check** (for frontend projects) — scan for existing UI/UX design docs. If none found, use `AskUserQuestion`:
566
+ - Question: "No UI/UX design docs found. Would you like to establish design direction?"
567
+ - Options: "Establish design direction now (Recommended)", "Skip for now", "I have external designs"
568
+ 3. Capture architecture decisions and finalize project brief
569
+ 4. Present completion summary with artifacts produced and possible next steps
570
+
571
+ ### Checkpoints (Mandatory Gates)
572
+
573
+ Checkpoints catch cascading errors early — skipping one means the next phase builds on unvalidated assumptions.
574
+
575
+ | Checkpoint | Artifact/State | Criteria | Phase |
576
+ |-----------|----------------|----------|-------|
577
+ | **CP-AP-0** | Intent Confirmed | User confirmed session goal (produce / explore) | 1 |
578
+ | **CP-AP-1** | Conventions Checked | Project conventions loaded or asked; `### Project Conventions` section in `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` up to date | 1 |
579
+ | **CP-AP-1.5** | Infrastructure Checked | Infrastructure config loaded or asked; `### Infrastructure` section in `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` addressed — database, deployment **and cloud services** each configured or explicitly deferred | 1-2 |
580
+ | **CP-AP-1.6** | Rules Configured | For each detected layer (from config.json or self-detection), rules file exists in `.prizmkit/rules/` or user explicitly skipped. `root.prizm` `RULES:` pointer up-to-date. | 2 |
581
+ | **CP-AP-2** | Vision Summary | Goal/users/differentiators confirmed by user. For brownfield: existing purpose confirmed or refined. | 1-2 |
582
+ | **CP-AP-3** | Frontend Design Evaluated | For frontend projects: checked for existing UI/UX design system; user was asked if missing. **Auto-pass** for backend-only or non-UI projects. | 2 |
583
+ | **CP-AP-4** | Project Brief Accumulated | `.prizmkit/plans/project-brief.md` exists at `.prizmkit/plans/` with at least 3 ideas listed. For brownfield: already-implemented items marked `[x]` count toward this total. | 3 |
584
+ | **CP-AP-5** | Planning Complete | All project-level context captured: conventions, infrastructure config, tech stack, architecture decisions, project brief finalized | 4 |
585
+
586
+ ## Architecture Decision Capture
587
+
588
+ After Phase 2, if framework-shaping architecture decisions emerged during planning (tech stack, communication patterns, data model strategies — not individual feature details), read `${SKILL_DIR}/references/architecture-decisions.md` and follow the capture flow. Most sessions will NOT produce architecture decisions — only capture when genuinely impactful.
589
+
590
+ **How it works**:
591
+ 1. If decisions are captured → append to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` under `### Architecture Decisions` section
592
+ 2. Downstream skills (feature-planner, prizmkit-plan, etc.) read `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` as standard context, so they automatically receive these decisions
593
+ 3. Do NOT write architecture decision content directly to `.prizmkit/prizm-docs/root.prizm` — that file is maintained by `prizmkit-prizm-docs` and `prizmkit-retrospective`. (The `RULES:` pointer line is managed by Rules Configuration, not by this section.) If the project needs `.prizmkit/prizm-docs/`, recommend the user run `prizmkit-prizm-docs` init after planning.
594
+
595
+ ## Project Brief Accumulation
596
+
597
+ During interactive planning, maintain a `.prizmkit/plans/project-brief.md` at `.prizmkit/plans/` as a simple checklist of product ideas.
598
+
599
+ → Read `${SKILL_DIR}/references/project-brief-guide.md` for full format and rules.
600
+
601
+ ## Session Exit Gate
602
+
603
+ Prevent accidental session exit without completing the planning artifacts.
604
+
605
+ ### Trigger Conditions
606
+
607
+ Activate when ALL true:
608
+ - Session goal = `produce`
609
+ - `.prizmkit/plans/project-brief.md` has not been written or is incomplete (fewer than 3 ideas listed)
610
+
611
+ ### Gate Behavior
612
+
613
+ When the session appears to be ending:
614
+ 1. **Remind**: "You set out to produce a project plan but `.prizmkit/plans/project-brief.md` isn't complete yet."
615
+ 2. Use `AskUserQuestion`: "How would you like to proceed?"
616
+ - **Continue to completion (Recommended)** — finish the project brief
617
+ - **Save draft & exit** — write current progress as draft to `.prizmkit/planning/`
618
+ - **Abandon** — exit without saving
619
+
620
+ ## Completion Summary
621
+
622
+ After all checkpoints pass, present a summary and end the session:
623
+
624
+ 1. **Summary** (as text): List all project-level artifacts produced:
625
+ - Project conventions → `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Project Conventions`
626
+ - Infrastructure config → `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Infrastructure` (database conventions + deployment config)
627
+ - Tech stack → `.prizmkit/config.json`
628
+ - Architecture decisions (if any) → `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Architecture Decisions`
629
+ - Dev rules (if configured) → `.prizmkit/rules/<layer>-rules.md` (with `root.prizm` `RULES:` pointer)
630
+ - Project brief → `.prizmkit/plans/project-brief.md`
631
+
632
+ 2. **Suggest possible next steps** (as text, NOT auto-invoked):
633
+ > Project-level planning is complete. When you're ready, here are some possible next steps:
634
+ > - `feature-planner` — decompose the project into features and generate `feature-list.json`
635
+ > - `prizmkit-plan` — start working on a specific feature directly
636
+ > - `prizmkit-prizm-docs` — initialize or update project documentation
637
+ > - `prizmkit-deploy` — supplement infrastructure config or execute deployment (if AI-assisted deploy was configured)
638
+
639
+ **Do NOT invoke any of these.** The user decides what to do next, in their own time.