Plugins · CCPP PQL
HOW directives
HOW directives tell Claude how to design and write the code of the objectives: limits, naming, principles, packages, boundaries.
A directive frames the objectives of its block and of its descendants. It creates no objective and no scope.
FROM @packages {
HOW {
LIMIT FILE TO 250 LINES;
LIMIT PARAMETERS TO 4;
NAMING FILES kebab-case;
FOLLOW KISS, YAGNI;
PACKAGES NO_NEW;
}
FROM @packages/pql {
LIMIT FILE TO 200 LINES; // tightens the inherited 250
PREFER "Plain functions" OVER "Classes";
ADD "The PQL lexer";
}
}Strengths
| Strength | Meaning | Directives |
|---|---|---|
| Constraint | Mandatory: a violation is fixed or reported as a blocker. | all but the two below |
| Principle | Guides decisions, applied with judgment. | FOLLOW |
| Preference | Favored when constraints allow; another approach is possible when justified. | PREFER, REUSE |
Forms and placement
Directives end with ;. Write them directly in a block or group them in HOW { }: both are equivalent. HOW
takes no parameter, holds directives only (and calls of how functions), and several HOW blocks add up.
Directives sit in the preamble of their block, with stop rules and policy references, before any objective, child scope or condition chain. A directive in a branch applies only when the branch is selected.
Directives
| Directive | Takes |
|---|---|
STRUCTURE BY, STYLE, ERRORS USING, STATE, ASYNC USING, TEST USING, INTEGRATE VIA, SPLIT WHEN | 1 description |
PATTERN, DOCUMENT | 1 to N descriptions |
BOUNDARY t EXPOSES "s", … / BOUNDARY t CONSUMES "type", … | a target; symbols or types |
ISOLATE t FROM t2, … | a target; the targets it must not depend on |
CONTRACT t ACCEPTS "type", … RETURNS "type" | a target; optional inputs, exactly one return |
COLOCATE t WITH t2 | two targets |
IMPLEMENT t USING "technique" | a target and a description |
LIMIT category TO n unit | a category, an integer, a unit (none for PARAMETERS) |
DEPTH MAX n | an integer: nesting depth of control structures |
COMPLEXITY metric MAX n | a metric and a positive integer |
NAMING category convention | two registered identifiers |
MATCH aspect OF @source | an aspect and an existing path |
FOLLOW principle, … | registered principles |
PREFER "a" OVER "b" | two descriptions |
REUSE @a, … | existing paths to examine before writing new code |
PACKAGES NO_NEW / STANDARD_ONLY / ALLOW "name", … | the third-party dependencies allowed |
COMPATIBILITY mode WITH baseline | BACKWARD or RUNTIME, and a path or a description |
A target is a string or an @ reference and may name code the objectives create. Package names are strings:
"@scope/name" is a package, never a path. Registered identifiers are listed in the
cheatsheet; unknown ones are refused with the known list.
Bounds are inclusive and measured: LINES counts lines (a final line ending adds none), KB is 1,000 bytes and
KIB 1,024. The compiled prompt tells Claude never to claim compliance it has not measured.
Inheritance and conflicts
Directives accumulate. A child never removes an inherited directive, and the order of declaration never decides a conflict: the compiler reports it.
| Conflict | Code |
|---|---|
Two PACKAGES modes in one block | PQL-H008 (error) |
PACKAGES ALLOW under an inherited NO_NEW or STANDARD_ONLY | PQL-H009 (error) |
One NAMING category with two conventions | PQL-H010 (error) |
PREFER a OVER b and PREFER b OVER a | PQL-H011 (warning) |
Child BOUNDARY widening its parent's for a target | PQL-H012 (error) |
Looser LIMIT, DEPTH MAX or COMPLEXITY than one in force: the stricter applies | PQL-H013 (warning) |
| Same bound declared twice | PQL-H014 (info) |
Other errors
| Situation | Code |
|---|---|
| Missing, extra, blank or mistyped parameter | PQL-T001 to PQL-T005 |
Empty @, negative or decimal bound, unknown identifier | PQL-T006, PQL-T007, PQL-T008 |
Required clause missing (CONTRACT without RETURNS) | PQL-H003 |
| Clause unknown, repeated or out of order | PQL-H004 |
Unit wrong for the LIMIT category, or missing | PQL-H005, PQL-H006 |
COMPLEXITY bound below the metric minimum | PQL-H007 |
Anything but a directive inside HOW; parameter on HOW | PQL-H001, PQL-H002 |
| Directive after an executable instruction | PQL-P001 |
MATCH, REUSE or COMPATIBILITY source missing | PQL-R009 |