global-coding-style
遵循DRY和YAGNI原则在整个代码库中保持一致的编码风格、格式和命名约定。在任何语言或框架中编写或重构任何代码时使用此技能,以确保一致的缩进、命名模式、函数大小和代码组织。在命名变量、函数、类或文件,使用适当的间距和换行符格式化代码,删除死代码或未使用的导入,将重复的逻辑提取为可重用函数,或确保小而专注的函数做好一件事时应用此技能。此技能确保整个代码库通过自动化格式化工具(Prettier、Black、ESLint)保持统一风格,遵循既定的命名约定(camelCase、PascalCase、snake_case),避免代码重复,删除注释掉的代码,并优先考虑可读性和可维护性而不是巧妙性。
📖 中文导读:遵循DRY和YAGNI原则在整个代码库中保持一致的编码风格、格式和命名约定。在任何语言或框架中编写或重构任何代码时使用此技能,以确保一致的缩进、命名模式、函数大小和代码组织。在命名变量、函数、类或文件,使用适当的间距和换行符格式化代码,删除死代码或未使用的导入,将重复的逻辑提取为可重用函数,或确保小而专注的函数做好一件事时应用此技能。此技能确保整个代码库通过自动化格式化工具(Prettier、Black、ESLint)保持统一风格,遵循既定的命名约定(camelCase、PascalCase、snake_case),避免代码重复,删除注释掉的代码,并优先考虑可读性和可维护性而不是巧妙性。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Global Coding Style description: Maintain consistent coding style, formatting, and naming conventions across the entire codebase following DRY and YAGNI principles. Use this skill when writing or refactoring any code in any language or framework to ensure consistent indentation, naming patterns, function size, and code organization. Apply this skill when naming variables, functions, classes, or files, when formatting code with proper spacing and line breaks, when removing dead code or unused imports, when extracting duplicated logic into reusable functions, or when ensuring small focused functions that do one thing well. This skill ensures the entire codebase maintains uniform style through automated formatting tools (Prettier, Black, ESLint), follows established naming conventions (camelCase, PascalCase, snake_case), avoids code duplication, removes commented-out code, and prioritizes readability and maintainability over cleverness.
Global Coding Style
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle global coding style.
When to use this skill
- When writing any new code in any file across the project
- When refactoring existing code to improve readability and maintainability
- When naming variables, functions, classes, files, or modules
- When formatting code (indentation, spacing, line breaks, bracket placement)
- When ensuring consistent naming conventions (camelCase for JS, snake_case for Python, etc.)
- When identifying and extracting duplicated code (DRY principle)
- When removing dead code, commented-out blocks, or unused imports
- When breaking down large functions into smaller, focused single-purpose functions
- When configuring or using code formatters (Prettier, Black, ESLint, RuboCop)
- When setting up linting rules or EditorConfig for the project
- When ensuring code follows team or language-specific style guides
- When deciding whether to build new functionality or use existing solutions (YAGNI principle)
- When avoiding premature optimization or unnecessary abstraction
Instructions
For details, refer to the information provided in this file: global coding style