← Primitives
hook Quality updated 2026-06-15

No-em-dash hook

A PostToolUse hook that blocks em dashes from being written to files.

json

A deterministic gate. The model cannot talk its way past it. Register in settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "node .claude/hooks/no-emdash.mjs"
          }
        ]
      }
    ]
  }
}

The script greps the edited file for em and en dashes and exits non-zero with a message if it finds any, which feeds the failure back to the model as a correction.

Used in

Raw text: /primitives/no-emdash-hook.txt