Localizing Variables

Installation
SKILL.md

Localizing Variables

Overview

The Principle of Proximity: Keep related actions together. Declare variables in the smallest scope possible, initialize them close to where they're first used, and keep all references to a variable close together.

Core principle: Minimize the window of vulnerability. The smaller the scope and the closer the references, the less can go wrong and the easier code is to understand.

Goal: Reduce what you must keep in mind at any one time.

When to Use

Apply to every variable you declare:

  • When declaring variables
  • When initializing variables
  • When reviewing code with scattered variable usage
  • When refactoring to improve clarity
Installs
Repository
obra/clank
GitHub Stars
40
First Seen
Localizing Variables — obra/clank