← スキル一覧に戻る

variable-name-update
by kishan04rajput
⭐ 0🍴 0📅 2026年1月24日
SKILL.md
name: variable-name-update description: Guidelines and systematic process for updating variable, function, and class names to improve code readability and maintainability.
Variable Name Update Skill
Use this skill when you need to rename variables, functions, classes, or other identifiers. Clear naming is fundamental to code maintainability.
1. Naming Best Practices
- Be Descriptive: A variable name should clearly describe the data it holds (e.g.,
userListinstead oful). - Avoid Abbreviations: Use full words unless the abbreviation is universally understood (e.g.,
id,html). - Use Consistent Casing:
- JavaScript/TypeScript:
camelCasefor variables and functions,PascalCasefor classes. - Python/Ruby on rails:
snake_casefor variables and functions,PascalCasefor classes.
- JavaScript/TypeScript:
- Context Awareness: Use names that make sense within their scope. In a short loop,
imight be fine, but for a global constant,MAX_RETRY_COUNTis better. - Boolean Naming: Use prefixes like
is,has, orcan(e.g.,isVisible,hasPermission).
2. Systematic Update Process
A. Identify and Scope
- Target: Clearly identify the identifier(s) to be renamed.
- Scope: Determine if the change is local (within a function), module-level, or global (used across multiple files).
- Impact: Check for usages in string literals, dynamic property access (e.g.,
obj[dynamicKey]), or external APIs.
B. Execute Rename
- LSP/Refactoring Tools: If your IDE/environment supports it, use automated rename tools to ensure all references are updated reliably.
- Manual Grep: If automated tools are unavailable, use
greporripgrepto find all occurrences across the project. - Minimum Change: Only change the necessary identifiers to avoid unnecessary diff noise.
C. Verify and Validate
- Code Integrity: Ensure that the logic remains unchanged. Renaming should be a "pure" refactor.
- Build/Lint: Run tests and linters to ensure no syntax errors were introduced.
- Regression Check: Verify that related functionalities still work as expected.
3. Common Pitfalls to Avoid
- Shadowing: Don't rename a variable to match one in an outer scope.
- Magic Strings: Be careful when renaming keys that are also used as strings (e.g., in JSON or database queries).
- Breaking Public APIs: If the identifier is exported or part of a public API, consider the impact on consumers.
[!IMPORTANT] Always think before you rename. A good name should explain "what" it is and "why" it exists, not "how" it is used.
スコア
総合スコア
35/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です