/pedantic-coder:boolean-namingfrom pedantic-coder
Enforces boolean variable naming conventions with is/has/can/should prefixes, positive naming, and the rule that names must read as yes/no questions. Activates for ambiguous or improper boolean names.
Ships in pedantic-coder. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Every boolean variable, field, parameter, and return value must read as a question that has exactly two answers: yes or no. If you read the name out loud and it does not form a grammatical yes/no question, the name is wrong. Not "could be better" — wrong.
active is not a question. isActive is. permission is not a question. hasPermission is. retry is not a question. shouldRetry is. This is the entire rule. Everything below is application of it.
Every boolean gets a prefix. No exceptions.
| Prefix | Meaning | Examples |
|---|---|---|
is | State of being — the subject currently exhibits this quality | isActive, isVisible, isAuthenticated, isEmpty, isValid |
has | Possession or existence — the subject owns or contains something | hasPermission, hasChildren, hasError, hasSubscription |
can | Capability or permission — the subject is allowed or able to do this | canEdit, canDelete, canAccessAdmin, canRetry |
should | Recommendation or conditional — logic recommends this action | shouldRetry, shouldCache, shouldNotify, shouldRedirect |
was / did | Past tense — something already happened | wasProcessed, didSucceed, wasModified, didExpire |
The prefix is not optional. A boolean without a prefix forces the reader to guess whether enabled is a boolean, a string, a function, or an adjective modifying something else. The prefix eliminates all ambiguity in a single glance.
Name booleans in the positive. Always. The logic can negate; the name must not.
BAD — negative names create double negatives:
isNotReady → if (!isNotReady) — unreadable
isDisabled → if (!isDisabled) — "not disabled" means "enabled"
isInvalid → if (!isInvalid) — triple cognitive load
hasNoPermission → if (!hasNoPermission) — brain melts
isNotFound → if (isNotFound) — why not just check the positive?
GOOD — positive names, inverted in logic when needed:
isReady → if (!isReady) — clear: "not ready"
isEnabled → if (!isEnabled) — clear: "not enabled"
isValid → if (!isValid) — clear: "not valid"
hasPermission → if (!hasPermission) — clear: "no permission"
isFound → if (!isFound) — clear: "not found"
The reason is mechanical: if (!isDisabled) requires the reader to evaluate a negation of a negation. if (isEnabled) or if (!isEnabled) each require evaluating one thing. This is not pedantry — studies on code comprehension consistently show negative boolean names increase error rates in conditionals.
Functions that return booleans follow the same prefix rules. The function name IS the question; the return value IS the answer.
# GOOD — the function name is the question
def is_even(number: int) -> bool: ...
def has_access(user: User, resource: Resource) -> bool: ...
def can_proceed(workflow: Workflow) -> bool: ...
def should_retry(error: Exception, attempt: int) -> bool: ...
# BAD — the function name is not a question
def check_even(number: int) -> bool: ... # "check" is a verb, not a question
def validate_access(user, resource) -> bool: ... # "validate" implies side effects
def get_status() -> bool: ... # "get" implies returning data, not answering
def verify(token: str) -> bool: ... # verify what? no subject, no question
// GOOD
function isEven(n: number): boolean { ... }
function hasAccess(user: User, resource: Resource): boolean { ... }
function canProceed(workflow: Workflow): boolean { ... }
// BAD
function checkEven(n: number): boolean { ... }
function getAccess(user: User): boolean { ... }
function processValid(data: unknown): boolean { ... }
// GOOD — Go convention: Is, Has, Can prefix on exported functions
func IsEven(n int) bool { ... }
func HasAccess(user *User, resource *Resource) bool { ... }
func CanProceed(wf *Workflow) bool { ... }
// BAD
func CheckEven(n int) bool { ... }
func GetStatus() bool { ... }
func Validate(token string) bool { ... }
The prefix always comes first. The prefix IS the first word. Not the second, not somewhere in the middle.
GOOD:
isUserAuthenticated
hasValidSubscription
canEditDocument
shouldRefreshToken
wasPaymentProcessed
BAD:
authenticatedUser → is this a User object? a string? a boolean?
userIsAuthenticated → prefix buried after the subject
validSubscription → no prefix at all
documentCanEdit → inverted order
paymentWasProcessed → prefix is not first
These names are never acceptable for booleans:
| Banned Name | Why | Fix |
|---|---|---|
flag | Says nothing about what it controls | Name the specific condition: isDebugMode, shouldLogVerbose |
status | Is it a boolean? A string? An enum? An object? | Name the specific state: isActive, isPending, isApproved |
toggle | Describes the action, not the state | Name the state being toggled: isExpanded, isVisible |
check | Describes the action, not the result | Name what is being checked: isValid, hasErrors |
state | Maximally vague | Name the specific state: isLoading, isConnected |
active / enabled / visible | Missing prefix — ambiguous type | isActive, isEnabled, isVisible |
b, f, ok | Single-letter booleans | Spell it out. Even in a 3-line scope. |
The only exception for single-letter booleans: loop variables in tiny, obvious scopes where the boolean is consumed on the next line. Even then, prefer a name.
| Context | BAD | GOOD | Why |
|---|---|---|---|
| User login state | loggedIn | isLoggedIn | Missing prefix |
| Feature toggle | darkMode | isDarkModeEnabled | Ambiguous type without prefix |
| Permission check | admin | isAdmin or hasAdminRole | admin could be a string, object, or ID |
| Error state | error | hasError | error is typically the error object itself |
| Loading state | loading | isLoading | Missing prefix |
| Empty collection | empty | isEmpty | Missing prefix |
| Negated state | isNotValid | isValid (negate in logic) | Negative name |
| Past event | processed | wasProcessed | Missing temporal prefix |
| Config flag | flag | isFeatureEnabled | flag means nothing |
| Function | validate() | isValid() | Verb implies action, not question |
Working implementations in examples/:
examples/boolean-patterns.md — Multi-language examples (Python, TypeScript, Go) showing bad-to-good boolean naming transformations for variables, function predicates, class properties, and function parameters.When naming or reviewing boolean identifiers:
is, has, can, should, was, or diduserIsActive, only isUserActiveisNot, isUn, isIn, hasNo prefixesif (!isValid) not if (isInvalid)flag, status, toggle, check, state, or a bare adjectivesetVisible(isVisible: true)isActive, no other file uses active for the same conceptWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
boolean-naming, naming-conventions, code-quality, variables, predicates
npx claudepluginhub oborchers/fractional-cto --plugin pedantic-coder16 skills in this plugin
/abbreviation-policyThis skill should be used when the user is abbreviating identifiers, using acronyms, or when a codebase has inconsistent short forms like btn/button, msg/message, req/request. Covers the abbreviation decision framework, approved short forms, and the rule that consistency beats brevity./casing-lawThis skill should be used when the user is writing code with mixed casing conventions, choosing casing for identifiers, enforcing casing consistency across a codebase, or when camelCase and snake_case appear in the same file. Covers per-context casing rules, acronym handling, and the absolute prohibition of mixed conventions./dead-code-intoleranceThis skill should be used when the user's code contains commented-out code blocks, unused imports, unreachable branches, TODO/FIXME comments that have been sitting for more than a day, or comments referencing removed functionality. Covers the elimination of dead code and the rule that version control remembers so you don't have to./declaration-orderThis skill should be used when the user is organizing code within a file, ordering class members, structuring module exports, or when a file has constants mixed with functions mixed with classes in no predictable order. Covers file-level ordering, class member ordering, and the rule that every file should have the same shape./go-pedantryThis skill should be used when the user is writing Go code and needs guidance on Go-specific pedantry: error wrapping with fmt.Errorf and %w, interface design (accept interfaces return structs), package naming conventions, struct field ordering, receiver naming, golangci-lint configuration, and Go-specific patterns that go beyond universal principles./guidelines-complianceThis skill should be used when the user asks to check code against CLAUDE.md guidelines, review compliance with project conventions, audit a repository's own rules, verify CLAUDE.md inheritance, or when performing a comprehensive pedantic audit that should include project-specific rules. Covers the CLAUDE.md inheritance model, directory walk-up algorithm, parsing guidelines vs informational content, and systematic compliance checking.Other plugins' skills for the same job