agentleFS
timmo001timmo001/skills/cleanup-unnecessary-variables/SKILL.md

cleanup-unnecessary-variables

Skill2 starsChanged todayApache-2.0View on GitHub

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.

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

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

    line 9
  2. Distinctive:

    Do not remove a value that is reused, mutated, or intentionally named for readability.

    line 13
  3. Very specific:

    Remove no-op aliases such as const x = y when direct usage is clearer.

    line 17
  4. Very specific:

    Treat aliases of instance fields or parameters (const params = this._params, const value = props.value) as no-op aliases unless they …

    line 18
  5. Very specific:

    Do not introduce any.

    line 22
  6. Very specific:

    Do not use the non-null assertion operator (!).

    line 23
  7. Distinctive:

    Do not add unnecessary comments or abstractions.

    line 24

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.
  • Do not introduce any.
  • Do not use the non-null assertion operator (!).
  • Do not add unnecessary comments or abstractions.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.