sitebender-predicates

Official

Validate data, narrow types, ensure correctness.

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 allPass and anyPass for complex validation logic.
  • Use Case: To validate if an input is a PositiveInteger, use this skill to create an isPositiveInteger predicate. This function will not only return true or false but also narrow the type of the input to PositiveInteger within if blocks, 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 required

Components

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.
View Source Repository