skills/tabular/hierarchical-rule-engine/SKILL.md
Two-level group-then-pattern dispatch for game AI agents where groups filter by game state and ordered patterns within a group fire the first matching action
npx skillsauth add wenmin-wu/ds-skills tabular-hierarchical-rule-engineInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
For heuristic game AI agents, a flat if-else chain becomes unmaintainable past ~20 rules. A two-level dispatch — groups that test broad game state (attacking, defending, set piece), then ordered patterns within the matching group — scales to hundreds of rules while staying readable. Each pattern is a dict with environment_fits (predicate) and get_action (callback), evaluated in priority order.
def make_pattern(predicate, action_fn):
return lambda obs, x, y: {
"environment_fits": predicate,
"get_action": action_fn,
}
def make_group(group_predicate, patterns_fn):
return lambda obs, x, y: {
"environment_fits": group_predicate,
"get_memory_patterns": patterns_fn,
}
groups = [attack_group, defend_group, set_piece_group, fallback_group]
def get_action(obs, x, y):
for make_grp in groups:
grp = make_grp(obs, x, y)
if grp["environment_fits"](obs, x, y):
for make_pat in grp["get_memory_patterns"](obs, x, y):
pat = make_pat(obs, x, y)
if pat["environment_fits"](obs, x, y):
return pat["get_action"](obs, x, y)
return default_action
environment_fits) and action callbackdata-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF