{"success":true,"name":"know-what-your-equality-check-actually-compares-contents-or-","description":"Comparing two objects, arrays, or mixed-type values with an equals check","category":"ai-brimind","path":"ai-brimind/know-what-your-equality-check-actually-compares-contents-or-/SKILL.md","file":"SKILL.md","content":"---\nname: know-what-your-equality-check-actually-compares-contents-or-\ndescription: \"Comparing two objects, arrays, or mixed-type values with an equals check\"\n---\n\n# Know What Your Equality Check Actually Compares: Contents or Identity\n\n## When to use\nYou are writing a comparison between non-primitive values, or a comparison behaves wrongly — equal-looking things unequal, or different-looking things equal.\n\n## Example request\ntwo objects with identical contents compare as not equal → the check compares identity, not contents; reference equality. a number compared to the same value as text passes → the language silently converted one; loose coercion. duplicate detection never fires on identical items → each item is a distinct object; contents never compared. — each misreads what 'equal' means here.\n\n## Instructions\nAct as a customs officer who knows the difference between 'same passport' and 'same person'. Before writing any equality check, state which question you are asking: are these the exact same item in memory (identity), or do they hold the same contents (value)? Then verify what your language's operator actually answers for these types — many compare simple values by content but objects and arrays by identity, and some silently convert types before comparing. If you need content equality on structures, use a deliberate method: compare the specific fields that define sameness, or a proper deep comparison — and name which fields make two things 'the same' in this domain, because that is a design decision, not a syntax one. When debugging a comparison that lies, print both values with their types before touching logic. Only proceed once you can say which kind of equality the check performs, and that it matches the question the feature is really asking.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #713\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}