Install
openclaw skills install review-structureRepo-wide structural-maintainability review — code-judo restructurings, 1k-line file guard, anti-spaghetti branching, canonical-layer enforcement, anti-magic abstractions, explicit type/boundary contracts.
openclaw skills install review-structureUse this skill for an unusually strict review focused on implementation quality, maintainability, abstraction quality, and codebase health.
Above all, this skill should push the reviewer to be ambitious about code structure. Do not merely identify local cleanup opportunities. Actively search for "code judo" moves: restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
The structural lens is repo-wide: read and search any file in the codebase as needed to judge whether canonical helpers already exist, whether file-size budgets are honored, and whether the change makes the codebase easier or harder to live with.
Before issuing any verdict — flag, propose a restructuring, or assert a structural claim — you MUST echo the exact artifact you are judging, quoted from a source you read in this turn:
wc -l/read-based count that backs it.The artifact is the only source of truth. Never infer what you are reviewing from the branch name, the working directory, surrounding files, or recollection. If your mental model differs from the freshly read source, the source wins. A verdict issued without a same-turn echo of its target is invalid — emit the echo first, or do not emit the verdict.
This gate exists because an LLM under contextual priming will confidently flag code that is not in the file. It runs before the hard gates below.
Advance only when each pass condition is objectively satisfied (artifact path, tool output, or labeled capture — not "I checked it mentally"):
| Gate | Pass condition |
|---|---|
| G1 — Changed-file list | git diff --name-only (or equivalent) returns a non-empty list or you exit with an explicit "no changed files" message; the list is recorded before any review step begins. |
| G2 — Full file reads | Every file in scope has been read in full; for each file you record the path and line count (e.g. src/foo.ts — 342 lines). Do not proceed to findings until all reads are logged. |
| G3 — Canonical-helper and 1k-line claims verified | Any finding that asserts "no canonical helper exists" must cite a codebase-search artifact showing the search pattern and result. Any finding that asserts a file exceeds 1 000 lines must cite a wc -l or read-based line-count artifact. Findings lacking these artifacts are blocked from the report. |
Start from this baseline:
Perform a deep structural review of the current branch's changes. Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior. Work to improve abstractions, modularity, reduce spaghetti code, improve succinctness and legibility. Be ambitious — if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it. Be extremely thorough and rigorous. Measure twice, cut once.
Apply the baseline prompt above, plus these explicit review rules:
Be ambitious about structural simplification.
Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.
Do not allow random spaghetti growth in existing code.
Bias toward cleaning the design, not just accepting working code.
Prefer direct, boring, maintainable code over hacky or magical code.
Push hard on type and boundary cleanliness when they affect maintainability.
unknown, any, or cast-heavy code when a clearer type boundary could exist.Keep logic in the canonical layer and reuse existing helpers.
Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.
For every meaningful change, ask:
Apply rules 0–7 above, and escalate especially when you see:
When you identify a code-quality problem, prefer suggestions like:
Do not be satisfied with "maybe rename this" feedback when the real issue is structural. Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
Be direct, serious, and demanding about quality. Do not be rude, but do not soften major maintainability issues into mild suggestions. If the code is making the codebase messier, say so clearly. If the implementation missed an opportunity for a dramatic simplification, say that clearly too.
Prioritize findings in this order:
Do not flood the review with low-value nits if there are larger structural issues. Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
Do not approve merely because behavior seems correct. The bar is: no violation of rules 0–7 above, and no clear structural regression.
Treat as presumptive blockers unless the author can justify them clearly:
If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
Capture the command output (or equivalent) as your authoritative changed-file set before reviewing. The structural lens applies to changes in any language — do not filter by extension.
BASE=$(for ref in main origin/main master origin/master; do
git rev-parse --verify "$ref" >/dev/null 2>&1 && { echo "$ref"; break; }
done)
if [ -z "$BASE" ]; then
echo "error: no main/master ref found (checked main, origin/main, master, origin/master)." >&2
exit 1
fi
MERGE_BASE=$(git merge-base HEAD "$BASE") || {
echo "error: git merge-base HEAD $BASE failed." >&2
exit 1
}
git diff --name-only "$MERGE_BASE..HEAD"
If the list is empty, state that explicitly and do not invent structural findings.
## Review Summary
[1-2 sentence overview of structural findings]
## Issues
### Critical (Blocking)
1. [FILE:LINE] ISSUE_TITLE
- Issue: Description of the structural problem
- Why: Why this matters (maintainability, spaghetti growth, missed code-judo move)
- Fix: Specific recommended restructuring
### Major (Should Fix)
2. [FILE:LINE] ISSUE_TITLE
- Issue: ...
- Why: ...
- Fix: ...
### Minor (Nice to Have)
N. [FILE:LINE] ISSUE_TITLE
- Issue: ...
- Why: ...
- Fix: ...
### Informational (For Awareness)
N. [FILE:LINE] SUGGESTION_TITLE
- Suggestion: ...
- Rationale: ...
## Good Patterns
- [FILE:LINE] Pattern description (preserve this)
## Verdict
Ready: Yes | No | With fixes 1-N (Critical/Major only; Minor items are acceptable)
Rationale: [1-2 sentences]