@fro.bot/systematic 1.21.3 → 1.22.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.
@@ -0,0 +1,525 @@
1
+ ---
2
+ name: ce:review
3
+ description: Perform exhaustive code reviews using multi-agent analysis, ultra-thinking, and worktrees
4
+ argument-hint: "[PR number, GitHub URL, branch name, or latest]"
5
+ ---
6
+
7
+ # Review Command
8
+
9
+ <command_purpose> Perform exhaustive code reviews using multi-agent analysis, ultra-thinking, and Git worktrees for deep local inspection. </command_purpose>
10
+
11
+ ## Introduction
12
+
13
+ <role>Senior Code Review Architect with expertise in security, performance, architecture, and quality assurance</role>
14
+
15
+ ## Prerequisites
16
+
17
+ <requirements>
18
+ - Git repository with GitHub CLI (`gh`) installed and authenticated
19
+ - Clean main/master branch
20
+ - Proper permissions to create worktrees and access the repository
21
+ - For document reviews: Path to a markdown file or document
22
+ </requirements>
23
+
24
+ ## Main Tasks
25
+
26
+ ### 1. Determine Review Target & Setup (ALWAYS FIRST)
27
+
28
+ <review_target> #$ARGUMENTS </review_target>
29
+
30
+ <thinking>
31
+ First, I need to determine the review target type and set up the code for analysis.
32
+ </thinking>
33
+
34
+ #### Immediate Actions:
35
+
36
+ <task_list>
37
+
38
+ - [ ] Determine review type: PR number (numeric), GitHub URL, file path (.md), or empty (current branch)
39
+ - [ ] Check current git branch
40
+ - [ ] If ALREADY on the target branch (PR branch, requested branch name, or the branch already checked out for review) → proceed with analysis on current branch
41
+ - [ ] If DIFFERENT branch than the review target → offer to use worktree: "Use git-worktree skill for isolated Call `skill: git-worktree` with branch name"
42
+ - [ ] Fetch PR metadata using `gh pr view --json` for title, body, files, linked issues
43
+ - [ ] Set up language-specific analysis tools
44
+ - [ ] Prepare security scanning environment
45
+ - [ ] Make sure we are on the branch we are reviewing. Use gh pr checkout to switch to the branch or manually checkout the branch.
46
+
47
+ Ensure that the code is ready for analysis (either in worktree or on current branch). ONLY then proceed to the next step.
48
+
49
+ </task_list>
50
+
51
+ #### Protected Artifacts
52
+
53
+ <protected_artifacts>
54
+ The following paths are systematic pipeline artifacts and must never be flagged for deletion, removal, or gitignore by any review agent:
55
+
56
+ - `docs/plans/*.md` — Plan files created by `/ce:plan`. These are living documents that track implementation progress (checkboxes are checked off by `/ce:work`).
57
+ - `docs/solutions/*.md` — Solution documents created during the pipeline.
58
+
59
+ If a review agent flags any file in these directories for cleanup or removal, discard that finding during synthesis. Do not create a todo for it.
60
+ </protected_artifacts>
61
+
62
+ #### Load Review Agents
63
+
64
+ Read `systematic.local.md` in the project root. If found, use `review_agents` from YAML frontmatter. If the markdown body contains review context, pass it to each agent as additional instructions.
65
+
66
+ If no settings file exists, invoke the `setup` skill to create one. Then read the newly created file and continue.
67
+
68
+ #### Parallel Agents to review the PR:
69
+
70
+ <parallel_tasks>
71
+
72
+ Run all configured review agents in parallel using task tool. For each agent in the `review_agents` list:
73
+
74
+ ```
75
+ task {agent-name}(PR content + review context from settings body)
76
+ ```
77
+
78
+ Additionally, always run these regardless of settings:
79
+ - task agent-native-reviewer(PR content) - Verify new features are agent-accessible
80
+ - task learnings-researcher(PR content) - Search docs/solutions/ for past issues related to this PR's modules and patterns
81
+
82
+ </parallel_tasks>
83
+
84
+ #### Conditional Agents (Run if applicable):
85
+
86
+ <conditional_agents>
87
+
88
+ These agents are run ONLY when the PR matches specific criteria. Check the PR files list to determine if they apply:
89
+
90
+ **MIGRATIONS: If PR contains database migrations, schema.rb, or data backfills:**
91
+
92
+ - task schema-drift-detector(PR content) - Detects unrelated schema.rb changes by cross-referencing against included migrations (run FIRST)
93
+ - task data-migration-expert(PR content) - Validates ID mappings match production, checks for swapped values, verifies rollback safety
94
+ - task deployment-verification-agent(PR content) - Creates Go/No-Go deployment checklist with SQL verification queries
95
+
96
+ **When to run:**
97
+ - PR includes files matching `db/migrate/*.rb` or `db/schema.rb`
98
+ - PR modifies columns that store IDs, enums, or mappings
99
+ - PR includes data backfill scripts or rake tasks
100
+ - PR title/body mentions: migration, backfill, data transformation, ID mapping
101
+
102
+ **What these agents check:**
103
+ - `schema-drift-detector`: Cross-references schema.rb changes against PR migrations to catch unrelated columns/indexes from local database state
104
+ - `data-migration-expert`: Verifies hard-coded mappings match production reality (prevents swapped IDs), checks for orphaned associations, validates dual-write patterns
105
+ - `deployment-verification-agent`: Produces executable pre/post-deploy checklists with SQL queries, rollback procedures, and monitoring plans
106
+
107
+ </conditional_agents>
108
+
109
+ ### 2. Ultra-Thinking Deep Dive Phases
110
+
111
+ <ultrathink_instruction> For each phase below, spend maximum cognitive effort. Think step by step. Consider all angles. Question assumptions. And bring all reviews in a synthesis to the user.</ultrathink_instruction>
112
+
113
+ <deliverable>
114
+ Complete system context map with component interactions
115
+ </deliverable>
116
+
117
+ #### Phase 1: Stakeholder Perspective Analysis
118
+
119
+ <thinking_prompt> ULTRA-THINK: Put yourself in each stakeholder's shoes. What matters to them? What are their pain points? </thinking_prompt>
120
+
121
+ <stakeholder_perspectives>
122
+
123
+ 1. **Developer Perspective** <questions>
124
+
125
+ - How easy is this to understand and modify?
126
+ - Are the APIs intuitive?
127
+ - Is debugging straightforward?
128
+ - Can I test this easily? </questions>
129
+
130
+ 2. **Operations Perspective** <questions>
131
+
132
+ - How do I deploy this safely?
133
+ - What metrics and logs are available?
134
+ - How do I troubleshoot issues?
135
+ - What are the resource requirements? </questions>
136
+
137
+ 3. **End User Perspective** <questions>
138
+
139
+ - Is the feature intuitive?
140
+ - Are error messages helpful?
141
+ - Is performance acceptable?
142
+ - Does it solve my problem? </questions>
143
+
144
+ 4. **Security Team Perspective** <questions>
145
+
146
+ - What's the attack surface?
147
+ - Are there compliance requirements?
148
+ - How is data protected?
149
+ - What are the audit capabilities? </questions>
150
+
151
+ 5. **Business Perspective** <questions>
152
+ - What's the ROI?
153
+ - Are there legal/compliance risks?
154
+ - How does this affect time-to-market?
155
+ - What's the total cost of ownership? </questions> </stakeholder_perspectives>
156
+
157
+ #### Phase 2: Scenario Exploration
158
+
159
+ <thinking_prompt> ULTRA-THINK: Explore edge cases and failure scenarios. What could go wrong? How does the system behave under stress? </thinking_prompt>
160
+
161
+ <scenario_checklist>
162
+
163
+ - [ ] **Happy Path**: Normal operation with valid inputs
164
+ - [ ] **Invalid Inputs**: Null, empty, malformed data
165
+ - [ ] **Boundary Conditions**: Min/max values, empty collections
166
+ - [ ] **Concurrent Access**: Race conditions, deadlocks
167
+ - [ ] **Scale Testing**: 10x, 100x, 1000x normal load
168
+ - [ ] **Network Issues**: Timeouts, partial failures
169
+ - [ ] **Resource Exhaustion**: Memory, disk, connections
170
+ - [ ] **Security Attacks**: Injection, overflow, DoS
171
+ - [ ] **Data Corruption**: Partial writes, inconsistency
172
+ - [ ] **Cascading Failures**: Downstream service issues </scenario_checklist>
173
+
174
+ ### 3. Multi-Angle Review Perspectives
175
+
176
+ #### Technical Excellence Angle
177
+
178
+ - Code craftsmanship evaluation
179
+ - Engineering best practices
180
+ - Technical documentation quality
181
+ - Tooling and automation assessment
182
+
183
+ #### Business Value Angle
184
+
185
+ - Feature completeness validation
186
+ - Performance impact on users
187
+ - Cost-benefit analysis
188
+ - Time-to-market considerations
189
+
190
+ #### Risk Management Angle
191
+
192
+ - Security risk assessment
193
+ - Operational risk evaluation
194
+ - Compliance risk verification
195
+ - Technical debt accumulation
196
+
197
+ #### Team Dynamics Angle
198
+
199
+ - Code review etiquette
200
+ - Knowledge sharing effectiveness
201
+ - Collaboration patterns
202
+ - Mentoring opportunities
203
+
204
+ ### 4. Simplification and Minimalism Review
205
+
206
+ Run the task code-simplicity-reviewer() to see if we can simplify the code.
207
+
208
+ ### 5. Findings Synthesis and Todo Creation Using file-todos Skill
209
+
210
+ <critical_requirement> ALL findings MUST be stored in the todos/ directory using the file-todos skill. Create todo files immediately after synthesis - do NOT present findings for user approval first. Use the skill for structured todo management. </critical_requirement>
211
+
212
+ #### Step 1: Synthesize All Findings
213
+
214
+ <thinking>
215
+ Consolidate all agent reports into a categorized list of findings.
216
+ Remove duplicates, prioritize by severity and impact.
217
+ </thinking>
218
+
219
+ <synthesis_tasks>
220
+
221
+ - [ ] Collect findings from all parallel agents
222
+ - [ ] Surface learnings-researcher results: if past solutions are relevant, flag them as "Known Pattern" with links to docs/solutions/ files
223
+ - [ ] Discard any findings that recommend deleting or gitignoring files in `docs/plans/` or `docs/solutions/` (see Protected Artifacts above)
224
+ - [ ] Categorize by type: security, performance, architecture, quality, etc.
225
+ - [ ] Assign severity levels: 🔴 CRITICAL (P1), 🟡 IMPORTANT (P2), 🔵 NICE-TO-HAVE (P3)
226
+ - [ ] Remove duplicate or overlapping findings
227
+ - [ ] Estimate effort for each finding (Small/Medium/Large)
228
+
229
+ </synthesis_tasks>
230
+
231
+ #### Step 2: Create Todo Files Using file-todos Skill
232
+
233
+ <critical_instruction> Use the file-todos skill to create todo files for ALL findings immediately. Do NOT present findings one-by-one asking for user approval. Create all todo files in parallel using the skill, then summarize results to user. </critical_instruction>
234
+
235
+ **Implementation Options:**
236
+
237
+ **Option A: Direct File Creation (Fast)**
238
+
239
+ - Create todo files directly using write tool
240
+ - All findings in parallel for speed
241
+ - Use standard template from `.opencode/skills/file-todos/assets/todo-template.md`
242
+ - Follow naming convention: `{issue_id}-pending-{priority}-{description}.md`
243
+
244
+ **Option B: Sub-Agents in Parallel (Recommended for Scale)** For large PRs with 15+ findings, use sub-agents to create finding files in parallel:
245
+
246
+ ```bash
247
+ # Launch multiple finding-creator agents in parallel
248
+ task() - Create todos for first finding
249
+ task() - Create todos for second finding
250
+ task() - Create todos for third finding
251
+ etc. for each finding.
252
+ ```
253
+
254
+ Sub-agents can:
255
+
256
+ - Process multiple findings simultaneously
257
+ - Write detailed todo files with all sections filled
258
+ - Organize findings by severity
259
+ - Create comprehensive Proposed Solutions
260
+ - Add acceptance criteria and work logs
261
+ - Complete much faster than sequential processing
262
+
263
+ **Execution Strategy:**
264
+
265
+ 1. Synthesize all findings into categories (P1/P2/P3)
266
+ 2. Group findings by severity
267
+ 3. Launch 3 parallel sub-agents (one per severity level)
268
+ 4. Each sub-agent creates its batch of todos using the file-todos skill
269
+ 5. Consolidate results and present summary
270
+
271
+ **Process (Using file-todos Skill):**
272
+
273
+ 1. For each finding:
274
+
275
+ - Determine severity (P1/P2/P3)
276
+ - Write detailed Problem Statement and Findings
277
+ - Create 2-3 Proposed Solutions with pros/cons/effort/risk
278
+ - Estimate effort (Small/Medium/Large)
279
+ - Add acceptance criteria and work log
280
+
281
+ 2. Use file-todos skill for structured todo management:
282
+
283
+ ```bash
284
+ skill: file-todos
285
+ ```
286
+
287
+ The skill provides:
288
+
289
+ - Template location: `.opencode/skills/file-todos/assets/todo-template.md`
290
+ - Naming convention: `{issue_id}-{status}-{priority}-{description}.md`
291
+ - YAML frontmatter structure: status, priority, issue_id, tags, dependencies
292
+ - All required sections: Problem Statement, Findings, Solutions, etc.
293
+
294
+ 3. Create todo files in parallel:
295
+
296
+ ```bash
297
+ {next_id}-pending-{priority}-{description}.md
298
+ ```
299
+
300
+ 4. Examples:
301
+
302
+ ```
303
+ 001-pending-p1-path-traversal-vulnerability.md
304
+ 002-pending-p1-api-response-validation.md
305
+ 003-pending-p2-concurrency-limit.md
306
+ 004-pending-p3-unused-parameter.md
307
+ ```
308
+
309
+ 5. Follow template structure from file-todos skill: `.opencode/skills/file-todos/assets/todo-template.md`
310
+
311
+ **Todo File Structure (from template):**
312
+
313
+ Each todo must include:
314
+
315
+ - **YAML frontmatter**: status, priority, issue_id, tags, dependencies
316
+ - **Problem Statement**: What's broken/missing, why it matters
317
+ - **Findings**: Discoveries from agents with evidence/location
318
+ - **Proposed Solutions**: 2-3 options, each with pros/cons/effort/risk
319
+ - **Recommended Action**: (Filled during triage, leave blank initially)
320
+ - **Technical Details**: Affected files, components, database changes
321
+ - **Acceptance Criteria**: Testable checklist items
322
+ - **Work Log**: Dated record with actions and learnings
323
+ - **Resources**: Links to PR, issues, documentation, similar patterns
324
+
325
+ **File naming convention:**
326
+
327
+ ```
328
+ {issue_id}-{status}-{priority}-{description}.md
329
+
330
+ Examples:
331
+ - 001-pending-p1-security-vulnerability.md
332
+ - 002-pending-p2-performance-optimization.md
333
+ - 003-pending-p3-code-cleanup.md
334
+ ```
335
+
336
+ **Status values:**
337
+
338
+ - `pending` - New findings, needs triage/decision
339
+ - `ready` - Approved by manager, ready to work
340
+ - `complete` - Work finished
341
+
342
+ **Priority values:**
343
+
344
+ - `p1` - Critical (blocks merge, security/data issues)
345
+ - `p2` - Important (should fix, architectural/performance)
346
+ - `p3` - Nice-to-have (enhancements, cleanup)
347
+
348
+ **Tagging:** Always add `code-review` tag, plus: `security`, `performance`, `architecture`, `rails`, `quality`, etc.
349
+
350
+ #### Step 3: Summary Report
351
+
352
+ After creating all todo files, present comprehensive summary:
353
+
354
+ ````markdown
355
+ ## ✅ Code Review Complete
356
+
357
+ **Review Target:** PR #XXXX - [PR Title] **Branch:** [branch-name]
358
+
359
+ ### Findings Summary:
360
+
361
+ - **Total Findings:** [X]
362
+ - **🔴 CRITICAL (P1):** [count] - BLOCKS MERGE
363
+ - **🟡 IMPORTANT (P2):** [count] - Should Fix
364
+ - **🔵 NICE-TO-HAVE (P3):** [count] - Enhancements
365
+
366
+ ### Created Todo Files:
367
+
368
+ **P1 - Critical (BLOCKS MERGE):**
369
+
370
+ - `001-pending-p1-{finding}.md` - {description}
371
+ - `002-pending-p1-{finding}.md` - {description}
372
+
373
+ **P2 - Important:**
374
+
375
+ - `003-pending-p2-{finding}.md` - {description}
376
+ - `004-pending-p2-{finding}.md` - {description}
377
+
378
+ **P3 - Nice-to-Have:**
379
+
380
+ - `005-pending-p3-{finding}.md` - {description}
381
+
382
+ ### Review Agents Used:
383
+
384
+ - kieran-rails-reviewer
385
+ - security-sentinel
386
+ - performance-oracle
387
+ - architecture-strategist
388
+ - agent-native-reviewer
389
+ - [other agents]
390
+
391
+ ### Next Steps:
392
+
393
+ 1. **Address P1 Findings**: CRITICAL - must be fixed before merge
394
+
395
+ - Review each P1 todo in detail
396
+ - Implement fixes or request exemption
397
+ - Verify fixes before merging PR
398
+
399
+ 2. **Triage All Todos**:
400
+ ```bash
401
+ ls todos/*-pending-*.md # View all pending todos
402
+ /triage # Use slash command for interactive triage
403
+ ```
404
+
405
+ 3. **Work on Approved Todos**:
406
+
407
+ ```bash
408
+ /resolve_todo_parallel # Fix all approved items efficiently
409
+ ```
410
+
411
+ 4. **Track Progress**:
412
+ - Rename file when status changes: pending → ready → complete
413
+ - Update Work Log as you work
414
+ - Commit todos: `git add todos/ && git commit -m "refactor: add code review findings"`
415
+
416
+ ### Severity Breakdown:
417
+
418
+ **🔴 P1 (Critical - Blocks Merge):**
419
+
420
+ - Security vulnerabilities
421
+ - Data corruption risks
422
+ - Breaking changes
423
+ - Critical architectural issues
424
+
425
+ **🟡 P2 (Important - Should Fix):**
426
+
427
+ - Performance issues
428
+ - Significant architectural concerns
429
+ - Major code quality problems
430
+ - Reliability issues
431
+
432
+ **🔵 P3 (Nice-to-Have):**
433
+
434
+ - Minor improvements
435
+ - Code cleanup
436
+ - Optimization opportunities
437
+ - Documentation updates
438
+ ````
439
+
440
+ ### 6. End-to-End Testing (Optional)
441
+
442
+ <detect_project_type>
443
+
444
+ **First, detect the project type from PR files:**
445
+
446
+ | Indicator | Project Type |
447
+ |-----------|--------------|
448
+ | `*.xcodeproj`, `*.xcworkspace`, `Package.swift` (iOS) | iOS/macOS |
449
+ | `Gemfile`, `package.json`, `app/views/*`, `*.html.*` | Web |
450
+ | Both iOS files AND web files | Hybrid (test both) |
451
+
452
+ </detect_project_type>
453
+
454
+ <offer_testing>
455
+
456
+ After presenting the Summary Report, offer appropriate testing based on project type:
457
+
458
+ **For Web Projects:**
459
+ ```markdown
460
+ **"Want to run browser tests on the affected pages?"**
461
+ 1. Yes - run `/test-browser`
462
+ 2. No - skip
463
+ ```
464
+
465
+ **For iOS Projects:**
466
+ ```markdown
467
+ **"Want to run Xcode simulator tests on the app?"**
468
+ 1. Yes - run `/xcode-test`
469
+ 2. No - skip
470
+ ```
471
+
472
+ **For Hybrid Projects (e.g., Rails + Hotwire Native):**
473
+ ```markdown
474
+ **"Want to run end-to-end tests?"**
475
+ 1. Web only - run `/test-browser`
476
+ 2. iOS only - run `/xcode-test`
477
+ 3. Both - run both commands
478
+ 4. No - skip
479
+ ```
480
+
481
+ </offer_testing>
482
+
483
+ #### If User Accepts Web Testing:
484
+
485
+ Spawn a subagent to run browser tests (preserves main context):
486
+
487
+ ```
488
+ task general-purpose("Run /test-browser for PR #[number]. Test all affected pages, check for console errors, handle failures by creating todos and fixing.")
489
+ ```
490
+
491
+ The subagent will:
492
+ 1. Identify pages affected by the PR
493
+ 2. Navigate to each page and capture snapshots (using Playwright MCP or agent-browser CLI)
494
+ 3. Check for console errors
495
+ 4. Test critical interactions
496
+ 5. Pause for human verification on OAuth/email/payment flows
497
+ 6. Create P1 todos for any failures
498
+ 7. Fix and retry until all tests pass
499
+
500
+ **Standalone:** `/test-browser [PR number]`
501
+
502
+ #### If User Accepts iOS Testing:
503
+
504
+ Spawn a subagent to run Xcode tests (preserves main context):
505
+
506
+ ```
507
+ task general-purpose("Run /xcode-test for scheme [name]. Build for simulator, install, launch, take screenshots, check for crashes.")
508
+ ```
509
+
510
+ The subagent will:
511
+ 1. Verify XcodeBuildMCP is installed
512
+ 2. Discover project and schemes
513
+ 3. Build for iOS Simulator
514
+ 4. Install and launch app
515
+ 5. Take screenshots of key screens
516
+ 6. Capture console logs for errors
517
+ 7. Pause for human verification (Sign in with Apple, push, IAP)
518
+ 8. Create P1 todos for any failures
519
+ 9. Fix and retry until all tests pass
520
+
521
+ **Standalone:** `/xcode-test [scheme]`
522
+
523
+ ### Important: P1 Findings Block Merge
524
+
525
+ Any **🔴 P1 (CRITICAL)** findings must be addressed before merging the PR. Present these prominently and ensure they're resolved before accepting the PR.