Skip to content
Back to skills

Code Minimization

ASecurity

Write minimum necessary code following YAGNI principle to prevent bloat and over-engineering. Use when implementing features to keep the codebase lean and avoid premature optimization or speculative features.

  • 754 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added February 8, 2026
developmentjavascriptpythongojavanode

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill code-minimization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Minimization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Minimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-code-minimization/badge)](https://www.skillsdirectory.com/skills/majiayu000-code-minimization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-minimization
description: Write minimum necessary code following YAGNI principle to prevent bloat and over-engineering. Use when implementing features to keep the codebase lean and avoid premature optimization or speculative features.
---

# Code Minimization

## Instructions

### Write minimum code

Implement what's needed NOW, not what MIGHT be needed.

**Avoid:**
- Premature optimization
- Speculative features
- Over-abstraction
- Unnecessary complexity

### YAGNI principle

**You Aren't Gonna Need It**

## Example

<!-- CUSTOMIZE: Replace with {{MAIN_TECH_STACK}}-appropriate examples -->

### Python Example
```python
# ❌ Over-engineered
class ValidatorFactory:
    def create(self, type):
        if type == 'basic': return BasicValidator()
        elif type == 'advanced': return AdvancedValidator()
        # 10 more types... (only use BasicValidator!)

# ✅ Minimal
class EntityValidator:
    def validate(self, entity):
        return entity.required_field is not None
```

### JavaScript/Node.js Example
```javascript
// ❌ Over-engineered
class ValidatorFactory {
    create(type) {
        if (type === 'basic') return new BasicValidator();
        else if (type === 'advanced') return new AdvancedValidator();
        // 10 more types... (only use BasicValidator!)
    }
}

// ✅ Minimal
class EntityValidator {
    validate(entity) {
        return entity.requiredField !== null && entity.requiredField !== undefined;
    }
}
```

### Go Example
```go
// ❌ Over-engineered
type ValidatorFactory struct{}

func (f *ValidatorFactory) Create(validatorType string) Validator {
    switch validatorType {
    case "basic":
        return &BasicValidator{}
    case "advanced":
        return &AdvancedValidator{}
    // 10 more types... (only use BasicValidator!)
    }
    return nil
}

// ✅ Minimal
type EntityValidator struct{}

func (v *EntityValidator) Validate(entity *Entity) bool {
    return entity.RequiredField != ""
}
```

## Guidelines

**Do:** Solve current requirements simply
**Don't:** Add "maybe later" features

---

**For detailed patterns, see [reference.md](reference.md)**
**For more examples, see [examples.md](examples.md)**

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.