AgentSkillsCN

Global Coding Style

在整个代码库中保持一致的编码风格、格式与命名规范,遵循DRY与YAGNI原则。当编写或重构任何语言或框架的代码时,使用此技能,确保缩进、命名模式、函数大小与代码组织一致。在命名变量、函数、类或文件时,使用此技能,当以恰当空格与换行格式化代码,当移除死代码或未使用的导入,当提取重复逻辑到可复用函数,或当确保小而专注的函数做好一件事时,应用此技能。此技能确保整个代码库通过自动化格式化工具(Prettier、Black、ESLint)保持统一风格,遵循既定命名规范(camelCase、PascalCase、snake_case),避免代码重复,移除注释掉的代码,优先考虑可读性与可维护性而非聪明技巧。

SKILL.md
--- frontmatter
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