sitebender-predicates
OfficialValidate data, narrow types, ensure correctness.
Software Engineering#typescript#type guards#validation#functional programming#boolean logic#type narrowing#predicate functions
Authorsite-bender
Version1.0.0
Installs0
System Documentation
What problem does it solves? This Skill provides a standardized, type-safe approach to writing predicate functions, eliminating ambiguity in boolean checks and ensuring reliable type narrowing. It reduces runtime errors and improves code clarity by enforcing pure, curried, and named predicate patterns, making your code more robust and easier to understand.
Core Features & Use Cases
- Type Guards: Guides the creation of functions that perform runtime type validation and narrow types for TypeScript, enhancing type safety.
- Branded Type Validation: Provides patterns for validating custom branded types, ensuring data integrity at the type level.
- Predicate Combinators: Shows how to compose multiple predicates using
allPassandanyPassfor complex validation logic. - Use Case: To validate if an input is a
PositiveInteger, use this skill to create anisPositiveIntegerpredicate. This function will not only returntrueorfalsebut also narrow the type of the input toPositiveIntegerwithinifblocks, allowing the compiler to catch errors early.
Quick Start
Explain how to write a type guard named 'isEven' that checks if a number is even.
Dependency Matrix
Required Modules
None requiredComponents
examples
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: sitebender-predicates Download link: https://github.com/site-bender/sitebender/archive/main.zip#sitebender-predicates Please download this .zip file, extract it, and install it in the .claude/skills/ directory.