Single Purpose Variables
CommunityOne variable, one meaning, zero confusion.
Software Engineering#code quality#bug prevention#software design#clean code#readability#maintainability#variable naming
Authorbarrydobson
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill eliminates "hybrid coupling" and hidden meanings in variables, which lead to confusion, bugs, and hard-to-read code. It ensures each variable clearly represents a single concept, making code more predictable and easier to understand.
Core Features & Use Cases
- Clarity & Predictability: Enforces that a variable's meaning never changes or has special, hidden interpretations (e.g.,
-1meaning error). - Prevents Hybrid Coupling: Guides you to separate concerns, using distinct variables for different purposes (e.g., a count and an error flag).
- Reduces Bugs: Minimizes errors caused by misinterpreting a variable's current state or purpose, improving code reliability.
- Use Case: Instead of having
page_count = -1to indicate an error, use this skill to create a separateprocessing_failed = Trueboolean variable, ensuringpage_countalways represents a valid count.
Quick Start
Analyze the attached Python function. Identify any variables that serve multiple purposes or have hidden meanings (e.g., special values for errors) and suggest how to refactor them into single-purpose variables.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: Single Purpose Variables Download link: https://github.com/barrydobson/dotfiles_extra/archive/main.zip#single-purpose-variables Please download this .zip file, extract it, and install it in the .claude/skills/ directory.