boolean-parameters
/boolean-parameters
Replace opaque boolean flags with named enums or split functions so call sites read without the definition open. Use when a signature takes a bare boolean or a function branches on a mode flag.
- Author
- Amey-Thakur ↗
- Repository
- AI-SKILLS ↗
- Licence
- MIT
- Last repository change
- 05.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Replace opaque boolean flags with named enums or split functions so call sites read without the definition open. Use when a signature takes a bare boolean or a function branches on a mode flag.
Original author description
Replace opaque boolean flags with named enums or split functions so call sites read without the definition open. Use when a signature takes a bare boolean or a function branches on a mode flag.
How it works
- Method
- Litmus tests
- Boundaries
SKILL.md preview
---
name: boolean-parameters
description: Replace opaque boolean flags with named enums or split functions so call sites read without the definition open. Use when a signature takes a bare boolean or a function branches on a mode flag.
---
# Boolean parameters
A boolean argument reads fine at the definition and lies at the call site:
`render(true, false)` tells the reader nothing about what is on and what is
off. Worse, a flag usually means the function does two different jobs bolted
together behind an `if`, and splitting them would be clearer than switching
between them.
## Method
1. **Read your call sites, not your signatures.** Find the bare
`true`/`false` arguments: `createUser(data, true)`, `connect(host,
false, true)`. If a reader must open the definition to learn what the
boolean means, it is the wrong parameter. Grep for `, true)` and
`, false)` to surface them.
2. **Replace a mode flag with an enum.** `setAlignment(true)` becomes
`setAlignment(Alignment.Left)`; a two-value flag becomes a named type
with two cases. The call site now states what it does, and a third mode
later extends the enum instead of adding a second boolean.
3. **Split a function that branches on the flag.** If `save(data, isDraft)`
is `if (isDraft) {...} else {...}` with two nearly separate bodies, make
`saveDraft(data)` and `publish(data)`. Two honest names beat one
function with a hidden fork inside it.
4. **Name the argument at the call when you cannot change the API.** For a
boolean you do not own, use a keyword argument (`retry=True` in Python),
an options object (`fetch(url, { cache: false })` in JS), or a named
constant so the site reads. This is the fallback, not the goal.
5. **Never pass two booleans in a row.** `f(true, false, true)` is
unreadable and one transposition away from a silent bug. Collect related
flags into an options object or a small config type where each field is
named at the call.
6. **Default the common case, require the rare one.** If a flag is true 95%
of the time, an options object with a sensible default drops it from
most calls entirely, leaving the flag visible only where behavior
actually differs.
## Litmus tests
- Can you read a call site and know what every argument does without
opening the definition?
- Does any function take two or more booleans in sequence?
- Is a boolean parameter really selecting between two behaviors that each
deserve their own name?
## Boundaries
A single boolean on a well-named setter (`setVisible(true)`) reads fine and
needs no enum: the property name already carries the meaning. Established
library APIs you do not control set their own conventions; wrap them for
clarity at your call sites rather than forking them.
Versions
The database has no other skills named boolean-parameters.
Database snapshot: 13.11.2026 · package version 40f77a8151fb (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 95type-driven-design
Make illegal states unrepresentable — enums instead of boolean and string flags, newtypes instead of bare primitives, parsed types instead of validated ones, typestate for protocol order. Use when a struct has fields that are only valid in some combinations, when validation is… - 100boolean-naming
This skill should be used when the user is naming boolean variables, writing predicate functions, using flags or toggles, or when code contains ambiguous boolean names like flag, status, check, active without proper prefixes. Covers is/has/can/should prefixes, positive naming,… - 90compose-component-design
Use when designing or reviewing reusable Jetpack Compose component APIs with modifier parameters, root layout placement, caller-provided variable content, primitive content parameters, optional content, or boolean shape flags. - 100clean-functions
Write functions that do one thing and are obvious from the outside — at most three arguments, no output arguments, no flag arguments, no dead functions, one level of abstraction, guard clauses over nesting (F1-F4, G30, G34). Use when writing or refactoring functions, components… - 90dcp-exact
Exact, a pseudo-Boolean and integer linear solver with Python bindings (package exact, import exact, class Exact) that builds models from named integer and 0/1 variables, linear constraints, reification and multiplication. Use when writing, debugging or explaining an integer… - 91effect-react-composition
Build composable React components using Effect Atom for state management. Use this skill when implementing React UIs that avoid boolean props, embrace component composition, and integrate with Effect's reactive state system.