Files
scopone/.github/skills/simplify-code/APPENDIX.md
2026-04-10 22:35:01 +02:00

1.2 KiB

Simplify Code Appendix

Extended examples and pattern notes live here to keep SKILL.md lean.

Pattern Details

  • Extract Method: split large functions into named units.
  • Guard Clauses: replace deep nesting with early returns.
  • Decompose Conditional: extract complex conditions and branches.
  • Replace Magic Numbers: promote literals to named constants.
  • Rename for Clarity: explicit, searchable, domain terms.
  • Remove Dead Code: delete commented or unreachable code.
  • Parameter Object: group related arguments when signatures are too long.

Language-Specific Reminders

  • JavaScript/TypeScript: prefer const, pure helpers, and array transforms.
  • Python: prefer clear names, type hints where useful, and small functions.
  • Java/C#: prefer focused classes and guard clauses.
  • Go: keep functions small, explicit error paths.

Anti-Patterns

  • Large-bang rewrites
  • Behavioral changes without explicit requirement
  • Premature abstractions
  • Clever code at cost of readability

Suggested Validation Loop

  1. Build/test baseline
  2. Apply one simplification pass
  3. Re-run build/tests
  4. Repeat

If a pass introduces failures, stop and document in simplification-report.md.