ccppccpp home
Browse the documentation

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

StrengthMeaningDirectives
ConstraintMandatory: a violation is fixed or reported as a blocker.all but the two below
PrincipleGuides decisions, applied with judgment.FOLLOW
PreferenceFavored 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

DirectiveTakes
STRUCTURE BY, STYLE, ERRORS USING, STATE, ASYNC USING, TEST USING, INTEGRATE VIA, SPLIT WHEN1 description
PATTERN, DOCUMENT1 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 t2two targets
IMPLEMENT t USING "technique"a target and a description
LIMIT category TO n unita category, an integer, a unit (none for PARAMETERS)
DEPTH MAX nan integer: nesting depth of control structures
COMPLEXITY metric MAX na metric and a positive integer
NAMING category conventiontwo registered identifiers
MATCH aspect OF @sourcean 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 baselineBACKWARD 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.

ConflictCode
Two PACKAGES modes in one blockPQL-H008 (error)
PACKAGES ALLOW under an inherited NO_NEW or STANDARD_ONLYPQL-H009 (error)
One NAMING category with two conventionsPQL-H010 (error)
PREFER a OVER b and PREFER b OVER aPQL-H011 (warning)
Child BOUNDARY widening its parent's for a targetPQL-H012 (error)
Looser LIMIT, DEPTH MAX or COMPLEXITY than one in force: the stricter appliesPQL-H013 (warning)
Same bound declared twicePQL-H014 (info)

Other errors

SituationCode
Missing, extra, blank or mistyped parameterPQL-T001 to PQL-T005
Empty @, negative or decimal bound, unknown identifierPQL-T006, PQL-T007, PQL-T008
Required clause missing (CONTRACT without RETURNS)PQL-H003
Clause unknown, repeated or out of orderPQL-H004
Unit wrong for the LIMIT category, or missingPQL-H005, PQL-H006
COMPLEXITY bound below the metric minimumPQL-H007
Anything but a directive inside HOW; parameter on HOWPQL-H001, PQL-H002
Directive after an executable instructionPQL-P001
MATCH, REUSE or COMPATIBILITY source missingPQL-R009