一键导入
rai-quality-review
Audit code for semantic bugs, type lies, and test muda. Use after implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Audit code for semantic bugs, type lies, and test muda. Use after implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Interactive adapter setup for Jira and Confluence. Detects available backends, discovers projects/spaces, generates validated YAML config. 3-4 questions max.
Evaluate design proportionality using Beck's four rules. Use after implementation.
Root cause analysis using the method best suited to the bug. Phase 3 of bugfix pipeline.
Push branch, create MR, verify artifacts complete. Phase 7 of bugfix pipeline.
Execute fix tasks with TDD and all validation gates. Phase 5 of bugfix pipeline.
Decompose fix into atomic TDD tasks. Phase 4 of bugfix pipeline.
| name | rai-quality-review |
| description | Audit code for semantic bugs, type lies, and test muda. Use after implementation. |
| allowed-tools | ["Read","Grep","Glob"] |
| license | MIT |
| metadata | {"raise.work_cycle":"story","raise.frequency":"on-demand","raise.prerequisites":"story-implement","raise.version":"1.0.0","raise.visibility":"public"} |
Act as an external auditor reviewing code that passed all automated gates. Find what the machines missed — semantic bugs account for 51% of all missed bugs in code review (ICSE, arxiv 2205.09428).
| Condition | Action |
|---|---|
After /rai-story-implement, all gates pass | Run quality review |
Before /rai-story-review | Catch issues before retrospective |
| Code feels "too clean" | Assumptions may be hiding — review |
Inputs: Story ID (to find changed files), passing gates (language-appropriate linters, type checkers, test runners).
Determine the primary language and toolchain using this priority chain:
.raise/manifest.yaml for explicit overrides (project.test_command, project.lint_command, project.type_check_command) — configuration over conventionproject.project_type in manifest, or scan extensions of changed files (git diff --name-only)# .raise/manifest.yaml — example overrides
project:
test_command: "npm run test:ci" # overrides Test Runner column
lint_command: "biome check" # overrides Linter column
type_check_command: "tsc --noEmit" # overrides Type Checker column
Manifest commands always win when present. The table is a fallback:
| Language | Extensions | Type Checker | Linter | Test Runner |
|---|---|---|---|---|
| Python | .py, .pyi | pyright/mypy | ruff | pytest |
| TypeScript | .ts, .tsx | tsc --noEmit | eslint | jest/vitest |
| JavaScript | .js, .jsx | — | eslint | jest/vitest |
| C# | .cs | dotnet build | dotnet format | xunit/nunit |
| Java | .java | javac | checkstyle | JUnit |
| Go | .go | go vet | golangci-lint | go test |
| PHP | .php | phpstan | php-cs-fixer | phpunit |
| Dart | .dart | dart analyze | dart fix | flutter test |
If mixed languages, review each language group separately using its section below.
# Use the parent branch (epic or dev) as merge base — not a hardcoded branch name
git diff --name-only $(git merge-base HEAD <parent-branch>)..HEAD -- '<extensions>'
Replace <extensions> with language-appropriate patterns from Step 0 (e.g., '*.py' '*.pyi' for Python, '*.ts' '*.tsx' for TypeScript).
Read every changed file. You cannot review code you haven't read.
Before auditing for bugs, understand what patterns should have been followed:
rai graph query "patterns for {affected_modules}" --types pattern
Pattern awareness prevents false positives (flagging code that follows a deliberate pattern) and catches real issues (code that ignores a pattern established after a past bug).
Logic correctness: Inverted conditionals (#1 semantic bug), off-by-one errors, wrong variable in expressions (copy-paste), unhandled edge cases (empty, null/None, zero-length).
Python:
type: ignore comments (each is a potential lie), cast() honesty, annotations claiming more specific types than runtime providesexcept Exception, swallowed exceptions, missing raise X from excTypeScript/JavaScript:
as type assertions (bypasses type checking), any types (defeats type safety), @ts-ignore/@ts-expect-error comments.catch(), overly broad catch(e) without type narrowing== vs ===, truthiness traps (0, "", [] are falsy), implicit any from untyped importsC#/.NET:
! (suppresses null warnings), unchecked casts vs pattern matching, dynamic type usagecatch blocks, catching System.Exception broadly, missing using/await using for IDisposableasync void methods (fire-and-forget), missing ConfigureAwait, LINQ deferred execution surprisesPHP:
@ error suppression operator, loose comparison (== vs ===)Go:
_), error wrapping without %wDart/Flutter:
as casts without is checks, dynamic type usage, ! null assertion operatorFuture errors, missing error handling in StreamBuildersetState after dispose, missing const constructors, build method side effectsApply these heuristics to every test file:
| # | Heuristic | Red Flag |
|---|---|---|
| 1 | Mutation Survival | Test passes regardless of code behavior change |
| 2 | Refactoring Resilience | Test asserts on internals, not behavior |
| 3 | Behavior Specification | Name mirrors code structure, not behavior |
| 4 | Magic Literal | Assertion against hardcoded value from implementation |
| 5 | Mock Depth | Mock returns mock returns mock |
| 6 | Deletion | No unique bug coverage if test deleted |
| 7 | Spec Independence | Assertion requires reading source to understand |
Classify: Muda (waste, recommend deletion) / Fragile (breaks on refactor) / Valuable (leave as-is).
API (language-adaptive):
| Language | Visibility Mechanism | Leak Detection |
|---|---|---|
| Python | Lean __all__, _-prefixed internals | Internal symbols in public API |
| TypeScript | export discipline, barrel files | Re-exporting internals, export * |
| C# | internal vs public, [assembly: InternalsVisibleTo] | Public types that should be internal |
| Go | Capitalization (exported vs unexported) | Exported helpers that should be internal |
| PHP | private/protected vs public | Public methods that should be protected |
| Dart | _-prefixed private, export directives | Part-of files leaking implementation |
Security (universal): Entry point trust model, input validation at boundaries, dependency justification, no secret exposure in logs/errors.
## Quality Review: {story_id}
### Critical (fix before merge)
### Recommended (improve code quality)
### Observations (no action needed)
### Verdict
- [ ] PASS / PASS WITH RECOMMENDATIONS / FAIL
Every finding: specific file:line, WHY it matters, concrete fix suggestion.
| Item | Destination |
|---|---|
| Review findings | Presented inline, saved if requested |
| Verdict | PASS, PASS WITH RECOMMENDATIONS, or FAIL |
| Next | /rai-story-review |
work/research/quality-review/evidence-catalog.md/rai-architecture-review (proportionality), /rai-story-review (retrospective)