ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

code-quality-principles

KISS, YAGNI, and SOLID code quality principles for clean code, reducing complexity and preventing over-engineering

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/athola/nm-conserve-code-quality-principles
Or

Night Market Skill — ported from claude-night-market/conserve. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

Table of Contents

  • KISS (Keep It Simple, Stupid)
  • YAGNI (You Aren't Gonna Need It)
  • SOLID Principles
  • Quick Reference
  • When Principles Conflict
  • Integration with Code Review

Code Quality Principles

Guidance on KISS, YAGNI, and SOLID principles with language-specific examples.

When To Use

  • Improving code readability and maintainability
  • Applying SOLID, KISS, YAGNI principles during refactoring

When NOT To Use

  • Throwaway scripts or one-time data migrations
  • Performance-critical code where readability trades are justified

KISS (Keep It Simple, Stupid)

Principle: Avoid unnecessary complexity. Prefer obvious solutions over clever ones.

Guidelines

PreferAvoid
Simple conditionalsComplex regex for simple checks
Explicit codeMagic numbers/strings
Standard patternsClever shortcuts
Direct solutionsOver-abstracted layers

Python Example

# Bad: Overly clever one-liner
users = [u for u in (db.get(id) for id in ids) if u and u.active and not u.banned]

# Good: Clear and readable
users = []
for user_id in ids:
    user = db.get(user_id)
    if user and user.active and not user.banned:
        users.append(user)

Rust Example

// Bad: Unnecessary complexity
fn process(data: &[u8]) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
    data.iter()
        .map(|&b| b.checked_add(1).ok_or("overflow"))
        .collect::<Result<Vec<_>, _>>()
        .map_err(|e| e.into())
}

// Good: Simple and clear
fn process(data: &[u8]) -> Result<Vec<u8>, &'static str> {
    let mut result = Vec::with_capacity(data.len());
    for &byte in data {
        result.push(byte.checked_add(1).ok_or("overflow")?);
    }
    Ok(result)
}

YAGNI (You Aren't Gonna Need It)

Principle: Don't implement features until they are actually needed.

Guidelines

DoDon't
Solve current problemBuild for hypothetical futures
Add when 3rd use case appearsCreate abstractions for 1 use case
Delete dead codeKeep "just in case" code
Minimal viable solutionPremature optimization

Python Example

# Bad: Premature abstraction for one use case
class AbstractDataProcessor:
    def process(self, data): ...
    def validate(self, data): ...
    def transform(self, data): ...

class CSVProcessor(AbstractDataProcessor):
    def process(self, data):
        return self.transform(self.validate(data))

Metadata

Author@athola
Stars4473
Views1
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-athola-nm-conserve-code-quality-principles": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.