Naming Variables

Resolve cryptic variable names with descriptive alternatives and naming conventions.

Updated Nov 27, 2025
One-click install
npx skills add https://github.com/barrydobson/dotfiles_extra --skill naming-variables
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Naming Variables
Source: https://github.com/barrydobson/dotfiles_extra/tree/main/packages/claude/dot-claude/skills/coding/naming-variables
Command: npx skills add https://github.com/barrydobson/dotfiles_extra --skill naming-variables

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates cryptic, ambiguous, or generic variable names that make code hard to understand, debug, and maintain. It provides comprehensive principles and conventions to ensure every name accurately and fully describes its purpose, making code self-documenting and intuitive.

Core Features & Use Cases

  • Descriptive Naming: Guides you to use names that describe "what" a variable represents in the problem domain, not "how" it's implemented.
  • Optimal Length & Scope: Provides guidelines for name length based on variable scope, balancing descriptiveness with conciseness.
  • Consistent Conventions: Establishes standards for naming booleans (is_valid), collections (users), constants (MAX_RETRIES), and computed values (revenue_total).
  • Use Case: Instead of x = x - xx, this skill guides you to use balance = balance - last_payment, making the code's intent immediately clear. It also helps diagnose design problems when a name is hard to find.

Quick Start

Review the attached Python function. Identify any variables with vague, generic, or misleading names. Suggest improved names following the principles of descriptiveness, optimal length, and consistent conventions.

Frequently Asked Questions about Naming Variables

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I improve variable names to make code more readable?

Replace cryptic or generic variable names with descriptive alternatives that explain what the variable represents in your problem domain. Use names like `balance` instead of `x`, and `last_payment` instead of `xx` to make code self-documenting and easier to debug and maintain.

What naming conventions should I follow for booleans, collections, and constants?

Use `is_` or `has_` prefixes for booleans (`is_valid`), plural forms for collections (`users`), uppercase with underscores for constants (`MAX_RETRIES`), and qualifiers at the end for computed values (`revenue_total`).

How do I choose the right length for variable names?

Balance descriptiveness with conciseness based on variable scope. Wider scopes need longer, more descriptive names; tighter scopes can use shorter names. Avoid abbreviations that sacrifice clarity; a name's length should match how often developers encounter it.

When is a variable name too vague or misleading?

A name is too vague when it doesn't describe what the variable represents in your domain, relies on abbreviations, or uses generic terms like `data` or `value`. If you struggle to name something, it often signals an underlying design problem worth investigating.

Can this approach help during code reviews?

Yes. This skill applies during design reviews or whenever readability is compromised by cryptic names or abbreviations, helping teams enforce consistent naming principles and catch clarity issues before they propagate.