Skip to Content
MeowKit
Skills

mk:clean-code

Applies SRP, DRY, KISS and YAGNI standards while you write code, with concrete naming and function rules.

Source.claude/skills/clean-code/SKILL.md
Ownerutility
Runtimeportable
Riskmedium
Phaseon-demand

mk:clean-code holds the coding standards MeowKit applies while code is being written: concise, direct and solution-focused. Use it during implementation (Phase 3) or for an ad-hoc quality check at any phase, on any change that adds or modifies logic.

When not to use it

If you needUse
Behaviour-preserving cleanup of the finished diff (Phase 3.5)mk:simplify
A review of a diff or PRmk:review

The two complement each other: clean-code applies standards as you write, simplify reduces complexity in completed code.

Principles

PrincipleRule
SRPEach function or class does one thing
DRYExtract duplicates and reuse them
KISSThe simplest solution that works
YAGNIDo not build unused features
Boy ScoutLeave code cleaner than you found it

What it does

  1. Read the existing code before changing it.
  2. Check dependencies: what imports the file, what it imports, which tests cover it, and whether it is a shared component. Edit the file and its dependents in the same task.
  3. Apply the standards in references/coding-standards.md.
  4. Self-check: goal met, all files edited, code works, nothing forgotten.
  5. Run the verification scripts.

Standards

AreaRule
VariablesReveal intent: userCount, not n
FunctionsVerb and noun: getUserById()
BooleansQuestion form: isActive, hasPermission, canEdit
ConstantsSCREAMING_SNAKE: MAX_RETRY_COUNT
Function sizeAt most 20 lines, ideally 5 to 10
ArgumentsAt most 3, preferably 0 to 2
StructureGuard clauses, flat over nested, small functions composed, related code kept close

If a name needs a comment to explain it, rename it. The skill removes obvious comments, inlines one-line helpers, drops factories for two objects, avoids a utils.ts with one function, replaces magic numbers with named constants and splits functions that do too much.

Verification scripts

ScriptCommand
validate.pynode .claude/hooks/lib/skill-python.cjs .claude/skills/lint-and-validate/scripts/validate.py
security-scan.pynode .claude/hooks/lib/skill-python.cjs .claude/skills/lint-and-validate/scripts/security-scan.py
injection-audit.cjsnode .claude/hooks/lib/injection-audit.cjs

Gotchas

  • A helper for a one-time operation breaks YAGNI. Three similar lines beat a premature abstraction.
  • Do not strip try-catch from system boundaries. Remove error handling only for internal calls with a guaranteed contract.

On this page