Agent skill
fundamental-coding-principles
Apply SOLID, DRY, KISS, YAGNI, and SSOT principles when writing, reviewing, or refactoring code to ensure maintainability and quality.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/fundamental-coding-principles-hanai-cc-marketplace
SKILL.md
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
- Splunk: "SOLID Design Principles – Hands-On Examples" – success/failure code walkthroughs for each letter.
- PullRequest.com: "7 Clean Coding Principles" – DRY-focused review prompts.
- MIT 6.031: Code Review Guide – DRY and simplification questions to ask.
- Baeldung: KISS Software Design Principle – tactics for keeping solutions lightweight.
- TechTarget: YAGNI Explainer – decision tests and risk scenarios.
- Atlassian Workstream: Building an SSOT – practices for maintaining canonical sources.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?