CFN DRY Review
Purpose: Systematically review code for DRY violations, modularity improvements, and resumable pipeline opportunities. Produces a structured manifest that feeds into cfn-vote-implement for 3-agent voting.
Inputs
$1: Target scope. One of:
- A file or directory path (e.g.,
src/services/)
--diff (default): review files changed in git diff against the base branch
--diff=<ref>: review files changed since a specific ref (e.g., --diff=main)
--category: Filter to specific categories: dry, modularity, resumable, or all (default: all)
Outputs
- JSON manifest at
<project-root>/.cfn-cache/manifests/cfn-dry-review-<timestamp>.json (auto-gitignored, timestamps are nanosecond-precision)
- Human-readable summary to stdout
Manifest Schema
{
"review_id": "dry-review-<timestamp>",
"scope": "git diff main | src/services/",
"generated_at": "ISO-8601",
"suggestions": [
{
"id": "S001",
"category": "dry | modularity | resumable",
"tag": "delete | stdlib | native | yagni | shrink",
"one_liner": "L12-38: stdlib: 27-line validator class. \"@\" check is 1 line; real validation is the confirmation mail.",
"title": "Short description",
"description": "What the problem is and why it matters",
"files": ["path/to/file.ts:42", "path/to/other.ts:17"],
"impact": "high | medium | low",
"effort": "high | medium | low",
"suggested_approach": "Brief description of the fix",
"related_suggestions": ["S003"]
}
]
}
Categories
| Category |
What to look for |
dry |
Duplicated logic, copy-pasted blocks, repeated patterns across files, string literals that should be constants |
modularity |
God functions/files, mixed concerns, missing abstractions at natural boundaries, tight coupling between modules |
resumable |
Pipelines that lose progress on failure, missing checkpoints, non-idempotent operations, batch processes without resume capability |
Suggestion Tags & Grammar
Every suggestion carries one tag (orthogonal to category — it sharpens the fix) and a one-line one_liner in imperative form:
L<line>: <tag> <what>. <replacement>. (use <file>:L<line>: ... for multi-file diffs)
| Tag |
Means |
delete |
Dead code, unused flexibility, speculative feature. Replacement: nothing. |
stdlib |
Hand-rolled thing the standard library ships. Name the function. |
native |
Dependency or code doing what the platform/DB/framework already does. Name the feature. |
yagni |
Abstraction with one implementation, config nobody sets, a layer with one caller. |
shrink |
Same logic, fewer lines. Show the shorter form. |
Imperative, not Socratic:
- ❌ "This EmailValidator class might be more complex than necessary, have you considered whether all these rules are needed?"
- ✅
L12-38: stdlib: 27-line validator class. "@" check is 1 line; real validation is the confirmation mail.
End the stdout summary with one metric: net: -<N> lines possible. (or Lean already. Ship. if nothing to cut).
Scope Lock
This review covers minimalism ONLY: DRY, modularity, resumable, over-engineering. Correctness bugs, security holes, and performance are explicitly OUT of scope — route those to /code-review. Do not mix axes; the scope lock is what keeps findings terse and the manifest focused.
Usage
# Review changed files (default)
/cfn-dry-review
# Review a specific directory
/cfn-dry-review src/services/
# Review only DRY violations
/cfn-dry-review --category=dry
# Review changes since a specific branch
/cfn-dry-review --diff=feature-branch
Integration
- Outputs feed directly into
/cfn-vote-implement for 3-agent voting
- Can be used standalone for review-only workflows
- Manifest is resumable: re-running
/cfn-vote-implement on the same manifest skips already-processed suggestions
Related
/cfn-vote-implement - Phase 2: voting and implementation
1---2name: cfn-dry-review3description: "MUST BE USED before merging any PR that adds 3+ new functions or 50+ lines. Run after implementation. Reviews code for DRY violations, modularity, resumable pipeline opportunities. Outputs JSON manifest for cfn-vote-implement."4version: 1.0.05tags: [code-review, DRY, modularity, refactoring]6status: production7metadata:8 source: https://skillmd.com/skills/masharratt/cfn-dry-review9---1011# CFN DRY Review1213**Purpose:** Systematically review code for DRY violations, modularity improvements, and resumable pipeline opportunities. Produces a structured manifest that feeds into cfn-vote-implement for 3-agent voting.1415## Inputs1617- `$1`: Target scope. One of:18 - A file or directory path (e.g., `src/services/`)19 - `--diff` (default): review files changed in `git diff` against the base branch20 - `--diff=<ref>`: review files changed since a specific ref (e.g., `--diff=main`)21- `--category`: Filter to specific categories: `dry`, `modularity`, `resumable`, or `all` (default: `all`)2223## Outputs2425- JSON manifest at `<project-root>/.cfn-cache/manifests/cfn-dry-review-<timestamp>.json` (auto-gitignored, timestamps are nanosecond-precision)26- Human-readable summary to stdout2728## Manifest Schema2930```json31{32 "review_id": "dry-review-<timestamp>",33 "scope": "git diff main | src/services/",34 "generated_at": "ISO-8601",35 "suggestions": [36 {37 "id": "S001",38 "category": "dry | modularity | resumable",39 "tag": "delete | stdlib | native | yagni | shrink",40 "one_liner": "L12-38: stdlib: 27-line validator class. \"@\" check is 1 line; real validation is the confirmation mail.",41 "title": "Short description",42 "description": "What the problem is and why it matters",43 "files": ["path/to/file.ts:42", "path/to/other.ts:17"],44 "impact": "high | medium | low",45 "effort": "high | medium | low",46 "suggested_approach": "Brief description of the fix",47 "related_suggestions": ["S003"]48 }49 ]50}51```5253## Categories5455| Category | What to look for |56|----------|-----------------|57| `dry` | Duplicated logic, copy-pasted blocks, repeated patterns across files, string literals that should be constants |58| `modularity` | God functions/files, mixed concerns, missing abstractions at natural boundaries, tight coupling between modules |59| `resumable` | Pipelines that lose progress on failure, missing checkpoints, non-idempotent operations, batch processes without resume capability |6061## Suggestion Tags & Grammar6263Every suggestion carries one `tag` (orthogonal to `category` — it sharpens the fix) and a one-line `one_liner` in imperative form:6465`L<line>: <tag> <what>. <replacement>.` (use `<file>:L<line>: ...` for multi-file diffs)6667| Tag | Means |68|-----|-------|69| `delete` | Dead code, unused flexibility, speculative feature. Replacement: nothing. |70| `stdlib` | Hand-rolled thing the standard library ships. Name the function. |71| `native` | Dependency or code doing what the platform/DB/framework already does. Name the feature. |72| `yagni` | Abstraction with one implementation, config nobody sets, a layer with one caller. |73| `shrink` | Same logic, fewer lines. Show the shorter form. |7475Imperative, not Socratic:76- ❌ "This EmailValidator class might be more complex than necessary, have you considered whether all these rules are needed?"77- ✅ `L12-38: stdlib: 27-line validator class. "@" check is 1 line; real validation is the confirmation mail.`7879End the stdout summary with one metric: `net: -<N> lines possible.` (or `Lean already. Ship.` if nothing to cut).8081### Scope Lock8283This review covers minimalism ONLY: DRY, modularity, resumable, over-engineering. **Correctness bugs, security holes, and performance are explicitly OUT of scope — route those to `/code-review`.** Do not mix axes; the scope lock is what keeps findings terse and the manifest focused.8485## Usage8687```bash88# Review changed files (default)89/cfn-dry-review9091# Review a specific directory92/cfn-dry-review src/services/9394# Review only DRY violations95/cfn-dry-review --category=dry9697# Review changes since a specific branch98/cfn-dry-review --diff=feature-branch99```100101## Integration102103- Outputs feed directly into `/cfn-vote-implement` for 3-agent voting104- Can be used standalone for review-only workflows105- Manifest is resumable: re-running `/cfn-vote-implement` on the same manifest skips already-processed suggestions106107## Related108109- `/cfn-vote-implement` - Phase 2: voting and implementation