Skip to main content

name-boolean-flags-affirmatively

When naming a boolean variable, parameter or attribute, phrase it affirmatively

Informations de source

Dépôt
samugit83/cortex
Dernière activité de la source
20 septembre 2026 à 20:32
Langue détectée de SKILL.md
anglais
Étoiles
1
Forks
0

Options d'installation

Le prompt qui vérifie d'abord la source est sélectionné par défaut. Vous pouvez passer à une commande directe ou télécharger une copie locale.

Vérifiez les fichiers source

Lisez SKILL.md et les fichiers associés affichés par SkillsMP avant de décider de l'installer.

Affichage de SKILL.md

SKILL.md
Instructions source · Aperçu en lecture seule
name
name-boolean-flags-affirmatively
description
When naming a boolean variable, parameter or attribute, phrase it affirmatively
# Boolean names A negated name forces the reader to undo the negation at every use. - Prefer `enabled` to `disabled`, `found` to `not_found`, `valid` to `invalid`. - A parameter that switches behaviour off should still be named for what it controls, with `False` as its value, rather than named for the absence. - Predicates that answer a question read best as `is_`, `has_` or `can_` followed by the thing being asked about. The gain is at the call site: `if enabled:` needs no second thought, and `if not disabled:` never quite does.
Voir sur GitHub