fundamental-coding-principles

hanai's avatarfrom hanai

Proactively use this skill when starting any code writing or refactoring task and must uphold SOLID, DRY, KISS, YAGNI, and SSOT principles.

⭐0stars🔀0forks📁View on GitHub🕐Updated Nov 16, 2025

When & Why to Use This Skill

This Claude skill integrates fundamental software engineering principles—SOLID, DRY, KISS, YAGNI, and SSOT—into the development workflow. It serves as a rigorous framework for writing, reviewing, and refactoring code, ensuring high maintainability, reduced technical debt, and streamlined logic. By enforcing these industry-standard guardrails, the skill helps developers produce clean, testable, and scalable code that adheres to best practices in software architecture.

Use Cases

  • Refactoring Legacy Code: Systematically apply SOLID and DRY principles to decompose monolithic functions and eliminate redundant logic in existing codebases.
  • Preventing Over-Engineering: Use KISS and YAGNI guardrails during new feature development to ensure solutions remain simple and focused strictly on current requirements.
  • Code Quality Assurance: Conduct comprehensive code reviews to verify that new implementations preserve caller expectations and adhere to the Single Source of Truth (SSOT).
  • Architectural Design Alignment: Guide the creation of extensible interfaces and decoupled components by following Dependency Inversion and Interface Segregation principles.
namefundamental-coding-principles
descriptionApply SOLID, DRY, KISS, YAGNI, and SSOT principles when writing, reviewing, or refactoring code to ensure maintainability and quality.

Fundamental Coding Principles

Apply this skill to keep code changes focused, testable, and maintainable.

Quick Checklist

  • Confirm each edit has a single purpose before coding.
  • Ruthlessly remove duplication or dead paths you touch.
  • Only add behavior backed by an explicit requirement.
  • Prefer simple, composable solutions over clever ones.
  • Keep truthy data and decisions in one authoritative place.

Principle Guardrails

SOLID

  • S: Validate the change impacts one reason to vary; split helpers if mixed concerns appear.
  • O: Extend behavior through new types or functions rather than rewriting stable code paths.
  • L: Ensure new subtype logic preserves caller expectations (inputs, return contracts, exceptions).
  • I: Create targeted interfaces; avoid forcing consumers to implement unused members.
  • D: Depend on abstractions or injected collaborators; eliminate hardwired globals where possible.

DRY

  • Scan for repeated logic, constants, or schemas; consolidate into shared utilities before finishing.
  • Prefer extracting reusable modules over copy-pasting even inside the same file.

KISS

  • Trim optional branches, flags, and polymorphism unless they solve today’s requirement.
  • Keep functions short and state minimal; decompose complex flows into readable steps.

YAGNI

  • Challenge every new feature, parameter, or hook: is there a verified need right now?
  • Defer premature abstractions until duplication or clear requirements emerge.

SSOT

  • Update or create the canonical definition (config, schema, doc) when data models change.
  • Remove divergent caches or mirrors unless you enforce sync in the same change.

Reference Playbooks