When to Use
Explicit Request Scenarios:
- The user says "refactor / review / take a look at what can be improved in this code / inspect it"
- Taking over legacy code and needing a systematic list of issues
- Before preparing to submit a PR, going through a quality gate
Summary Timing:
- After completing a batch of code modifications in succession, the agent proactively asks "Do you want to run yzr-code-refactoring-review once?"
- After the main feature code is landed, the user confirms the inspection
When Not to Use
- One-off typo / changing a variable name → single-point change, not a review
- Adding a new feature → development, not refactoring
- Fixing a bug → debugging, not review
- Performance tuning → profile + benchmark, not catalog coverage
- Rewriting a module → spans the entire structure, not a review
- Single-step inquiry ("what does this code do") → answer directly, not a review
Input / Output
Input(any form):
- Complete code snippet (paste directly)
- File path (the agent reads it itself)
- git diff / patch (review only the changes)
- Project root directory + scope (file / module / class filter)
Output: code review report (Markdown), for structure see references/report-template.md:
- Main table 5 columns: # / Location / Refactoring Scenario / Severity / Suggestion
- Summary paragraph: counts + distribution by severity + priority top-3 + risk points
- Tool run record footnote
- Do not modify source files
Execution Principles / Boundaries
- Do not proactively modify files: the output is a report; only after the user nods do you proceed to the specific refactoring
- catalog SSOT:
references/catalog.mdis the single source of truth for the 60+ scenario cards; SKILL.md does not recopy the cards - Severity SSOT:
references/severity-rubric.mdis the SSOT for the detailed rules for determining the 4 severity levels; SKILL.md does not recopy the detailed rules - Tool Fallback: when a static tool is not in PATH, silently skip it and record in the report footnote "tool unavailable, pure LLM inspection"
- Language Routing: upon receiving code, first determine the language and load the corresponding
references/languages/{lang}.md; when the language is unrecognized, only use the catalog - Trigger Convergence: the main path is explicit requests; the summary timing is "ask" not "run automatically"
- Every finding is traceable: every report item maps to at least 1 catalog scenario name
Workflow / Steps
Step 1: Collect Code
Parse the input (code snippet / path / diff / scope), determine language + line count; when line count > 500, confirm the segmentation granularity with the user (by file / by class / by function).
Step 2: Load References
Required reading references/catalog.md(scenario table); conditional reading references/languages/{lang}.md(when the language is recognized); read as needed references/severity-rubric.md(when determining severity).
Step 3: Run Static Tools (if available)
Try each one according to the language plugin's "tool mapping table"; if not in PATH → silently skip; convert output into main table rows.
Step 4: Supplement via the Catalog
LLM uses the catalog of 60+ scenario cards to fill in design-layer issues; deduplicates against tool results; each item maps to ≥ 1 scenario name.
Step 5: Generate report + ask
Output according to references/report-template.md ; check severity in references/severity-rubric.md; at the end, ask the user whether to refine / skip / change the judgment.
Relationship with adjacent skills
- Do not call
yzr-outline-wiki(The report is output to the current conversation by default; if the user explicitly wants it added to the wiki, hand off toyzr-outline-wiki) - Do not call
yzr-skill-creator(This skill itself is the artifact) - Do not call
gemini-paper-summary(Unrelated to papers)
Reference examples
See the complete input/output examples in references/examples.md(Python function / Go file / TSX component).
Brief example — User input:
Help me review src/parser.py (an 80-line Python parser)
Main table produced by the skill (excerpt):
| # | Location | Refactoring scenario | Severity | Suggestion |
|---|---|---|---|---|
| 1 | parser.py:1 | Extract Method | Major | Extract parse_lines() / calc_total() |
| 2 | parser.py:14 | Replace Magic Literal | Minor | 0.9 / 100 / 0.95 / 1000 and change to a named constant |
| 3 | parser.py:6 | Introduce Parameter Object | Major | (qty, price) is duplicated in 4 places; change to a dataclass |