Skip to content
Back to skills

Simplify

ASecurity

Scan changed files for complexity patterns: deep nesting, local duplication, dead code, magic values, conditional simplification. Apply minimal safe refactors to improve readability.

  • 4 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added October 9, 2026
ai-agentsbashexpressgit

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add marcoguillermaz/Tierward --skill simplify --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Simplify?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Simplify
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/marcoguillermaz-simplify/badge)](https://www.skillsdirectory.com/skills/marcoguillermaz-simplify)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: simplify
description: Scan changed files for complexity patterns: deep nesting, local duplication, dead code, magic values, conditional simplification. Apply minimal safe refactors to improve readability.
user-invocable: true
model: haiku
context: fork
background: false
allowed-tools: Read Glob Grep Bash(git:*) Edit
---

## Applicability

Run on files changed in the current block after writing (Phase 2). Skip for trivial 1-file changes with <20 lines modified.

**Input**: the user invokes `/simplify` optionally followed by file paths. If no paths given, use `git diff --name-only HEAD` to find changed files. Filter to source files only (skip config, docs, generated files).

---

## Step 1 - Scan each file for simplification opportunities

For every source file in scope, check these 6 patterns:

### S1 - Early returns
Nested `if/else` where the `else` (or `if`) branch is a short return, throw, or continue. Invert the condition and return early to flatten the block.

### S2 - Nesting depth
Any block nested >3 levels deep. Extract the inner logic into a named function, or apply guard clauses (S1) to reduce depth.

### S3 - Local duplication
Two or more blocks within the same file that repeat the same logic (>3 lines identical or near-identical). Extract into a local helper.

### S4 - Conditional simplification
- Ternaries nested inside ternaries
- Boolean expressions that can collapse (`if (x) return true; return false;` → `return x;`)
- Switch/match with identical arms that can be merged

### S5 - Dead code
- Unreachable code after return/throw/break
- Commented-out code blocks (>3 lines)
- Unused local variables, parameters, or imports (only flag if confidence is high)

### S6 - Magic values
Repeated literal values (strings, numbers) used >2 times in the same file. Extract to a named constant at file/module scope.

---

## Step 2 - Apply fixes

For each finding:
1. Apply the simplification directly using the Edit tool.
2. Keep changes minimal - do not restructure surrounding code.
3. Preserve existing tests - if a rename would break imports, skip it.

---

## Step 3 - Summary

Output a compact summary:

```
/simplify - [N] files scanned, [M] changes applied

| File | Change | Pattern |
|---|---|---|
| path/to/file.ext | description of change | S1/S2/S3/S4/S5/S6 |
```

If no changes needed: `/simplify - [N] files scanned, all clean ✓`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.