refactor-codebase-with-types

Installation
SKILL.md

Refactor Codebase with Types

Surface refactoring opportunities inspired by Alexis King's “Parse, don't validate” and “Types as axioms.” The aim is to move facts learned at runtime into values and types so valid states are easy to construct, invalid states are hard or impossible to represent, and execution code stops re-checking things boundary code already proved.

Glossary

Use these terms exactly in suggestions. Full definitions are in LANGUAGE.md.

  • Boundary — where less-structured outside data enters the program.
  • Parser — code that consumes less-structured input and produces more-structured output or a typed failure.
  • Validator — code that checks a fact but throws away the evidence, often returning void, (), boolean, or raising.
  • Evidence — a value/type that preserves a checked fact for later code.
  • Precise representation — a datatype that encodes the facts downstream code depends on.
  • Illegal state — a value shape the domain or algorithm cannot correctly handle.
  • Correct by construction — a representation whose constructors preserve the invariant.
  • Partial function — code whose signature promises more than it can deliver for all inputs.
  • Burden of proof — the obligation to establish a precondition before execution can proceed.
  • Shotgun parsing — validation scattered through processing code.
  • Axiom — a constructor or factory that introduces a valid base case.
Related skills
Installs
1
GitHub Stars
6
First Seen
2 days ago