Transversal software-engineering principles for any code in any language, frontend or backend. Use when writing or refactoring code, reviewing code, naming things, splitting or merging classes, functions or components, introducing or removing an abstraction, removing duplication, or judging whether code is "good enough", even when the person does not name a principle (e.g. "clean this up", "does this look right?", "is this too complex?"). It encodes SOLID, simple design, clean code, code smel...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Solid?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/jorgecostamacia-solid-code-harness)
---
name: solid
description: >-
Transversal software-engineering principles for any code in any language,
frontend or backend. Use when writing or refactoring code, reviewing code,
naming things, splitting or merging classes, functions or components,
introducing or removing an abstraction, removing duplication, or judging
whether code is "good enough", even when the person does not name a
principle (e.g. "clean this up", "does this look right?", "is this too
complex?"). It encodes SOLID, simple design, clean code, code smells, and
complexity management, applied with judgment, not dogma: rules are
signals to weigh, and a minor duplication is better than a wrong
abstraction.
---
# Engineering principles (transversal)
These apply to **all** code — any language, any layer, front or back. They are lenses for judgment, not laws: when two of them conflict, prefer the one that makes the code easier to change tomorrow.
## The core loop
1. **Understand the behavior** you need before touching code — inputs, outputs, edge cases. If you cannot state it in one sentence, do not start yet.
2. **Make the smallest change that delivers it.** No speculative parameters, no "while I'm here" abstractions.
3. **Prove it works** — a test when the code is testable; a real execution when it isn't yet.
4. **Then refactor**: better names, remove duplication (rule of three), simplify structure. Refactor with green tests, never mid-change.
## Four elements of simple design — in priority order
1. **Works** — passes its tests / observably does the job.
2. **Expresses intent** — a reader understands *what* and *why* without a search through the history.
3. **No knowledge duplication** — one fact lives in one place (code repetition is only a smell when it duplicates *knowledge*).
4. **Minimal** — nothing present "just in case". YAGNI.
When these conflict, the lower number wins.
## SOLID — the five questions
Ask these when designing or reviewing a type/module (details and examples in [references/solid-principles.md](references/solid-principles.md)):
- **S**RP — does it have **one reason to change**? (One actor/concern per unit.)
- **O**CP — can you add foreseeable variation **without editing** this code? (Only invest where variation is *actually expected*.)
- **L**SP — can any implementation substitute the abstraction **without surprising** the caller?
- **I**SP — does anyone depend on methods it **doesn't use**?
- **D**IP — does policy depend on **abstractions**, not concretions? (Dependencies point toward the domain.)
## Naming
Priority: **consistent** with the codebase > **understandable** > **specific** > **searchable** > short. Rename as soon as a better name appears. Readers trust a name, so a misleading name causes bugs. Full guidance: [references/clean-code.md](references/clean-code.md).
## Code smells are signals, not errors
Long method, large class, feature envy, data clump, primitive obsession, shotgun surgery… A smell means *stop and look*, not *mechanically split*. Catalog with the fix — and the false-positive cases — in [references/code-smells.md](references/code-smells.md).
## Complexity
Distinguish **essential** complexity (the domain is genuinely like that) from **accidental** complexity (we introduced it). Fight only the accidental kind: YAGNI, KISS, DRY-after-the-third-time. Details: [references/simplicity.md](references/simplicity.md).
## Anti-dogma — when NOT to apply
- **A minor duplication is better than a wrong abstraction.** Extract on the third occurrence, when the shape is stable — not the second.
- **Don't split by size.** A 60-line method with one clear job is better than four 15-line methods that a reader must put together again. Split by *responsibility*, never by line count.
- **Don't abstract for one implementation.** An interface with one implementer and no seam requirement is noise. Test seams and module boundaries are valid seam requirements.
- **Declarative/config-like code is exempt from "too long"**: exhaustive mappings, schema definitions, and wiring tables are long by nature.
- **A framework that the project chose on purpose is not "coupling to fix".** Do not wrap it in speculative indirection.
## Review checklist (before calling it done)
- [ ] Behavior proven (test or real run).
- [ ] Names say what things are; no comment explains what a rename could.
- [ ] Each new/edited unit has one reason to change.
- [ ] No knowledge duplicated; no abstraction with a single caller and no seam need.
- [ ] Nothing speculative: every parameter, branch, and config option has a user today.
- [ ] Errors handled where the code can *act on* them: not swallowed, and not wrapped again without new information.
## References
| File | Load when |
| --- | --- |
| [references/solid-principles.md](references/solid-principles.md) | applying/reviewing SOLID in a concrete design |
| [references/clean-code.md](references/clean-code.md) | naming, functions, structure, comments |
| [references/code-smells.md](references/code-smells.md) | something feels off and you want the catalog + fixes |
| [references/simplicity.md](references/simplicity.md) | fighting complexity, deciding YAGNI/DRY/KISS trade-offs |