rulebox

Execute named business rule sets against a mutable context in ColdBox/BoxLang.

1|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ColdBox/skills --skill rulebox
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rulebox
Source: https://github.com/ColdBox/skills/tree/main/modules/rulebox
Command: npx skills add https://github.com/ColdBox/skills --skill rulebox

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Encapsulates complex conditional logic and policy evaluation outside of handlers and services so that eligibility, pricing, authorization, and workflow branching can be expressed as reusable, testable rules instead of sprawling if/elseif trees.

Core Features & Use Cases

  • RuleEngine injection for seamless dependency access in ColdBox/BoxLang components.
  • Define rules with when/then/otherwise closures, compose named rule sets, chain rules, and run sets against a mutable context struct.
  • Production patterns such as loan eligibility evaluation, pricing adjustments, policy enforcement, and workflow branching that remain deterministic and testable.
  • Testability: call .run(context) directly from TestBox specs and keep side effects out of rule closures.

Quick Start

Run a named rule set like loan_eligibility against an applicant struct to return approved and reasons fields.

Frequently Asked Questions about rulebox

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

FAQPage Schema
How do I replace complex conditional logic with a business rules engine in ColdBox?

Encapsulate complex conditional logic by defining when/then/otherwise closures in named rule sets, then execute them against a mutable context struct to replace sprawling if/elseif trees for eligibility and authorization decisions.

How do I test business rules and policy evaluation without external side effects?

Test business rules directly from TestBox specs by calling .run(context) on a named rule set, keeping side effects out of rule closures to ensure deterministic evaluation and testable policy enforcement.

Can I use RuleEngine injection for dependency access in BoxLang applications?

RuleEngine injection provides seamless dependency access in ColdBox and BoxLang components, allowing you to compose named rule sets and chain rules for pricing adjustments and workflow branching.

What is the best way to handle loan eligibility evaluation and workflow branching deterministically?

Run a named rule set like loan_eligibility against an applicant struct to deterministically evaluate eligibility, returning approved and reasons fields while maintaining a predictable evaluation order.

Does this business rules approach require external dependencies or components?

No external dependencies or components are required; the rule engine operates entirely within the ColdBox and BoxLang ecosystem to evaluate policies and enforce rules against mutable context structs.

When should I move policy enforcement and authorization checks out of my handlers and services?

Move policy enforcement out of handlers and services when eligibility, pricing, and workflow branching logic becomes complex, expressing them as reusable, testable rule sets instead of nested conditionals.