/review:codegenfrom review
Generates simple tests, docstrings, and documentation updates for PR changes. Use when reviewing a PR and you want draft tests, docstrings, or CHANGELOG entries to fill the gaps it surfaced (human review required before committing).
Ships in review. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generates simple, low-risk code and documentation for PR changes — "easy wins": tests for simple functions, missing docstrings, CHANGELOG entries, API docs. Everything it emits is a draft for human review, never auto-committed.
mktemp -d.analyze at $OUTPUT_DIR/pr-analysis-<number>.json
(languages, frameworks, test_setup.framework, uses_mac_ui).docs-drift at $OUTPUT_DIR/docs-drift-<number>.json
(completeness findings — facet: "completeness", drift_class: "missing-doc"
— name the missing docstring / CHANGELOG / API-doc surfaces).$OUTPUT_DIR/code-generation-<PR_NUMBER>.json (structure in Step 7) plus a
human-readable code-generation-<PR_NUMBER>-summary.md (template in
references/output-examples.md).
PR_URL="$1"
OUTPUT_DIR="${2:-$(mktemp -d -t pr-review-XXXXXX)}"
PR_NUMBER=$(echo "$PR_URL" | grep -oE 'pull/[0-9]+' | grep -oE '[0-9]+')
Both files must already exist in $OUTPUT_DIR; this skill reads, never
produces them. Run review:analyze and review:docs-drift first.
cat "$OUTPUT_DIR/pr-analysis-${PR_NUMBER}.json"
cat "$OUTPUT_DIR/docs-drift-${PR_NUMBER}.json"
Stop if either cat fails. Without the docs-drift findings there is no gap
list, and the run produces an empty output file that reads like "nothing to
generate".
Generate only LOW-complexity, LOW-risk, HIGH-confidence items: simple getters/setters/validators/formatters, missing docstrings, CHANGELOG entries, API docs for new endpoints, trivial lint fixes.
Never generate: business logic, DB migrations, endpoint implementations, auth/authz logic, or anything needing domain knowledge.
Parse the inputs: identify simple, untested functions directly from the PR diff
(cross-checking the changed files for an existing test); completeness gaps from
docs-drift; language/framework/uses_mac_ui from analysis.
Candidates: pure functions, simple validators, data transformers, property
accessors — under 20 lines, no external deps, no existing test. Use the
skeletons in references/generation-templates.md (Python/JS/Go/Java/Rust).
Rules: max 3 tests per function (happy + ≤2 edge/error cases); skip complex,
side-effecting, or already-tested functions. For Rust, prefer filling an exact
untested branch/arm visible in the diff (e.g. an env-parse unset|blank|invalid
arm) over a bare happy path, and place tests in the file's #[cfg(test)] mod tests block.
For each completeness missing-doc finding on a public item, generate a
docstring in the language's convention (templates in
references/generation-templates.md). Document params, returns, and errors;
omit internals. Match the file's existing docstring density; 2-10 lines.
Only if the repo keeps a CHANGELOG. Group PR commits into Added/Changed/Fixed/ Deprecated/Removed/Security (Keep a Changelog style):
gh pr view "$PR_URL" --json commits --jq '.commits[].messageHeadline'
Determine the version bump per the table in references/output-examples.md.
For each new/changed endpoint the completeness findings flagged, emit an
OpenAPI-style markdown section (template in references/generation-templates.md):
method+path, request (headers/body), response (success/error), error codes.
Omit internals. For an OpenAPI-first repo, prefer proposing the spec edit and
let the render regenerate, rather than hand-writing prose (see docs-drift).
If technical-writing:write-doc is available, shape README/Reference prose
with its matching template (templates/readme.md / reference.md) and
references/common-doc-guidelines.md; emit the text into generated.api_docs,
write no file, and ask no questions. Otherwise generate inline as above.
Docstrings (Step 3) and CHANGELOG entries (Step 4) stay as they are, since
CHANGELOG is not a write-doc type.
Only trivial issues: unused variable → _-prefix, trailing commas, whitespace,
import ordering. Never fix logic/type errors. Emit {file, line, issue, fix, diff}.
These diffs are evidence that drift exists, not the remedy. /review:fix
discards them and runs the repo's own formatter instead: the tool is
authoritative, and a diff drafted during review is stale by the time anyone
applies it. Keep emitting them — they are what tells fix to run the formatter
at all.
Build with jq -n, every generated snippet passed via --arg (never heredoc
model/PR-derived text). Emit generated.{tests,docstrings,changelog_entries, api_docs,lint_fixes} (each entry carries file, reason, confidence),
plus stats counts and a one-line summary:
jq -n --argjson pr_number "$PR_NUMBER" --arg ts "$(date -Iseconds)" \
--arg test_code "$TEST_CODE" --arg docstring "$DOCSTRING" \
'{ pr_number:$pr_number, generation_timestamp:$ts, status:"completed",
generated:{ tests:[{file:"…",function:"…",code:$test_code,reason:"…",confidence:"high"}],
docstrings:[{file:"…",line:0,docstring:$docstring,reason:"…",confidence:"high"}],
changelog_entries:[], api_docs:[], lint_fixes:[] },
stats:{tests_generated:0,docstrings_generated:0,changelog_entries:0,api_docs_sections:0,lint_fixes:0},
review_required:true,
summary:"…" }' > "$OUTPUT_DIR/code-generation-${PR_NUMBER}.json"
Then write the human-readable summary per references/output-examples.md.
Validate each snippet (syntax, imports, naming convention) before emitting.
Confidence: HIGH (validators/getters/formatters), MEDIUM (CHANGELOG,
API docs). Emit HIGH+MEDIUM only — drop LOW. Always set review_required:true
with concrete review notes (verify assertions match behavior; check CHANGELOG
version against the release plan; validate API examples).
Report counts by artifact and confidence, and remind that human review is required before committing. Point the reviewer at the JSON + summary files.
Does NOT generate business logic, DB migrations, endpoint implementations, or architectural decisions; does NOT modify existing tests or auto-commit. DOES draft simple tests, docstrings, CHANGELOG entries, API docs, and trivial lint fixes — all for review.
If an item fails, continue with the rest and record it under skipped with a
reason and a manual-write recommendation (example in
references/output-examples.md).
Standalone. review does not call it, and nothing it writes reaches the
findings ledger, so /review:fix never sees its output — invoke it by name when
you want drafts, and review them by hand. Conservative by design: only easy,
well-established patterns; skip anything ambiguous. Cost ~$0.50-1.50/PR.
references/generation-templates.md — per-language test/docstring/API skeletons.references/output-examples.md — human-summary template, version-bump table,
skipped-item record.What SKILL.md sets; muted values are Claude Code's defaults
11 skills in this plugin
/analyzeAnalyze PR changes to detect languages, frameworks, test setup, impact areas, and risk classes. Use when starting a PR review and you need to understand what changed before deeper analysis./change-evolutionReviews PR diffs for CD readiness, reversibility, and design-quality risks such as YAGNI, deep modules, and complexity budget. Use when a PR is large, mixes refactor with behavior, or introduces flags/migrations/stranglers./data-contractsReviews PR diffs for data consistency, schema/migration safety, and API/event contract compatibility. Use when analyze risk_class includes data or api, or when a PR changes schemas, migrations, public APIs, or event payloads./docs-driftDetect documentation drift in a repo's docs/ folder — ADRs, glossaries, API specs (OpenAPI), rendered artifacts, READMEs, code comments, runbooks, and caller-migration notes — that has fallen out of sync with the code a PR changes, and flag documentation-completeness gaps (missing CHANGELOG/README/ docstring updates). Use when reviewing a PR to verify docs still describe the CURRENT model: stale comments describing a removed mechanism, docs asserting a superseded design, a rendered file lagging its source, ADR index rows that don't reflect an amendment or supersede, env/config docs that name the wrong app or variable, missing runbooks for ops-facing changes, or missing caller migration notes for breaking APIs. Use even when the PR doesn't obviously touch docs — code changes silently invalidate docs elsewhere in the tree.
/domain-architectureReviews PR diffs for domain model integrity, architecture dependency rules, and team/org boundary risks. Use when analyze risk_class includes domain, or when a PR crosses bounded contexts, ownership, or layering boundaries./fixApply and commit fixes for the findings a prior /review:review recorded — refactor code smells using the named Fowler/Kerievsky refactoring in the language's own idiom, rewrite flagged documentation and comments for clarity, regenerate stale generated artifacts, and defer anything needing a human design decision rather than guessing. Then push the head branch once the suite is green and answer the review comments that raised them: reply with the fix and resolve the thread. Use after /review:review when you want the findings actually resolved on the PR, one commit per finding. Edits files, commits, pushes the PR branch, replies and resolves; never force-pushes, never merges. Also the fix engine behind monitor-pr.npx claudepluginhub ozzycodes2/claudellum --plugin review