dev-code-quality
Code Quality Standards. Use it everytime you plan or implement any code.
When & Why to Use This Skill
This Claude skill serves as a comprehensive framework for universal code quality standards, designed to ensure that every line of code is clean, maintainable, and professional. By integrating best practices for naming conventions, function design, and error handling, it empowers developers to reduce technical debt and improve team collaboration through consistent architectural patterns.
Use Cases
- Automated Code Review: Use the skill as a standardized checklist during peer reviews to identify anti-patterns, such as magic numbers, poor naming, or excessive function parameters.
- Development Planning: Apply these standards during the design phase to establish clear naming conventions and structural rules before implementation begins.
- Refactoring Legacy Code: Utilize the guidelines to systematically clean up older codebases, ensuring functions follow the single responsibility principle and improve overall system reliability.
- Onboarding and Mentorship: Provide junior developers with a clear set of quality benchmarks to follow, ensuring their contributions align with professional engineering standards.
| name | dev-code-quality |
|---|---|
| description | Code Quality Standards. Use it everytime you plan or implement any code. |
Universal Code Quality Standards
Naming Conventions (adapt to language case style)
- Classes/Types: nouns that represent concepts
- Functions/Methods: verbs that describe actions
- Booleans: questions (is/has/can/should)
- Constants: descriptive, not abbreviated
- Avoid: abbreviations, single letters (except i,j for loops), mental mapping
Function Design
- Single responsibility
- Maximum 3-4 parameters
- One level of abstraction
- No side effects unless name indicates
- Early returns for guard clauses
- Pure functions when possible
Code Organization
- Group related code together
- Order: public before private
- Most important/high-level code first
- Dependencies at top
Comments
- Why, not what (code explains what)
- Explain non-obvious business rules
- Document gotchas and workarounds
- Keep comments updated with code
- Prefer self-documenting code over comments
Error Handling
- Fail fast, fail clearly
- Specific error types
- Include context in error messages
- Don't swallow exceptions
- Log appropriately
Magic Numbers
- Extract to named constants
- Explain the meaning, not just the value