Code quality practices: error handling, validation, logging, and DRY. Use when writing or reviewing code.
Installation
Details
Usage
After installing, this skill will be available to your AI coding assistant.
Verify installation:
skills listSkill Instructions
name: coding-practices description: Code quality practices: error handling, validation, logging, and DRY. Use when writing or reviewing code.
Coding Practices
Guidelines for writing maintainable, robust, and self-documenting code.
Quick Start
// Self-documenting with proper error handling
function createUser(email: string, age: number): User {
if (!email.includes("@")) throw new Error("Invalid email");
if (age < 0 || age > 150) throw new Error("Invalid age");
return { email, age };
}
Key Principles
- Use meaningful names (self-documenting code)
- Comments explain "why", not "what"
- DRY: abstract when used 3+ times
- Validate all input data
- Handle all error cases with proper Error objects
- Never ignore errors
- Use named constants instead of magic values
- Avoid circular dependencies
References
See rules.md for complete guidelines with examples.
More by eser
View allCode design patterns: pure functions, immutability, composition, and async. Use when designing code or functions.
Go conventions for hexagonal architecture, project structure, error handling, testing, and observability. Use when writing Go services.
Workflow rules for task execution, respecting user code, and git commits. Use when planning or executing development tasks.
System architecture: modules, project structure, ADRs, and testing. Use when designing or reviewing systems.