tsentials/predicate

Compose reusable boolean predicates with logical operators and type refinements in TypeScript.

49|Updated May 12, 2026
One-click install
npx skills add https://github.com/senrecep/tsentials --skill tsentials-predicate
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tsentials/predicate
Source: https://github.com/senrecep/tsentials/tree/main/.well-known/agent-skills/tsentials-predicate
Command: npx skills add https://github.com/senrecep/tsentials --skill tsentials-predicate

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you stop scattering ad-hoc boolean checks throughout your TypeScript code by providing a composable way to define, combine, and reuse conditions.

Core Features & Use Cases

  • Composable predicates: build conditions with Predicate.from and combine them using Predicate.and, Predicate.or, and Predicate.not for clear, reusable logic.
  • Bulk composition: create complex rules with Predicate.all (all must match) and Predicate.any (any may match).
  • Refinements (type guards): narrow unknown values safely using Predicate.refinement, including intersection narrowing with Predicate.andRefinement.
  • Rule engine integration: convert a predicate into a rule-compatible function via Predicate.toRule to standardize validation-style flows.

Quick Start

Use the tsentials/predicate Skill to define predicates like isAdult and isActive, combine them with Predicate.and, and then convert the result into a rule using Predicate.toRule.

Frequently Asked Questions about tsentials/predicate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I combine multiple type guards into a single reusable validation rule in TypeScript?▼

You can combine type guards by creating individual predicates and composing them using logical operators like `and`, `or`, and `not`. This builds reusable validation rules that maintain consistent type narrowing across complex domain filtering conditions.

What is the best way to maintain consistent boolean conditions across sync and async flows?▼

The best way to maintain consistent boolean conditions across sync and async flows is to define composable predicates once and reuse them. This prevents scattering ad-hoc boolean checks and ensures validation logic remains standardized throughout your application.

How do I narrow unknown values safely when applying multiple validation checks in TypeScript?▼

To narrow unknown values safely, use predicate refinements that act as type guards. By applying `refinement` and intersection narrowing with `andRefinement`, you ensure values are safely validated and their types are narrowed for subsequent operations.

Can I convert a type guard predicate into a rule-compatible function for a rule engine?▼

Yes, you can convert a predicate into a rule-compatible function using `Predicate.toRule`. This standardizes validation-style flows by transforming your composable boolean conditions into a format that rule engines can process directly.

When should I use `Predicate.all` versus `Predicate.any` for bulk composition?▼

Use `Predicate.all` when every condition in a bulk composition must match, acting as a logical AND. Use `Predicate.any` when only one condition needs to match, acting as a logical OR, allowing you to create complex rules efficiently.