帮助你为变量选择清晰准确、易维护的命名,提升代码可读性。
该技能材料显示其本质是开源的纯提示/文档型命名规范,无需密钥、无远程端点、未见本地执行或数据外发行为,整体低风险。主要不确定性在于仓库星标低、许可证未声明、维护状态未知,但不足以单独提升为高风险。
材料明确注明不需要任何密钥或环境变量;作为纯提示/文档型技能,未见凭证收集、存储或滥用场景。
未声明任何远程端点,且系统检查项标记为 prompt-only;未见将用户内容发送到外部服务的事实依据。
从描述与 README 看,该技能仅提供变量命名建议,不涉及本机起进程、脚本执行或系统能力调用。
材料未显示其需要读取、写入或枚举本地文件、代码库或其他数据资源;属于内容指导型技能。
来源为 GitHub 开源仓库,源码原则上可审计,这有助于降低风险;但仓库 0 star、许可证未声明、维护状态未知,供应链成熟度与持续维护性存在不确定性。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "Naming Variables" 技能: 1. 下载 https://raw.githubusercontent.com/obra/clank/main/skills/coding/naming-variables/SKILL.md 2. 保存为 ~/.claude/skills/naming-variables/SKILL.md 3. 装好后重载技能,告诉我可以用了
请检查这段代码中的变量命名,并把含糊不清的变量改成更准确、可读的名字,说明每个修改的理由: let d = new Date(); let x = users.filter(u => u.active); let n = x.length;
返回重命名后的代码,并逐项解释新变量名为何更贴合实际含义。
我在一个 JavaScript 项目里混用了缩写、拼音和不一致的命名方式。请根据语义清晰、风格统一的原则,给出变量命名规范,并示范如何修改下面的变量名:userNm、shijian、tmpVal、list2。
给出简明命名规范,并提供更统一、更具描述性的变量名建议。
我在写电商订单逻辑,需要为这些变量取名:用户首次下单时间、可退款金额、已发货商品数量、是否满足免邮条件。请给出简洁但完整准确的英文变量名,并说明命名思路。
输出一组适合业务代码使用的英文变量名,并附上命名依据说明。
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.
Always use when:
Warning signs you need better names:
x, x1, x2, temp, data, info, valProblem-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).
Optimal: 10-16 characters average
| Too Long | Too Short | Just Right |
|---|---|---|
numberOfPeopleOnTheUsOlympicTeam | n, np, ntm | numTeamMembers, teamMemberCount |
numberOfSeatsInTheStadium | n, ns, nsisd | numSeatsInStadium, seatCount |
maximumNumberOfPointsInModernOlympics | m, mp, max | teamPointsMax, pointsRecord |
Exception: Short names OK for very limited scope (loop index i in 3-line loop)
i, j acceptableShort name says: "I'm a scratch value with limited scope, don't look for me elsewhere"
Effective technique: state in words what the variable represents. Often that statement IS the best name.
Example:
runningTotal or checkTotalvelocity, trainVelocity, velocityInMphcurrentDate, todaysDatePut qualifiers like Total, Sum, Average, Max, Min, Count at the END:
✅ Good: revenueTotal, expenseAverage, pointsMax, customerCount
❌ Bad: totalRevenue mixed with revenueTotal (inconsistent)
Why:
revenueTotal, revenueAverage, revenueMaxtotalRevenue vs revenueTotal - pick one convention)Exception: Num is ambiguous
numCustomers (count of all customers)customerNum (specific customer number)Count for total, Index for specific: customerCount, customerIndexDon't be clever. Use the ordinary, obvious words:
✅ currentDate, employeeName, accountBalance
❌ cd, empNm, acctBal
Programmers sometimes overlook using ordinary words, which is often the easiest solution.
Names that are too general can be used for anything = not informative:
❌ Bad: x, temp, data, info, value, variable
✅ Good: discriminant, oldRoot, errorMessage, customerInfo, totalRevenue
Generic names acceptable ONLY for very limited scope.
Standard patterns for consistency and clarity:
…
帮助你撰写不过时的代码注释,聚焦做什么与为什么而非时序背景。
系统性沿调用链逆向排查缺陷,快速定位问题的最初触发点
帮助开发者为代码补充设计意图注释,聚焦原因与关键取舍而非表面功能。
并行分派多个智能体,同时调查并修复彼此独立的问题
帮助开发者规范完成开发分支收尾,支持合并、提 PR 或清理流程。
通过为每个任务分派独立子代理并穿插代码审查,稳步推进实现计划。