agentsclimarketplace

Code review simplify

Skill mickeyyaya/evolve-loop/skills/code-review-simplify

Use when reviewing code changes for quality, security, performance, or maintainability issues and identifying simplification opportunities in a single token-efficient passFrom its SKILL.md

Install
npx -y skills add mickeyyaya/evolve-loop --skill code-review-simplify

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

13.3 KB, as published. Nobody here has run it

Unified code review + simplification. Single-pass, multi-dimensional scoring, adaptive depth. Integrates with evolve-loop auditor and builder phases.

Contents

Architecture

Hybrid pipeline+agentic model. Structured passes handle known patterns cheaply; agentic reasoning handles contextual issues that require understanding intent.

Input: git diff (changed files)
         │
         ▼
┌─────────────────────────┐
│  PIPELINE LAYER (fast)  │  Deterministic pattern checks
│  ─────────────────────  │
│  1. Complexity scan     │  Cognitive complexity, nesting depth
│  2. Smell detection     │  22-smell catalog from detect-code-smells
│  3. Security scan       │  OWASP patterns, secrets, injection
│  4. Style check         │  Naming, file size, function length
│  5. Duplication check   │  Near-duplicate code blocks
└─────────┬───────────────┘
          │ Structured findings
          ▼
┌─────────────────────────┐
│  AGENTIC LAYER (deep)   │  LLM-powered contextual analysis
│  ─────────────────────  │
│  6. Logic correctness   │  Edge cases, off-by-one, null handling
│  7. Intent alignment    │  Does change match acceptance criteria?
│  8. Cross-file impact   │  Dependency effects, API contract breaks
│  9. Simplification      │  Extract Method, reduce nesting, dedup
│  10. Compound risk      │  Future maintenance cost assessment
└─────────┬───────────────┘
          │ Contextual findings
          ▼
┌─────────────────────────┐
│  SCORING & REPORT       │  Aggregate into multi-dimensional scores
│  ─────────────────────  │
│  Composite score 0.0-1.0│
│  Per-dimension scores   │
│  Simplification actions │
│  Priority-ranked issues │
└─────────────────────────┘

Why hybrid? Pipeline catches 60-70% of issues at ~5% of the token cost. Agentic layer focuses expensive reasoning on the 30-40% that requires context. Research: Cursor BugBot's biggest quality leap was pipeline→agentic; Anthropic's review dispatches parallel specialist agents.

Token budget: Pipeline layer ~2-5K tokens. Agentic layer ~15-40K tokens (scales with diff). Total: ~20-45K per review pass.

Single-Pass Flow

Read the diff once. Run both review and simplification analysis on the same context. This saves ~40-50% tokens vs. invoking separate review and simplify agents.

Step 1: LOAD (once)

# Detect context: pre-commit (HEAD has uncommitted changes) vs post-commit (standalone)
DIFF_STAT=$(git diff HEAD --stat 2>/dev/null || echo "")
if [ -n "$DIFF_STAT" ]; then
  REF="HEAD"   # pre-commit self-review: review uncommitted changes
else
  REF="HEAD~1" # standalone invocation: review last committed change
fi
DIFF=$(git diff "$REF" --stat)
DIFF_LINES=$(git diff "$REF" --numstat | awk '{s+=$1+$2} END {print s}')
CHANGED_FILES=$(git diff "$REF" --name-only)

Step 2: PIPELINE (structured checks)

Run deterministic checks on each changed file:

CheckToolThresholdFinding Type
Cognitive complexitylegacy/scripts/verification/complexity-check.sh> 15 per functioncomplexity
Nesting depthgrep-based> 4 levelscomplexity
Function lengthline count> 50 linesmaintainability
File lengthline count> 800 linesmaintainability
Near-duplicatescontent hash> 6 similar linesmaintainability
Hardcoded secretspattern matchany matchsecurity
Injection vectorspattern matchany matchsecurity
Naming conventionsproject configdeviationstyle

Step 3: AGENTIC (contextual analysis)

