Naming Variables

Choose names that fully and accurately describe what the variable represents

43 stars 26 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add obra/clank --skill Naming Variables
Manual install
git clone --depth 1 https://github.com/obra/clank.git /tmp/clank
mkdir -p ~/.claude/skills
cp -r /tmp/clank/skills/coding/naming-variables ~/.claude/skills/Naming-Variables

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Naming Variables

## Overview

The most important consideration in naming a variable is that the name fully and accurately describes the entity the variable represents.

**Core principle:** A variable and its name are essentially the same thing. The goodness or badness of a variable is largely determined by its name.

**Name quality = Design quality.** If you struggle to name something well, that's a warning sign about the design.

## When to Use

**Always use when:**
- Naming any variable, function, class, parameter, constant
- Reviewing code with unclear names
- Struggling to understand what a variable does

**Warning signs you need better names:**
- Variables named `x`, `x1`, `x2`, `temp`, `data`, `info`, `val`
- Can't remember what a variable does
- Need to search back to find variable's purpose
- Abbreviations that aren't obvious
- Names that could mean multiple things
- Struggling to name something (indicates design problem)

## Naming Principles

### 1. Describe What, Not How

**Problem-oriented** (what it represents) not **solution-oriented** (how it's implemented):

✅ **Good:** `employeeData`, `printerReady`, `totalRevenue`
❌ **Bad:** `inputRec`, `bitFlag`, `calcVal`

The bad names describe computing concepts (input, record, bit, calculation). Good names describe the problem domain (employee, printer, revenue).

### 2. Use Optimal Name Length

**Optimal: 10-16 characters average**
- Too short: doesn't convey meaning
- Too long: hard to type, obscures structure
Read the full skill on GitHub

Details

Skill name
Naming Variables
Repository
obra/clank
Path
skills/coding/naming-variables/SKILL.md
Repo updated
9 October 2025

FAQ

What does the Naming Variables skill do?

Choose names that fully and accurately describe what the variable represents

How do I install the Naming Variables skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add obra/clank --skill Naming Variables. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Naming Variables popular?

It lives in obra/clank, which has 43 GitHub stars and 26 forks.

Related skills

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.