@smartsoft001/pro-claude-plugins 0.2.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 (198) hide show
  1. package/.claude-plugin/marketplace.json +26 -0
  2. package/README.md +56 -0
  3. package/package.json +14 -0
  4. package/plugins/flow/.claude-plugin/README.md +91 -0
  5. package/plugins/flow/.claude-plugin/merge-permissions.js +115 -0
  6. package/plugins/flow/.claude-plugin/plugin.json +5 -0
  7. package/plugins/flow/.claude-plugin/settings.template.json +86 -0
  8. package/plugins/flow/agents/angular-component-scaffolder.md +176 -0
  9. package/plugins/flow/agents/angular-directive-builder.md +154 -0
  10. package/plugins/flow/agents/angular-guard-builder.md +244 -0
  11. package/plugins/flow/agents/angular-jest-test-writer.md +475 -0
  12. package/plugins/flow/agents/angular-pipe-builder.md +170 -0
  13. package/plugins/flow/agents/angular-resolver-builder.md +287 -0
  14. package/plugins/flow/agents/angular-service-builder.md +162 -0
  15. package/plugins/flow/agents/angular-signal-state-builder.md +340 -0
  16. package/plugins/flow/agents/angular-test-diagnostician.md +279 -0
  17. package/plugins/flow/agents/angular-testbed-configurator.md +315 -0
  18. package/plugins/flow/agents/arch-scaffolder.md +278 -0
  19. package/plugins/flow/agents/e2e-data-testid-injector.md +195 -0
  20. package/plugins/flow/agents/e2e-project-scaffolder.md +194 -0
  21. package/plugins/flow/agents/e2e-test-writer.md +357 -0
  22. package/plugins/flow/agents/shared-agent-evolver.md +294 -0
  23. package/plugins/flow/agents/shared-build-verifier.md +160 -0
  24. package/plugins/flow/agents/shared-config-updater.md +310 -0
  25. package/plugins/flow/agents/shared-coverage-enforcer.md +184 -0
  26. package/plugins/flow/agents/shared-error-handler.md +217 -0
  27. package/plugins/flow/agents/shared-file-creator.md +344 -0
  28. package/plugins/flow/agents/shared-impl-orchestrator.md +312 -0
  29. package/plugins/flow/agents/shared-impl-reporter.md +368 -0
  30. package/plugins/flow/agents/shared-impl-teammate.md +201 -0
  31. package/plugins/flow/agents/shared-linear-subtask-iterator.md +337 -0
  32. package/plugins/flow/agents/shared-logic-implementer.md +244 -0
  33. package/plugins/flow/agents/shared-maia-api.md +26 -0
  34. package/plugins/flow/agents/shared-parallelization-analyzer.md +343 -0
  35. package/plugins/flow/agents/shared-performance-validator.md +168 -0
  36. package/plugins/flow/agents/shared-plan-perspective.md +271 -0
  37. package/plugins/flow/agents/shared-project-standardizer.md +205 -0
  38. package/plugins/flow/agents/shared-report-synthesizer.md +188 -0
  39. package/plugins/flow/agents/shared-review-teammate.md +189 -0
  40. package/plugins/flow/agents/shared-security-scanner.md +186 -0
  41. package/plugins/flow/agents/shared-style-enforcer.md +230 -0
  42. package/plugins/flow/agents/shared-subtask-dependency-analyzer.md +189 -0
  43. package/plugins/flow/agents/shared-tdd-developer.md +350 -0
  44. package/plugins/flow/agents/shared-team-coordinator.md +192 -0
  45. package/plugins/flow/agents/shared-test-fixer.md +186 -0
  46. package/plugins/flow/agents/shared-test-runner.md +191 -0
  47. package/plugins/flow/agents/shared-ui-classifier.md +263 -0
  48. package/plugins/flow/agents/shared-verification-orchestrator.md +194 -0
  49. package/plugins/flow/agents/shared-verification-runner.md +140 -0
  50. package/plugins/flow/agents/ui-a11y-validator.md +305 -0
  51. package/plugins/flow/agents/ui-screenshot-reporter.md +329 -0
  52. package/plugins/flow/agents/ui-web-designer.md +214 -0
  53. package/plugins/flow/scripts/compute-session-tokens.sh +39 -0
  54. package/plugins/flow/skills/a11y-audit/SKILL.md +214 -0
  55. package/plugins/flow/skills/angular-patterns/SKILL.md +191 -0
  56. package/plugins/flow/skills/browser-capture/SKILL.md +238 -0
  57. package/plugins/flow/skills/commit/SKILL.md +259 -0
  58. package/plugins/flow/skills/debug-helper/SKILL.md +375 -0
  59. package/plugins/flow/skills/impl/SKILL.md +992 -0
  60. package/plugins/flow/skills/karpathy-guidelines/SKILL.md +72 -0
  61. package/plugins/flow/skills/linear-suggestion/SKILL.md +132 -0
  62. package/plugins/flow/skills/maia-files-delete/SKILL.md +59 -0
  63. package/plugins/flow/skills/maia-files-upload/SKILL.md +57 -0
  64. package/plugins/flow/skills/nx-conventions/SKILL.md +326 -0
  65. package/plugins/flow/skills/plan/SKILL.md +1033 -0
  66. package/plugins/flow/skills/push/SKILL.md +759 -0
  67. package/plugins/flow/skills/review/SKILL.md +443 -0
  68. package/plugins/flow/skills/test-e2e/SKILL.md +164 -0
  69. package/plugins/flow/skills/test-unit/SKILL.md +456 -0
  70. package/plugins/flow-external/.claude-plugin/README.md +146 -0
  71. package/plugins/flow-external/.claude-plugin/merge-permissions.js +94 -0
  72. package/plugins/flow-external/.claude-plugin/plugin.json +5 -0
  73. package/plugins/flow-external/.claude-plugin/settings.template.json +78 -0
  74. package/plugins/flow-external/agents/angular-component-scaffolder.md +271 -0
  75. package/plugins/flow-external/agents/angular-directive-builder.md +134 -0
  76. package/plugins/flow-external/agents/angular-guard-builder.md +73 -0
  77. package/plugins/flow-external/agents/angular-pipe-builder.md +90 -0
  78. package/plugins/flow-external/agents/angular-resolver-builder.md +79 -0
  79. package/plugins/flow-external/agents/angular-service-builder.md +168 -0
  80. package/plugins/flow-external/agents/angular-state-builder.md +263 -0
  81. package/plugins/flow-external/agents/shared-build-verifier.md +67 -0
  82. package/plugins/flow-external/agents/shared-impl-orchestrator.md +90 -0
  83. package/plugins/flow-external/agents/shared-impl-reporter.md +135 -0
  84. package/plugins/flow-external/agents/shared-linear-subtask-iterator.md +70 -0
  85. package/plugins/flow-external/agents/shared-ui-classifier.md +38 -0
  86. package/plugins/flow-external/agents/ui-web-designer.md +203 -0
  87. package/plugins/flow-external/scripts/compute-session-tokens.sh +39 -0
  88. package/plugins/flow-external/skills/a11y-audit/SKILL.md +97 -0
  89. package/plugins/flow-external/skills/angular-cli-conventions/SKILL.md +268 -0
  90. package/plugins/flow-external/skills/angular-patterns/SKILL.md +182 -0
  91. package/plugins/flow-external/skills/browser-capture/SKILL.md +74 -0
  92. package/plugins/flow-external/skills/commit/SKILL.md +114 -0
  93. package/plugins/flow-external/skills/debug-helper/SKILL.md +135 -0
  94. package/plugins/flow-external/skills/impl/SKILL.md +218 -0
  95. package/plugins/flow-external/skills/karpathy-guidelines/SKILL.md +72 -0
  96. package/plugins/flow-external/skills/linear-suggestion/SKILL.md +62 -0
  97. package/plugins/flow-external/skills/maia-files-delete/SKILL.md +34 -0
  98. package/plugins/flow-external/skills/maia-files-upload/SKILL.md +41 -0
  99. package/plugins/flow-external/skills/plan/SKILL.md +334 -0
  100. package/plugins/flow-external/skills/push/SKILL.md +232 -0
  101. package/plugins/flow-legacy/.claude-plugin/README.md +143 -0
  102. package/plugins/flow-legacy/.claude-plugin/merge-permissions.js +94 -0
  103. package/plugins/flow-legacy/.claude-plugin/plugin.json +5 -0
  104. package/plugins/flow-legacy/.claude-plugin/settings.template.json +79 -0
  105. package/plugins/flow-legacy/agents/angular-component-scaffolder.md +327 -0
  106. package/plugins/flow-legacy/agents/angular-directive-builder.md +253 -0
  107. package/plugins/flow-legacy/agents/angular-guard-builder.md +326 -0
  108. package/plugins/flow-legacy/agents/angular-pipe-builder.md +238 -0
  109. package/plugins/flow-legacy/agents/angular-resolver-builder.md +339 -0
  110. package/plugins/flow-legacy/agents/angular-service-builder.md +271 -0
  111. package/plugins/flow-legacy/agents/angular-state-builder.md +480 -0
  112. package/plugins/flow-legacy/agents/shared-impl-orchestrator.md +174 -0
  113. package/plugins/flow-legacy/agents/shared-impl-reporter.md +232 -0
  114. package/plugins/flow-legacy/agents/shared-linear-subtask-iterator.md +198 -0
  115. package/plugins/flow-legacy/agents/shared-tdd-developer.md +307 -0
  116. package/plugins/flow-legacy/agents/shared-test-runner.md +133 -0
  117. package/plugins/flow-legacy/agents/shared-ui-classifier.md +145 -0
  118. package/plugins/flow-legacy/scripts/compute-session-tokens.sh +39 -0
  119. package/plugins/flow-legacy/skills/a11y-audit/SKILL.md +214 -0
  120. package/plugins/flow-legacy/skills/angular-patterns/SKILL.md +346 -0
  121. package/plugins/flow-legacy/skills/browser-capture/SKILL.md +238 -0
  122. package/plugins/flow-legacy/skills/commit/SKILL.md +215 -0
  123. package/plugins/flow-legacy/skills/debug-helper/SKILL.md +395 -0
  124. package/plugins/flow-legacy/skills/impl/SKILL.md +710 -0
  125. package/plugins/flow-legacy/skills/karpathy-guidelines/SKILL.md +72 -0
  126. package/plugins/flow-legacy/skills/linear-suggestion/SKILL.md +132 -0
  127. package/plugins/flow-legacy/skills/maia-files-delete/SKILL.md +59 -0
  128. package/plugins/flow-legacy/skills/maia-files-upload/SKILL.md +57 -0
  129. package/plugins/flow-legacy/skills/nx-conventions/SKILL.md +368 -0
  130. package/plugins/flow-legacy/skills/plan/SKILL.md +742 -0
  131. package/plugins/flow-legacy/skills/push/SKILL.md +645 -0
  132. package/plugins/flow-legacy/skills/test-unit/SKILL.md +500 -0
  133. package/plugins/smart-pro/.claude-plugin/README.md +115 -0
  134. package/plugins/smart-pro/.claude-plugin/merge-permissions.js +129 -0
  135. package/plugins/smart-pro/.claude-plugin/plugin.json +5 -0
  136. package/plugins/smart-pro/.claude-plugin/settings.template.json +94 -0
  137. package/plugins/smart-pro/agents/angular-components/AGENT.md +214 -0
  138. package/plugins/smart-pro/hooks/CONFIG.md +198 -0
  139. package/plugins/smart-pro/hooks/README.md +139 -0
  140. package/plugins/smart-pro/hooks/audit_logger.py +107 -0
  141. package/plugins/smart-pro/hooks/auto_format.sh +11 -0
  142. package/plugins/smart-pro/hooks/hooks.json +79 -0
  143. package/plugins/smart-pro/hooks/safety_validator.py +129 -0
  144. package/plugins/smart-pro/hooks/sensitive_file_blocker.py +58 -0
  145. package/plugins/smart-pro/hooks/skill_validator.py +220 -0
  146. package/plugins/smart-pro/skills/angular-components-action-panel/SKILL.md +159 -0
  147. package/plugins/smart-pro/skills/angular-components-avatar/SKILL.md +142 -0
  148. package/plugins/smart-pro/skills/angular-components-badge/SKILL.md +110 -0
  149. package/plugins/smart-pro/skills/angular-components-breadcrumbs/SKILL.md +91 -0
  150. package/plugins/smart-pro/skills/angular-components-button/SKILL.md +146 -0
  151. package/plugins/smart-pro/skills/angular-components-button-group/SKILL.md +121 -0
  152. package/plugins/smart-pro/skills/angular-components-calendar/SKILL.md +78 -0
  153. package/plugins/smart-pro/skills/angular-components-card/SKILL.md +110 -0
  154. package/plugins/smart-pro/skills/angular-components-card-heading/SKILL.md +105 -0
  155. package/plugins/smart-pro/skills/angular-components-command-palette/SKILL.md +168 -0
  156. package/plugins/smart-pro/skills/angular-components-container/SKILL.md +93 -0
  157. package/plugins/smart-pro/skills/angular-components-description-list/SKILL.md +102 -0
  158. package/plugins/smart-pro/skills/angular-components-details/SKILL.md +70 -0
  159. package/plugins/smart-pro/skills/angular-components-divider/SKILL.md +110 -0
  160. package/plugins/smart-pro/skills/angular-components-drawer/SKILL.md +136 -0
  161. package/plugins/smart-pro/skills/angular-components-dropdown/SKILL.md +131 -0
  162. package/plugins/smart-pro/skills/angular-components-empty-state/SKILL.md +103 -0
  163. package/plugins/smart-pro/skills/angular-components-feed/SKILL.md +110 -0
  164. package/plugins/smart-pro/skills/angular-components-form/SKILL.md +77 -0
  165. package/plugins/smart-pro/skills/angular-components-grid-list/SKILL.md +91 -0
  166. package/plugins/smart-pro/skills/angular-components-input/SKILL.md +118 -0
  167. package/plugins/smart-pro/skills/angular-components-list/SKILL.md +75 -0
  168. package/plugins/smart-pro/skills/angular-components-list-container/SKILL.md +106 -0
  169. package/plugins/smart-pro/skills/angular-components-media-object/SKILL.md +133 -0
  170. package/plugins/smart-pro/skills/angular-components-modal/SKILL.md +159 -0
  171. package/plugins/smart-pro/skills/angular-components-multi-column-layout/SKILL.md +84 -0
  172. package/plugins/smart-pro/skills/angular-components-navbar/SKILL.md +93 -0
  173. package/plugins/smart-pro/skills/angular-components-notification/SKILL.md +147 -0
  174. package/plugins/smart-pro/skills/angular-components-page/SKILL.md +162 -0
  175. package/plugins/smart-pro/skills/angular-components-page-heading/SKILL.md +96 -0
  176. package/plugins/smart-pro/skills/angular-components-paging/SKILL.md +86 -0
  177. package/plugins/smart-pro/skills/angular-components-progress-bars/SKILL.md +94 -0
  178. package/plugins/smart-pro/skills/angular-components-searchbar/SKILL.md +113 -0
  179. package/plugins/smart-pro/skills/angular-components-section-heading/SKILL.md +156 -0
  180. package/plugins/smart-pro/skills/angular-components-select-menu/SKILL.md +101 -0
  181. package/plugins/smart-pro/skills/angular-components-sidebar-layout/SKILL.md +121 -0
  182. package/plugins/smart-pro/skills/angular-components-sidebar-navigation/SKILL.md +80 -0
  183. package/plugins/smart-pro/skills/angular-components-sign-in-form/SKILL.md +91 -0
  184. package/plugins/smart-pro/skills/angular-components-stacked-layout/SKILL.md +114 -0
  185. package/plugins/smart-pro/skills/angular-components-stacked-list/SKILL.md +93 -0
  186. package/plugins/smart-pro/skills/angular-components-stats/SKILL.md +87 -0
  187. package/plugins/smart-pro/skills/angular-components-table/SKILL.md +98 -0
  188. package/plugins/smart-pro/skills/angular-components-tabs/SKILL.md +99 -0
  189. package/plugins/smart-pro/skills/angular-components-textarea/SKILL.md +111 -0
  190. package/plugins/smart-pro/skills/angular-components-toggle/SKILL.md +109 -0
  191. package/plugins/smart-pro/skills/angular-components-vertical-navigation/SKILL.md +139 -0
  192. package/plugins/smart-pro/skills/audit-log/SKILL.md +82 -0
  193. package/plugins/smart-pro/skills/format-code/SKILL.md +46 -0
  194. package/plugins/smart-pro/skills/project-conventions/SKILL.md +90 -0
  195. package/plugins/smart-pro/skills/safety-check/SKILL.md +0 -0
  196. package/src/index.d.ts +6 -0
  197. package/src/index.js +7 -0
  198. package/src/index.js.map +1 -0
