@windagency/valora-plugin-engineering 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.
@@ -0,0 +1,681 @@
1
+ ---
2
+ name: review-code
3
+ description: Perform comprehensive code quality review including standards, security, maintainability, and best practices validation
4
+ experimental: true
5
+ argument-hint: '<scope> [--severity=critical|high|medium|low] [--focus=security|performance|maintainability|all] [--checklist] [--auto-only]'
6
+ allowed-tools:
7
+ - codebase_search
8
+ - read_file
9
+ - grep
10
+ - list_dir
11
+ - glob_file_search
12
+ - run_terminal_cmd # Required for modern CLI tools (jq, yq, rg, fd)
13
+ - read_lints
14
+ # MCP: GitHub for PR review context
15
+ - mcp_github
16
+ # MCP: AI-powered code analysis
17
+ - mcp_serena
18
+ model: claude-opus-4.6
19
+ agent: lead
20
+ prompts:
21
+ pipeline:
22
+ - stage: context
23
+ prompt: context.analyze-changes-for-review
24
+ required: true
25
+ inputs:
26
+ scope: $ARG_1
27
+ severity: $ARG_severity
28
+ focus: $ARG_focus
29
+ outputs:
30
+ - changed_files
31
+ - change_scope
32
+ - review_focus_areas
33
+ - risk_level
34
+ - stage: review
35
+ prompt: review.assess-code-quality
36
+ required: true
37
+ inputs:
38
+ scope: $ARG_1
39
+ severity: $ARG_severity
40
+ focus: $ARG_focus
41
+ changed_files: $STAGE_context.changed_files
42
+ change_scope: $STAGE_context.change_scope
43
+ review_focus_areas: $STAGE_context.review_focus_areas
44
+ risk_level: $STAGE_context.risk_level
45
+ outputs:
46
+ - quality_score
47
+ - issues_found
48
+ - security_concerns
49
+ - blocking_issues
50
+ - review_decision
51
+ - validation_results
52
+ - stage: documentation
53
+ prompt: documentation.generate-code-review-report
54
+ batch: true
55
+ required: true
56
+ inputs:
57
+ quality_score: $STAGE_review.quality_score
58
+ issues_found: $STAGE_review.issues_found
59
+ review_decision: $STAGE_review.review_decision
60
+ blocking_issues: $STAGE_review.blocking_issues
61
+ validation_results: $STAGE_review.validation_results
62
+ changed_files: $STAGE_context.changed_files
63
+ outputs:
64
+ - review_report
65
+ - recommendations
66
+ - next_steps
67
+ merge_strategy: sequential
68
+ cache_strategy: none
69
+ retry_policy:
70
+ max_attempts: 1
71
+ backoff_ms: 0
72
+ retry_on: []
73
+ ---
74
+
75
+ # Code Review Command
76
+
77
+ ## Role
78
+
79
+ You are the **@lead** engineer conducting a comprehensive code quality review to ensure implementation meets production standards.
80
+
81
+ ## Goal
82
+
83
+ Conduct thorough code quality review to ensure code adheres to:
84
+
85
+ - **Security** best practices and vulnerability prevention
86
+ - **Architecture** patterns and design principles
87
+ - **Performance** optimization and scalability
88
+ - **Maintainability** standards and code health
89
+ - **Standards** compliance (linting, formatting, conventions)
90
+ - **Type Safety** and contract correctness
91
+
92
+ Provide actionable feedback with prioritized recommendations.
93
+
94
+ ## Context
95
+
96
+ ```plaintext
97
+ $ARGUMENTS
98
+ ```
99
+
100
+ **Argument Mapping**:
101
+
102
+ - `$ARG_1`: Review scope (file path, directory, git diff, or empty for current changes)
103
+ - `$ARG_severity`: Minimum severity level (critical|high|medium|low), defaults to "low" (show all)
104
+ - `$ARG_focus`: Focus area (security|performance|maintainability|all), defaults to "all"
105
+ - `$ARG_checklist`: Use REVIEW_CODE_CHECKLIST.md for quick binary validation (~3 min)
106
+ - `$ARG_auto_only`: Run automated checks only (tsc, lint, test) without manual review (~1 min)
107
+
108
+ ## Process
109
+
110
+ This command executes a **three-stage pipeline** that orchestrates specialized prompts:
111
+
112
+ ### Stage 1: Context Analysis
113
+
114
+ **Prompt**: `context.analyze-changes-for-review`
115
+
116
+ **Purpose**: Identify what changed and determine review focus
117
+
118
+ **Inputs**:
119
+
120
+ - `scope`: Review scope from $ARG_1 (file/directory/git diff)
121
+ - `severity`: Minimum severity filter from $ARG_severity
122
+ - `focus`: Focus area from $ARG_focus
123
+
124
+ **Outputs**:
125
+
126
+ - `changed_files`: List of files with change types and criticality
127
+ - `change_scope`: Categorization by functional area
128
+ - `review_focus_areas`: Prioritized areas for review
129
+ - `risk_level`: Calculated risk (low/medium/high/critical)
130
+
131
+ **Details**: See [`02_context/analyze-changes-for-review.md`](../prompts/02_context/analyze-changes-for-review.md)
132
+
133
+ ---
134
+
135
+ ### Stage 2: Quality Assessment
136
+
137
+ **Prompt**: `review.assess-code-quality`
138
+
139
+ **Purpose**: Orchestrate comprehensive quality validations
140
+
141
+ **This stage internally coordinates 6 specialized validation prompts**:
142
+
143
+ 1. **`review.validate-security`** - Security vulnerabilities, OWASP compliance
144
+ 2. **`review.validate-architecture`** - Design patterns, layer boundaries
145
+ 3. **`review.validate-performance`** - Bottlenecks, efficiency, optimization
146
+ 4. **`review.validate-maintainability`** - Complexity, code smells, technical debt
147
+ 5. **`review.validate-standards-compliance`** - Linting, formatting, conventions
148
+ 6. **`review.validate-type-safety`** - Type correctness, contract compliance
149
+
150
+ **Note**: These validation prompts are **NOT** separate pipeline stages. They are invoked internally by `assess-code-quality` which orchestrates their execution based on the focus area and aggregates their results.
151
+
152
+ **Execution**: Validations run in parallel within the prompt based on focus area
153
+
154
+ **Inputs**:
155
+
156
+ - `scope`: Review scope from $ARG_1
157
+ - `severity`: Minimum severity filter from $ARG_severity
158
+ - `focus`: Focus area from $ARG_focus
159
+ - `changed_files`: Files changed from context stage
160
+ - `change_scope`: Categorization from context stage
161
+ - `review_focus_areas`: Prioritized focus areas from context stage
162
+ - `risk_level`: Calculated risk level from context stage
163
+
164
+ **Outputs**:
165
+
166
+ - `quality_score`: Objective score (0-100)
167
+ - `issues_found`: Aggregated issues from all validations
168
+ - `security_concerns`: Critical security vulnerabilities
169
+ - `blocking_issues`: Issues preventing merge
170
+ - `review_decision`: APPROVE | REQUEST_CHANGES | BLOCK
171
+ - `validation_results`: Per-validation status
172
+
173
+ **Details**: See [`05_review/assess-code-quality.md`](../prompts/05_review/assess-code-quality.md)
174
+
175
+ ---
176
+
177
+ ### Stage 3: Report Generation
178
+
179
+ **Prompt**: `documentation.generate-code-review-report`
180
+
181
+ **Purpose**: Synthesize results into actionable review report
182
+
183
+ **Inputs**:
184
+
185
+ - `quality_score`: Overall quality score from review stage
186
+ - `issues_found`: Aggregated issues from review stage
187
+ - `review_decision`: Decision (APPROVE/REQUEST_CHANGES/BLOCK) from review stage
188
+ - `blocking_issues`: Critical blocking issues from review stage
189
+ - `validation_results`: Per-validation status from review stage
190
+ - `changed_files`: Files list from context stage (for report context)
191
+
192
+ **Outputs**:
193
+
194
+ - `review_report`: Complete markdown report
195
+ - `recommendations`: Prioritized action items
196
+ - `next_steps`: Clear path forward
197
+
198
+ **Details**: See [`07_documentation/generate-code-review-report.md`](../prompts/07_documentation/generate-code-review-report.md)
199
+
200
+ ---
201
+
202
+ ## Command Responsibilities
203
+
204
+ **The command itself**:
205
+
206
+ - ✅ Execute pipeline stages sequentially
207
+ - ✅ Pass data between stages via outputs/inputs
208
+ - ✅ Handle errors and retries per policy
209
+ - ✅ Save final report to `.valora/.history/review-code/`
210
+
211
+ **The command does NOT**:
212
+
213
+ - ❌ Contain detailed review logic (delegated to prompts)
214
+ - ❌ Implement validation algorithms (in specialized prompts)
215
+ - ❌ Generate report structure (in documentation prompt)
216
+
217
+ ## Review Criteria
218
+
219
+ ### Severity Levels
220
+
221
+ - **CRITICAL**: Security vulnerabilities, data loss risks, breaking changes
222
+ - **HIGH**: Major bugs, performance issues, architectural violations
223
+ - **MEDIUM**: Code smells, maintainability concerns, minor bugs
224
+ - **LOW**: Style inconsistencies, documentation gaps, optimizations
225
+
226
+ ### Blocking Issues
227
+
228
+ Issues that **MUST** be fixed before merge:
229
+
230
+ - Critical/high security vulnerabilities (CVSS ≥ 7.0)
231
+ - Type errors in strict mode
232
+ - Major architectural violations
233
+ - Breaking changes without migration
234
+ - N+1 query problems
235
+ - Memory leaks in production code
236
+
237
+ ### Quality Thresholds
238
+
239
+ - **Score ≥ 70**: Acceptable quality
240
+ - **Score < 70**: Needs improvement
241
+ - **No critical issues**: Required for approval
242
+ - **No blocking issues**: Required for merge
243
+
244
+ ## Success Criteria
245
+
246
+ - ✅ All stages completed successfully
247
+ - ✅ Comprehensive review across all dimensions
248
+ - ✅ Blocking issues clearly identified
249
+ - ✅ Quality score calculated objectively
250
+ - ✅ Actionable recommendations provided
251
+ - ✅ Clear APPROVE/REQUEST_CHANGES/BLOCK decision
252
+ - ✅ Report saved for reference
253
+
254
+ ## Integration Points
255
+
256
+ **Before this command**:
257
+
258
+ - `/test` must have passed successfully
259
+ - All tests must be green
260
+ - Coverage thresholds must be met
261
+
262
+ **After this command**:
263
+
264
+ - **If APPROVED**: Proceed to `/review-functional`
265
+ - **If REQUEST_CHANGES**: Return to `/implement`
266
+ - **If BLOCKED**: Address critical issues and re-review
267
+
268
+ **Recommended Next Step**:
269
+
270
+ - APPROVED → `/review-functional` to validate feature completeness
271
+ - CHANGES REQUESTED → `/implement` to address issues
272
+ - BLOCKED → Escalate architectural/security concerns
273
+
274
+ ## Usage Examples
275
+
276
+ ### Basic Usage
277
+
278
+ ```bash
279
+ # Review current uncommitted changes (staged + unstaged)
280
+ valora review-code
281
+
282
+ # Review specific file
283
+ valora review-code src/api/auth.ts
284
+
285
+ # Review entire directory
286
+ valora review-code src/backend/
287
+
288
+ # Review multiple files
289
+ valora review-code src/api/auth.ts src/services/user.service.ts
290
+ ```
291
+
292
+ ### With Focus Areas
293
+
294
+ ```bash
295
+ # Focus on security vulnerabilities only
296
+ valora review-code src/ --focus=security
297
+
298
+ # Focus on performance issues
299
+ valora review-code src/services/ --focus=performance
300
+
301
+ # Focus on maintainability and code quality
302
+ valora review-code --focus=maintainability
303
+
304
+ # Focus on architectural concerns only (after pre-check passes)
305
+ valora review-code --focus=architecture
306
+
307
+ # All focus areas (default)
308
+ valora review-code src/ --focus=all
309
+ ```
310
+
311
+ ### Architecture-Focused Review (After Pre-Check)
312
+
313
+ When automated pre-checks pass, use `--focus=architecture` for faster manual review:
314
+
315
+ ```bash
316
+ # Run automated pre-checks first (~1.5 min)
317
+ valora pre-check
318
+
319
+ # Then focus on architecture only (~5 min instead of ~10 min)
320
+ valora review-code --focus=architecture
321
+ ```
322
+
323
+ **Architecture Focus Areas**:
324
+
325
+ - Design patterns (SOLID, DRY, KISS)
326
+ - Layer boundaries (no cross-layer dependencies)
327
+ - Dependency injection (no hard dependencies)
328
+ - Adapter pattern for third-party libraries
329
+ - Domain model integrity
330
+ - API contract design
331
+ - Error handling strategy
332
+ - State management patterns
333
+
334
+ **Skipped in Architecture Focus** (already covered by pre-check):
335
+
336
+ - TypeScript compilation
337
+ - Linting errors
338
+ - Formatting issues
339
+ - Security vulnerabilities
340
+ - Basic test coverage
341
+
342
+ ### With Severity Filtering
343
+
344
+ ```bash
345
+ # Show only critical issues
346
+ valora review-code src/ --severity=critical
347
+
348
+ # Show critical and high severity issues
349
+ valora review-code src/ --severity=high
350
+
351
+ # Show medium severity and above
352
+ valora review-code src/ --severity=medium
353
+
354
+ # Show all issues (default)
355
+ valora review-code src/ --severity=low
356
+ ```
357
+
358
+ ### Combined Options
359
+
360
+ ```bash
361
+ # Security review, only critical/high issues
362
+ valora review-code src/api/ --focus=security --severity=high
363
+
364
+ # Performance review of backend services
365
+ valora review-code src/backend/services/ --focus=performance --severity=medium
366
+
367
+ # Full review of auth module
368
+ valora review-code src/auth/ --focus=all --severity=low
369
+ ```
370
+
371
+ ### Git-based Reviews
372
+
373
+ ```bash
374
+ # Review changes in current branch vs main
375
+ valora review-code main...HEAD
376
+
377
+ # Review specific commit range
378
+ valora review-code HEAD~3..HEAD
379
+
380
+ # Review changes in a feature branch
381
+ valora review-code main...feature/user-authentication
382
+ ```
383
+
384
+ ### Workflow Integration
385
+
386
+ ```bash
387
+ # Typical workflow sequence after implementation:
388
+ valora implement # Make code changes
389
+ valora assert # Validate completeness
390
+ valora test # Run tests
391
+ valora review-code # Code quality review (this command)
392
+ valora review-functional # Functional review (next step)
393
+ valora commit # Create commit
394
+ valora create-pr # Create pull request
395
+ ```
396
+
397
+ ## Output Artifacts
398
+
399
+ **Primary**: Code review report (markdown)
400
+ **Location**: `.valora/.history/review-code/REVIEW-[timestamp].md`
401
+
402
+ **Contents**:
403
+
404
+ - Executive summary with quality score
405
+ - Critical/high/medium/low issues
406
+ - Positive observations
407
+ - Quality metrics per category
408
+ - Prioritized recommendations
409
+ - Next steps and approval conditions
410
+
411
+ ## Notes
412
+
413
+ - Command orchestrates; prompts implement
414
+ - Prompts are reusable across commands
415
+ - Parallel execution for performance
416
+ - Caching disabled for fresh review each time
417
+ - No retries (reviews should be deterministic)
418
+ - All logic delegated to specialized prompts
419
+
420
+ ## Document Generation
421
+
422
+ **File**: `.valora/.history/review-code/REVIEW-[timestamp].md`
423
+
424
+ **Ask user**: "Would you like me to save the code review report?"
425
+
426
+ ## Command Output Summary
427
+
428
+ Print the following summary at command completion:
429
+
430
+ **For APPROVED:**
431
+
432
+ ```markdown
433
+ ## ✅ Code Review: APPROVED
434
+
435
+ **Quality Score**: [XX]/100
436
+ **Decision**: APPROVED - Ready for functional review
437
+
438
+ ### Review Summary
439
+
440
+ | Category | Score | Issues |
441
+ | --------------- | ----- | ------ |
442
+ | Security | [XX] | 0 |
443
+ | Architecture | [XX] | 0 |
444
+ | Performance | [XX] | 0 |
445
+ | Maintainability | [XX] | 0 |
446
+
447
+ ### Positive Observations
448
+
449
+ - ✅ [Good practice observed]
450
+ - ✅ [Good practice observed]
451
+
452
+ ### Document Generated
453
+
454
+ → `.valora/.history/review-code/REVIEW-[timestamp].md`
455
+
456
+ ### Next Step
457
+
458
+ → `/review-functional` to validate feature completeness
459
+ ```
460
+
461
+ **For REQUEST_CHANGES:**
462
+
463
+ ```markdown
464
+ ## 🔄 Code Review: CHANGES REQUESTED
465
+
466
+ **Quality Score**: [XX]/100
467
+ **Decision**: CHANGES REQUESTED - Issues must be addressed
468
+
469
+ ### Issues Found
470
+
471
+ | Severity | Count | Category |
472
+ | -------- | ----- | ---------- |
473
+ | High | [N] | [Category] |
474
+ | Medium | [N] | [Category] |
475
+ | Low | [N] | [Category] |
476
+
477
+ ### Critical Issues
478
+
479
+ 1. **[Issue]**: [Description]
480
+ - Location: [file:line]
481
+ - Fix: [Suggested fix]
482
+
483
+ ### Document Generated
484
+
485
+ → `.valora/.history/review-code/REVIEW-[timestamp].md`
486
+
487
+ ### Next Step
488
+
489
+ → `/implement` to address review feedback
490
+ ```
491
+
492
+ **For BLOCKED:**
493
+
494
+ ```markdown
495
+ ## ❌ Code Review: BLOCKED
496
+
497
+ **Quality Score**: [XX]/100
498
+ **Decision**: BLOCKED - Critical issues require resolution
499
+
500
+ ### Critical Blockers
501
+
502
+ 1. **[Security/Architecture Issue]**: [Description]
503
+ - Impact: [Why this is critical]
504
+ - Required: [What must be done]
505
+
506
+ ### Next Step
507
+
508
+ → Escalate or major rework required
509
+ → Consider revisiting `/plan` if architectural issues
510
+ ```
511
+
512
+ ---
513
+
514
+ ## Quick Review Modes
515
+
516
+ To reduce code review time from ~10 min to ~3 min, use these quick modes:
517
+
518
+ ### Auto-Only Mode (`--auto-only`)
519
+
520
+ Runs automated quality checks only, without manual review:
521
+
522
+ ```bash
523
+ valora review-code --auto-only
524
+ ```
525
+
526
+ **Duration**: ~1 minute
527
+
528
+ **Checks performed**:
529
+
530
+ - `pnpm tsc:check` - TypeScript compilation
531
+ - `pnpm lint` - ESLint validation
532
+ - `pnpm format --check` - Prettier formatting
533
+ - `pnpm test:quick` - Quick test suite
534
+ - `pnpm audit` - Security vulnerabilities
535
+
536
+ **Output**:
537
+
538
+ ```markdown
539
+ ## Automated Review: PASS
540
+
541
+ **Duration**: 0.8 min
542
+
543
+ ### Check Results
544
+
545
+ | Check | Status | Time |
546
+ | ---------- | ------ | ---- |
547
+ | TypeScript | PASS | 12s |
548
+ | Linting | PASS | 8s |
549
+ | Formatting | PASS | 3s |
550
+ | Tests | PASS | 25s |
551
+ | Security | PASS | 5s |
552
+
553
+ ### Next Step
554
+
555
+ → Run `valora review-code --checklist` for quick manual review
556
+ → Or run `valora review-code` for full review
557
+ ```
558
+
559
+ ### Checklist Mode (`--checklist`)
560
+
561
+ Uses REVIEW_CODE_CHECKLIST.md template for binary Y/N validation:
562
+
563
+ ```bash
564
+ valora review-code --checklist
565
+ ```
566
+
567
+ **Duration**: ~3 minutes
568
+
569
+ **Sections covered** (40 items total):
570
+ | Section | Items | Critical |
571
+ | ---------------- | ----- | -------- |
572
+ | Automated Checks | 5 | Yes |
573
+ | Security | 5 | Yes |
574
+ | Architecture | 5 | No |
575
+ | Code Quality | 5 | No |
576
+ | Error Handling | 5 | No |
577
+ | Performance | 5 | No |
578
+ | Testing | 5 | No |
579
+ | Maintainability | 5 | No |
580
+
581
+ **Quality gate**: 80% overall, 100% critical sections
582
+
583
+ **Output**:
584
+
585
+ ```markdown
586
+ ## Checklist Review: APPROVE
587
+
588
+ **Duration**: 2.5 min
589
+ **Score**: 36/40 (90%)
590
+
591
+ ### Section Scores
592
+
593
+ | Section | Passed | Total |
594
+ | ---------------- | ------ | ----- |
595
+ | Automated Checks | 5 | 5 |
596
+ | Security | 5 | 5 |
597
+ | Architecture | 4 | 5 |
598
+ | Code Quality | 5 | 5 |
599
+ | Error Handling | 5 | 5 |
600
+ | Performance | 4 | 5 |
601
+ | Testing | 4 | 5 |
602
+ | Maintainability | 4 | 5 |
603
+
604
+ ### Failed Items
605
+
606
+ - 3.4 - Adapter pattern not used for Stripe integration
607
+ - 6.3 - No caching for frequently accessed data
608
+ - 7.2 - Edge case for empty array not tested
609
+ - 8.3 - Duplicate validation logic in two files
610
+
611
+ ### Decision: APPROVE (90% >= 80%)
612
+
613
+ ### Next Step
614
+
615
+ → `/review-functional` for feature validation
616
+ → Consider addressing failed items in follow-up
617
+ ```
618
+
619
+ ### Combined Workflow
620
+
621
+ Use auto-only as a pre-filter, then checklist for quick review:
622
+
623
+ ```bash
624
+ # Step 1: Automated checks (~1 min)
625
+ valora review-code --auto-only
626
+
627
+ # Step 2: Quick checklist review (~3 min)
628
+ valora review-code --checklist
629
+
630
+ # Step 3: Full review only if needed (~10 min)
631
+ valora review-code --focus=security
632
+ ```
633
+
634
+ ### Mode Comparison
635
+
636
+ | Mode | Duration | Depth | Use Case |
637
+ | -------------- | -------- | ---------------- | ----------------------------- |
638
+ | `--auto-only` | ~1 min | Automated tools | CI integration, pre-commit |
639
+ | `--checklist` | ~3 min | Binary checklist | Quick validation, iteration |
640
+ | Full (default) | ~10 min | Deep analysis | Final review, complex changes |
641
+
642
+ ### Workflow Integration
643
+
644
+ ```
645
+ /implement
646
+ |
647
+ v
648
+ valora review-code --auto-only <-- Automated gate (~1 min)
649
+ |
650
+ v (if PASS)
651
+ valora review-code --checklist <-- Quick review (~3 min)
652
+ |
653
+ v (if APPROVE)
654
+ valora review-code <-- Full review (optional, ~10 min)
655
+ |
656
+ v
657
+ /review-functional
658
+ ```
659
+
660
+ ### When to Use Each Mode
661
+
662
+ **Use `--auto-only`**:
663
+
664
+ - Before committing changes
665
+ - In CI/CD pipeline as first gate
666
+ - Quick iteration during development
667
+ - When you just want tooling feedback
668
+
669
+ **Use `--checklist`**:
670
+
671
+ - After automated checks pass
672
+ - For routine code changes
673
+ - When time is constrained
674
+ - Self-review before requesting human review
675
+
676
+ **Use full review**:
677
+
678
+ - For complex or high-risk changes
679
+ - Before major releases
680
+ - When training new team members
681
+ - For security-sensitive code