@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,742 @@
1
+ ---
2
+ name: plan
3
+ description: Create an implementation plan for a Linear task and save it as a `plan.md` attachment. Analyzes codebase with Angular 14 legacy patterns, previous commits, and external dependencies.
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Glob
9
+ - Grep
10
+ - AskUserQuestion
11
+ - TaskCreate
12
+ - TaskUpdate
13
+ - TaskList
14
+ - TaskGet
15
+ - mcp__linear__get_issue
16
+ - mcp__linear__list_issues
17
+ - mcp__linear__list_comments
18
+ - mcp__linear__save_comment
19
+ - mcp__linear__save_issue
20
+ - mcp__linear__create_attachment
21
+ - mcp__linear__delete_attachment
22
+ - mcp__linear__list_issue_labels
23
+ ---
24
+
25
+ # Plan Skill
26
+
27
+ 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 parent task.
28
+
29
+ ## 🚨 Hard Rules — read before doing anything
30
+
31
+ These rules override ANY other instruction, ANY surrounding example, and ANY default habit. Violating them is a skill failure.
32
+
33
+ 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, and (b) the single token-usage comment posted in Step 9c. No other comment may carry plan content.
34
+ 2. **One call, no fallback.** First Linear write for the plan is `mcp__linear__create_attachment`. If it fails, surface the error — do NOT silently fall back to `save_comment`.
35
+ 3. **Subtasks: one attachment each.** Each subtask gets its own `plan.md`; the parent gets only the `AI Plan` label, no `plan.md`.
36
+ 4. **`AI Plan` label is workspace-scoped — NEVER create it.** Only `mcp__linear__list_issue_labels` + `mcp__linear__save_issue`. `create_issue_label` MUST NOT be called.
37
+
38
+ If any of these would be violated, stop and ask the user instead.
39
+
40
+ ## Execution Checklist
41
+
42
+ Execute each step in order. Do not skip any step marked as MANDATORY.
43
+
44
+ - [ ] **1. Fetch Linear task** — get title, description, labels, priority, estimate from MCP Linear server
45
+ - [ ] **2. Fetch subtasks** — check for children; if present, plan each subtask individually
46
+ - [ ] **3. Fetch existing attachments and comments** — list `plan.md` attachments and all comments per task/subtask
47
+ - [ ] **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
48
+ - [ ] **5. Analyze previous commits** — `git log --all --grep="<taskId>"` for each task/subtask
49
+ - [ ] **6. Analyze staged changes** — `git status` and `git diff --cached` for work in progress
50
+ - [ ] **7. MANDATORY: Analyze codebase** — explore affected files, patterns, dependencies, and test coverage
51
+ - [ ] **8. MANDATORY: Verify Angular 14 patterns** — confirm `*ngIf`/`*ngFor`, constructor DI, `@Input()`/`@Output()`, BehaviorSubject in existing code
52
+ - [ ] **9. Analyze external library deps** — check if `@smartsoft001` or `@smartsoft001/pro` changes are needed (mark as separate process)
53
+ - [ ] **10. Create implementation plans** — generate structured plans per task/subtask with all required sections, using Angular 14 patterns
54
+ - [ ] **11. MANDATORY: Write plans in Polish** — all plan content must be in Polish language
55
+ - [ ] **12. 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).
56
+ - [ ] **13. 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)
57
+ - [ ] **14. 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.
58
+ - [ ] **15. 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)
59
+ - [ ] **16. Confirm to user** — list saved plans with summaries and Linear links
60
+
61
+ ### Task Progress Tracking
62
+
63
+ **MANDATORY**: Use Claude Code's built-in task tracking to provide real-time progress visibility.
64
+
65
+ **Task naming convention**: Every task subject MUST be prefixed with the Linear task ID:
66
+
67
+ ```
68
+ <linearTaskId> <step description>
69
+ ```
70
+
71
+ **At skill start**: Create tasks for each checklist step using `TaskCreate`:
72
+
73
+ ```
74
+ TaskCreate({
75
+ subject: "MM-123 Fetch Linear task",
76
+ description: "Get title, description, labels, priority, estimate from MCP Linear server",
77
+ activeForm: "MM-123 Fetching Linear task"
78
+ })
79
+ TaskCreate({
80
+ subject: "MM-123 Analyze codebase",
81
+ description: "Explore affected files, patterns, dependencies, and test coverage",
82
+ activeForm: "MM-123 Analyzing codebase"
83
+ })
84
+ ```
85
+
86
+ **During execution**:
87
+
88
+ - Before starting a step → `TaskUpdate({ taskId, status: "in_progress" })`
89
+ - After completing a step → `TaskUpdate({ taskId, status: "completed" })`
90
+
91
+ **Before user review**: Use `TaskList` to show progress overview before presenting plans for approval.
92
+
93
+ ## Role
94
+
95
+ **You are a highly experienced software architect** with:
96
+
97
+ - Over 15 years of experience in system design
98
+ - Deep knowledge of design patterns and architectural patterns
99
+ - Expertise in **Angular 14** patterns (NgModules, `*ngIf`/`*ngFor`, constructor DI, `@Input`/`@Output`)
100
+ - Ability to break down complex tasks into smaller, understandable steps
101
+ - Experience planning tasks for development teams in a clear and precise manner
102
+ - Skill in anticipating potential problems and risks
103
+ - Focus on architectural consistency and alignment with existing project patterns
104
+ - Thinking about scalability, maintainability, and testability of solutions
105
+
106
+ You create plans that are:
107
+
108
+ - **Specific**: each step is clearly defined
109
+ - **Actionable**: the developer knows exactly what to do
110
+ - **Complete**: nothing is omitted
111
+ - **Realistic**: they account for constraints and dependencies
112
+ - **Legacy-compatible**: they use Angular 14 patterns (no signals, no standalone components)
113
+
114
+ ## Usage
115
+
116
+ ```
117
+ /plan [linearTaskId]
118
+ /plan [linearTaskId] --auto # Non-interactive mode for CI / GitHub Actions
119
+ ```
120
+
121
+ ## Parameters
122
+
123
+ - `linearTaskId` - Linear task ID (e.g., ENG-123)
124
+ - `--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.
125
+
126
+ ## Auto Mode (`--auto`)
127
+
128
+ **When `--auto` is set, the skill MUST run end-to-end without any human-in-the-loop prompts.** Apply these overrides:
129
+
130
+ | Default behavior | `--auto` override |
131
+ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
132
+ | Final approval of generated plan content before saving | Skip the approval gate; proceed directly to attachment save (auto-approve) |
133
+ | Ask user to confirm deletion of old `plan.md` attachments | Delete old attachments automatically before saving new ones |
134
+ | Ask "regenerate anyway?" when all plans are up-to-date | Exit cleanly with a Linear comment noting all plans are current; no regeneration |
135
+ | Secondary signal prompt (keyword-triggered confirmation to regen) | Ignore the secondary signal; only the mtime rule decides regeneration |
136
+ | `AskUserQuestion` for any decision | Use the option marked **(Recommended)**; if none, fail fast with a Linear comment explaining why |
137
+
138
+ **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.
139
+
140
+ **Detection**: The flag `--auto` is provided as a positional/named arg. Treat any of `--auto`, `--ci`, `--non-interactive` as equivalent.
141
+
142
+ ## Angular 14 Legacy Patterns
143
+
144
+ When creating plans, always use these legacy patterns:
145
+
146
+ ### Components
147
+
148
+ - Use `@Component` with `NgModule` (NOT standalone)
149
+ - Use `*ngIf` and `*ngFor` (NOT `@if` and `@for`)
150
+ - Use constructor injection (NOT `inject()`)
151
+ - Use `@Input()` and `@Output()` decorators (NOT `input()`, `output()`)
152
+
153
+ ### Services
154
+
155
+ - Use `BehaviorSubject` and `Observable` (NOT signals)
156
+ - Use constructor injection
157
+ - Use `@Injectable({ providedIn: 'root' })` or module providers
158
+
159
+ ### State Management
160
+
161
+ - Use NgRx Store/Effects or BehaviorSubject patterns
162
+ - NO signals, computed(), or effect()
163
+
164
+ ## Instructions
165
+
166
+ 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.
167
+
168
+ ### Step 1: Fetch Linear Task Details
169
+
170
+ Use the MCP Linear server to fetch task details for the provided `linearTaskId`. Extract:
171
+
172
+ - Task title
173
+ - Task description
174
+ - Task labels/type (bug, feature, etc.)
175
+ - Acceptance criteria (if available)
176
+ - Task priority
177
+ - Task estimate (if available)
178
+
179
+ ### Step 2: Fetch Subtasks
180
+
181
+ Use the MCP Linear server to check if the task has subtasks (children). If subtasks exist:
182
+
183
+ - Fetch details for each subtask (title, description, labels, priority)
184
+ - Note the subtask IDs for later comment creation
185
+ - The main task becomes the "parent context" for all subtask plans
186
+
187
+ **Important**: If subtasks exist, you will create individual plans for each subtask, not for the parent task.
188
+
189
+ ### Step 3: Fetch Task Attachments and Comments
190
+
191
+ Use the MCP Linear server to fetch, for the parent task and each subtask:
192
+
193
+ - Attachments via `mcp__linear__get_issue` (attachments included in response) — look for one titled exactly `plan.md`
194
+ - Comments via `mcp__linear__list_comments` — keep `id`, `createdAt`, body text
195
+
196
+ ### Step 3a: Determine Which Tasks Need Planning
197
+
198
+ For each task/subtask, use the **attachment mtime vs comment ctime** rule:
199
+
200
+ #### Inputs per task
201
+
202
+ - `planAttachment`: the Linear attachment titled `plan.md` (or `null`)
203
+ - `planAttachment.updatedAt` (fall back to `createdAt`): when the plan was last written
204
+ - `comments`: list of all comments with `createdAt`
205
+
206
+ #### Decision logic
207
+
208
+ **Create a NEW plan if:**
209
+
210
+ 1. `planAttachment == null`, OR
211
+ 2. there is at least one comment where `comment.createdAt > planAttachment.updatedAt`
212
+
213
+ **SKIP planning if:**
214
+
215
+ 1. `planAttachment` exists AND no comment is newer than it.
216
+
217
+ #### Secondary signal (optional)
218
+
219
+ If `planAttachment` exists and no comment is newer than it, but the user's latest prompt mentions plan-change keywords ("zmień plan", "zaktualizuj plan", "popraw plan", "nowy plan", "uwagi do planu"), ask the user explicitly — do **not** regenerate silently on keyword alone.
220
+
221
+ #### Output:
222
+
223
+ - `tasksNeedingPlan`: Array of task IDs that need a new or updated plan
224
+ - `tasksWithExistingPlan`: Array of task IDs with up-to-date plans
225
+ - `oldPlanAttachments`: Map of task ID → `attachmentId` for plans being replaced
226
+
227
+ **Important**: If ALL tasks already have up-to-date plans:
228
+
229
+ - **Default mode**: Inform the user and ask if they want to regenerate anyway.
230
+ - **`--auto` mode**: Exit cleanly with a Linear comment in Polish noting all plans are current; do NOT regenerate.
231
+
232
+ ### Step 4: Analyze Previous Commits
233
+
234
+ Search for previous commits related to this Linear task by looking for the `linearTaskId` (and subtask IDs if applicable) in commit messages:
235
+
236
+ ```bash
237
+ # For parent task
238
+ git log --all --grep="<linearTaskId>" --oneline
239
+
240
+ # For each subtask
241
+ git log --all --grep="<subtaskId>" --oneline
242
+ ```
243
+
244
+ For each found commit, analyze:
245
+
246
+ 1. **Commit message**: What was the purpose of the change
247
+ 2. **Changed files**: Run `git show --stat <commit-hash>` to see affected files
248
+ 3. **Detailed changes**: Run `git show <commit-hash>` if needed to understand specific changes
249
+
250
+ This helps to:
251
+
252
+ - Understand what work has already been completed
253
+ - Identify patterns and approaches already established
254
+ - Avoid duplicating already implemented features
255
+ - Build upon existing implementation
256
+
257
+ ### Step 5: Analyze Staged Changes
258
+
259
+ Check what's currently staged in Git:
260
+
261
+ ```bash
262
+ git status
263
+ git diff --cached
264
+ ```
265
+
266
+ Analyze staged changes to understand:
267
+
268
+ - What work is in progress but not yet committed
269
+ - Files that are being modified as part of this task
270
+ - Current implementation direction
271
+
272
+ ### Step 6: Analyze the Codebase
273
+
274
+ Based on the task requirements (and each subtask if applicable), explore the codebase to understand:
275
+
276
+ 1. **Affected areas**: Identify which files, components, or modules will need changes
277
+ 2. **Existing patterns**: Understand current implementation patterns to maintain consistency
278
+ 3. **Dependencies**: Identify any dependencies or related code that might be affected
279
+ 4. **Test coverage**: Check existing tests that might need updates
280
+
281
+ Use tools like:
282
+
283
+ - `Glob` to find relevant files
284
+ - `Grep` to search for related code patterns
285
+ - `Read` to understand specific implementations
286
+
287
+ **Important**: Always check for Angular 14 patterns in existing code:
288
+
289
+ - Look for `*ngIf`, `*ngFor` usage (NOT `@if`, `@for`)
290
+ - Look for constructor injection patterns
291
+ - Look for `@Input()`, `@Output()` decorators
292
+ - Look for `BehaviorSubject`, `Observable` patterns (NOT signals)
293
+
294
+ ### Step 6a: Analyze External Library Dependencies
295
+
296
+ Check if the task requires changes to external library packages:
297
+
298
+ #### @smartsoft001 libraries
299
+
300
+ - **Repository location**: `../smartsoft001`
301
+ - **Package path**: `../smartsoft001/packages/`
302
+ - If changes are needed in `@smartsoft001/*` packages, explore the library repository to understand:
303
+ - Current implementation of the relevant package
304
+ - API surface that needs to be modified or extended
305
+ - Existing patterns and conventions in the library
306
+
307
+ #### @smartsoft001/pro libraries
308
+
309
+ - **Repository location**: `../smartsoft001-pro`
310
+ - **Package path**: `../smartsoft001-pro/packages/`
311
+ - If changes are needed in `@smartsoft001/pro-*` packages, explore the library repository to understand:
312
+ - Current implementation of the relevant package
313
+ - API surface that needs to be modified or extended
314
+ - Existing patterns and conventions in the library
315
+
316
+ **Important**: Changes to these external libraries are NOT part of this task's implementation. They require a separate process:
317
+
318
+ 1. Create a separate task/PR in the library repository
319
+ 2. Publish new version of the library
320
+ 3. Update dependency version in this project
321
+ 4. Then implement the changes in this project that depend on the library updates
322
+
323
+ ### Step 7: Create Implementation Plans
324
+
325
+ #### If NO subtasks exist:
326
+
327
+ Create a single detailed implementation plan for the parent task with:
328
+
329
+ 1. **Summary**: Brief overview of what needs to be done
330
+ 2. **Already Completed**: Work done in previous commits (with commit references)
331
+ 3. **Currently In Progress**: Work visible in staged changes
332
+ 4. **Remaining Work**: What still needs to be implemented
333
+ 5. **Technical Analysis**: Key findings from codebase exploration
334
+ 6. **Implementation Steps**: Numbered list of specific remaining tasks
335
+ 7. **Files to Modify**: List of files that will need changes
336
+ 8. **New Files**: List of any new files that need to be created
337
+ 9. **External Library Changes**: Changes needed in @smartsoft001 or @smartsoft001/pro (separate process)
338
+ 10. **Testing Strategy**: How the changes will be tested
339
+ 11. **Risks & Considerations**: Any potential issues or things to watch out for
340
+ 12. **Estimated Complexity**: Low / Medium / High
341
+
342
+ #### If subtasks exist:
343
+
344
+ Create a **separate plan for each subtask** that includes:
345
+
346
+ 1. **Parent Context**: Reference to parent task and its overall goal
347
+ 2. **Subtask Summary**: What this specific subtask needs to accomplish
348
+ 3. **Already Completed**: Work done in previous commits for this subtask
349
+ 4. **Currently In Progress**: Staged changes related to this subtask
350
+ 5. **Remaining Work**: What still needs to be done for this subtask
351
+ 6. **Technical Analysis**: Findings specific to this subtask
352
+ 7. **Implementation Steps**: Steps specific to this subtask
353
+ 8. **Files to Modify**: Files affected by this subtask
354
+ 9. **New Files**: New files needed for this subtask
355
+ 10. **External Library Changes**: Changes in @smartsoft001 or @smartsoft001/pro (separate process)
356
+ 11. **Dependencies**: Other subtasks this depends on or blocks
357
+ 12. **Testing Strategy**: Testing specific to this subtask
358
+ 13. **Estimated Complexity**: Low / Medium / High
359
+
360
+ ### Step 8: Format the Plans
361
+
362
+ #### Format for task WITHOUT subtasks:
363
+
364
+ ```markdown
365
+ ## Implementation Plan
366
+
367
+ ### Summary
368
+
369
+ [Brief overview]
370
+
371
+ ### Already Completed
372
+
373
+ [List of work done in previous commits - skip if no previous commits]
374
+
375
+ - `abc1234` - [commit message / description of changes]
376
+ - `def5678` - [commit message / description of changes]
377
+
378
+ **Files modified in previous commits:**
379
+
380
+ - `path/to/file1.ts`
381
+ - `path/to/file2.ts`
382
+
383
+ ### Currently In Progress
384
+
385
+ [Description of staged changes - skip if nothing staged]
386
+
387
+ - [File/change description]
388
+
389
+ ### Remaining Work
390
+
391
+ [What still needs to be done based on task requirements]
392
+
393
+ - [ ] [Remaining item 1]
394
+ - [ ] [Remaining item 2]
395
+
396
+ ### Technical Analysis
397
+
398
+ [Key findings from codebase exploration]
399
+
400
+ **Angular 14 patterns to follow:**
401
+
402
+ - Use `*ngIf` / `*ngFor` for control flow
403
+ - Use constructor injection for DI
404
+ - Use `@Input()` / `@Output()` for component communication
405
+ - Use `BehaviorSubject` / `Observable` for state management
406
+
407
+ ### Implementation Steps
408
+
409
+ 1. [Step 1]
410
+ 2. [Step 2]
411
+ 3. [Step 3]
412
+ ...
413
+
414
+ ### Files to Modify
415
+
416
+ - `path/to/file1.ts` - [reason]
417
+ - `path/to/file2.ts` - [reason]
418
+
419
+ ### New Files
420
+
421
+ - `path/to/new-file.ts` - [purpose]
422
+
423
+ ### External Library Changes (separate process)
424
+
425
+ [Skip this section if no library changes are needed]
426
+
427
+ **@smartsoft001 (repo: ../smartsoft001)**
428
+
429
+ - [ ] `packages/[package-name]` - [description of required changes]
430
+
431
+ **@smartsoft001/pro (repo: ../smartsoft001-pro)**
432
+
433
+ - [ ] `packages/[package-name]` - [description of required changes]
434
+
435
+ > **Note**: These changes are NOT part of this task implementation. They require:
436
+ >
437
+ > 1. Separate task/PR in the library repository
438
+ > 2. Library version publication
439
+ > 3. Dependency update in this project
440
+
441
+ ### Testing Strategy
442
+
443
+ - [ ] Unit tests for [component/service]
444
+ - [ ] E2E tests for [feature]
445
+ - [ ] Manual testing: [scenarios]
446
+
447
+ ### Risks & Considerations
448
+
449
+ - [Risk 1]
450
+ - [Risk 2]
451
+
452
+ ### Estimated Complexity
453
+
454
+ [Low / Medium / High]
455
+
456
+ ---
457
+
458
+ _Plan generated by Claude Code (flow-legacy)_
459
+ ```
460
+
461
+ #### Format for SUBTASK plan:
462
+
463
+ ```markdown
464
+ ## Implementation Plan for Subtask
465
+
466
+ **Parent Task**: [Parent task ID] - [Parent task title]
467
+
468
+ ### Subtask Summary
469
+
470
+ [What this specific subtask needs to accomplish]
471
+
472
+ ### Already Completed
473
+
474
+ [Work done in previous commits for this subtask - skip if none]
475
+
476
+ - `abc1234` - [commit message / description of changes]
477
+
478
+ **Files modified:**
479
+
480
+ - `path/to/file1.ts`
481
+
482
+ ### Currently In Progress
483
+
484
+ [Staged changes related to this subtask - skip if none]
485
+
486
+ - [File/change description]
487
+
488
+ ### Remaining Work
489
+
490
+ - [ ] [Remaining item 1]
491
+ - [ ] [Remaining item 2]
492
+
493
+ ### Technical Analysis
494
+
495
+ [Findings specific to this subtask]
496
+
497
+ **Angular 14 patterns to follow:**
498
+
499
+ - Use `*ngIf` / `*ngFor` for control flow
500
+ - Use constructor injection for DI
501
+ - Use `@Input()` / `@Output()` for component communication
502
+
503
+ ### Implementation Steps
504
+
505
+ 1. [Step 1]
506
+ 2. [Step 2]
507
+ ...
508
+
509
+ ### Files to Modify
510
+
511
+ - `path/to/file1.ts` - [reason]
512
+
513
+ ### New Files
514
+
515
+ - `path/to/new-file.ts` - [purpose]
516
+
517
+ ### External Library Changes (separate process)
518
+
519
+ [Skip this section if no library changes are needed]
520
+
521
+ **@smartsoft001 (repo: ../smartsoft001)**
522
+
523
+ - [ ] `packages/[package-name]` - [description of required changes]
524
+
525
+ **@smartsoft001/pro (repo: ../smartsoft001-pro)**
526
+
527
+ - [ ] `packages/[package-name]` - [description of required changes]
528
+
529
+ > **Note**: These changes are NOT part of this subtask. Separate process required.
530
+
531
+ ### Dependencies
532
+
533
+ - **Depends on**: [List subtask IDs this depends on, or "None"]
534
+ - **Blocks**: [List subtask IDs this blocks, or "None"]
535
+
536
+ ### Testing Strategy
537
+
538
+ - [ ] [Test specific to this subtask]
539
+
540
+ ### Estimated Complexity
541
+
542
+ [Low / Medium / High]
543
+
544
+ ---
545
+
546
+ _Plan generated by Claude Code (flow-legacy)_
547
+ ```
548
+
549
+ ### Step 8a: User Approval of Generated Plan
550
+
551
+ **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.
552
+
553
+ **`--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.
554
+
555
+ **Default mode** (interactive):
556
+
557
+ 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.
558
+
559
+ 2. **Ask for approval** via `AskUserQuestion`:
560
+
561
+ ```markdown
562
+ ## Akceptacja planu
563
+
564
+ Powyżej znajduje się wygenerowany plan dla zadania <linearTaskId> (oraz <N> podzadań, jeśli dotyczy).
565
+ Czy akceptujesz plan i mogę zapisać go jako załącznik `plan.md` w Linear?
566
+ ```
567
+
568
+ Options (use exactly these labels for consistency with Step 9):
569
+
570
+ - **"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.
571
+ - **"Wygeneruj plan ponownie"** — user wants a different plan. Go to step 3 (regeneration loop) below.
572
+ - **"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.
573
+
574
+ 3. **Regeneration branch**: if the user chose "Wygeneruj plan ponownie":
575
+
576
+ - 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.
577
+ - 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.
578
+ - On the regenerated plan, return to **Step 8a step 1** (render + ask again).
579
+ - **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.
580
+
581
+ 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.
582
+
583
+ ### Step 9: Confirm and Delete Old Plan Attachments
584
+
585
+ **This step applies only when replacing existing plans** (`oldPlanAttachments` from Step 3a is not empty).
586
+
587
+ **`--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.
588
+
589
+ **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:
590
+
591
+ ```markdown
592
+ ## Zastąpienie istniejących planów
593
+
594
+ Następujące załączniki `plan.md` zostaną usunięte i zastąpione nowymi:
595
+
596
+ | Task | Stary załącznik (ID) |
597
+ | --------- | -------------------- |
598
+ | <task-id> | <attachment-id> |
599
+
600
+ Czy potwierdzasz usunięcie starych planów i zapisanie nowych?
601
+ ```
602
+
603
+ Use `AskUserQuestion` with options:
604
+
605
+ - "Tak, usuń stare plany i zapisz nowe" (Recommended)
606
+ - "Anuluj"
607
+
608
+ **If user confirms:**
609
+
610
+ 1. For each entry in `oldPlanAttachments`, delete the Linear attachment via `mcp__linear__delete_attachment({ id: attachmentId })`.
611
+ 2. Proceed to Step 9a.
612
+
613
+ **If user cancels:** Stop the process, do not save any plans.
614
+
615
+ ### Step 9a: Save Plan as Native Linear Attachment
616
+
617
+ **⛔ 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.)
618
+
619
+ For each task that needs planning, upload the plan content directly to Linear (no external storage).
620
+
621
+ #### 9a.1 — Write `plan.md` locally
622
+
623
+ The plan content is exactly the markdown produced in Step 8. Write it to the temp file:
624
+
625
+ ```bash
626
+ mkdir -p /tmp/claude-plans
627
+ ```
628
+
629
+ Use `Write` to save the plan content to `/tmp/claude-plans/<taskId>-plan.md`.
630
+
631
+ #### 9a.2 — Base64-encode
632
+
633
+ ```bash
634
+ b64=$(base64 -i /tmp/claude-plans/<taskId>-plan.md)
635
+ ```
636
+
637
+ On macOS `base64 -i <file>` outputs without line-wrapping. On Linux, pipe through `tr -d '\n'` if needed.
638
+
639
+ #### 9a.3 — Create Linear attachment
640
+
641
+ Call `mcp__linear__create_attachment` with:
642
+
643
+ - `issue`: the task/subtask ID
644
+ - `filename`: `plan.md`
645
+ - `contentType`: `text/markdown`
646
+ - `title`: `plan.md` (exact — used for detection in Step 3 and by `/impl`)
647
+ - `subtitle`: `Plan wygenerowany przez Claude Code (legacy)`
648
+ - `base64Content`: the base64 string from 9a.2
649
+
650
+ Linear hosts the file on its own infrastructure.
651
+
652
+ #### 9a.4 — Clean up local file
653
+
654
+ Delete `/tmp/claude-plans/<taskId>-plan.md` after the attachment is created. `/push` does NOT delete Linear attachments — they stay on the issue.
655
+
656
+ #### Scope rule
657
+
658
+ - No subtasks → attach `plan.md` to parent.
659
+ - Has subtasks → attach `plan.md` to each subtask needing planning. Do NOT attach on the parent.
660
+
661
+ ### Step 9b: Add "AI Plan" Label
662
+
663
+ Apply the `AI Plan` label to the **invoked issue** — i.e. the `linearTaskId` passed to `/plan`:
664
+
665
+ - `/plan FRA-123` (parent) → label on `FRA-123`. Subtasks receive `plan.md` attachments but no label.
666
+ - `/plan FRA-123-1` (subtask) → label on `FRA-123-1` directly; parent untouched.
667
+
668
+ **`AI Plan` is a workspace-level (organization-wide) label that already exists** — do NOT create it.
669
+
670
+ 1. Look up label `AI Plan` via `mcp__linear__list_issue_labels` (workspace-wide). If not found for any reason, surface the error — do NOT create a team-scoped duplicate.
671
+ 2. Apply via `mcp__linear__save_issue({ id: invokedTaskId, labelIds: [...existingLabelIds, aiPlanLabelId] })`. Preserve existing labels. Skip if already present.
672
+ 3. If label operations fail, surface the error but do not roll back the attachment.
673
+
674
+ ### Step 9c: Post Token-Usage Comment
675
+
676
+ 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.
677
+
678
+ 1. Run the per-plugin token-summing script:
679
+
680
+ ```bash
681
+ bash "$CLAUDE_PLUGIN_ROOT/scripts/compute-session-tokens.sh"
682
+ ```
683
+
684
+ 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).
685
+
686
+ 2. Compute `<TOTAL> = <input> + <output> + <cache_creation> + <cache_read>`.
687
+
688
+ 3. Call `mcp__linear__save_comment` with `issueId: invokedTaskId` and `body` equal to:
689
+
690
+ ```markdown
691
+ ## Zużycie tokenów — etap /plan
692
+
693
+ | Metryka | Wartość |
694
+ | -------------- | -------------- |
695
+ | Input | <INPUT> |
696
+ | Output | <OUTPUT> |
697
+ | Cache creation | <CACHE_CREATE> |
698
+ | Cache read | <CACHE_READ> |
699
+ | **Łącznie** | **<TOTAL>** |
700
+ ```
701
+
702
+ 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.
703
+
704
+ 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.
705
+
706
+ ### Step 10: Confirm to User
707
+
708
+ After saving:
709
+
710
+ - List all tasks/subtasks where `plan.md` was attached (with Linear attachment URL)
711
+ - Show plan summaries
712
+ - Confirm `AI Plan` label added to parent task
713
+ - Provide Linear links
714
+
715
+ ## Guidelines
716
+
717
+ 1. **Write plans in Polish**: All implementation plans must be written in Polish language
718
+ 2. **Be thorough but concise**: Include all necessary details without being verbose
719
+ 3. **Be specific**: Reference actual file paths and code patterns found in the codebase
720
+ 4. **Consider edge cases**: Think about error handling, validation, and edge cases
721
+ 5. **Follow project conventions**: Ensure the plan aligns with project architecture and patterns
722
+ 6. **Identify dependencies**: Note if any tasks depend on others or external factors
723
+ 7. **Ask for clarification**: If requirements are unclear, use `AskUserQuestion` before creating the plan
724
+ 8. **Track progress accurately**: Clearly distinguish between completed, in-progress, and remaining work
725
+ 9. **Reference commits**: Always include commit hashes when mentioning previous work
726
+ 10. **Keep subtask plans focused**: Each subtask plan should only cover that subtask's scope
727
+ 11. **Identify cross-subtask dependencies**: Note which subtasks depend on or block others
728
+ 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
729
+ 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.updatedAt`).
730
+ 14. **Mtime rule is authoritative**: Regeneration driven by attachment `updatedAt` vs comment `createdAt`. Keyword detection triggers an explicit user confirmation only — never a silent regen.
731
+ 15. **Use Angular 14 patterns**: Always plan for `*ngIf`/`*ngFor`, constructor DI, `@Input()`/`@Output()`, BehaviorSubject - NOT signals, `@if`/`@for`, or `inject()`
732
+ 16. **Delete old plans cleanly**: When replacing, ask user to confirm, then delete the old Linear attachment via `mcp__linear__delete_attachment`.
733
+ 17. **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.
734
+
735
+ ---
736
+
737
+ **Important**:
738
+
739
+ - **Default mode**: Before saving the plans as attachments, show them to the user for review and approval.
740
+ - **`--auto` mode**: Skip the review step; proceed directly to saving the attachments.
741
+
742
+ 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.