Plugins · CCPP PQL
Conditions
IF HAPPEN, IF NOT HAPPEN, ELSE IF and ELSE select the instructions to apply according to a situation Claude can verify.
A condition chain selects at most one branch, according to a situation Claude verifies when it gets there. It uses the active scope and creates none.
| Keyword | Runs its block | Parameter |
|---|---|---|
IF HAPPEN | when the situation is verified | exactly 1 description |
IF NOT HAPPEN | when the situation is refuted | exactly 1 description |
ELSE IF HAPPEN | otherwise, when this situation is verified | exactly 1 description |
ELSE IF NOT HAPPEN | otherwise, when this situation is refuted | exactly 1 description |
ELSE | when every previous condition of the chain is false | none |
FROM @packages/pql {
IF HAPPEN "The test setup is incomplete" {
SKIP "Fixing the failures caused by this setup";
} ELSE IF HAPPEN "A defect of the code explains the failures" {
MODIFY "The code responsible for the failures";
} ELSE {
CONTINUE;
}
}Chains
- A chain is one
IF HAPPENorIF NOT HAPPEN, then any number ofELSE IF …, then at most oneELSE, last. - A branch continues the chain only when it directly follows the
}of the previous one. TwoIFin a row are two independent decisions. - Braces are mandatory, even for one instruction. An empty block is valid: nothing is asked in that branch.
- A description is one situation: several comma-separated strings are refused, not combined.
How Claude evaluates them
The compiler checks the structure only. The compiled prompt tells Claude how to decide a chain when execution reaches it:
- Test the branches in order and select the first whose condition is true; if none is, run
ELSEwhen present. - A situation is verified, refuted or indeterminate. Indeterminate is never false, and a missing observation is no proof: while a condition is indeterminate, no later branch is selected, and Claude says what information is missing or asks you.
- Decide once: no watching for the situation later, no switching branch if it changes afterwards.
- An unselected branch is inactive: it creates nothing and activates none of its rules.
What a branch holds
A branch inherits the scope and restrictions of its block. It holds objectives, child scopes, nested chains and,
in its preamble, stop rules, policy references and HOW directives that apply to that branch only. No branch can
lift an inherited restriction, and SESSION SUCCESS is not allowed in a branch.
Syntax and types are checked in every branch. File system checks of a branch (a FROM target, a MATCH source)
become warnings, checked again when the branch is selected.
Errors
| Situation | Code |
|---|---|
| No description, several, blank, or not a string | PQL-T001 to PQL-T004 |
| Block missing | PQL-C001 |
ELSE IF or ELSE with no chain to attach to | PQL-C002 |
Several ELSE in one chain | PQL-C003 |
Branch after ELSE | PQL-C004 |
Parameter given to ELSE | PQL-C005 |
| No active scope | PQL-D004 |