mmalyska/claude-plugins/simplify

Claude Code and agent skill by mmalyska/claude-plugins

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Reduce complexity in recently changed code — guard clauses, extract helpers, deduplicate, name constants and conditions. Apply after code review or before shipping. Never changes behavior; reverts any change that breaks tests.

Install

npx vskill@latest install mmalyska/claude-plugins/simplify

SKILL.md

The same SKILL.md was published earlier as mmalyska/claude-plugins/simplify.

Simplify

Read the workflow contract first. Select profile and topology independently; default STANDARD + SOLO. Apply mandatory project policy in every profile. This procedure does not authorize another actor or work beyond the requested stage.

Reduce unnecessary complexity in recently changed code without changing behavior.

Golden Rule: Preserve behavior and scope. Undo only your own failed simplification, preserving earlier user work; never reset or restore a whole file/worktree to roll back one edit.

When to Activate

  • After /review or code-reviewer agent identifies complexity issues (deep nesting, long functions, magic values, duplicated logic)
  • Before /ship when code passes tests but has structural noise
  • After implementing a feature — as a final cleanup pass before the quality gate
  • When you spot nesting depth ≥ 4, functions > 50 lines, or repeated 3-line blocks while writing code

Do not activate:

  • On code outside the current change scope
  • When all complexity findings are intentional (performance-critical tight loops, generated code, migrations)
  • When tests are failing — fix tests first

Phase 1 — SCOPE

If a specific file or directory was requested, use that as the scope.

Otherwise, use review scope selection: current unstaged, staged and task-relevant untracked files first, then the actual base comparison when clean. A recent commit is a target only when intended. Include docs/config when relevant; do not silently select an unrelated last commit.

QUICK removes obvious noise only; STANDARD evaluates clearer structure; DEEP records alternatives and maintenance tradeoffs. If nothing needs simplification, record a no-op assessment. Never expand scope to satisfy this skill.

Detect test command from project config:

MarkerCommand
package.jsonnpm test (or pnpm/yarn/bun test)
pytest.ini or pyproject.tomlpytest
go.modgo test ./...
Cargo.tomlcargo test
Makefile with test targetmake test
Repository unittest suiteDocumented python3 -B -m unittest discover -s tests

For documentation/configuration changes, a relevant installed linter or manual check may be the meaningful verification; do not invent code tests or fetch tools.

Phase 2 — SIMPLIFICATION PASSES

Run applicable passes sequentially. After each owned edit, rerun affected checks and mandatory project gates. If it regresses behavior, undo only that edit and verify recovery; stop if recovery fails. Report unavailable required checks as NOT RUN, never fabricate a green suite.

Pass 1 — Guard Clauses

Target: Functions with nesting depth ≥ 4.

Invert conditions and return early to flatten nesting:

javascript
// BEFORE
function validate(user) {
if (user) {
if (user.email) {
if (isValidEmail(user.email)) {
return processUser(user);
}
}
}
}
// AFTER
function validate(user) {
if (!user) return null;
if (!user.email) return null;
if (!isValidEmail(user.email)) return null;
return processUser(user);
}

Per function: identify deepest block → invert condition → add early return → unindent → run tests → revert on failure.


Pass 2 — Extract Helpers

Target: Functions longer than ~50 lines.

Extract cohesive sub-tasks to named helpers (name describes WHAT, not HOW):

javascript
// BEFORE: processOrder() — 50+ lines
// AFTER
function processOrder(order) {
const validated = validateOrderItems(order);
const priced = calculatePricing(validated);
saveToDatabase(priced);
sendConfirmation(priced);
}

Per function: find logical groupings → extract to named helper → replace with call → run tests → revert on failure.


Pass 3 — Deduplicate

Target: Repeated code blocks (3+ similar lines, 2+ occurrences) within the change scope.

Extract to a shared utility function. Do not reach outside the scope to deduplicate with unrelated code.

Per duplication: identify pattern → extract utility → replace both occurrences → run tests → revert on failure.


Pass 4 — Name Magic Values

Target: Hardcoded literals used in logic conditions (if (status === "PENDING"), if (count > 100)).

javascript
// BEFORE
if (items.length > 50) { ... }
// AFTER
const MAX_BATCH_SIZE = 50;
if (items.length > MAX_BATCH_SIZE) { ... }

Per literal: identify usage context → choose descriptive name → define constant at file/module top → replace → run tests → revert on failure.


Pass 5 — Name Complex Conditions

Target: Boolean expressions with 3+ operators.

javascript
// BEFORE
if (user.isActive && user.hasSubscription && !user.isBlocked || user.isAdmin) { ... }
// AFTER
const canAccess = (user.isActive && user.hasSubscription && !user.isBlocked) || user.isAdmin;
if (canAccess) { ... }

Name describes intent, not logic. Per condition: identify intent → extract to named variable or helper → replace → run tests → revert on failure.


Phase 3 — SUMMARY

text
## Simplification Summary
### Changes
- [file:line] — guard clauses: inverted N conditions in functionName
- [file:line] — extracted helper: helperName
- [file:line] — named constant: CONSTANT_NAME = value
- ...
### Skipped
- [file] — reason (e.g., "No deep nesting", "All changes reverted — tests failed")
### Tests
All N tests passing.

If nothing was simplified: Code is already clean — no simplifications applied.


Lifecycle Position

Follow the workflow contract. Simplify follows Review and precedes Ship readiness; rerun affected checks after edits. No-op is valid and neither simplification nor readiness authorizes delivery.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mmalyska/claude-plugins/simplify/badge)](https://verified-skill.com/skills/mmalyska/claude-plugins/simplify)

Something wrong with this skill or its page? Tell us.