LLM analyzes the diff with pipeline findings as context:

AnalysisWhat to CheckScore Impact
Logic correctnessEdge cases, boundary conditions, null/undefined, off-by-onecorrectness score
Intent alignmentAcceptance criteria match, no scope creep, no missing requirementscorrectness score
Cross-file impactBreaking API changes, dependency effects, import correctnesscorrectness + security
Simplification opportunitiesExtract Method candidates, reducible nesting, inlineable abstractionsmaintainability score
Performance concernsN+1 queries, missing indexes, unnecessary allocations, blocking callsperformance score
Security reviewAuth checks, input validation, error info leakagesecurity score

Step 4: SCORE & REPORT

Aggregate findings into the multi-dimensional scoring output (see below).

Multi-Dimensional Scoring

Four dimensions, each scored 0.0 to 1.0. Replaces binary PASS/FAIL with actionable numeric scores.

DimensionWeightWhat It MeasuresScore Guide
correctness0.35Logic errors, edge cases, intent alignment, test coverage1.0 = no issues; 0.7 = minor edge case; 0.3 = logic bug; 0.0 = critical flaw
security0.25Injection, auth, secrets, input validation, error leakage1.0 = hardened; 0.7 = minor gap; 0.3 = exploitable; 0.0 = critical vuln
performance0.15Complexity, N+1, blocking, memory, unnecessary work1.0 = optimal; 0.7 = acceptable; 0.3 = slow path; 0.0 = denial-of-service risk
maintainability0.25Readability, complexity, duplication, naming, file size1.0 = clean; 0.7 = minor smell; 0.3 = high cognitive load; 0.0 = unmaintainable

Composite score: composite = 0.35*correctness + 0.25*security + 0.15*performance + 0.25*maintainability

Verdict mapping:

CompositeVerdictAction
>= 0.8PASSShip immediately
0.6 - 0.79WARNShip with noted issues; simplification recommended
< 0.6FAILBlock shipping; fix required

Simplification trigger: If maintainability < 0.7, auto-generate simplification suggestions (see Simplification Catalog).

Confidence: Each dimension includes a confidence (0.0-1.0). If any dimension's confidence < 0.7, escalate to WARN regardless of score.

Adaptive Depth Routing

Scale analysis intensity with diff complexity. Small changes get lightweight review; large changes get full multi-agent analysis.

TierTriggerPipelineAgenticToken Budget
Lightweight< 50 changed lines, 1-3 filesFull pipeline checksSingle-pass agentic (no specialists)~10-15K
Standard50-200 lines, 3-10 filesFull pipeline checksFull agentic analysis (all 5 checks)~20-35K
Full Review> 200 lines, 10+ files, or security-sensitiveFull pipeline checksMulti-agent specialist panel: correctness + security + performance agents~40-80K

Security-sensitive detection: Files matching these patterns auto-escalate to full review:

  • auth*, *login*, *password*, *token*, *secret*
  • *payment*, *billing*, *checkout*
  • *eval*, *grader*, *.evolve/evals/*
  • Any file in agents/, skills/*/SKILL.md

Risk-based routing: Files with high churn (> 5 commits in last 10 cycles) or high fan-in (imported by > 5 other files) get escalated one tier.

Integration Hooks

Evolve-Loop Auditor Integration

The auditor invokes this skill as an optional enhancement to its review pass:

Auditor Standard Flow:
  1. Read build-report.md
  2. Run code quality checks          ← ENHANCED by pipeline layer
  3. Run security checks               ← ENHANCED by security scan
  4. Run hallucination detection        (unchanged)
  5. Run pipeline integrity checks      (unchanged)
  6. Run eval verification              (unchanged)
  7. Generate verdict                   ← ENHANCED by multi-dimensional scoring

Auditor invocation: When the auditor encounters code changes (not doc-only or config-only), it can invoke this skill's structured checks to supplement its review. The skill's composite score feeds into the auditor's verdict logic.

Configuration in evolve-auditor.md:

