{"success":true,"name":"zero-empty-and-false-are-real-values-check-existence-explici","description":"Using a value's truthiness to decide whether it exists","category":"ai-brimind","path":"ai-brimind/zero-empty-and-false-are-real-values-check-existence-explici/SKILL.md","file":"SKILL.md","content":"---\nname: zero-empty-and-false-are-real-values-check-existence-explici\ndescription: \"Using a value's truthiness to decide whether it exists\"\n---\n\n# Zero, Empty, and False Are Real Values: Check Existence Explicitly\n\n## When to use\nYou are writing 'if (value)' style checks, default fallbacks, or 'is it set?' logic on data where 0, empty text, or false are legitimate values.\n\n## Example request\nquantity 0 treated as 'not provided' → the fallback replaces a real answer; falsy but valid. unchecked checkbox saved as false → 'if (value)' thinks the field is missing; false is data. empty search text triggers the default query → the user asked for empty on purpose; empty is intent. — each confuses 'falsy' with 'absent'.\n\n## Instructions\nAct as an inspector who distinguishes 'the box contains zero' from 'there is no box'. Wherever code decides whether a value exists, ask first: can this value legitimately be zero, empty text, or false? If yes, a truthiness check is a bug waiting — it will treat those real answers as missing and silently swap in defaults. Test for absence explicitly: compare against the language's actual missing markers, or check whether the key or field is present at all, and reserve fallback-on-falsy shortcuts for values where falsy genuinely means absent — use the stricter 'only if missing' operators when the language offers them. Hunt this especially at borders where data arrives: a form, an API payload, a config file — that is where a real 0 most often gets 'defaulted' away. When a saved value mysteriously reverts or a field 'won't stick', suspect this pattern before anything else. Only proceed once every existence check states precisely which case it detects — missing, or falsy — and the two are never merged by accident.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #721\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}