add-trigger

Automate MTG triggered ability definition and wiring in the engine.

212|148|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/phase-rs/phase --skill add-trigger
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-trigger
Source: https://github.com/phase-rs/phase/tree/main/.claude/skills/add-trigger
Command: npx skills add https://github.com/phase-rs/phase --skill add-trigger

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables consistent modeling and wiring of MTG triggered abilities within the engine, covering the full trigger lifecycle from event detection to resolution, including TriggerDefinition, TriggerMode, the matcher registry, APNAP ordering, targeting, intervening-if, constraints, and parser wiring.

Core Features & Use Cases

  • Defines TriggerDefinition with fields like mode, execute, origin, destination, trigger_zones, and condition.
  • Provides matchers to detect relevant events (ChangesZone, SpellCast, DamageDone, etc.) and a central registry to dispatch them.
  • Handles APNAP ordering, targeting extraction, and constraint checks (OncePerTurn, OncePerGame, OnlyDuringYourTurn) during fire and resolution.
  • Integrates with oracle_trigger parser to convert Oracle-style trigger lines into executable definitions, enabling end-to-end trigger support.

Quick Start

Define a TriggerDefinition, register a matcher, and parse an oracle trigger line to verify correct frontmatter and activation.

Frequently Asked Questions about add-trigger

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

FAQPage Schema
How do I define and validate MTG triggered abilities in a game engine?

To define MTG triggered abilities, you create a TriggerDefinition with fields like mode, execute, and condition, then validate it against intervening-if clauses, APNAP ordering, and constraint checks such as OncePerTurn to ensure correct event resolution.

How does an oracle trigger parser convert MTG trigger lines into executable definitions?

An oracle trigger parser parses When/Whenever/At style MTG trigger lines and converts them into executable TriggerDefinitions by integrating with the TriggerMode registry and matcher system to wire event detection automatically.

Can I use matchers to detect specific MTG events like ChangesZone or SpellCast?

Yes, you can use matchers to detect specific MTG events like ChangesZone, SpellCast, and DamageDone. A central matcher registry dispatches these events to the corresponding TriggerDefinition for resolution.

What's the best way to handle APNAP ordering and targeting for triggered abilities?

Handling APNAP ordering and targeting for triggered abilities requires the engine to process trigger resolution through the central registry, applying constraint checks and extracting targets during both fire and resolution phases.

What constraints can I apply to MTG triggered abilities like OncePerTurn or OnlyDuringYourTurn?

You can apply constraints like OncePerTurn, OncePerGame, and OnlyDuringYourTurn to MTG triggered abilities. These constraint checks are evaluated during the fire and resolution phases to limit ability activation.

Why does my MTG triggered ability fail validation against intervening-if clauses?

MTG triggered ability validation fails against intervening-if clauses when the TriggerDefinition condition field does not correctly map to the event matching logic, preventing the parser from wiring proper event detection.