plan-flow-skill 1.0.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 (124) hide show
  1. package/.claude/commands/create-contract.md +468 -0
  2. package/.claude/commands/create-plan.md +512 -0
  3. package/.claude/commands/discovery-plan.md +561 -0
  4. package/.claude/commands/execute-plan.md +682 -0
  5. package/.claude/commands/review-code.md +459 -0
  6. package/.claude/commands/review-pr.md +651 -0
  7. package/.claude/commands/setup.md +1609 -0
  8. package/.claude/commands/write-tests.md +543 -0
  9. package/.claude/rules/core/allowed-patterns.md +175 -0
  10. package/.claude/rules/core/complexity-scoring.md +225 -0
  11. package/.claude/rules/core/forbidden-patterns.md +253 -0
  12. package/.claude/rules/languages/python-patterns.md +6 -0
  13. package/.claude/rules/languages/typescript-patterns.md +7 -0
  14. package/.claude/rules/patterns/contract-patterns.md +332 -0
  15. package/.claude/rules/patterns/discovery-patterns.md +342 -0
  16. package/.claude/rules/patterns/discovery-templates.md +319 -0
  17. package/.claude/rules/patterns/jest-patterns.md +482 -0
  18. package/.claude/rules/patterns/plans-patterns.md +225 -0
  19. package/.claude/rules/patterns/plans-templates.md +227 -0
  20. package/.claude/rules/patterns/pytest-patterns.md +457 -0
  21. package/.claude/rules/patterns/review-code-templates.md +305 -0
  22. package/.claude/rules/patterns/review-pr-patterns.md +360 -0
  23. package/.claude/rules/tools/auth-pr-tool.md +30 -0
  24. package/.claude/rules/tools/interactive-questions-tool.md +235 -0
  25. package/.claude/rules/tools/jest-testing-tool.md +73 -0
  26. package/.claude/rules/tools/plan-mode-tool.md +164 -0
  27. package/.claude/rules/tools/pytest-testing-tool.md +121 -0
  28. package/.claude/rules/tools/reference-expansion-tool.md +326 -0
  29. package/LICENSE +21 -0
  30. package/README.md +167 -0
  31. package/dist/cli/commands/init.d.ts +6 -0
  32. package/dist/cli/commands/init.d.ts.map +1 -0
  33. package/dist/cli/commands/init.js +139 -0
  34. package/dist/cli/commands/init.js.map +1 -0
  35. package/dist/cli/handlers/claude.d.ts +9 -0
  36. package/dist/cli/handlers/claude.d.ts.map +1 -0
  37. package/dist/cli/handlers/claude.js +119 -0
  38. package/dist/cli/handlers/claude.js.map +1 -0
  39. package/dist/cli/handlers/codex.d.ts +9 -0
  40. package/dist/cli/handlers/codex.d.ts.map +1 -0
  41. package/dist/cli/handlers/codex.js +100 -0
  42. package/dist/cli/handlers/codex.js.map +1 -0
  43. package/dist/cli/handlers/cursor.d.ts +8 -0
  44. package/dist/cli/handlers/cursor.d.ts.map +1 -0
  45. package/dist/cli/handlers/cursor.js +34 -0
  46. package/dist/cli/handlers/cursor.js.map +1 -0
  47. package/dist/cli/handlers/openclaw.d.ts +8 -0
  48. package/dist/cli/handlers/openclaw.d.ts.map +1 -0
  49. package/dist/cli/handlers/openclaw.js +34 -0
  50. package/dist/cli/handlers/openclaw.js.map +1 -0
  51. package/dist/cli/handlers/shared.d.ts +9 -0
  52. package/dist/cli/handlers/shared.d.ts.map +1 -0
  53. package/dist/cli/handlers/shared.js +44 -0
  54. package/dist/cli/handlers/shared.js.map +1 -0
  55. package/dist/cli/index.d.ts +8 -0
  56. package/dist/cli/index.d.ts.map +1 -0
  57. package/dist/cli/index.js +43 -0
  58. package/dist/cli/index.js.map +1 -0
  59. package/dist/cli/types.d.ts +26 -0
  60. package/dist/cli/types.d.ts.map +1 -0
  61. package/dist/cli/types.js +5 -0
  62. package/dist/cli/types.js.map +1 -0
  63. package/dist/cli/utils/files.d.ts +37 -0
  64. package/dist/cli/utils/files.d.ts.map +1 -0
  65. package/dist/cli/utils/files.js +122 -0
  66. package/dist/cli/utils/files.js.map +1 -0
  67. package/dist/cli/utils/logger.d.ts +11 -0
  68. package/dist/cli/utils/logger.d.ts.map +1 -0
  69. package/dist/cli/utils/logger.js +34 -0
  70. package/dist/cli/utils/logger.js.map +1 -0
  71. package/dist/cli/utils/prompts.d.ts +10 -0
  72. package/dist/cli/utils/prompts.d.ts.map +1 -0
  73. package/dist/cli/utils/prompts.js +65 -0
  74. package/dist/cli/utils/prompts.js.map +1 -0
  75. package/dist/test/setup.d.ts +5 -0
  76. package/dist/test/setup.d.ts.map +1 -0
  77. package/dist/test/setup.js +7 -0
  78. package/dist/test/setup.js.map +1 -0
  79. package/package.json +63 -0
  80. package/rules/core/_index.mdc +89 -0
  81. package/rules/core/allowed-patterns.mdc +185 -0
  82. package/rules/core/complexity-scoring.mdc +235 -0
  83. package/rules/core/forbidden-patterns.mdc +263 -0
  84. package/rules/languages/_index.mdc +80 -0
  85. package/rules/languages/python-patterns.mdc +188 -0
  86. package/rules/languages/typescript-patterns.mdc +128 -0
  87. package/rules/patterns/_index.mdc +185 -0
  88. package/rules/patterns/contract-patterns.mdc +344 -0
  89. package/rules/patterns/discovery-patterns.mdc +354 -0
  90. package/rules/patterns/discovery-templates.mdc +329 -0
  91. package/rules/patterns/jest-patterns.mdc +492 -0
  92. package/rules/patterns/plans-patterns.mdc +237 -0
  93. package/rules/patterns/plans-templates.mdc +237 -0
  94. package/rules/patterns/pytest-patterns.mdc +467 -0
  95. package/rules/patterns/review-code-templates.mdc +315 -0
  96. package/rules/patterns/review-pr-patterns.mdc +370 -0
  97. package/rules/skills/_index.mdc +174 -0
  98. package/rules/skills/create-contract-skill.mdc +239 -0
  99. package/rules/skills/create-plan-skill.mdc +271 -0
  100. package/rules/skills/discovery-skill.mdc +295 -0
  101. package/rules/skills/execute-plan-skill.mdc +388 -0
  102. package/rules/skills/review-code-skill.mdc +308 -0
  103. package/rules/skills/review-pr-skill.mdc +496 -0
  104. package/rules/skills/setup-skill.mdc +923 -0
  105. package/rules/skills/write-tests-skill.mdc +294 -0
  106. package/rules/templates/index-template.mdc +126 -0
  107. package/rules/tools/_index.mdc +114 -0
  108. package/rules/tools/auth-pr-tool.mdc +362 -0
  109. package/rules/tools/interactive-questions-tool.mdc +337 -0
  110. package/rules/tools/jest-testing-tool.mdc +96 -0
  111. package/rules/tools/plan-mode-tool.mdc +229 -0
  112. package/rules/tools/pytest-testing-tool.mdc +144 -0
  113. package/rules/tools/reference-expansion-tool.mdc +338 -0
  114. package/skills/plan-flow/SKILL.md +109 -0
  115. package/skills/plan-flow/create-contract/SKILL.md +139 -0
  116. package/skills/plan-flow/create-plan/SKILL.md +93 -0
  117. package/skills/plan-flow/discovery/SKILL.md +85 -0
  118. package/skills/plan-flow/execute-plan/SKILL.md +89 -0
  119. package/skills/plan-flow/review-code/SKILL.md +100 -0
  120. package/skills/plan-flow/review-pr/SKILL.md +122 -0
  121. package/skills/plan-flow/setup/SKILL.md +73 -0
  122. package/skills/plan-flow/write-tests/SKILL.md +115 -0
  123. package/templates/shared/AGENTS.md.template +60 -0
  124. package/templates/shared/CLAUDE.md.template +62 -0
