type-checking-vs-testing
Installation
SKILL.md
Understand the Relationship Between Type Checking and Unit Testing
Overview
Type checking and unit testing catch different kinds of errors. Type checking catches type mismatches at compile time. Unit testing catches logic errors and edge cases at runtime. They complement each other - types reduce the need for some tests, but can't replace tests for logic.
When to Use This Skill
- Deciding between types and tests
- Catching logic errors
- Testing edge cases
- Building test suites
- Validating assumptions
The Iron Rule
Use types to catch type errors at compile time. Use tests to catch logic errors and edge cases at runtime. They complement each other.