42 lines
2.6 KiB
Markdown
42 lines
2.6 KiB
Markdown
---
|
|
name: code-review
|
|
description: Review changed code against the Refactoring smell catalog in six groups (bloaters, obscurity, couplers, dispensables, comment contract, shallow modules). Run when a file change is complete or an implementation is complete, e.g. from jsc-sdlc implement. Each group runs as a sub agent over the git diff; findings are reported with file:line, severity, and refactoring, and the caller decides whether to fix. Not a replacement for the CLI's built-in security or bug review.
|
|
---
|
|
|
|
# code-review
|
|
|
|
Review changed code against `references/smells.md` (from the book *Refactoring*). The reference is written in Traditional Chinese; read it as-is.
|
|
|
|
## When to run
|
|
|
|
1. **When a file change is complete**: one file or one related group of files is done.
|
|
2. **When an implementation is complete**: all todos of a work package are done (called by `jsc-sdlc:implement` step 6).
|
|
|
|
## Division of labor
|
|
|
|
- This skill covers the *Refactoring* smells, the comment contract (group 5), and shallow modules (group 6).
|
|
- Security, logic bugs, and test coverage belong to the CLI's built-in review (e.g. claude's `/security-review`); do not duplicate them.
|
|
|
|
## Steps
|
|
|
|
1. Get the review scope: `git diff` (uncommitted changes) or `git diff {base}...HEAD` (against the base branch when an implementation is complete); list the changed files.
|
|
2. Review in six groups, and every group **MUST run as a sub agent**; the six groups may run in parallel:
|
|
|
|
| Group | Scope |
|
|
| --- | --- |
|
|
| 1 Bloaters | smells.md group 1 |
|
|
| 2 Obscurity | smells.md group 2 |
|
|
| 3 Couplers | smells.md group 3 |
|
|
| 4 Dispensables & Others | smells.md group 4 |
|
|
| 5 Comment contract | smells.md group 5 |
|
|
| 6 Shallow Module | smells.md group 6 |
|
|
|
|
Instructions for each sub agent: read only, change nothing; check every changed line and its enclosing function or class against the group's definitions and detection signals in smells.md; report each finding as `file:line`, smell name, severity (高、中、低 per the smells.md scale), one sentence of evidence, and the suggested refactoring. Findings are reported in Traditional Chinese.
|
|
3. Merge the six groups' findings: deduplicate (when one location hits several groups, merge and list every smell), then sort by severity.
|
|
4. Report the finding list. **This skill never modifies code**; the caller decides what to fix (inside the implementation flow, 高 and 中 are normally mandatory, 低 is judgment).
|
|
|
|
## Notes
|
|
|
|
- If group 5 examples are fetched from a database, they must be de-identified; never include personal data.
|
|
- When there are no findings, report the literal 「無發現」 explicitly; never leave the report empty.
|