@@ -0,0 +1,651 @@
1
+ ---
2
+ description: This command reviews a Pull Request from GitHub or Azure DevOps by invoking the `review-pr` skill. T
3
+ ---
4
+
5
+ # Review PR Command
6
+
7
+ ## Command Description
8
+
9
+ This command reviews a Pull Request from GitHub or Azure DevOps by invoking the `review-pr` skill. The command validates inputs and orchestrates the review process.
10
+
11
+ ---
12
+
13
+
14
+ ## Help
15
+
16
+ **If the user invokes this command with `-help`, display only this section and stop:**
17
+
18
+ ```
19
+ /review-pr - Review Pull Request
20
+
21
+ DESCRIPTION:
22
+ Reviews a Pull Request from GitHub or Azure DevOps. Authenticates,
23
+ fetches PR details, and generates a detailed review document.
24
+
25
+ USAGE:
26
+ /review-pr <pr_url>
27
+ /review-pr -help
28
+
29
+ ARGUMENTS:
30
+ pr_url URL of the Pull Request to review
31
+
32
+ EXAMPLES:
33
+ /review-pr https://github.com/org/repo/pull/123
34
+ /review-pr https://dev.azure.com/org/project/_git/repo/pullrequest/456
35
+ /review-pr https://github.com/myorg/myrepo/pull/789
36
+
37
+ SUPPORTED PLATFORMS:
38
+ - GitHub (github.com)
39
+ - Azure DevOps (dev.azure.com, visualstudio.com)
40
+
41
+ OUTPUT:
42
+ Creates: flow/reviewed-pr/<pr_identifier>.md
43
+
44
+ WORKFLOW:
45
+ 1. Validates PR URL format
46
+ 2. Authenticates using auth-pr tool
47
+ 3. Fetches PR information and diff
48
+ 4. Loads review patterns from project rules
49
+ 5. Analyzes code changes
50
+ 6. Generates review document
51
+
52
+ REVIEW INCLUDES:
53
+ - Summary of changes
54
+ - Pattern compliance check
55
+ - Code quality issues
56
+ - Suggestions for improvement
57
+ - Approval recommendation
58
+
59
+ RECOMMENDED MODEL:
60
+ Claude Opus 4.5 or Sonnet 4.5 for best results
61
+
62
+ RELATED COMMANDS:
63
+ /review-code Review local changes instead
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Critical Rules
69
+
70
+ | Rule | Description |
71
+ | ------------------------ | -------------------------------------------------------- |
72
+ | **Read-Only Analysis** | This command ONLY produces a review document |
73
+ | **Complete and Stop** | After presenting results, STOP and wait for user |
74
+
75
+ ---
76
+
77
+ ## Instructions
78
+
79
+ ### Step 1: Validate Inputs
80
+
81
+ | Input | Required | Description |
82
+ |-------|----------|-------------|
83
+ | `pr_link` | Yes | The URL of the Pull Request to review |
84
+ | `language` | Optional | Primary language (auto-detected if not provided) |
85
+
86
+ ### Step 2: Validate PR URL Format
87
+
88
+ - **GitHub**: Must contain `github.com` and `/pull/`
89
+ - **Azure DevOps**: Must contain `dev.azure.com` or `visualstudio.com` and `pullrequest`
90
+
91
+ ### Step 3: Invoke Review PR Skill
92
+
93
+ The skill will:
94
+ 1. Authenticate using the `auth-pr` tool
95
+ 2. Fetch PR information
96
+ 3. Load review patterns
97
+ 4. Analyze code changes
98
+ 5. Generate review document
99
+
100
+ ### Step 4: Present Results
101
+
102
+ **Review document created**: `flow/reviewed-pr/{filename}.md`
103
+
104
+ ---
105
+
106
+ ## Example Usage
107
+
108
+ ```bash
109
+ # Review a GitHub PR
110
+ review-pr https://github.com/org/repo/pull/123
111
+
112
+ # Review an Azure DevOps PR
113
+ review-pr https://dev.azure.com/org/project/_git/repo/pullrequest/456
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Context Optimization
119
+
120
+ This command uses hierarchical context loading to reduce context consumption. Instead of loading full files, load indexes first and expand specific sections on-demand.
121
+
122
+ ### Recommended Loading Order
123
+
124
+ 1. **Always load first**: This command file (`commands/review-pr.md`)
125
+ 2. **Load indexes**: Load `_index.md` files for relevant folders
126
+ 3. **Expand on-demand**: Use reference codes to load specific sections when needed
127
+
128
+ ### Index Files for PR Review
129
+
130
+ | Index | When to Load |
131
+ |-------|--------------|
132
+ | `rules/skills/_index.md` | To understand review workflow |
133
+ | `rules/tools/_index.md` | For authentication tool |
134
+ | `rules/patterns/_index.md` | For review patterns |
135
+ | `rules/core/_index.md` | For allowed/forbidden patterns |
136
+
137
+ ### Reference Codes for PR Review
138
+
139
+ | Code | Description | When to Expand |
140
+ |------|-------------|----------------|
141
+ | SKL-PR-1 | Review PR skill workflow | Understanding full process |
142
+ | TLS-AUTH-1 | Auth tool configuration | Setting up authentication |
143
+ | TLS-AUTH-2 | Authentication workflow | Authenticating to platform |
144
+ | PTN-PR-1 | PR review patterns | Creating review output |
145
+ | COR-AP-1 | Allowed patterns overview | Checking pattern compliance |
146
+ | COR-FP-1 | Forbidden patterns overview | Identifying anti-patterns |
147
+
148
+ ### Expansion Instructions
149
+
150
+ When executing this command:
151
+
152
+ 1. **Start with indexes**: Read `rules/skills/_index.md` and `rules/tools/_index.md`
153
+ 2. **Expand auth first**: Load TLS-AUTH-* codes for authentication
154
+ 3. **Then expand review patterns**: Load PTN-PR-* codes for review structure
155
+ 4. **Don't expand everything**: Only load patterns relevant to the PR being reviewed
156
+
157
+ ---
158
+
159
+ ## Related Resources
160
+
161
+ | Resource | Purpose |
162
+ | ------------------------------ | -------------------------------------- |
163
+ | `rules/skills/_index.md` | Index of skills with reference codes |
164
+ | `rules/tools/_index.md` | Index of tools with reference codes |
165
+ | `rules/patterns/_index.md` | Index of patterns with reference codes |
166
+ | `rules/core/_index.md` | Index of core rules with reference codes |
167
+ | `review-pr-skill.md` | Skill that executes the review |
168
+ | `auth-pr-tool.md` | Authentication tool for PR platforms |
169
+ | `review-pr-patterns.md` | Review patterns and guidelines |
170
+
171
+ ---
172
+
173
+ # Implementation Details
174
+
175
+
176
+ ## Restrictions - READ ONLY
177
+
178
+ This skill is **strictly read-only analysis**. The review process:
179
+
180
+ 1. **Reads** the PR diff and files
181
+ 2. **Analyzes** against patterns and guidelines
182
+ 3. **Generates** a markdown file with findings
183
+
184
+ **No code execution, no code modification, no builds.**
185
+
186
+ ### NEVER Do These Actions
187
+
188
+ | Forbidden Action | Reason |
189
+ | ---------------------------------------- | ---------------------------------------------- |
190
+ | `npm run build` | No build commands - analysis only |
191
+ | `npm run test` | No test commands - analysis only |
192
+ | `npm install` | No dependency installation |
193
+ | Edit/modify any source code | No code changes - review produces findings |
194
+ | Create/edit files outside `flow/` | Only write to `flow/reviewed-pr/` |
195
+ | `git commit` | No commits to any repository |
196
+ | `git push` | No pushing to remote repositories |
197
+ | `git checkout` | No branch switching on external repos |
198
+ | `gh pr merge` | No merging pull requests |
199
+ | `gh pr close` | No closing pull requests |
200
+ | `gh pr review --approve` | No approving PRs directly via CLI |
201
+ | `gh pr review --request-changes` | No requesting changes directly via CLI |
202
+ | `gh pr comment` | No posting comments directly to the PR |
203
+ | Any write operation to the external repo | All output goes to local markdown only |
204
+ | Any shell command that modifies code | This is a read-only analysis, not an execution |
205
+
206
+ ### Allowed Actions
207
+
208
+ #### GitHub Commands
209
+
210
+ | Allowed Action | Purpose |
211
+ | ---------------------------- | -------------------------------------------- |
212
+ | `gh auth status` | Check authentication status |
213
+ | `gh auth login --with-token` | Authenticate using PAT from `.plan.flow.env` |
214
+ | `gh pr view` | Read PR information |
215
+ | `gh pr diff` | Read PR diff/changes |
216
+ | `gh pr files` | List files changed in PR |
217
+ | `gh api` (GET requests only) | Fetch additional PR data |
218
+
219
+ #### Azure DevOps Commands
220
+
221
+ | Allowed Action | Purpose |
222
+ | ----------------------------------------------------- | --------------------------------------- |
223
+ | `az devops configure` | Configure Azure DevOps defaults |
224
+ | `az devops invoke --area git --resource pullRequests` | Fetch PR details |
225
+ | `az devops invoke --area git --resource blobs` | Fetch file contents |
226
+ | `az devops invoke --area git --resource diffs` | Fetch PR diff |
227
+ | `az devops invoke --area git --resource commits` | Fetch commit information |
228
+ | `az repos pr show` | Show PR details |
229
+ | `az repos pr list` | List PRs (for finding existing reviews) |
230
+ | `curl` with GET + PAT auth | Direct API calls to Azure DevOps |
231
+
232
+ #### Local Operations
233
+
234
+ | Allowed Action | Purpose |
235
+ | -------------------------------- | ------------------------------------- |
236
+ | Write to `flow/reviewed-pr/` | Save review notes locally |
237
+ | Write to `/tmp/` | Temporary file storage for processing |
238
+ | Read project rule files | Load patterns for analysis |
239
+ | `source .plan.flow.env` | Load environment credentials |
240
+
241
+ > **Important**: The ONLY writable location is `flow/reviewed-pr/`. No source code, configuration files, or any other project files should be modified.
242
+
243
+ ### Allowed Command Examples
244
+
245
+ ```bash
246
+ # Fetch file content from Azure DevOps
247
+ az devops invoke \
248
+ --area git \
249
+ --resource blobs \
250
+ --route-parameters project={project} repositoryId={repo} sha1={sha} \
251
+ --query-parameters '$format=text' \
252
+ --api-version 7.0 \
253
+ --out-file /tmp/{filename} \
254
+ && cat /tmp/{filename}
255
+
256
+ # Fetch PR details from Azure DevOps
257
+ az devops invoke \
258
+ --area git \
259
+ --resource pullRequests \
260
+ --route-parameters project={project} repositoryId={repo} pullRequestId={pr_id} \
261
+ --api-version 7.0
262
+
263
+ # Fetch PR diff/changes
264
+ az devops invoke \
265
+ --area git \
266
+ --resource diffs \
267
+ --route-parameters project={project} repositoryId={repo} \
268
+ --query-parameters 'baseVersion={base}&targetVersion={target}' \
269
+ --api-version 7.0
270
+
271
+ # Direct API call with PAT
272
+ curl -s -u ":$AZURE_DEVOPS_PAT" \
273
+ "https://dev.azure.com/{org}/{project}/_apis/git/pullrequests/{pr_id}?api-version=7.0"
274
+ ```
275
+
276
+ > 📝 **Output**: All findings, comments, and suggestions are saved to a local markdown file in `flow/reviewed-pr/`. The user can then manually copy comments to the PR if desired.
277
+
278
+ ---
279
+
280
+ ## Inputs
281
+
282
+ | Input | Required | Description |
283
+ | ---------- | -------- | ------------------------------------------------ |
284
+ | `pr_link` | Yes | The URL of the Pull Request to review |
285
+ | `language` | Optional | Primary language (auto-detected if not provided) |
286
+
287
+ ---
288
+
289
+ ## Workflow
290
+
291
+ ### Step 0: Authenticate for PR Access
292
+
293
+ Use the **[PR Authentication Tool](../tools/auth-pr-tool.md)** to authenticate and verify access to the PR.
294
+
295
+ **What the tool does**:
296
+
297
+ 1. Detects platform from PR URL (GitHub or Azure DevOps)
298
+ 2. Loads credentials from `.plan.flow.env`
299
+ 3. Authenticates using the appropriate method for the platform
300
+ 4. Verifies access by fetching the PR
301
+
302
+ **Usage**:
303
+
304
+ ```markdown
305
+ Use the auth-pr tool with the PR URL: {pr_link}
306
+
307
+ The tool will:
308
+ - Detect platform (GitHub/Azure DevOps)
309
+ - Load credentials from .plan.flow.env
310
+ - Authenticate and verify access
311
+ - Return authentication status
312
+ ```
313
+
314
+ After successful authentication, proceed to fetch PR information.
315
+
316
+ ---
317
+
318
+ ### Step 1: Fetch PR Information
319
+
320
+ 1. Use the provided PR link to fetch the Pull Request details
321
+ 2. Extract the PR title, description, and list of changed files
322
+ 3. Identify the primary language(s) used in the PR
323
+
324
+ ### Step 2: Load Review Patterns
325
+
326
+ 1. Read `.claude/rules/patterns/review-pr-patterns.md` for general review guidelines
327
+ 2. Based on the detected language(s), load the appropriate pattern file:
328
+ - **TypeScript/JavaScript**: Load `.claude/rules/languages/typescript-patterns.md`
329
+ - **Python**: Load `.claude/rules/languages/python-patterns.md`
330
+ 3. Cross-reference with `.claude/rules/core/forbidden-patterns.md` for anti-patterns to flag
331
+ 4. Cross-reference with `.claude/rules/core/allowed-patterns.md` for best practices to encourage
332
+ 5. Use the [`complexity-scoring` pattern](../core/complexity-scoring.md) for fix complexity scoring
333
+
334
+ ### Step 3: Analyze Code Changes
335
+
336
+ For each file in the PR:
337
+
338
+ 1. Review the diff/changes
339
+ 2. Check for violations of forbidden patterns
340
+ 3. Verify adherence to allowed patterns
341
+ 4. Apply language-specific checks
342
+ 5. Identify security, performance, and maintainability concerns
343
+
344
+ ### Step 4: Generate or Update Review Document
345
+
346
+ **Check for existing review file** in `flow/reviewed-pr/` before creating a new one.
347
+
348
+ #### If reviewing the same PR again:
349
+
350
+ 1. **Find the existing file** matching the PR (by PR number or title)
351
+ 2. **Update the existing file** with the new review findings
352
+ 3. **Add a review history entry** showing when each review was performed
353
+ 4. **Mark resolved findings** from previous reviews if they've been fixed
354
+ 5. **Add new findings** discovered in the updated PR
355
+
356
+ #### If this is a new PR:
357
+
358
+ Create a markdown file in `flow/reviewed-pr/` with the naming convention:
359
+
360
+ ```
361
+ pr-notes-{sanitized-pr-title}.md
362
+ ```
363
+
364
+ **Example**: For a PR titled "Add user authentication flow", create:
365
+
366
+ ```
367
+ flow/reviewed-pr/pr-notes-add-user-authentication-flow.md
368
+ ```
369
+
370
+ > 💡 **Tip**: Use the PR number in the filename for easier matching on re-reviews (e.g., `pr-notes-123-add-user-authentication-flow.md`)
371
+
372
+ ---
373
+
374
+ ## Output Format
375
+
376
+ The generated review document should follow this structure:
377
+
378
+ ```markdown
379
+ # PR Review: {PR Title}
380
+
381
+ ## PR Information
382
+
383
+ | Field | Value |
384
+ | ----------- | -------------------- |
385
+ | PR Link | {pr_link} |
386
+ | PR Number | {pr_number} |
387
+ | PR Title | {pr_title} |
388
+ | Author | {author} |
389
+ | Branch | {branch} |
390
+ | Files | {number_of_files} |
391
+ | Language(s) | {detected_languages} |
392
+
393
+ ---
394
+
395
+ ## Review History
396
+
397
+ | Review # | Date | Findings | Resolved | New |
398
+ | -------- | -------------- | -------- | -------- | ----- |
399
+ | 1 | {initial_date} | {count} | - | - |
400
+ | 2 | {update_date} | {count} | {fixed} | {new} |
401
+
402
+ > Update this table each time the PR is re-reviewed.
403
+
404
+ ---
405
+
406
+ ## Review Summary
407
+
408
+ | Metric | Value |
409
+ | -------------------- | ------------------ |
410
+ | **Total Findings** | {count} |
411
+ | Critical 🔴 | {critical_count} |
412
+ | Major 🟠 | {major_count} |
413
+ | Minor 🟡 | {minor_count} |
414
+ | Suggestion 🔵 | {suggestion_count} |
415
+ | **Total Fix Effort** | {sum_of_scores}/X |
416
+
417
+ > **Total Fix Effort**: Sum of all fix complexity scores. Use this to estimate the overall effort needed to address all findings.
418
+
419
+ ---
420
+
421
+ ## Findings
422
+
423
+ ### Finding 1: {Finding Name}
424
+
425
+ | Field | Value |
426
+ | -------------- | -------------------------------------------------- |
427
+ | File | `{file_path}` |
428
+ | Line | {line_number} |
429
+ | **Link** | **[View in PR]({direct_url_to_line})** ⬅️ REQUIRED |
430
+ | Severity | {Critical \| Major \| Minor \| Suggestion} |
431
+ | Fix Complexity | {X/10} - {Level} |
432
+ | Status | {Open \| Resolved} |
433
+ | Pattern | {Reference to pattern from rules, if applicable} |
434
+
435
+ > ⚠️ **Important**: The Link field is REQUIRED. Always include a clickable link to the exact line in the PR.
436
+ > 📊 **Fix Complexity**: Use the [`complexity-scoring` pattern](../core/complexity-scoring.md) to calculate the effort required to fix this finding.
437
+
438
+ **Description**:
439
+ {Detailed explanation of the issue found}
440
+
441
+ **PR Comment** (for manual use):
442
+
443
+ > {Short, polished message ready to copy/paste into the PR comment section}
444
+
445
+ **Suggested Fix**:
446
+ \`\`\`{language}
447
+ // Suggested code improvement
448
+ \`\`\`
449
+
450
+ ---
451
+
452
+ ### Finding 2: {Finding Name}
453
+
454
+ ... (repeat structure for each finding)
455
+
456
+ ---
457
+
458
+ ## Positive Highlights
459
+
460
+ List any particularly well-written code or good practices observed:
461
+
462
+ - {Highlight 1}
463
+ - {Highlight 2}
464
+
465
+ ---
466
+
467
+ ## Approval Recommendation
468
+
469
+ | Status | {Approve \| Request Changes \| Needs Discussion} |
470
+ | ------ | ------------------------------------------------ |
471
+ | Reason | {Brief explanation of the recommendation} |
472
+ ```
473
+
474
+ ---
475
+
476
+ ## Severity Levels
477
+
478
+ | Level | Icon | Description |
479
+ | ---------- | ---- | -------------------------------------------------------- |
480
+ | Critical | 🔴 | Security vulnerabilities, data loss risks, blocking bugs |
481
+ | Major | 🟠 | Significant issues affecting functionality or quality |
482
+ | Minor | 🟡 | Code style, minor improvements, non-critical concerns |
483
+ | Suggestion | 🔵 | Nice-to-have improvements, optional enhancements |
484
+
485
+ ---
486
+
487
+ ## Fix Complexity Scoring
488
+
489
+ Use the [`complexity-scoring` pattern](../core/complexity-scoring.md) to calculate the effort required to fix each finding. This helps prioritize which issues to address first.
490
+
491
+ ### Complexity Scale
492
+
493
+ | Score | Level | Description | Example Fix |
494
+ | ----- | --------- | -------------------------------- | ---------------------------------------------- |
495
+ | 0-2 | Trivial | Simple, quick fix | Adding a missing import, renaming a variable |
496
+ | 3-4 | Low | Straightforward fix | Adding error logging, fixing a type annotation |
497
+ | 5-6 | Medium | Moderate effort, some decisions | Refactoring a function, adding validation |
498
+ | 7-8 | High | Complex fix, multiple files | Restructuring state management, adding tests |
499
+ | 9-10 | Very High | Significant refactoring required | Architecture changes, multi-file refactoring |
500
+
501
+ ### Scoring Modifiers
502
+
503
+ Apply these modifiers to calculate the fix complexity:
504
+
505
+ | Modifier | Points |
506
+ | ------------------------------------- | ------ |
507
+ | Each file that needs to be modified | +1 |
508
+ | Requires adding new tests | +1 |
509
+ | Involves state management changes | +1 |
510
+ | Requires API/interface changes | +1 |
511
+ | Simple code addition (no refactoring) | -1 |
512
+ | Fix follows existing pattern exactly | -1 |
513
+
514
+ ### Example Calculations
515
+
516
+ | Finding | Calculation | Score |
517
+ | -------------------------------- | ------------------------------------- | ----- |
518
+ | Missing error logging | 1 file, simple addition = 2 - 1 | 1/10 |
519
+ | Type annotation fix | 1 file, follows pattern = 1 - 1 | 0/10 |
520
+ | Add input validation with Zod | 1 file + new schema = 2 + 1 | 3/10 |
521
+ | Refactor to view/logic split | 2 files + pattern + state = 2 + 1 + 1 | 4/10 |
522
+ | Fix silent error swallowing | 1 file + error handling = 1 + 2 | 3/10 |
523
+ | Add comprehensive error handling | Multiple files + tests = 3 + 1 + 2 | 6/10 |
524
+
525
+ ---
526
+
527
+ ## Link Format
528
+
529
+ Generate direct links to the specific line in the PR. The format depends on the platform:
530
+
531
+ ### GitHub
532
+
533
+ **For branch blob view (preferred)**:
534
+
535
+ ```
536
+ https://github.com/{owner}/{repo}/blob/{branch_name}/{file_path}#L{line_number}
537
+ ```
538
+
539
+ **For PR file view**:
540
+
541
+ ```
542
+ https://github.com/{owner}/{repo}/pull/{pr_number}/files#diff-{file_path_hash}R{line_number}
543
+ ```
544
+
545
+ ### Azure DevOps
546
+
547
+ **For PR file view with line (CORRECT FORMAT)**:
548
+
549
+ ```
550
+ https://dev.azure.com/{org}/{project}/_git/{repo}/pullrequest/{pr_id}?_a=files&path={file_path}&line={line_number}&lineEnd={line_number}&lineStartColumn=1&lineEndColumn=1000&lineStyle=plain
551
+ ```
552
+
553
+ > ⚠️ **Critical Parameters**:
554
+ >
555
+ > - `_a=files` - Required to navigate to the Files tab
556
+ > - `lineStyle=plain` - Ensures line highlighting works
557
+ > - `lineEndColumn=1000` - Use a large number to highlight the full line
558
+
559
+ **For branch file view (alternative)**:
560
+
561
+ ```
562
+ https://dev.azure.com/{org}/{project}/_git/{repo}?path={file_path}&version=GB{branch_name}&line={line_number}&lineEnd={line_number}&lineStartColumn=1&lineEndColumn=1000&lineStyle=plain&_a=contents
563
+ ```
564
+
565
+ ### Examples
566
+
567
+ | Platform | Type | URL Example |
568
+ | ------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
569
+ | GitHub | Blob View | `https://github.com/acme/webapp/blob/feature-auth/src/services/userService.ts#L45` |
570
+ | GitHub | PR Files | `https://github.com/acme/webapp/pull/123/files#diff-abc123R45` |
571
+ | Azure DevOps | PR Files | `https://dev.azure.com/org/project/_git/repo/pullrequest/123?_a=files&path=/src/api/route.ts&line=45&lineEnd=45&lineStartColumn=1&lineEndColumn=1000&lineStyle=plain` |
572
+ | Azure DevOps | Branch | `https://dev.azure.com/org/project/_git/repo?path=/src/api/route.ts&version=GBfeature-branch&line=45&lineEnd=45&_a=contents` |
573
+
574
+ > ⚠️ **REQUIRED**: Every finding MUST include a clickable link. This allows reviewers to quickly navigate to the exact location of the issue.
575
+
576
+ ---
577
+
578
+ ## Example Finding
579
+
580
+ ### Finding 1: Silent Error Swallowing
581
+
582
+ | Field | Value |
583
+ | -------------- | ------------------------------------------------------------------------------------------------- |
584
+ | File | `src/services/userService.ts` |
585
+ | Line | 45 |
586
+ | **Link** | **[View in PR](https://github.com/org/repo/blob/feature-branch/src/services/userService.ts#L45)** |
587
+ | Severity | Major 🟠 |
588
+ | Fix Complexity | 3/10 - Low |
589
+ | Status | Open |
590
+ | Pattern | `forbidden-patterns.md` - DON'T Swallow Errors |
591
+
592
+ > **Azure DevOps example link**: `[View in PR](https://dev.azure.com/org/project/_git/repo/pullrequest/123?_a=files&path=/src/services/userService.ts&line=45&lineEnd=45&lineStartColumn=1&lineEndColumn=1000&lineStyle=plain)`
593
+
594
+ **Description**:
595
+ The catch block on line 45 catches an error but does not log it or provide user feedback. This makes debugging production issues extremely difficult and leaves users unaware that their action failed.
596
+
597
+ **PR Comment** (for manual use):
598
+
599
+ > This error is being caught but not logged or handled. Consider adding proper error logging and user feedback. See our team guidelines in `forbidden-patterns.md` for error handling best practices.
600
+
601
+ **Suggested Fix**:
602
+
603
+ ```typescript
604
+ try {
605
+ await saveUserData(userData);
606
+ } catch (error) {
607
+ logger.error("Failed to save user data", { error, userId: userData.id });
608
+ throw new UserFacingError("Unable to save your changes. Please try again.");
609
+ }
610
+ ```
611
+
612
+ ---
613
+
614
+ ## Quick Reference Commands
615
+
616
+ ```bash
617
+ # Review a GitHub PR
618
+ review-pr https://github.com/org/repo/pull/123
619
+
620
+ # Review with explicit language
621
+ review-pr https://github.com/org/repo/pull/123 --language typescript
622
+ ```
623
+
624
+ ---
625
+
626
+ ## Related Files
627
+
628
+ | File | Purpose |
629
+ | ------------------------------------------ | ------------------------------------ |
630
+ | `.claude/rules/patterns/review-pr-patterns.md` | Main review checklist and guidelines |
631
+ | `.claude/rules/core/forbidden-patterns.md` | Anti-patterns to flag |
632
+ | `.claude/rules/core/allowed-patterns.md` | Best practices to encourage |
633
+ | `.claude/rules/languages/typescript-patterns.md` | TypeScript-specific checks |
634
+ | `.claude/rules/languages/python-patterns.md` | Python-specific checks |
635
+ | `.claude/rules/core/complexity-scoring.md` | Fix complexity scoring system |
636
+ | `tools/auth-pr-tool.md` | PR authentication tool |
637
+ | `flow/reviewed-pr/` | Output folder for review documents |
638
+ | `.plan.flow.env` | Authentication tokens (gitignored) |
639
+ | `.example.plan.flow.env` | Example env file template |
640
+
641
+ ---
642
+
643
+ ## Authentication
644
+
645
+ Authentication is handled by the **[PR Authentication Tool](../tools/auth-pr-tool.md)**. See that tool for:
646
+
647
+ - Credential configuration
648
+ - Platform detection
649
+ - Authentication methods
650
+ - Error handling
651
+ - Security notes