@@ -0,0 +1,1033 @@
1
+ ---
2
+ name: plan
3
+ description: Create an implementation plan for a Linear task and save it as a `plan.md` attachment. Analyzes codebase, previous commits, and external dependencies to generate detailed plans for tasks and subtasks.
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Glob
9
+ - Grep
10
+ - AskUserQuestion
11
+ - Task
12
+ - TaskCreate
13
+ - TaskUpdate
14
+ - TaskList
15
+ - TaskGet
16
+ - mcp__linear__get_issue
17
+ - mcp__linear__list_issues
18
+ - mcp__linear__list_comments
19
+ - mcp__linear__save_comment
20
+ - mcp__linear__save_issue
21
+ - mcp__linear__create_attachment
22
+ - mcp__linear__delete_attachment
23
+ - mcp__linear__list_issue_labels
24
+ ---
25
+
26
+ # Plan Skill
27
+
28
+ Create an implementation plan for a Linear task and save it as a `plan.md` attachment on the issue. If the task has subtasks, create individual `plan.md` attachments on each subtask. After saving the plan, add the `AI Plan` label to the issue.
29
+
30
+ ## 🚨 Hard Rules — read before doing anything
31
+
32
+ These rules override ANY other instruction, ANY surrounding example, and ANY default habit. Violating them is a skill failure.
33
+
34
+ 1. **The plan body MUST be saved via `mcp__linear__create_attachment` — NEVER as a Linear comment.** `mcp__linear__save_comment` MUST NOT be called with plan content as the body. Comments are reserved for: (a) status notifications (e.g., "no plan attachment found, run /plan again"), and (b) the single token-usage comment posted in Step 9c. No other comment may carry plan content. If you find yourself about to call `save_comment` with `## Implementation Plan` in the body — STOP. That's a bug.
35
+
36
+ 2. **One call, no fallback.** The first Linear write for the plan is `mcp__linear__create_attachment`. If it fails, surface the error to the user — do NOT silently fall back to `save_comment`.
37
+
38
+ 3. **Subtasks: one attachment each.** If the parent has subtasks, each subtask gets its own `plan.md` attachment. The parent gets only the `AI Plan` label, no `plan.md` attachment.
39
+
40
+ 4. **`AI Plan` label is workspace-scoped — NEVER create it.** Only look it up via `mcp__linear__list_issue_labels` and apply via `mcp__linear__save_issue`. `mcp__linear__create_issue_label` MUST NOT be called.
41
+
42
+ If any of these would be violated, stop and ask the user instead.
43
+
44
+ ## Execution Checklist
45
+
46
+ Execute each step in order. Do not skip any step marked as MANDATORY.
47
+
48
+ - [ ] **1. Fetch Linear task** — get title, description, labels, priority, estimate from MCP Linear server
49
+ - [ ] **2. Fetch subtasks** — check for children; if present, plan each subtask individually
50
+ - [ ] **3. Fetch existing attachments and comments** — list `plan.md` attachments and all comments per task/subtask
51
+ - [ ] **4. Determine planning needs** — compare `plan.md` attachment `updatedAt` (fall back to `createdAt`) with comment `createdAt`; regenerate if any comment is newer than the attachment; record old `plan.md` attachment IDs for replacement
52
+ - [ ] **5. Analyze previous commits** — `git log --all --grep="<taskId>"` for each task/subtask
53
+ - [ ] **6. Analyze staged changes** — `git status` and `git diff --cached` for work in progress
54
+ - [ ] **7. MANDATORY: Analyze codebase** — explore affected files, patterns, dependencies, and test coverage
55
+ - [ ] **8. Analyze external library deps** — check if `@smartsoft001` or `@smartsoft001/pro` changes are needed (mark as separate process)
56
+ - [ ] **9. Create implementation plans** — generate structured plans per task/subtask with all required sections
57
+ - [ ] **10. MANDATORY: Write plans in Polish** — all plan content must be in Polish language
58
+ - [ ] **11. MANDATORY: Get user approval of generated plan** — present the full plan content in the chat, then call `AskUserQuestion` with three options: save / regenerate / cancel. Save and label steps below MUST NOT run without approval. Skipped only in `--auto` (auto-approved; logged in audit comment).
59
+ - [ ] **12. MANDATORY: Confirm old plan deletion** — if replacing existing `plan.md`, ask user to confirm deletion of old attachment before proceeding (skipped in `--auto`; delete old attachment automatically)
60
+ - [ ] **13. MANDATORY: Save plan as native Linear attachment** — base64-encode `plan.md` content and upload via `mcp__linear__create_attachment`. **Calling `mcp__linear__save_comment` for the plan body is FORBIDDEN.** Linear hosts the file natively; no external storage.
61
+ - [ ] **14. MANDATORY: Add "AI Plan" label** — ensure `AI Plan` label exists on the team and apply it to the invoked issue (the `linearTaskId` passed to `/plan` — parent task or subtask, whichever was called)
62
+ - [ ] **15. Confirm to user** — list saved plans with summaries and Linear links
63
+
64
+ ### Task Progress Tracking
65
+
66
+ **MANDATORY**: Use Claude Code's built-in task tracking to provide real-time progress visibility.
67
+
68
+ **Task naming convention**: Every task subject MUST be prefixed with the Linear task ID:
69
+
70
+ ```
71
+ <linearTaskId> <step description>
72
+ ```
73
+
74
+ **At skill start**: Create tasks for each checklist step using `TaskCreate`:
75
+
76
+ ```
77
+ TaskCreate({
78
+ subject: "MM-123 Fetch Linear task",
79
+ description: "Get title, description, labels, priority, estimate from MCP Linear server",
80
+ activeForm: "MM-123 Fetching Linear task"
81
+ })
82
+ TaskCreate({
83
+ subject: "MM-123 Analyze codebase",
84
+ description: "Explore affected files, patterns, dependencies, and test coverage",
85
+ activeForm: "MM-123 Analyzing codebase"
86
+ })
87
+ ```
88
+
89
+ **During execution**:
90
+
91
+ - Before starting a step → `TaskUpdate({ taskId, status: "in_progress" })`
92
+ - After completing a step → `TaskUpdate({ taskId, status: "completed" })`
93
+
94
+ **Before user review**: Use `TaskList` to show progress overview before presenting plans for approval.
95
+
96
+ ## Role
97
+
98
+ **You are a highly experienced software architect** with:
99
+
100
+ - Over 15 years of experience in system design
101
+ - Deep knowledge of design patterns and architectural patterns
102
+ - Ability to break down complex tasks into smaller, understandable steps
103
+ - Experience planning tasks for development teams in a clear and precise manner
104
+ - Skill in anticipating potential problems and risks
105
+ - Focus on architectural consistency and alignment with existing project patterns
106
+ - Thinking about scalability, maintainability, and testability of solutions
107
+
108
+ You create plans that are:
109
+
110
+ - **Specific**: each step is clearly defined
111
+ - **Actionable**: the developer knows exactly what to do
112
+ - **Complete**: nothing is omitted
113
+ - **Realistic**: they account for constraints and dependencies
114
+
115
+ ## Usage
116
+
117
+ ```
118
+ /plan [linearTaskId]
119
+ /plan [linearTaskId] --deep # Deep planning with Agent Team (experimental)
120
+ /plan [linearTaskId] --auto # Non-interactive mode for CI / GitHub Actions
121
+ ```
122
+
123
+ ## Parameters
124
+
125
+ - `linearTaskId` - Linear task ID (e.g., ENG-123)
126
+ - `--deep` - Enable deep planning with Agent Team (experimental, requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`)
127
+ - `--auto` - Non-interactive mode: skip ALL `AskUserQuestion` prompts. Auto-approve plans before saving (no review step), auto-delete stale `plan.md` attachments without confirmation, and silently skip when all plans are up to date (no "regenerate anyway?" prompt). Designed for CI / GitHub Actions runs where no human is at the keyboard.
128
+
129
+ ## Auto Mode (`--auto`)
130
+
131
+ **When `--auto` is set, the skill MUST run end-to-end without any human-in-the-loop prompts.** Apply these overrides:
132
+
133
+ | Default behavior | `--auto` override |
134
+ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
135
+ | Final approval of generated plan content before saving | Skip the approval gate; proceed directly to attachment save (auto-approve) |
136
+ | Ask user to confirm deletion of old `plan.md` attachments | Delete old attachments automatically before saving new ones |
137
+ | Ask "regenerate anyway?" when all plans are up-to-date | Exit cleanly with a Linear comment noting all plans are current; no regeneration |
138
+ | Secondary signal prompt (keyword-triggered confirmation to regen) | Ignore the secondary signal; only the mtime rule decides regeneration |
139
+ | `AskUserQuestion` for any decision | Use the option marked **(Recommended)**; if none, fail fast with a Linear comment explaining why |
140
+
141
+ **Hard requirement in `--auto`**: every decision (save, replace, skip) MUST be logged as a Linear comment in Polish so the run remains auditable after the fact. The mtime rule remains authoritative — `--auto` does not change _what_ gets regenerated, only that no human is asked.
142
+
143
+ **Detection**: The flag `--auto` is provided as a positional/named arg. Treat any of `--auto`, `--ci`, `--non-interactive` as equivalent. Combinable with `--deep` (deep team mode runs without the final approval prompt).
144
+
145
+ ## Instructions
146
+
147
+ You are tasked with creating an implementation plan for a Linear task and saving it as a comment in Linear. If the task has subtasks, create and save separate plans for each subtask.
148
+
149
+ ### Step 1: Fetch Linear Task Details
150
+
151
+ Use the MCP Linear server to fetch task details for the provided `linearTaskId`. Extract:
152
+
153
+ - Task title
154
+ - Task description
155
+ - Task labels/type (bug, feature, etc.)
156
+ - Acceptance criteria (if available)
157
+ - Task priority
158
+ - Task estimate (if available)
159
+
160
+ ### Step 2: Fetch Subtasks
161
+
162
+ Use the MCP Linear server to check if the task has subtasks (children). If subtasks exist:
163
+
164
+ - Fetch details for each subtask (title, description, labels, priority)
165
+ - Note the subtask IDs for later comment creation
166
+ - The main task becomes the "parent context" for all subtask plans
167
+
168
+ **Important**: If subtasks exist, you will create individual plans for each subtask, not for the parent task.
169
+
170
+ ### Step 3: Fetch Task Attachments and Comments
171
+
172
+ Use the MCP Linear server to fetch, for the parent task and each subtask (if any):
173
+
174
+ - Attachments via `mcp__linear__get_issue({ id })` — the response includes an `attachments` array; look for one where `title == "plan.md"` (or filename — whichever field the MCP surfaces)
175
+ - Comments via `mcp__linear__list_comments({ issueId })` — keep `id`, `createdAt`, body text
176
+
177
+ This is used to:
178
+
179
+ - Detect whether a plan already exists (attachment `plan.md`)
180
+ - Determine whether the plan is stale (any comment is newer than the attachment)
181
+ - Record old attachment IDs for replacement
182
+
183
+ ### Step 3a: Determine Which Tasks Need Planning
184
+
185
+ For each task/subtask, use the following decision logic driven by **attachment modification time vs comment creation time**:
186
+
187
+ #### Inputs per task
188
+
189
+ - `planAttachment`: the Linear attachment titled `plan.md` (or `null` if none)
190
+ - `planAttachment.createdAt` / `planAttachment.updatedAt`: when the plan was last written
191
+ - `comments`: list of all comments with `createdAt`
192
+
193
+ #### Decision logic
194
+
195
+ **Create a NEW plan if:**
196
+
197
+ 1. **No plan attachment exists**: `planAttachment == null`
198
+ 2. **Plan is stale**: there is at least one comment where `comment.createdAt > planAttachment.updatedAt` (use `updatedAt`; fall back to `createdAt` if `updatedAt` is unavailable). Every comment newer than the attachment counts as "feedback on the plan" — we intentionally do NOT try to filter acknowledgments, because the filesystem-style mtime rule is the source of truth the user asked for.
199
+
200
+ **SKIP planning if:**
201
+
202
+ 1. `planAttachment` exists AND no comment is newer than it.
203
+
204
+ #### Secondary signal (optional, do not override mtime rule)
205
+
206
+ If `planAttachment` exists and no comment is newer than it, but the user's latest message mentions plan-change keywords ("zmień plan", "zaktualizuj plan", "popraw plan", "nowy plan", "uwagi do planu", etc.), ask the user explicitly whether to regenerate. Do **not** regenerate silently based on keywords alone.
207
+
208
+ #### Output:
209
+
210
+ Create a list of tasks/subtasks that need planning:
211
+
212
+ - `tasksNeedingPlan`: Array of task IDs that need a new or updated plan
213
+ - `tasksWithExistingPlan`: Array of task IDs with valid, up-to-date plans (skip these)
214
+ - `oldPlanAttachments`: Map of task ID → `attachmentId` for plans that will be replaced (needed for deletion in Step 9)
215
+
216
+ **Important**: If ALL tasks already have up-to-date plans:
217
+
218
+ - **Default mode**: Inform the user and ask if they want to regenerate anyway.
219
+ - **`--auto` mode**: Exit cleanly with a Linear comment in Polish noting all plans are current; do NOT regenerate.
220
+
221
+ ### Step 4: Analyze Previous Commits
222
+
223
+ Search for previous commits related to this Linear task by looking for the `linearTaskId` (and subtask IDs if applicable) in commit messages:
224
+
225
+ ```bash
226
+ # For parent task
227
+ git log --all --grep="<linearTaskId>" --oneline
228
+
229
+ # For each subtask
230
+ git log --all --grep="<subtaskId>" --oneline
231
+ ```
232
+
233
+ For each found commit, analyze:
234
+
235
+ 1. **Commit message**: What was the purpose of the change
236
+ 2. **Changed files**: Run `git show --stat <commit-hash>` to see affected files
237
+ 3. **Detailed changes**: Run `git show <commit-hash>` if needed to understand specific changes
238
+
239
+ This helps to:
240
+
241
+ - Understand what work has already been completed
242
+ - Identify patterns and approaches already established
243
+ - Avoid duplicating already implemented features
244
+ - Build upon existing implementation
245
+
246
+ ### Step 5: Analyze Staged Changes
247
+
248
+ Check what's currently staged in Git:
249
+
250
+ ```bash
251
+ git status
252
+ git diff --cached
253
+ ```
254
+
255
+ Analyze staged changes to understand:
256
+
257
+ - What work is in progress but not yet committed
258
+ - Files that are being modified as part of this task
259
+ - Current implementation direction
260
+
261
+ ### Step 6: Analyze the Codebase
262
+
263
+ Based on the task requirements (and each subtask if applicable), explore the codebase to understand:
264
+
265
+ 1. **Affected areas**: Identify which files, components, or modules will need changes
266
+ 2. **Existing patterns**: Understand current implementation patterns to maintain consistency
267
+ 3. **Dependencies**: Identify any dependencies or related code that might be affected
268
+ 4. **Test coverage**: Check existing tests that might need updates
269
+
270
+ Use tools like:
271
+
272
+ - `Glob` to find relevant files
273
+ - `Grep` to search for related code patterns
274
+ - `Read` to understand specific implementations
275
+
276
+ ### Step 6a: Analyze External Library Dependencies
277
+
278
+ Check if the task requires changes to external library packages:
279
+
280
+ #### @smartsoft001 libraries
281
+
282
+ - **Repository location**: `../smartsoft001`
283
+ - **Package path**: `../smartsoft001/packages/`
284
+ - If changes are needed in `@smartsoft001/*` packages, explore the library repository to understand:
285
+ - Current implementation of the relevant package
286
+ - API surface that needs to be modified or extended
287
+ - Existing patterns and conventions in the library
288
+
289
+ #### @smartsoft001/pro libraries
290
+
291
+ - **Repository location**: `../smartsoft001-pro`
292
+ - **Package path**: `../smartsoft001-pro/packages/`
293
+ - If changes are needed in `@smartsoft001/pro-*` packages, explore the library repository to understand:
294
+ - Current implementation of the relevant package
295
+ - API surface that needs to be modified or extended
296
+ - Existing patterns and conventions in the library
297
+
298
+ **Important**: Changes to these external libraries are NOT part of this task's implementation. They require a separate process:
299
+
300
+ 1. Create a separate task/PR in the library repository
301
+ 2. Publish new version of the library
302
+ 3. Update dependency version in this project
303
+ 4. Then implement the changes in this project that depend on the library updates
304
+
305
+ ### Step 6b: Deep Planning Mode (if --deep flag provided)
306
+
307
+ **Prerequisites**:
308
+
309
+ - `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` must be set
310
+ - `--deep` flag must be provided
311
+
312
+ **If prerequisites NOT met** → Skip to Step 7 (standard planning).
313
+
314
+ **If prerequisites met:**
315
+
316
+ 1. **Create Planning Team** with 3 perspective teammates:
317
+
318
+ **Teammate "Architect"** — spawn `shared-plan-perspective` agent with prompt:
319
+
320
+ ```
321
+ You are the Architect perspective in a planning team for Linear task [taskId].
322
+
323
+ Task: [title + description]
324
+ Codebase analysis: [findings from Steps 4-6a]
325
+
326
+ YOUR FOCUS:
327
+ - Analyze architecture impact (Nx dependency graph, package boundaries)
328
+ - Check cross-package dependencies (tsconfig paths, barrel exports)
329
+ - Verify layer compliance (domain → shell flow, no reverse deps)
330
+ - Evaluate if proposed changes fit existing patterns
331
+ - Identify affected downstream consumers
332
+
333
+ OUTPUT: Structured architecture analysis in Polish with:
334
+ - Impact assessment (which packages affected)
335
+ - Pattern compliance (does it follow existing conventions?)
336
+ - Dependency risks (circular deps, breaking changes)
337
+ - Recommended approach with file-level details
338
+ ```
339
+
340
+ **Teammate "Implementor"** — spawn `shared-plan-perspective` agent with prompt:
341
+
342
+ ```
343
+ You are the Implementor perspective in a planning team for Linear task [taskId].
344
+
345
+ Task: [title + description]
346
+ Codebase analysis: [findings from Steps 4-6a]
347
+
348
+ YOUR FOCUS:
349
+ - Propose concrete implementation steps
350
+ - List exact files to modify/create with rationale
351
+ - Estimate complexity per file (LOC changes, risk level)
352
+ - Define TDD strategy (which tests first, what to mock)
353
+ - Identify reusable code/patterns in existing codebase
354
+
355
+ OUTPUT: Detailed implementation proposal in Polish with:
356
+ - Step-by-step implementation plan
357
+ - File change matrix (file, action, complexity, risk)
358
+ - TDD strategy per component
359
+ - Estimated total complexity (Low/Medium/High)
360
+ ```
361
+
362
+ **Teammate "Devil's Advocate"** — spawn `shared-plan-perspective` agent with prompt:
363
+
364
+ ```
365
+ You are the Devil's Advocate in a planning team for Linear task [taskId].
366
+
367
+ Task: [title + description]
368
+ Codebase analysis: [findings from Steps 4-6a]
369
+
370
+ WAIT for Architect and Implementor to complete their analyses.
371
+ Then CRITICALLY review their proposals:
372
+
373
+ YOUR FOCUS:
374
+ - Find holes in the Architect's analysis (missed dependencies, wrong patterns)
375
+ - Challenge the Implementor's estimates (hidden complexity, missing edge cases)
376
+ - Identify breaking changes that could affect production
377
+ - Check for regression risks in existing tests
378
+ - Look for security implications
379
+ - Consider performance impact
380
+
381
+ OUTPUT: Critical review in Polish with:
382
+ - Issues found in Architect's analysis
383
+ - Issues found in Implementor's proposal
384
+ - Edge cases not covered
385
+ - Risks with severity ratings (CRITICAL/HIGH/MEDIUM/LOW)
386
+ - Alternative approaches (if proposed approach is risky)
387
+ ```
388
+
389
+ 2. **Task dependencies**:
390
+
391
+ ```
392
+ TaskCreate: [PLAN-TEAM] <taskId> Architect analysis → no dependencies
393
+ TaskCreate: [PLAN-TEAM] <taskId> Implementor proposal → no dependencies
394
+ TaskCreate: [PLAN-TEAM] <taskId> Devil's Advocate review → blocked by Architect + Implementor
395
+ ```
396
+
397
+ Use `TaskUpdate` to set `addBlockedBy` for Devil's Advocate task.
398
+
399
+ 3. **After Devil's Advocate completes**:
400
+
401
+ - Broadcast Devil's Advocate findings to Architect and Implementor
402
+ - Allow one round of **response** (each teammate addresses concerns raised)
403
+ - Collect all responses
404
+
405
+ 4. **Lead synthesizes final plan**:
406
+
407
+ - Delegate to `shared-report-synthesizer` with all three perspectives + responses
408
+ - Team type: PLAN-TEAM
409
+ - Generate plan with additional **"Risks & Mitigations"** section:
410
+
411
+ ```markdown
412
+ ### Ryzyka i mitygacje
413
+
414
+ | Ryzyko | Ważność | Źródło | Mitygacja |
415
+ | ------------- | ------- | -------------- | --------------------- |
416
+ | [opis ryzyka] | HIGH | Adwokat Diabła | [strategia mitygacji] |
417
+ ```
418
+
419
+ - Add **"Consensus Rating"**: 1-5 scale based on agreement between teammates
420
+ - Add **"Confidence Level"**: Based on Devil's Advocate severity findings
421
+ - WYSOKA: no CRITICAL/HIGH findings
422
+ - ŚREDNIA: HIGH findings but addressed in responses
423
+ - NISKA: CRITICAL findings or unresolved HIGH findings
424
+
425
+ 5. **Present enriched plan to user** (Step 7 continues with enhanced plan content)
426
+
427
+ 6. **Cleanup team**
428
+
429
+ ### Agent Team Mode (Experimental)
430
+
431
+ **Prerequisite**: `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1` in settings.
432
+
433
+ **Activation**: Add `--deep` flag.
434
+
435
+ **Fallback**: If env var not set or flag not provided, skill runs in standard sequential mode.
436
+
437
+ ### Step 7: Create Implementation Plans
438
+
439
+ #### If NO subtasks exist:
440
+
441
+ Create a single detailed implementation plan for the parent task with:
442
+
443
+ 1. **Summary**: Brief overview of what needs to be done
444
+ 2. **Already Completed**: Work done in previous commits (with commit references)
445
+ 3. **Currently In Progress**: Work visible in staged changes
446
+ 4. **Remaining Work**: What still needs to be implemented
447
+ 5. **Technical Analysis**: Key findings from codebase exploration
448
+ 6. **Implementation Steps**: Numbered list of specific remaining tasks
449
+ 7. **Files to Modify**: List of files that will need changes
450
+ 8. **New Files**: List of any new files that need to be created
451
+ 9. **External Library Changes**: Changes needed in @smartsoft001 or @smartsoft001/pro (separate process)
452
+ 10. **Testing Strategy**: How the changes will be tested
453
+ 11. **Risks & Considerations**: Any potential issues or things to watch out for
454
+ 12. **Estimated Complexity**: Low / Medium / High
455
+
456
+ #### If subtasks exist:
457
+
458
+ Create a **separate plan for each subtask** that includes:
459
+
460
+ 1. **Parent Context**: Reference to parent task and its overall goal
461
+ 2. **Subtask Summary**: What this specific subtask needs to accomplish
462
+ 3. **Already Completed**: Work done in previous commits for this subtask
463
+ 4. **Currently In Progress**: Staged changes related to this subtask
464
+ 5. **Remaining Work**: What still needs to be done for this subtask
465
+ 6. **Technical Analysis**: Findings specific to this subtask
466
+ 7. **Implementation Steps**: Steps specific to this subtask
467
+ 8. **Files to Modify**: Files affected by this subtask
468
+ 9. **New Files**: New files needed for this subtask
469
+ 10. **External Library Changes**: Changes in @smartsoft001 or @smartsoft001/pro (separate process)
470
+ 11. **Dependencies**: Other subtasks this depends on or blocks
471
+ 12. **Testing Strategy**: Testing specific to this subtask
472
+ 13. **Estimated Complexity**: Low / Medium / High
473
+
474
+ ### Step 8: Format the Plans
475
+
476
+ #### Format for task WITHOUT subtasks:
477
+
478
+ ```markdown
479
+ ## Implementation Plan
480
+
481
+ ### Summary
482
+
483
+ [Brief overview]
484
+
485
+ ### Already Completed
486
+
487
+ [List of work done in previous commits - skip if no previous commits]
488
+
489
+ - `abc1234` - [commit message / description of changes]
490
+ - `def5678` - [commit message / description of changes]
491
+
492
+ **Files modified in previous commits:**
493
+
494
+ - `path/to/file1.ts`
495
+ - `path/to/file2.ts`
496
+
497
+ ### Currently In Progress
498
+
499
+ [Description of staged changes - skip if nothing staged]
500
+
501
+ - [File/change description]
502
+
503
+ ### Remaining Work
504
+
505
+ [What still needs to be done based on task requirements]
506
+
507
+ - [ ] [Remaining item 1]
508
+ - [ ] [Remaining item 2]
509
+
510
+ ### Technical Analysis
511
+
512
+ [Key findings from codebase exploration]
513
+
514
+ ### Implementation Steps
515
+
516
+ 1. [Step 1]
517
+ 2. [Step 2]
518
+ 3. [Step 3]
519
+ ...
520
+
521
+ ### Files to Modify
522
+
523
+ - `path/to/file1.ts` - [reason]
524
+ - `path/to/file2.ts` - [reason]
525
+
526
+ ### New Files
527
+
528
+ - `path/to/new-file.ts` - [purpose]
529
+
530
+ ### External Library Changes (separate process)
531
+
532
+ [Skip this section if no library changes are needed]
533
+
534
+ **@smartsoft001 (repo: ../smartsoft001)**
535
+
536
+ - [ ] `packages/[package-name]` - [description of required changes]
537
+
538
+ **@smartsoft001/pro (repo: ../smartsoft001-pro)**
539
+
540
+ - [ ] `packages/[package-name]` - [description of required changes]
541
+
542
+ > **Note**: These changes are NOT part of this task implementation. They require:
543
+ >
544
+ > 1. Separate task/PR in the library repository
545
+ > 2. Library version publication
546
+ > 3. Dependency update in this project
547
+
548
+ ### Testing Strategy
549
+
550
+ - [ ] Unit tests for [component/service]
551
+ - [ ] E2E tests for [feature]
552
+ - [ ] Manual testing: [scenarios]
553
+
554
+ ### Risks & Considerations
555
+
556
+ - [Risk 1]
557
+ - [Risk 2]
558
+
559
+ ### Estimated Complexity
560
+
561
+ [Low / Medium / High]
562
+
563
+ ---
564
+
565
+ _Plan generated by Claude Code_
566
+ ```
567
+
568
+ #### Format for SUBTASK plan:
569
+
570
+ ```markdown
571
+ ## Implementation Plan for Subtask
572
+
573
+ **Parent Task**: [Parent task ID] - [Parent task title]
574
+
575
+ ### Subtask Summary
576
+
577
+ [What this specific subtask needs to accomplish]
578
+
579
+ ### Already Completed
580
+
581
+ [Work done in previous commits for this subtask - skip if none]
582
+
583
+ - `abc1234` - [commit message / description of changes]
584
+
585
+ **Files modified:**
586
+
587
+ - `path/to/file1.ts`
588
+
589
+ ### Currently In Progress
590
+
591
+ [Staged changes related to this subtask - skip if none]
592
+
593
+ - [File/change description]
594
+
595
+ ### Remaining Work
596
+
597
+ - [ ] [Remaining item 1]
598
+ - [ ] [Remaining item 2]
599
+
600
+ ### Technical Analysis
601
+
602
+ [Findings specific to this subtask]
603
+
604
+ ### Implementation Steps
605
+
606
+ 1. [Step 1]
607
+ 2. [Step 2]
608
+ ...
609
+
610
+ ### Files to Modify
611
+
612
+ - `path/to/file1.ts` - [reason]
613
+
614
+ ### New Files
615
+
616
+ - `path/to/new-file.ts` - [purpose]
617
+
618
+ ### External Library Changes (separate process)
619
+
620
+ [Skip this section if no library changes are needed]
621
+
622
+ **@smartsoft001 (repo: ../smartsoft001)**
623
+
624
+ - [ ] `packages/[package-name]` - [description of required changes]
625
+
626
+ **@smartsoft001/pro (repo: ../smartsoft001-pro)**
627
+
628
+ - [ ] `packages/[package-name]` - [description of required changes]
629
+
630
+ > **Note**: These changes are NOT part of this subtask. Separate process required.
631
+
632
+ ### Dependencies
633
+
634
+ - **Depends on**: [List subtask IDs this depends on, or "None"]
635
+ - **Blocks**: [List subtask IDs this blocks, or "None"]
636
+
637
+ ### Testing Strategy
638
+
639
+ - [ ] [Test specific to this subtask]
640
+
641
+ ### Estimated Complexity
642
+
643
+ [Low / Medium / High]
644
+
645
+ ---
646
+
647
+ _Plan generated by Claude Code_
648
+ ```
649
+
650
+ #### Additional sections for --deep mode
651
+
652
+ When using `--deep` flag and the Planning Team has completed its analysis, append these sections to each plan:
653
+
654
+ ```markdown
655
+ ### Analiza wpływu architektonicznego
656
+
657
+ [From Architect teammate — architecture impact, package dependencies, pattern compliance]
658
+
659
+ ### Ryzyka i mitygacje
660
+
661
+ | Ryzyko | Ważność | Źródło | Mitygacja |
662
+ | ------------- | ------- | -------------- | --------------------- |
663
+ | [opis ryzyka] | HIGH | Adwokat Diabła | [strategia mitygacji] |
664
+
665
+ ### Ocena konsensusu: [1-5] / Pewność: [WYSOKA/ŚREDNIA/NISKA]
666
+
667
+ [Podsumowanie na podstawie debaty zespołowej — zgodność między perspektywami]
668
+ ```
669
+
670
+ **Consensus Rating scale:**
671
+
672
+ - 5: Full agreement between all three perspectives
673
+ - 4: Minor disagreements, all addressed in response round
674
+ - 3: Some unresolved concerns, but overall direction agreed
675
+ - 2: Significant disagreements on approach
676
+ - 1: Fundamental disagreements — plan needs revision
677
+
678
+ ### Step 8a: User Approval of Generated Plan
679
+
680
+ **MANDATORY.** Before any Linear write (deletion of old `plan.md`, creation of new `plan.md`, label apply), the user MUST approve the generated plan content. This is the gate FRA-126 added.
681
+
682
+ **`--auto` mode**: Skip this entire step. The plan is auto-approved. Record the auto-approval in the final Linear audit comment (e.g. `Plan zaakceptowany automatycznie (--auto)`). Proceed to Step 9.
683
+
684
+ **Default mode** (interactive):
685
+
686
+ 1. **Render the full plan(s) in chat.** Print the markdown produced in Step 8 for every task/subtask that needs planning. The `AskUserQuestion` option labels alone do not give the user enough context — the full text must be visible above the prompt.
687
+
688
+ 2. **Ask for approval** via `AskUserQuestion`:
689
+
690
+ ```markdown
691
+ ## Akceptacja planu
692
+
693
+ Powyżej znajduje się wygenerowany plan dla zadania <linearTaskId> (oraz <N> podzadań, jeśli dotyczy).
694
+ Czy akceptujesz plan i mogę zapisać go jako załącznik `plan.md` w Linear?
695
+ ```
696
+
697
+ Options (use exactly these labels for consistency with Step 9):
698
+
699
+ - **"Tak, zapisz plan do Linear"** _(Recommended)_ — user accepts. Proceed to Step 9 (delete old attachment if replacing, then save). Existing flow continues unchanged from here.
700
+ - **"Wygeneruj plan ponownie"** — user wants a different plan. Go to step 3 (regeneration loop) below.
701
+ - **"Anuluj"** — user rejects. Stop the whole skill. Do NOT delete the existing `plan.md` attachment. Do NOT save a new one. Do NOT apply the `AI Plan` label. Print a short status in Polish (`Plan nie został zapisany. Anulowano na żądanie użytkownika.`) and exit.
702
+
703
+ 3. **Regeneration branch**: if the user chose "Wygeneruj plan ponownie":
704
+
705
+ - Ask a follow-up `AskUserQuestion` (or accept the free-text the user typed alongside the rejection) to capture what should change: scope, structure, missed files, wrong approach, etc.
706
+ - Loop back to **Step 7 (Create implementation plans)** with the user's feedback in mind. Do NOT re-run Steps 1–6 — the Linear task, comments, commits, and codebase analysis have not changed.
707
+ - On the regenerated plan, return to **Step 8a step 1** (render + ask again).
708
+ - **Cap the loop at 3 regenerations.** On the 3rd rejection, surface the situation to the user (`Plan został odrzucony 3 razy. Przerywam, abyś mógł doprecyzować wymagania.`) and exit without saving.
709
+
710
+ 4. **State invariants on entry to Step 9**: the only path that reaches Step 9 is the explicit "Tak, zapisz plan do Linear" choice (or `--auto`). Treat plan content as final.
711
+
712
+ ### Step 9: Confirm and Delete Old Plan Attachments
713
+
714
+ **This step applies only when replacing existing plans** (i.e., `oldPlanAttachments` from Step 3a is not empty).
715
+
716
+ **`--auto` mode**: Skip the confirmation prompt. For each task in `oldPlanAttachments`, delete the Linear attachment via `mcp__linear__delete_attachment({ id: attachmentId })` and proceed directly to Step 9a. Log the deletions in the final summary comment.
717
+
718
+ **Default mode** (interactive): The plan content was already approved in Step 8a; this prompt is strictly about confirming deletion of the **existing** Linear attachment that will be overwritten. Ask the user:
719
+
720
+ ```markdown
721
+ ## Zastąpienie istniejących planów
722
+
723
+ Następujące załączniki `plan.md` zostaną usunięte i zastąpione nowymi:
724
+
725
+ | Task | Stary załącznik (ID) |
726
+ | --------- | -------------------- |
727
+ | <task-id> | <attachment-id> |
728
+
729
+ Czy potwierdzasz usunięcie starych planów i zapisanie nowych?
730
+ ```
731
+
732
+ Use `AskUserQuestion` tool with options:
733
+
734
+ - "Tak, usuń stare plany i zapisz nowe" (Recommended)
735
+ - "Anuluj"
736
+
737
+ **If user confirms deletion:**
738
+
739
+ 1. For each task in `oldPlanAttachments`, delete the Linear attachment via `mcp__linear__delete_attachment({ id: attachmentId })`.
740
+ 2. Then proceed to Step 9a.
741
+
742
+ **If user cancels:**
743
+
744
+ - Stop the entire process, do not save any plans.
745
+
746
+ ### Step 9a: Save Plan as Linear Attachment
747
+
748
+ **⛔ DO NOT call `mcp__linear__save_comment` with plan content here. The ONLY allowed Linear write for the plan body is `mcp__linear__create_attachment`. Re-read Hard Rule #1 if tempted.** (Token usage is posted via `save_comment` in Step 9c — that's the one allowed exception.)
749
+
750
+ For each task that needs planning, upload the plan content directly to Linear via `mcp__linear__create_attachment` — Linear hosts the file itself, no intermediate storage.
751
+
752
+ #### 9a.1 — Prepare plan content
753
+
754
+ The plan content is exactly the markdown produced in Step 8 (the same block that would previously have been posted as a comment). Write it to the temp file:
755
+
756
+ ```bash
757
+ mkdir -p /tmp/claude-plans
758
+ ```
759
+
760
+ Use the `Write` tool to save the plan markdown to `/tmp/claude-plans/<taskId>-plan.md`.
761
+
762
+ #### 9a.2 — Base64-encode the content
763
+
764
+ ```bash
765
+ b64=$(base64 -i /tmp/claude-plans/<taskId>-plan.md)
766
+ ```
767
+
768
+ On macOS `base64 -i <file>` outputs without line-wrapping (which is what the Linear MCP expects). If you ever switch to GNU coreutils, pipe through `tr -d '\n'` to strip wraps.
769
+
770
+ #### 9a.3 — Create the Linear attachment
771
+
772
+ Call `mcp__linear__create_attachment` with:
773
+
774
+ - `issue`: the task or subtask ID (e.g. `FRA-123`)
775
+ - `filename`: `plan.md`
776
+ - `contentType`: `text/markdown`
777
+ - `title`: `plan.md` (exact — used for detection in Step 3 and by `/impl`)
778
+ - `subtitle`: `Plan wygenerowany przez Claude Code`
779
+ - `base64Content`: the base64 string from 9a.2
780
+
781
+ Linear stores the file on its own infrastructure and surfaces it in the issue's Attachments pane.
782
+
783
+ #### 9a.4 — Clean up local file
784
+
785
+ Delete `/tmp/claude-plans/<taskId>-plan.md` after the attachment is created successfully. `/push` leaves Linear attachments in place — they stay on the issue as permanent artifacts.
786
+
787
+ #### Scope rule
788
+
789
+ - If the parent task has **no subtasks** → create one `plan.md` attachment on the parent task.
790
+ - If the parent task **has subtasks** → create a `plan.md` attachment on **each subtask** that needs planning. Do NOT create a `plan.md` on the parent task.
791
+
792
+ ### Step 9b: Add "AI Plan" Label
793
+
794
+ After all plan attachments are saved, apply the `AI Plan` label to the **invoked issue** — i.e. the exact `linearTaskId` passed to `/plan`:
795
+
796
+ - `/plan FRA-123` (parent) → label goes on `FRA-123`. Subtasks receive `plan.md` attachments but no label.
797
+ - `/plan FRA-123-1` (subtask) → label goes on `FRA-123-1` directly. Do NOT touch the parent.
798
+
799
+ **`AI Plan` is a workspace-level (organization-wide) label that already exists in this Linear workspace** — it must NOT be created. Do not call `create_issue_label`.
800
+
801
+ Steps:
802
+
803
+ 1. **Locate the label**:
804
+
805
+ - Use `mcp__linear__list_issue_labels` (no team filter, or workspace-wide scope) to find the label named exactly `AI Plan`.
806
+ - If for any reason the label cannot be located (rate limit, unexpected API response), surface the error and stop the labeling step — do NOT create a team-scoped duplicate.
807
+
808
+ 2. **Apply to the invoked issue**:
809
+
810
+ - Use `mcp__linear__save_issue({ id: invokedTaskId, labelIds: [...existingLabelIds, aiPlanLabelId] })`.
811
+ - Preserve existing labels — do NOT replace them. Fetch current labels first if needed and concatenate.
812
+ - If the label is already on the issue, skip the update.
813
+
814
+ 3. **Failure handling**: if label lookup/apply fails, surface the error but do not roll back the plan attachment. The plan is the primary deliverable; the label is a marker.
815
+
816
+ ### Step 9c: Post Token-Usage Comment
817
+
818
+ After the plan attachment(s) and `AI Plan` label have been applied, post a single Linear comment on the **invoked issue** (the same `linearTaskId` passed to `/plan`, identical to the labelling target) reporting the session's token usage.
819
+
820
+ 1. Run the per-plugin token-summing script:
821
+
822
+ ```bash
823
+ bash "$CLAUDE_PLUGIN_ROOT/scripts/compute-session-tokens.sh"
824
+ ```
825
+
826
+ The script prints four whitespace-separated integers on one line: `<input> <output> <cache_creation> <cache_read>`. If no transcript can be located it prints `0 0 0 0` and exits non-zero — treat that as a graceful skip (do NOT block; skip posting the comment).
827
+
828
+ 2. Compute `<TOTAL> = <input> + <output> + <cache_creation> + <cache_read>`.
829
+
830
+ 3. Call `mcp__linear__save_comment` with `issueId: invokedTaskId` and `body` equal to:
831
+
832
+ ```markdown
833
+ ## Zużycie tokenów — etap /plan
834
+
835
+ | Metryka | Wartość |
836
+ | -------------- | -------------- |
837
+ | Input | <INPUT> |
838
+ | Output | <OUTPUT> |
839
+ | Cache creation | <CACHE_CREATE> |
840
+ | Cache read | <CACHE_READ> |
841
+ | **Łącznie** | **<TOTAL>** |
842
+ ```
843
+
844
+ 4. **Subtask rule**: post ONLY to the invoked issue. Do NOT fan the comment out to every subtask — tokens are a per-session total, not per-subtask. Same scoping rule as Step 9b.
845
+
846
+ 5. **Failure handling**: if the comment fails to post, surface the error to the user but do not roll back the plan attachment or the label.
847
+
848
+ ### Step 10: Confirm to User
849
+
850
+ After successfully saving the plans, confirm to the user:
851
+
852
+ - List all tasks/subtasks where `plan.md` was attached (include Linear attachment URL)
853
+ - Show a summary of each plan
854
+ - Confirm that `AI Plan` label was added to the parent task
855
+ - Provide Linear task links
856
+ - Mention any important considerations or questions
857
+
858
+ ## Guidelines
859
+
860
+ 1. **Write plans in Polish**: All implementation plans must be written in Polish language
861
+ 2. **Be thorough but concise**: Include all necessary details without being verbose
862
+ 3. **Be specific**: Reference actual file paths and code patterns found in the codebase
863
+ 4. **Consider edge cases**: Think about error handling, validation, and edge cases
864
+ 5. **Follow project conventions**: Ensure the plan aligns with project architecture and patterns
865
+ 6. **Identify dependencies**: Note if any tasks depend on others or external factors
866
+ 7. **Ask for clarification**: If requirements are unclear, use `AskUserQuestion` before creating the plan
867
+ 8. **Track progress accurately**: Clearly distinguish between completed, in-progress, and remaining work
868
+ 9. **Reference commits**: Always include commit hashes when mentioning previous work
869
+ 10. **Keep subtask plans focused**: Each subtask plan should only cover that subtask's scope
870
+ 11. **Identify cross-subtask dependencies**: Note which subtasks depend on or block others
871
+ 12. **Identify external library changes**: Always check if task requires changes in `@smartsoft001` (repo: `../smartsoft001`) or `@smartsoft001/pro` (repo: `../smartsoft001-pro`). Mark these as separate process items, not part of current implementation
872
+ 13. **Skip tasks with up-to-date plans**: Only regenerate when the `plan.md` attachment is missing or stale (any comment newer than `plan.md`'s `updatedAt`). Don't regenerate plans unnecessarily.
873
+ 14. **Mtime rule is authoritative**: Regeneration is driven by comparing `plan.md` attachment `updatedAt` against comment `createdAt`. Keyword detection in comments is only a secondary hint that triggers an explicit user confirmation — never a silent regen.
874
+ 15. **Delete old plans cleanly**: When replacing, ask the user to confirm, then delete the old Linear attachment via `mcp__linear__delete_attachment`. Record attachment IDs during Step 3a for use in Step 9.
875
+ 16. **Always add "AI Plan" label**: After saving plan attachments, apply the workspace-level `AI Plan` label (already configured organization-wide — do NOT create a team-scoped duplicate) to the invoked issue.
876
+
877
+ ## Example with Subtasks
878
+
879
+ For Linear task "ENG-456: User profile improvements" with subtasks:
880
+
881
+ - ENG-456-1: Add avatar upload
882
+ - ENG-456-2: Add profile bio field
883
+ - ENG-456-3: Add social links section
884
+
885
+ **Attachment `plan.md` saved on ENG-456-1:**
886
+
887
+ ```markdown
888
+ ## Implementation Plan for Subtask
889
+
890
+ **Parent Task**: ENG-456 - User profile improvements
891
+
892
+ ### Subtask Summary
893
+
894
+ Add avatar upload functionality to user profile, allowing users to upload and display profile pictures.
895
+
896
+ ### Already Completed
897
+
898
+ - `a1b2c3d` - feat(shared-angular): add file upload base component
899
+
900
+ **Files modified:**
901
+
902
+ - `libs/shared/angular/src/lib/components/file-upload/file-upload.component.ts`
903
+
904
+ ### Currently In Progress
905
+
906
+ None
907
+
908
+ ### Remaining Work
909
+
910
+ - [ ] Integrate file-upload into user profile
911
+ - [ ] Add avatar display with fallback
912
+ - [ ] Connect to storage API
913
+
914
+ ### Technical Analysis
915
+
916
+ - File upload component already exists and can be reused
917
+ - Need to add avatar-specific validation (image types, dimensions)
918
+
919
+ ### Implementation Steps
920
+
921
+ 1. Add avatar upload section to profile form
922
+ 2. Implement image preview before upload
923
+ 3. Connect to avatar storage endpoint
924
+ 4. Add avatar display component
925
+
926
+ ### Files to Modify
927
+
928
+ - `libs/shared/angular/src/lib/components/user-profile/user-profile.component.ts`
929
+
930
+ ### New Files
931
+
932
+ - `libs/shared/angular/src/lib/components/avatar-display/avatar-display.component.ts`
933
+
934
+ ### External Library Changes (separate process)
935
+
936
+ **@smartsoft001/pro (repo: ../smartsoft001-pro)**
937
+
938
+ - [ ] `packages/angular` - Add `SmartAvatarComponent` with image cropping support
939
+
940
+ > **Note**: These changes are NOT part of this subtask. Separate process required.
941
+
942
+ ### Dependencies
943
+
944
+ - **Depends on**: None (but blocked by library changes above)
945
+ - **Blocks**: None
946
+
947
+ ### Testing Strategy
948
+
949
+ - [ ] Unit tests for avatar upload integration
950
+ - [ ] E2E test for upload flow
951
+
952
+ ### Estimated Complexity
953
+
954
+ Medium
955
+
956
+ ---
957
+
958
+ _Plan generated by Claude Code_
959
+ ```
960
+
961
+ **Attachment `plan.md` saved on ENG-456-2:**
962
+
963
+ ```markdown
964
+ ## Implementation Plan for Subtask
965
+
966
+ **Parent Task**: ENG-456 - User profile improvements
967
+
968
+ ### Subtask Summary
969
+
970
+ Add a bio/description field to the user profile allowing users to write about themselves.
971
+
972
+ ### Already Completed
973
+
974
+ None
975
+
976
+ ### Currently In Progress
977
+
978
+ None
979
+
980
+ ### Remaining Work
981
+
982
+ - [ ] Add bio field to user model
983
+ - [ ] Add textarea to profile form
984
+ - [ ] Implement character limit validation
985
+
986
+ ### Technical Analysis
987
+
988
+ - User model at `libs/shared/angular/src/lib/models/user.model.ts`
989
+ - Profile form uses reactive forms pattern
990
+
991
+ ### Implementation Steps
992
+
993
+ 1. Add `bio` field to user model
994
+ 2. Add textarea with character counter to profile form
995
+ 3. Update user service to handle bio field
996
+
997
+ ### Files to Modify
998
+
999
+ - `libs/shared/angular/src/lib/models/user.model.ts`
1000
+ - `libs/shared/angular/src/lib/components/user-profile/user-profile.component.ts`
1001
+ - `libs/shared/angular/src/lib/services/user.service.ts`
1002
+
1003
+ ### New Files
1004
+
1005
+ None
1006
+
1007
+ ### Dependencies
1008
+
1009
+ - **Depends on**: None
1010
+ - **Blocks**: None
1011
+
1012
+ ### Testing Strategy
1013
+
1014
+ - [ ] Unit test for bio validation
1015
+ - [ ] E2E test for bio save flow
1016
+
1017
+ ### Estimated Complexity
1018
+
1019
+ Low
1020
+
1021
+ ---
1022
+
1023
+ _Plan generated by Claude Code_
1024
+ ```
1025
+
1026
+ ---
1027
+
1028
+ **Important**:
1029
+
1030
+ - **Default mode**: Before saving the plans as attachments, show them to the user for review and approval.
1031
+ - **`--auto` mode**: Skip the review step; proceed directly to saving the attachments.
1032
+
1033
+ The plan content is written to `/tmp/claude-plans/<taskId>-plan.md`, base64-encoded, and uploaded as a native Linear attachment via `mcp__linear__create_attachment`. After that, the `AI Plan` label is applied to the invoked issue.