name-boolean-flags-affirmatively
When naming a boolean variable, parameter or attribute, phrase it affirmatively
ソース情報
- リポジトリ
- samugit83/cortex
- ソースの最終更新活動
- 2026年9月20日 20:32
- 検出された SKILL.md の言語
- 英語
- スター
- 1
- フォーク
- 0
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
SKILL.md を表示中
SKILL.md
ソースの指示 · 読み取り専用プレビュー- 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.
GitHubで見る