boolean-naming-conventions
Installation
SKILL.md
Summary
Boolean variables and functions returning booleans must be named with a Verb Prefix such as is, has, can, or should. This ensures the name clearly indicates a true/false value and reads naturally in control structures.
Rationale
- Natural Language: Code should read like a sentence.
if (isValid)is clearer thanif (valid). - Ambiguity Reduction:
validcould be a validation object or a boolean.isValidis definitely a boolean.
Guidance
- Prefixes:
is: State or Identity (e.g.,isVisible,isAdmin).has: Possession or Containment (e.g.,hasPermission,hasChildren).can: Capability (e.g.,canEdit,canSubmit).should: Recommendation or Future Action (e.g.,shouldRender,shouldRetry).
- Scope:
- Applies to local variables, class properties, and functions.
- Exception: See Component Props Naming for UI component props (which follow HTML attribute style).