naming-things

A guide for choosing clear names for variables, functions, types, constants, and files.

In plain words
What is it for?
Use it when creating code, reviewing confusing names, or making terminology consistent during a refactor.
Why use it?
It makes code easier to understand by replacing vague names, unnecessary abbreviations, and inconsistent terms with names that show meaning and intent.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/wade-devcode/awesome-coding-skills-cn/naming-things
Any agent
npx skills add Wade-DevCode/awesome-coding-skills-cn --skill naming-things
Clone the repo
git clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cn

Made for: Claude Code, Codex.

Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,179 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00024 $0.02179
Opus 5 $0.00012 $0.01090
Sonnet 5 $0.00005 $0.00436
Haiku 4.5 $0.00002 $0.00218

Measured 2d ago against content hash f93fa5cc58b0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

naming-things scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/naming-things/SKILL.md · 144 lines

How it starts

The opening of the file, as written. The whole thing — 144 lines — stays where its author put it; the contents beside it link to each section on GitHub.

命名之道

何时用

  • 新建变量、函数、类、接口、常量、文件时。
  • review 代码发现读了三遍还不明白某个名字是什么意思。
  • 重构阶段整理命名一致性,消除同一概念在项目里的多种叫法。
  • 发现自己犹豫"这个变量叫 d 还是 data 还是 result"时。

核心规则

1. 名字说"是什么/做什么",不说"怎么做";避免缩写与匈牙利命名

规则: 名字应表达业务语义或功能意图,不暴露实现机制;除公认缩写(URL、HTTP、ID)外不缩写,不加类型前缀。

为什么: AI 生成的代码里频繁出现 strNamearrItemsbIsValid(匈牙利命名)或 tmpresd(无意义缩写)。读者看到 strName 不但没获得额外信息(类型系统已知道它是 string),反而被迫在脑中翻译。缩写制造认知负担:是 mgr 还是 manager?是 usr 还是 user?项目大了以后每个人缩写规则不同,读起来像乱码。

怎么做:

  • 写出完整单词:invoiceTotal 而非 invTot,userRepository 而非 usrRepo
  • 去掉类型前缀:isActive 而非 bIsActive,items 而非 arrItems
  • 例外:循环变量 i/j、数学公式里的 x/y 等约定俗成的短名可保留。

2. 布尔用 is/has/can;函数用动词;集合用复数

规则: 按照名字的语法角色选前缀/形式:布尔量用 is/has/can/should,函数/方法用动词短语,集合类型用复数名词。

为什么: AI 生成的代码常出现 active(布尔?状态枚举?名词?)、data()(函数?属性?做什么?)、item(一个?列表?)这类模糊命名。读者必须跳到定义处才知道类型,增加认知跳跃次数。命名的语法结构是免费的文档:看到 isLoading 立刻知道是 bool,看到 fetchUser() 立刻知道是动作且有 I/O。

怎么做:

  • 布尔:isLoadinghasPermissioncanEditshouldRetry
  • 函数:getUserById()validateEmail()sendNotification()
  • 集合:usersorderItemspendingTasks(复数)。
  • 避免:activeflagcheck()handle()process()——太泛,说不清做什么。

3. 一致性:同一概念全项目同一词,不混用 fetch/get/load

规则: 确定一个动词/名词后全项目统一使用,相同语义的操作不能在不同文件里用不同词。

为什么: AI 在不同上下文里会随意选词:getUserById 在一处、fetchUserById 在另一处、loadUser 在第三处,做的是完全相同的事。读者面对三种叫法会疑惑:有什么区别?哪个有缓存?哪个走网络?实际上三者等价,只是 AI 在不同时刻生成了不同的词。这种不一致积累到一定规模后,代码库变成"方言集合",新人入手极难。

怎么做:

  • 项目初期在 GLOSSARY.md 或 ADR 里约定核心动词:fetch=网络请求、get=本地/同步读取、load=带副作用的初始化。
  • review 时主动检查:新增函数的动词是否与现有命名一致。
  • 发现不一致,批量重命名统一,不要新旧并存。

4. 避免无意义名(data/info/manager/tmp)与误导名

规则: 禁止使用 datainfomanagerhandlerhelperutiltmpobj 等意义模糊的名字作为正式命名;不用听起来像 X 但实际是 Y 的名字。

为什么: AI 生成代码时最爱用 UserManagerDataHelperhandleStuff() 这类名字——因为它们"总能用上"。但这些名字不提供任何信息:什么数据?哪种管理?处理什么?误导名更危险:函数叫 saveUser 却同时发了邮件;变量叫 userList 里实际是 Map。读者建立了错误预期,bug 由此而生。

怎么做:

  • 用具体职责替换空洞词:UserManagerUserRegistrationService/UserSessionCache
  • 用行为描述替换 -helper/-util:formatCurrency()parseISO8601() 而非 DateHelper.format()
  • 名字不准确宁可改名,也别加注释解释"为什么名字不准确"。

Read the full file on GitHub · 144 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 144 lines · 24 tokens per session scan A f93fa5cc58b0

Subscribe to this mod's changes

naming-things is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (6 stars, last pushed 2mo ago), licensed MIT. It adds 24 tokens to every session and 2,179 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

chinese-documentation

中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-git-workflow

国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 69 tokens

brainstorming

在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.

jnMetaCode/superpowers-zh · 40 tokens

chinese-code-review

中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-commit-conventions

中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 65 tokens

mcp-builder

MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力.

jnMetaCode/superpowers-zh · 32 tokens