Skip to content
Back to skills

Simplify Code

ASecurity

Cuts the length and nesting of one function without changing what it does, and proves it with before and after tests.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 15, 2026
ai-agents

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill simplify-code --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Simplify Code?

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

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

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-code
description: Cuts the length and nesting of one function without changing what it does, and proves it with before and after tests.
argument-hint: "[function name or file:line]"
user-invocable: true
disable-model-invocation: true
---

Simplify this function without changing behavior: $ARGUMENTS

1. Read the function and its callers. Record the starting numbers: lines, deepest nesting level, count of branches.
2. Make sure tests cover it. If a path is untested, add a test for it first, using real inputs from the code. Run them.
3. Apply, in this order, and stop when the code reads cleanly: guard clauses instead of nested else; remove branches that cannot happen; merge duplicated branches; replace flag variables with direct returns; use the language's built-ins (map, filter, any, get with default) over hand loops; delete unused variables and parameters that no caller passes.
4. Keep the same inputs, outputs, exceptions and side effects, including their order. If a change might alter behavior in an edge case, do not make it; list it instead.
5. Run the tests after the edit and compare with the starting numbers.

Show the old and new function side by side with the numbers. Do not touch other functions or ask to commit before showing the diff.

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.