### Optional Skill Consultation
- **code-review-simplify**: For code changes, invoke `skills/code-review-simplify/SKILL.md` 
  pipeline layer. Use composite score to supplement verdict. If maintainability < 0.7, 
  append simplification suggestions to audit-report.md.

Evolve-Loop Builder Integration

The builder can invoke this skill post-implementation for self-review:

Builder Self-Review (after implementation, before reporting):
  1. Run eval graders (existing)
  2. Run code-review-simplify lightweight tier
  3. If maintainability < 0.7: apply simplification suggestions before reporting
  4. Include self-review score in build-report.md

Builder invocation: After implementing a task and before writing build-report.md, the builder runs this skill's lightweight tier on its own changes. Simplification suggestions with maintainability < 0.7 are applied inline. This catches issues before the auditor sees them, reducing audit-fix cycles.

Standalone Invocation

The skill can be invoked directly outside the evolve-loop:

# Review + simplify changed files
/evo:code-review-simplify [--tier lightweight|standard|full] [--files <paths>]

Simplification Catalog

When maintainability < 0.7, generate simplification suggestions from this catalog. Prioritize by impact and confidence.

CategoryTechniqueWhen to ApplyConfidence
ComplexityExtract MethodFunction > 30 lines or complexity > 10High (0.9)
ComplexityFlatten nestingNesting > 3 levels, guard clauses applicableHigh (0.9)
ComplexityDecompose conditionalComplex boolean expressions (> 3 operators)High (0.85)
DuplicationExtract shared utilityNear-duplicate blocks (> 6 lines, > 80% similar)Medium (0.75)
ReadabilityRename for clarityAmbiguous names (< 3 chars, generic like data/temp)Medium (0.7)
ReadabilityReplace magic numbersHardcoded literals in logic branchesHigh (0.85)
AbstractionInline over-abstractionSingle-use wrapper with no added valueMedium (0.7)
AbstractionRemove dead codeUnreachable branches, unused imports/varsHigh (0.9)

Constraints:

  • Only suggest localized refactorings (same file or module). LLMs are weak at cross-module architectural refactoring.
  • Max 5 simplification suggestions per review. Focus on highest-impact.
  • Each suggestion must include before/after code snippets and estimated complexity reduction.
  • Never suggest simplification that changes external behavior (pure refactoring only).

Output Schema

The skill produces a structured report:

# Code Review + Simplify Report

## Summary
- **Tier:** lightweight | standard | full review
- **Changed:** X files, Y lines
- **Composite Score:** 0.XX
- **Verdict:** PASS | WARN | FAIL

## Dimension Scores
| Dimension | Score | Confidence | Key Finding |
|-----------|-------|------------|-------------|
| correctness | 0.X | 0.X | <summary> |
| security | 0.X | 0.X | <summary> |
| performance | 0.X | 0.X | <summary> |
| maintainability | 0.X | 0.X | <summary> |

## Issues (priority-ranked)
| # | Severity | Dimension | File:Line | Description | Suggestion |
|---|----------|-----------|-----------|-------------|-----------|

## Simplification Suggestions
| # | Technique | File:Line | Before (snippet) | After (snippet) | Impact |
|---|----------|-----------|-------------------|-----------------|--------|

## Pipeline Findings
<structured check results>

## Agentic Findings
<contextual analysis results>

JSON variant (for programmatic consumption by auditor/builder):

{
  "tier": "lightweight|standard|full",
  "composite": 0.0,
  "verdict": "PASS|WARN|FAIL",
  "dimensions": {
    "correctness": {"score": 0.0, "confidence": 0.0, "findings": []},
    "security": {"score": 0.0, "confidence": 0.0, "findings": []},
    "performance": {"score": 0.0, "confidence": 0.0, "findings": []},
    "maintainability": {"score": 0.0, "confidence": 0.0, "findings": []}
  },
  "simplifications": [],
  "issueCount": {"critical": 0, "high": 0, "medium": 0, "low": 0}
}

Keep looking

Skills are one crate of 628,853. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.