Coding Standards & Design Principles Guide
Overview
This skill ensures you write high-quality, maintainable code that follows industry best practices. Use this whenever you're writing code, reviewing code, or refactoring existing implementations. The principles here apply across all programming languages, with specific considerations for different contexts.
Core Philosophy:
- Clarity over cleverness - Code is read more often than written
- Practical pragmatism - Apply patterns when they add value, not dogmatically
- Evolution-friendly - Design for change and future extension
- Team-oriented - Write code others (including future you) can understand
Process
🚀 High-Level Workflow
Writing quality code involves three main phases:
Phase 1: Planning and Design
1.1 Understand Core Design Principles
Before writing code, internalize these fundamental principles:
DRY (Don't Repeat Yourself):
- Extract duplicated logic when the same code appears 3+ times
- Create reusable functions/methods/classes for shared behavior
- BUT: Don't abstract prematurely - two instances might just be coincidence
- Balance: Readability > DRY for simple, self-explanatory code
- Example: If you see identical validation logic in 3 endpoints, extract it
SOLID Principles:
S - Single Responsibility Principle (SRP):
- Each class/function should do one thing and do it well
- If you can't describe what it does in one sentence without "and", it's doing too much
- Red flag: Functions with names like
processAndValidateAndSaveUser()
- Good: Separate
validateUser(), processUser(), saveUser()
O - Open/Closed Principle:
- Open for extension, closed for modification
- Use interfaces, abstract classes, or composition to allow new behavior without changing existing code
- Example: Plugin architecture instead of giant switch statements
L - Liskov Substitution Principle:
- Subclasses should be substitutable for their base classes
- Don't break contracts - if parent returns non-null, child shouldn't return null
- Red flag: Subclass that throws NotImplementedException for parent methods
I - Interface Segregation Principle:
- Many specific interfaces are better than one general-purpose interface
- Clients shouldn't depend on methods they don't use
- Example:
IReadable and IWritable instead of IFileOperations with unused methods
D - Dependency Inversion Principle:
- Depend on abstractions, not concrete implementations
- High-level modules shouldn't depend on low-level modules
- Use: Dependency injection, interface-based design
Composition Over Inheritance:
- Favor "has-a" relationships over "is-a"
- Inheritance creates tight coupling; composition provides flexibility
- Example: Use strategy pattern instead of inheritance hierarchies
- Guideline: More than 2-3 inheritance levels is usually a smell
YAGNI (You Aren't Gonna Need It):
- Don't build features "just in case" or "for the future"
- Add complexity only when actually needed
- Balance: Don't over-engineer, but leave sensible extension points
KISS (Keep It Simple, Stupid):
- Simple solutions are easier to understand, test, and maintain
- If a junior developer can't understand it, it's probably too complex
- Question: "Is there a simpler way to achieve the same goal?"
1.2 Plan Your Approach
Before writing code, ask yourself:
Functionality:
- What is the single responsibility of this code?
- What are the inputs, outputs, and side effects?
- What are the error cases and how should they be handled?
Reusability:
- Is there existing code that does something similar?
- Will this logic be needed elsewhere?
- What's the right level of abstraction?
Dependencies:
- What external dependencies does this need?
- Can dependencies be injected rather than hard-coded?
- Are we depending on abstractions or concrete implementations?
Testing:
- How will this be tested?
- Are we writing testable code (pure functions, dependency injection)?
- What are the edge cases?
1.3 Design the Interface First
Before implementation, design the public interface:
- What will consumers of this code need?
- What parameters are required vs optional?
- What does success look like? What about failure?
- How will this be documented?
Consider:
- Function/method signatures
- Class constructors and public methods
- Return types and error handling strategy
- Naming conventions
Phase 2: Implementation
2.1 Code Organization
File Structure:
- One class per file (for OOP languages)
- Group related functionality in modules/packages
- Keep files under 300-500 lines (guideline, not rule)
- Organize imports: stdlib → third-party → local
Function/Method Length:
- Aim for 20-30 lines max per function
- If longer, can you extract helper functions?
- Exception: Sometimes a long, linear function is clearer than over-decomposition
Class Length:
- Aim for under 200-300 lines per class
- If larger, consider if it has multiple responsibilities
- Extract inner classes or create new classes
2.2 Naming Conventions
Critical Rules:
- Names should reveal intent:
getUserById() not get()
- Avoid abbreviations unless universally known:
HTTP is fine, usrLst is not
- Be consistent within the codebase
- Use domain language that business stakeholders understand
Specific Guidelines:
Variables:
- Use nouns:
userCount, activeConnections, databasePool
- Boolean: Prefix with
is, has, can: isValid, hasAccess, canDelete
- Avoid single letters except for:
i, j, k (loop indices), x, y (coordinates), e (exceptions)
Functions/Methods:
- Use verbs:
calculateTotal(), fetchUser(), validateEmail()
- Predicates return boolean:
isEmpty(), hasPermission()
- Commands vs Queries: Separate functions that change state from those that return data
Classes:
- Use nouns:
UserRepository, EmailValidator, PaymentProcessor
- Avoid "Manager", "Helper", "Utility" names - they hide responsibility
- If you need them, be specific:
DatabaseConnectionManager not Manager
Constants:
- All caps with underscores:
MAX_RETRY_ATTEMPTS, DEFAULT_TIMEOUT
- Group related constants in enums or dedicated modules
2.3 Function Design
Parameters:
- Ideal: 0-2 parameters
- Acceptable: 3 parameters
- Avoid: 4+ parameters (use parameter objects/configs)
- Example: Instead of
createUser(name, email, age, country, preferences, settings), use createUser(UserCreateRequest request)
Return Values:
- Be consistent: Don't mix null, undefined, empty arrays, and exceptions for "no data"
- Prefer explicit error handling over null: Result types, Option types, or exceptions
- Return early to avoid deep nesting
Side Effects:
- Document all side effects in function documentation
- Separate query operations (read) from command operations (write)
- Minimize hidden side effects (global state, file I/O, etc.)
Pure Functions When Possible:
- Same inputs always produce same outputs
- No side effects
- Easier to test, reason about, and parallelize
- Example:
calculateTax(amount, rate) is pure; updateUserInDatabase(user) is not
2.4 Error Handling
General Principles:
- Fail fast: Validate inputs early
- Provide actionable error messages
- Don't swallow exceptions silently
- Use specific exception types
Error Handling Strategies:
Exceptions (for exceptional situations):
- Use for truly exceptional conditions, not control flow
- Provide context: What failed, why, and what to do about it
- Clean up resources (use try-finally or context managers)
Return Values (for expected failures):
- Use Result/Option types for operations that commonly fail
- Example:
findUser() returns Option<User> or Result<User, NotFoundError>
- Avoid null/undefined when possible
Validation:
- Validate at system boundaries (API endpoints, database queries)
- Use type systems and schema validation
- Return structured validation errors
Logging:
- Log actionable information
- Include context: user ID, request ID, timestamp
- Use appropriate levels: ERROR for failures, WARN for degraded state, INFO for significant events
2.5 Comments and Documentation
When to Comment:
- WHY, not WHAT: Explain the reasoning, not the obvious
- ❌
// Increment counter by 1
- ✅
// Skip first item as it contains headers
- Complex algorithms: Explain the approach
- Non-obvious business rules
- TODO/FIXME with context and owner
When NOT to Comment:
- Self-explanatory code (use better names instead)
- Commented-out code (use version control)
- Obvious statements
Documentation (Doc Comments):
- Public APIs: Always document
- Complex internal functions: Document
- Simple, self-explanatory functions: Optional
Include:
- Purpose and behavior
- Parameter descriptions with types and constraints
- Return value description
- Exceptions/errors that can be thrown
- Usage examples for complex APIs
2.6 Code Quality Practices
Avoid Deep Nesting:
- Maximum 3 levels of indentation
- Use early returns/guards
- Extract complex conditions into well-named functions
Example:
// ❌ BAD:
if (user !== null) {
if (user.isActive) {
if (user.hasPermission("write")) {
// do something
}
}
}
// ✅ GOOD:
if (user === null) return;
if (!user.isActive) return;
if (!user.hasPermission("write")) return;
// do something
Avoid Long Parameter Lists:
- Use parameter objects/configs for 4+ parameters
- Consider builder pattern for objects with many optional parameters
Avoid Magic Numbers:
- Define constants with descriptive names
- ❌
if (status === 404)
- ✅
if (status === HTTP_NOT_FOUND)
Consistent Formatting:
- Use automated formatters (Prettier, Black, gofmt)
- Follow language-specific style guides
- Be consistent within the project
Minimize Global State:
- Prefer dependency injection over global singletons
- Use function parameters instead of accessing global variables
- Make mutability explicit and minimal
Phase 3: Review and Refine
3.1 Self-Review Checklist
Before considering code complete, verify:
Design Principles:
Code Quality:
Error Handling:
Testing:
Documentation:
Performance:
Security:
3.2 Refactoring Opportunities
Code Smells to Watch For:
Long Functions/Methods:
- Extract smaller, well-named functions
- Each function should do one thing
Large Classes:
- Consider if class has multiple responsibilities
- Extract collaborating classes
Long Parameter Lists:
- Use parameter objects or builder pattern
- Consider if function is doing too much
Primitive Obsession:
- Create domain objects instead of passing primitives
- Example:
Email class instead of raw strings
Feature Envy:
- Method uses another class's data more than its own
- Move method to the class whose data it uses
Data Clumps:
- Same group of parameters appears together repeatedly
- Extract into a dedicated object
Switch Statements:
- Consider polymorphism or strategy pattern
- Especially if same switch appears in multiple places
Comments:
- If you need a comment to explain what code does, consider better naming
- If explaining why, the comment is valuable
For language-specific best practices and examples, see references/LANGUAGE-SPECIFICS.md.
For detailed code examples demonstrating these principles, see references/EXAMPLES.md.
Quick Reference
When to Apply Each Principle
Use DRY when:
- Same logic appears 3+ times
- The abstraction is clear and natural
- Changes to the logic should affect all uses
Don't use DRY when:
- Two similar pieces of code serve different purposes
- The abstraction would be more complex than duplication
- Code is unlikely to change together
Use SRP when:
- Class/function is hard to name without "and"
- Changes for one reason affect unrelated functionality
- Testing requires mocking many dependencies
Use Dependency Injection when:
- Testing with mock dependencies
- Supporting multiple implementations
- Configuration needs to vary by environment
Use Composition when:
- Multiple inheritance creates diamond problem
- Behavior needs to be mixed and matched
- Inheritance depth exceeds 2-3 levels
Keep It Simple when:
- Always - start simple, add complexity only when needed
- You're tempted to use advanced patterns
- Junior developers will maintain the code
Common Anti-Patterns to Avoid
- God Objects: Classes that do everything
- Shotgun Surgery: One change requires editing many files
- Spaghetti Code: No clear structure, everything connected
- Copy-Paste Programming: Duplicating code instead of abstracting
- Golden Hammer: Using favorite pattern everywhere
- Premature Optimization: Optimizing before measuring
- Not Invented Here: Reimplementing existing solutions
- Analysis Paralysis: Over-planning without implementing
Final Notes
Remember:
- These are guidelines, not laws - apply them with judgment
- Consistency within a codebase matters more than perfect adherence
- Write code for humans first, machines second
- When in doubt, favor simplicity and clarity
- Refactor continuously - don't let technical debt accumulate
The Goal:
Write code that is:
- Easy to understand
- Easy to change
- Easy to test
- Easy to debug
- Easy to extend
If your code achieves these goals, you're on the right track.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: coding-standards-53description: Guide for writing clean, maintainable code following industry best practices and design principles like DRY, SOLID, and composition patterns. Use when writing any code to ensure consistency, readability, and long-term maintainability across all programming languages. Use when this capability is needed.4---56# Coding Standards & Design Principles Guide78## Overview910This skill ensures you write high-quality, maintainable code that follows industry best practices. Use this whenever you're writing code, reviewing code, or refactoring existing implementations. The principles here apply across all programming languages, with specific considerations for different contexts.1112**Core Philosophy:**1314- **Clarity over cleverness** - Code is read more often than written15- **Practical pragmatism** - Apply patterns when they add value, not dogmatically16- **Evolution-friendly** - Design for change and future extension17- **Team-oriented** - Write code others (including future you) can understand1819---2021# Process2223## 🚀 High-Level Workflow2425Writing quality code involves three main phases:2627### Phase 1: Planning and Design2829#### 1.1 Understand Core Design Principles3031Before writing code, internalize these fundamental principles:3233**DRY (Don't Repeat Yourself):**3435- Extract duplicated logic when the same code appears **3+ times**36- Create reusable functions/methods/classes for shared behavior37- **BUT**: Don't abstract prematurely - two instances might just be coincidence38- **Balance**: Readability > DRY for simple, self-explanatory code39- **Example**: If you see identical validation logic in 3 endpoints, extract it4041**SOLID Principles:**4243**S - Single Responsibility Principle (SRP):**4445- Each class/function should do one thing and do it well46- If you can't describe what it does in one sentence without "and", it's doing too much47- **Red flag**: Functions with names like `processAndValidateAndSaveUser()`48- **Good**: Separate `validateUser()`, `processUser()`, `saveUser()`4950**O - Open/Closed Principle:**5152- Open for extension, closed for modification53- Use interfaces, abstract classes, or composition to allow new behavior without changing existing code54- **Example**: Plugin architecture instead of giant switch statements5556**L - Liskov Substitution Principle:**5758- Subclasses should be substitutable for their base classes59- Don't break contracts - if parent returns non-null, child shouldn't return null60- **Red flag**: Subclass that throws NotImplementedException for parent methods6162**I - Interface Segregation Principle:**6364- Many specific interfaces are better than one general-purpose interface65- Clients shouldn't depend on methods they don't use66- **Example**: `IReadable` and `IWritable` instead of `IFileOperations` with unused methods6768**D - Dependency Inversion Principle:**6970- Depend on abstractions, not concrete implementations71- High-level modules shouldn't depend on low-level modules72- **Use**: Dependency injection, interface-based design7374**Composition Over Inheritance:**7576- Favor "has-a" relationships over "is-a"77- Inheritance creates tight coupling; composition provides flexibility78- **Example**: Use strategy pattern instead of inheritance hierarchies79- **Guideline**: More than 2-3 inheritance levels is usually a smell8081**YAGNI (You Aren't Gonna Need It):**8283- Don't build features "just in case" or "for the future"84- Add complexity only when actually needed85- **Balance**: Don't over-engineer, but leave sensible extension points8687**KISS (Keep It Simple, Stupid):**8889- Simple solutions are easier to understand, test, and maintain90- If a junior developer can't understand it, it's probably too complex91- **Question**: "Is there a simpler way to achieve the same goal?"9293#### 1.2 Plan Your Approach9495Before writing code, ask yourself:9697**Functionality:**9899- What is the single responsibility of this code?100- What are the inputs, outputs, and side effects?101- What are the error cases and how should they be handled?102103**Reusability:**104105- Is there existing code that does something similar?106- Will this logic be needed elsewhere?107- What's the right level of abstraction?108109**Dependencies:**110111- What external dependencies does this need?112- Can dependencies be injected rather than hard-coded?113- Are we depending on abstractions or concrete implementations?114115**Testing:**116117- How will this be tested?118- Are we writing testable code (pure functions, dependency injection)?119- What are the edge cases?120121#### 1.3 Design the Interface First122123**Before implementation, design the public interface:**124125- What will consumers of this code need?126- What parameters are required vs optional?127- What does success look like? What about failure?128- How will this be documented?129130**Consider:**131132- Function/method signatures133- Class constructors and public methods134- Return types and error handling strategy135- Naming conventions136137---138139### Phase 2: Implementation140141#### 2.1 Code Organization142143**File Structure:**144145- One class per file (for OOP languages)146- Group related functionality in modules/packages147- Keep files under 300-500 lines (guideline, not rule)148- Organize imports: stdlib → third-party → local149150**Function/Method Length:**151152- Aim for 20-30 lines max per function153- If longer, can you extract helper functions?154- **Exception**: Sometimes a long, linear function is clearer than over-decomposition155156**Class Length:**157158- Aim for under 200-300 lines per class159- If larger, consider if it has multiple responsibilities160- Extract inner classes or create new classes161162#### 2.2 Naming Conventions163164**Critical Rules:**165166- Names should reveal intent: `getUserById()` not `get()`167- Avoid abbreviations unless universally known: `HTTP` is fine, `usrLst` is not168- Be consistent within the codebase169- Use domain language that business stakeholders understand170171**Specific Guidelines:**172173**Variables:**174175- Use nouns: `userCount`, `activeConnections`, `databasePool`176- Boolean: Prefix with `is`, `has`, `can`: `isValid`, `hasAccess`, `canDelete`177- Avoid single letters except for: `i, j, k` (loop indices), `x, y` (coordinates), `e` (exceptions)178179**Functions/Methods:**180181- Use verbs: `calculateTotal()`, `fetchUser()`, `validateEmail()`182- Predicates return boolean: `isEmpty()`, `hasPermission()`183- Commands vs Queries: Separate functions that change state from those that return data184185**Classes:**186187- Use nouns: `UserRepository`, `EmailValidator`, `PaymentProcessor`188- Avoid "Manager", "Helper", "Utility" names - they hide responsibility189- If you need them, be specific: `DatabaseConnectionManager` not `Manager`190191**Constants:**192193- All caps with underscores: `MAX_RETRY_ATTEMPTS`, `DEFAULT_TIMEOUT`194- Group related constants in enums or dedicated modules195196#### 2.3 Function Design197198**Parameters:**199200- Ideal: 0-2 parameters201- Acceptable: 3 parameters202- Avoid: 4+ parameters (use parameter objects/configs)203- **Example**: Instead of `createUser(name, email, age, country, preferences, settings)`, use `createUser(UserCreateRequest request)`204205**Return Values:**206207- Be consistent: Don't mix null, undefined, empty arrays, and exceptions for "no data"208- Prefer explicit error handling over null: Result types, Option types, or exceptions209- Return early to avoid deep nesting210211**Side Effects:**212213- Document all side effects in function documentation214- Separate query operations (read) from command operations (write)215- Minimize hidden side effects (global state, file I/O, etc.)216217**Pure Functions When Possible:**218219- Same inputs always produce same outputs220- No side effects221- Easier to test, reason about, and parallelize222- **Example**: `calculateTax(amount, rate)` is pure; `updateUserInDatabase(user)` is not223224#### 2.4 Error Handling225226**General Principles:**227228- Fail fast: Validate inputs early229- Provide actionable error messages230- Don't swallow exceptions silently231- Use specific exception types232233**Error Handling Strategies:**234235**Exceptions (for exceptional situations):**236237- Use for truly exceptional conditions, not control flow238- Provide context: What failed, why, and what to do about it239- Clean up resources (use try-finally or context managers)240241**Return Values (for expected failures):**242243- Use Result/Option types for operations that commonly fail244- Example: `findUser()` returns `Option<User>` or `Result<User, NotFoundError>`245- Avoid null/undefined when possible246247**Validation:**248249- Validate at system boundaries (API endpoints, database queries)250- Use type systems and schema validation251- Return structured validation errors252253**Logging:**254255- Log actionable information256- Include context: user ID, request ID, timestamp257- Use appropriate levels: ERROR for failures, WARN for degraded state, INFO for significant events258259#### 2.5 Comments and Documentation260261**When to Comment:**262263- **WHY, not WHAT**: Explain the reasoning, not the obvious264 - ❌ `// Increment counter by 1`265 - ✅ `// Skip first item as it contains headers`266- Complex algorithms: Explain the approach267- Non-obvious business rules268- TODO/FIXME with context and owner269270**When NOT to Comment:**271272- Self-explanatory code (use better names instead)273- Commented-out code (use version control)274- Obvious statements275276**Documentation (Doc Comments):**277278- Public APIs: Always document279- Complex internal functions: Document280- Simple, self-explanatory functions: Optional281282**Include:**283284- Purpose and behavior285- Parameter descriptions with types and constraints286- Return value description287- Exceptions/errors that can be thrown288- Usage examples for complex APIs289290#### 2.6 Code Quality Practices291292**Avoid Deep Nesting:**293294- Maximum 3 levels of indentation295- Use early returns/guards296- Extract complex conditions into well-named functions297298**Example:**299300```typescript301// ❌ BAD:302if (user !== null) {303 if (user.isActive) {304 if (user.hasPermission("write")) {305 // do something306 }307 }308}309310// ✅ GOOD:311if (user === null) return;312if (!user.isActive) return;313if (!user.hasPermission("write")) return;314// do something315```316317**Avoid Long Parameter Lists:**318319- Use parameter objects/configs for 4+ parameters320- Consider builder pattern for objects with many optional parameters321322**Avoid Magic Numbers:**323324- Define constants with descriptive names325- ❌ `if (status === 404)`326- ✅ `if (status === HTTP_NOT_FOUND)`327328**Consistent Formatting:**329330- Use automated formatters (Prettier, Black, gofmt)331- Follow language-specific style guides332- Be consistent within the project333334**Minimize Global State:**335336- Prefer dependency injection over global singletons337- Use function parameters instead of accessing global variables338- Make mutability explicit and minimal339340---341342### Phase 3: Review and Refine343344#### 3.1 Self-Review Checklist345346Before considering code complete, verify:347348**Design Principles:**349350- [ ] Each function/class has a single, clear responsibility351- [ ] No code duplication (DRY applied where it adds value)352- [ ] Dependencies are injected, not hard-coded353- [ ] Code is open for extension, closed for modification354- [ ] Abstractions don't leak implementation details355356**Code Quality:**357358- [ ] Names clearly express intent359- [ ] Functions are short and focused (< 30 lines typically)360- [ ] No deep nesting (< 3 levels)361- [ ] No magic numbers or strings362- [ ] Consistent formatting and style363364**Error Handling:**365366- [ ] Input validation at boundaries367- [ ] Meaningful error messages368- [ ] Resources properly cleaned up369- [ ] No swallowed exceptions370371**Testing:**372373- [ ] Code is testable (minimal dependencies, pure functions where possible)374- [ ] Edge cases identified375- [ ] Test coverage for critical paths376377**Documentation:**378379- [ ] Public APIs documented380- [ ] Complex logic has explanatory comments381- [ ] Non-obvious decisions explained382383**Performance:**384385- [ ] No obvious inefficiencies (N+1 queries, unnecessary loops)386- [ ] Appropriate data structures chosen387- [ ] No premature optimization388389**Security:**390391- [ ] Input sanitized/validated392- [ ] Sensitive data not logged393- [ ] Authentication/authorization checked394395#### 3.2 Refactoring Opportunities396397**Code Smells to Watch For:**398399**Long Functions/Methods:**400401- Extract smaller, well-named functions402- Each function should do one thing403404**Large Classes:**405406- Consider if class has multiple responsibilities407- Extract collaborating classes408409**Long Parameter Lists:**410411- Use parameter objects or builder pattern412- Consider if function is doing too much413414**Primitive Obsession:**415416- Create domain objects instead of passing primitives417- Example: `Email` class instead of raw strings418419**Feature Envy:**420421- Method uses another class's data more than its own422- Move method to the class whose data it uses423424**Data Clumps:**425426- Same group of parameters appears together repeatedly427- Extract into a dedicated object428429**Switch Statements:**430431- Consider polymorphism or strategy pattern432- Especially if same switch appears in multiple places433434**Comments:**435436- If you need a comment to explain what code does, consider better naming437- If explaining why, the comment is valuable438439---440441**For language-specific best practices and examples, see [references/LANGUAGE-SPECIFICS.md](references/LANGUAGE-SPECIFICS.md).**442443**For detailed code examples demonstrating these principles, see [references/EXAMPLES.md](references/EXAMPLES.md).**444445---446447# Quick Reference448449## When to Apply Each Principle450451**Use DRY when:**452453- Same logic appears 3+ times454- The abstraction is clear and natural455- Changes to the logic should affect all uses456457**Don't use DRY when:**458459- Two similar pieces of code serve different purposes460- The abstraction would be more complex than duplication461- Code is unlikely to change together462463**Use SRP when:**464465- Class/function is hard to name without "and"466- Changes for one reason affect unrelated functionality467- Testing requires mocking many dependencies468469**Use Dependency Injection when:**470471- Testing with mock dependencies472- Supporting multiple implementations473- Configuration needs to vary by environment474475**Use Composition when:**476477- Multiple inheritance creates diamond problem478- Behavior needs to be mixed and matched479- Inheritance depth exceeds 2-3 levels480481**Keep It Simple when:**482483- Always - start simple, add complexity only when needed484- You're tempted to use advanced patterns485- Junior developers will maintain the code486487## Common Anti-Patterns to Avoid488489- **God Objects**: Classes that do everything490- **Shotgun Surgery**: One change requires editing many files491- **Spaghetti Code**: No clear structure, everything connected492- **Copy-Paste Programming**: Duplicating code instead of abstracting493- **Golden Hammer**: Using favorite pattern everywhere494- **Premature Optimization**: Optimizing before measuring495- **Not Invented Here**: Reimplementing existing solutions496- **Analysis Paralysis**: Over-planning without implementing497498---499500# Final Notes501502**Remember:**503504- These are guidelines, not laws - apply them with judgment505- Consistency within a codebase matters more than perfect adherence506- Write code for humans first, machines second507- When in doubt, favor simplicity and clarity508- Refactor continuously - don't let technical debt accumulate509510**The Goal:**511Write code that is:512513- Easy to understand514- Easy to change515- Easy to test516- Easy to debug517- Easy to extend518519If your code achieves these goals, you're on the right track.520521---522> Converted and distributed by [TomeVault](https://tomevault.io/claim/yzlin) — claim your Tome and manage your conversions.523<!-- tomevault:4.0:skill_md:2026-04-11 -->