Skip to content
Back to skills

Cleanup Unnecessary Variables

ASecurity

Safe removal of unnecessary variables during code review and refactoring. Use when simplifying code, inlining temporary or single-use variables, or removing redundant aliases, while preserving runtime behaviour, evaluation order, and variables kept for readability or debugging.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 24, 2026
code-qualitydebuggingrefactoring

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add timmo001/skills --skill cleanup-unnecessary-variables --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cleanup Unnecessary Variables?

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

Security grade badge for Cleanup Unnecessary Variables
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/timmo001-cleanup-unnecessary-variables/badge)](https://www.skillsdirectory.com/skills/timmo001-cleanup-unnecessary-variables)

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: cleanup-unnecessary-variables
license: Apache-2.0
description: Safe removal of unnecessary variables during code review and refactoring. Use when simplifying code, inlining temporary or single-use variables, or removing redundant aliases, while preserving runtime behaviour, evaluation order, and variables kept for readability or debugging.
---

# Cleanup Unnecessary Variables

Use this skill when reviewing or editing cleanup/refactor changes that remove or inline variables:

- The candidate must be local and non-exported.
- Preserve evaluation order and runtime behavior.
- Do not remove a value that is reused, mutated, or intentionally named for readability.
- Skip values with side-effectful initializers unless inlining keeps the same single execution.
- Skip public constants, config or env bindings, and values used as debug breakpoints or log anchors.
- Inline single-use temporary variables directly at the use site when safe.
- Remove no-op aliases such as `const x = y` when direct usage is clearer.
- Treat aliases of instance fields or parameters (`const params = this._params`, `const value = props.value`) as no-op aliases unless they preserve a required snapshot, narrowing across async boundaries, evaluation order, or readability for repeated complex access.
- Inline object literals that are constructed only to be passed immediately to one function or event payload, when doing so preserves clarity and behavior.
- Drop dead assignments and declarations that are never read.
- Flatten deep nesting via guard clauses and early returns when it reduces indentation without obscuring control flow.

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 code-quality →

Comments

Loading comments…

Newsletter

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