[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M74JGZW4HZCSQDPKP1R0JE1C":3,"skill-same:01M74JGZW4HZCSQDPKP1R0JE1C":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M74JGZW4HZCSQDPKP1R0JE1C","pretooluse-prose",null,"A PreToolUse Bash guard reads the whole command, so a heredoc or commit message naming a banned command trips it. Use on BLOCKED by a guard, writing a Bash matcher, or a non-prose argument misread.","MrBinnacle\u002Fskills","MrBinnacle","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F124333270?v=4","01M74JFP3ZCYZP94CVBY1JR1E6","Matthew Gruber","01M74JFP4K4A75MGTZBC9D836G",1,"MIT","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fpretooluse-prose\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: pretooluse-prose\ndescription: A PreToolUse Bash guard reads the whole command, so a heredoc or commit message naming a banned command trips it. Use on BLOCKED by a guard, writing a Bash matcher, or a non-prose argument misread.\n---\n\n# PreToolUse Bash Guards Match Prose, Not Just Commands\n\n## Problem\n\nA `PreToolUse` hook on the `Bash` matcher receives the **entire command string**. That string\nroutinely contains English: commit messages, `gh issue create` bodies, heredocs, comments.\n\nA guard written as `re.search(r\"\\bgh\\s+issue\\s+create\\b\", cmd)` therefore fires on\n\n```bash\ngit commit -F- \u003C\u003C'EOF'\nThree issues were created with `gh issue create --body-file -`.\nEOF\n```\n\nwhich invokes no such command. Worse, a guard that blocks a forbidden *phrase* will block the\ndocument that quotes the phrase **to forbid it** — so the fix for the anti-pattern\ncannot be committed.\n\nMeasured instance, 2026-08-17: a newly written guard blocked the very commit installing it.\nThe message described the CLI it policed and quoted the banned wording as an example. Two\nindependent defects, one commit.\n\n## Context \u002F Trigger Conditions\n\n- A hook you just wrote blocks its own installation, its own tests, or its documentation.\n- `BLOCKED by \u003Cyour guard>` appears on a `git commit`, `cat`, or `echo` that contains prose.\n- A guard fires on a heredoc body rather than on a command.\n- You are writing a `PreToolUse` matcher on `Bash` and your detection regex has no anchor.\n- **Non-prose branch:** a live command is blocked because an argument contains the banned word.\n  `git fetch origin pull\u002F292\u002Fhead` names a pull-request ref, and a `git pull` guard reads `pull`\n  in the path. Same defect, no prose: the predicate read text instead of command position.\n\n## Solution\n\n**When a guard blocks your prose, write the file with a file-write tool, not a heredoc.** Use\nthe agent's Write tool, then pass the path: `git commit -F msg.txt`, `gh pr create --body-file\nbody.md`. No guard reads the prose. Read the file back before you send it: a blocked call\nwrites nothing, so a same-named file from earlier work can be what gets posted.\n\n**1. Anchor detection to a command position outside quotes.** A command starts at the beginning\nof the string, after an unquoted shell separator, or inside `$(`, optionally after `VAR=value`\nassignments. A `;` inside quotes is data, and a regex cannot see quotes, so scan for them:\n\n```python\ndef command_starts(cmd):\n    starts, quote, i = [0], None, 0\n    while i \u003C len(cmd):\n        c = cmd[i]\n        if quote == \"'\":\n            quote = None if c == \"'\" else quote\n        elif c == \"\\\\\":\n            i += 1\n        elif c == \"$\" and cmd[i + 1:i + 2] == \"(\":\n            starts.append(i + 2)\n        elif quote == '\"':\n            quote = None if c == '\"' else quote\n        elif c in \"'\\\"\":\n            quote = c\n        elif c in \";&|\\n\":\n            starts.append(i + 1)\n        i += 1\n    return starts\n\n_PREFIX = re.compile(r\"[\\s;&|]*(?:[A-Za-z_]\\w*=\\S*\\s+)*\")\nCREATE_RE = re.compile(r\"gh\\s+(?:issue|pr)\\s+create\\b\", re.IGNORECASE)\n\ndef runs(shell, pattern):\n    return any(pattern.match(shell, _PREFIX.match(shell, s).end())\n               for s in command_starts(shell))\n```\n\n**2. Split the heredoc body from the shell before deciding anything.** The body is the\nartifact; the shell is the invocation. Detect commands in the shell part, inspect content in\nthe body part.\n\n```python\nHEREDOC_RE = re.compile(\n    r\"\u003C\u003C(-)?\\s*(['\\\"]?)(\\w+)\\2\\s*\\n(.*?)(?:^(?(1)\\t*)\\3$|\\Z)\",\n    re.DOTALL | re.MULTILINE)\n\ndef split_shell_and_body(cmd):\n    bodies = []\n    shell = HEREDOC_RE.sub(lambda m: (bodies.append(m.group(4)), \"\u003C\u003CHEREDOC>>\")[1], cmd)\n    for m in re.finditer(r\"--body(?:-file)?[= ]\\s*(['\\\"])(.*?)\\1\", shell, re.DOTALL):\n        bodies.append(m.group(2))\n    return shell, \"\\n\".join(bodies) if bodies else shell\n```\n\n`\u003C\u003C-` lets the terminator carry leading tabs; plain `\u003C\u003C` does not. `(-)?` captures only a real\ndash, so `(?(1)\\t*)` accepts tabs for `\u003C\u003C-` alone. Without that branch a `\u003C\u003C-` match runs to the\nend of the string and swallows every later command into the body.\n\n**3. Fail open on every internal error.** A guard must never be the reason work stops.\n\n```python\nexcept Exception:\n    return 0\n```\n\n**4. Exit codes** (Claude Code hooks docs, checked 2026-10-05). `2` blocks the tool call and\nfeeds stderr to the model; `0` raises no objection, so the normal permission flow applies. To\nwarn without blocking, exit `0` and print `{\"hookSpecificOutput\": {\"hookEventName\": \"PreToolUse\",\n\"additionalContext\": \"...\"}}` on stdout.\n\n## Verification\n\nTest the regression case explicitly — a command that *mentions* the target and *quotes* the\nbanned content must pass:\n\n```bash\npython guard.py \u003C\u003C'IN'\n{\"tool_name\":\"Bash\",\"tool_input\":{\"command\":\"git commit -F- \u003C\u003C'EOF'\\nUse `gh issue create`. Blocks \\\"do not revisit\\\" framing.\\nEOF\"}}\nIN\n# expect exit 0\n```\n\nThen confirm a genuine offender still exits `2`. Both directions, every time — a guard tested\nonly on true positives will over-block, and over-blocking gets the guard deleted.\n\n## Example\n\nMinimum test matrix for any Bash guard:\n\n| Case | Expect |\n| --- | --- |\n| Real offending command | block (2) |\n| Prose mentioning the command | pass (0) |\n| Prose quoting the banned phrase | pass (0) |\n| Compliant real command | pass (0) |\n| Unrelated command | pass (0) |\n| Read-only subcommand (`list`, `view`) | pass (0) |\n| Banned phrase after a `;` inside quotes | pass (0) |\n| Offending command after a `\u003C\u003C-` heredoc | block (2) |\n| Malformed stdin | pass (0) |\n\n## Notes\n\nOpen [gotchas.md](gotchas.md) when a Bash guard blocks its own install, a commit message, or a heredoc body. It records every observed block, including one where the input was not prose at all.\n\n- **`git commit -F-` is the highest-risk input.** Commit messages describe commands and quote\n  forbidden strings by design. If a guard is going to false-positive, it will be here.\n- **Duplicating regexes across two guards is deliberate when they enforce one discipline** —\n  but they drift. Note the sibling in a comment so a change to one prompts a change to both.\n- The same trap applies to `Edit|Write` guards on documentation paths (a matcher of letters\n  and `|` is a list of exact tool names, so `Edit|Write` matches those two tools only; checked\n  2026-10-06): a skill file *describing* an anti-pattern\n  contains the anti-pattern verbatim.\n- Prefer prose-tolerant detection over a suppression escape hatch. An `ACK=1` bypass gets\n  used reflexively and the guard stops meaning anything.\n","# PreToolUse Bash Guards Match Prose, Not Just Commands\n\n## Problem\n\nA `PreToolUse` hook on the `Bash` matcher receives the **entire command string**. That string\nroutinely contains English: commit messages, `gh issue create` bodies, heredocs, comments.\n\nA guard written as `re.search(r\"\\bgh\\s+issue\\s+create\\b\", cmd)` therefore fires on\n\n```bash\ngit commit -F- \u003C\u003C'EOF'\nThree issues were created with `gh issue create --body-file -`.\nEOF\n```\n\nwhich invokes no such command. Worse, a guard that blocks a forbidden *phrase* will block the\ndocument that quotes the phrase **to forbid it** — so the fix for the anti-pattern\ncannot be committed.\n\nMeasured instance, 2026-08-17: a newly written guard blocked the very commit installing it.\nThe message described the CLI it policed and quoted the banned wording as an example. Two\nindependent defects, one commit.\n\n## Context \u002F Trigger Conditions\n\n- A hook you just wrote blocks its own installation, its own tests, or its documentation.\n- `BLOCKED by \u003Cyour guard>` appears on a `git commit`, `cat`, or `echo` that contains prose.\n- A guard fires on a heredoc body rather than on a command.\n- You are writing a `PreToolUse` matcher on `Bash` and your detection regex has no anchor.\n- **Non-prose branch:** a live command is blocked because an argument contains the banned word.\n  `git fetch origin pull\u002F292\u002Fhead` names a pull-request ref, and a `git pull` guard reads `pull`\n  in the path. Same defect, no prose: the predicate read text instead of command position.\n\n## Solution\n\n**When a guard blocks your prose, write the file with a file-write tool, not a heredoc.** Use\nthe agent's Write tool, then pass the path: `git commit -F msg.txt`, `gh pr create --body-file\nbody.md`. No guard reads the prose. Read the file back before you send it: a blocked call\nwrites nothing, so a same-named file from earlier work can be what gets posted.\n\n**1. Anchor detection to a command position outside quotes.** A command starts at the beginning\nof the string, after an unquoted shell separator, or inside `$(`, optionally after `VAR=value`\nassignments. A `;` inside quotes is data, and a regex cannot see quotes, so scan for them:\n\n```python\ndef command_starts(cmd):\n    starts, quote, i = [0], None, 0\n    while i \u003C len(cmd):\n        c = cmd[i]\n        if quote == \"'\":\n            quote = None if c == \"'\" else quote\n        elif c == \"\\\\\":\n            i += 1\n        elif c == \"$\" and cmd[i + 1:i + 2] == \"(\":\n            starts.append(i + 2)\n        elif quote == '\"':\n            quote = None if c == '\"' else quote\n        elif c in \"'\\\"\":\n            quote = c\n        elif c in \";&|\\n\":\n            starts.append(i + 1)\n        i += 1\n    return starts\n\n_PREFIX = re.compile(r\"[\\s;&|]*(?:[A-Za-z_]\\w*=\\S*\\s+)*\")\nCREATE_RE = re.compile(r\"gh\\s+(?:issue|pr)\\s+create\\b\", re.IGNORECASE)\n\ndef runs(shell, pattern):\n    return any(pattern.match(shell, _PREFIX.match(shell, s).end())\n               for s in command_starts(shell))\n```\n\n**2. Split the heredoc body from the shell before deciding anything.** The body is the\nartifact; the shell is the invocation. Detect commands in the shell part, inspect content in\nthe body part.\n\n```python\nHEREDOC_RE = re.compile(\n    r\"\u003C\u003C(-)?\\s*(['\\\"]?)(\\w+)\\2\\s*\\n(.*?)(?:^(?(1)\\t*)\\3$|\\Z)\",\n    re.DOTALL | re.MULTILINE)\n\ndef split_shell_and_body(cmd):\n    bodies = []\n    shell = HEREDOC_RE.sub(lambda m: (bodies.append(m.group(4)), \"\u003C\u003CHEREDOC>>\")[1], cmd)\n    for m in re.finditer(r\"--body(?:-file)?[= ]\\s*(['\\\"])(.*?)\\1\", shell, re.DOTALL):\n        bodies.append(m.group(2))\n    return shell, \"\\n\".join(bodies) if bodies else shell\n```\n\n`\u003C\u003C-` lets the terminator carry leading tabs; plain `\u003C\u003C` does not. `(-)?` captures only a real\ndash, so `(?(1)\\t*)` accepts tabs for `\u003C\u003C-` alone. Without that branch a `\u003C\u003C-` match runs to the\nend of the string and swallows every later command into the body.\n\n**3. Fail open on every internal error.** A guard must never be the reason work stops.\n\n```python\nexcept Exception:\n    return 0\n```\n\n**4. Exit codes** (Claude Code hooks docs, checked 2026-10-05). `2` blocks the tool call and\nfeeds stderr to the model; `0` raises no objection, so the normal permission flow applies. To\nwarn without blocking, exit `0` and print `{\"hookSpecificOutput\": {\"hookEventName\": \"PreToolUse\",\n\"additionalContext\": \"...\"}}` on stdout.\n\n## Verification\n\nTest the regression case explicitly — a command that *mentions* the target and *quotes* the\nbanned content must pass:\n\n```bash\npython guard.py \u003C\u003C'IN'\n{\"tool_name\":\"Bash\",\"tool_input\":{\"command\":\"git commit -F- \u003C\u003C'EOF'\\nUse `gh issue create`. Blocks \\\"do not revisit\\\" framing.\\nEOF\"}}\nIN\n# expect exit 0\n```\n\nThen confirm a genuine offender still exits `2`. Both directions, every time — a guard tested\nonly on true positives will over-block, and over-blocking gets the guard deleted.\n\n## Example\n\nMinimum test matrix for any Bash guard:\n\n| Case | Expect |\n| --- | --- |\n| Real offending command | block (2) |\n| Prose mentioning the command | pass (0) |\n| Prose quoting the banned phrase | pass (0) |\n| Compliant real command | pass (0) |\n| Unrelated command | pass (0) |\n| Read-only subcommand (`list`, `view`) | pass (0) |\n| Banned phrase after a `;` inside quotes | pass (0) |\n| Offending command after a `\u003C\u003C-` heredoc | block (2) |\n| Malformed stdin | pass (0) |\n\n## Notes\n\nOpen [gotchas.md](gotchas.md) when a Bash guard blocks its own install, a commit message, or a heredoc body. It records every observed block, including one where the input was not prose at all.\n\n- **`git commit -F-` is the highest-risk input.** Commit messages describe commands and quote\n  forbidden strings by design. If a guard is going to false-positive, it will be here.\n- **Duplicating regexes across two guards is deliberate when they enforce one discipline** —\n  but they drift. Note the sibling in a comment so a change to one prompts a change to both.\n- The same trap applies to `Edit|Write` guards on documentation paths (a matcher of letters\n  and `|` is a list of exact tool names, so `Edit|Write` matches those two tools only; checked\n  2026-10-06): a skill file *describing* an anti-pattern\n  contains the anti-pattern verbatim.\n- Prefer prose-tolerant detection over a suppression escape hatch. An `ACK=1` bypass gets\n  used reflexively and the guard stops meaning anything.\n",{"name":5,"description":7},"main","fb8ab02da6c849e2cdb704371f5c8c190512d15e","skills\u002Fengineering\u002Fpretooluse-prose","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills","https:\u002F\u002Fmrbinnacle.github.io\u002Fskills\u002F","https:\u002F\u002Fgithub.com\u002FMrBinnacle","https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fmatthew-g-83390523","I make AI coding agents work in messy, real environments, and measure whether they did. Ex-Army NCO, ex-J.P. Morgan.","2026-11-15 04:37:29",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add MrBinnacle\u002Fskills --skill pretooluse-prose",{"tool":39,"command":40},"bunx","bunx skills add MrBinnacle\u002Fskills --skill pretooluse-prose",{"tool":42,"command":43},"pnpm","pnpm dlx skills add MrBinnacle\u002Fskills --skill pretooluse-prose","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fpretooluse-prose\u002FSKILL.md",true,[47,53,57],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"evals\u002Fevals.json","REFERENCE","参考文档",3011,"https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fpretooluse-prose\u002Fevals\u002Fevals.json",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"EVIDENCE.md",10409,"https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fpretooluse-prose\u002FEVIDENCE.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"gotchas.md",18782,"https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fpretooluse-prose\u002Fgotchas.md",[62,69,76,83,90,97],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M74JHKQKA5V9N4B4VDAHBGAP","subagent-handback","Use when prompting, briefing or dispatching a research subagent, or when one goes idle with no report. Name a return channel, check its tool grant, verify every claim, negatives first.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Forchestration\u002Fsubagent-handback\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M74JHGXP4YFAGQCRTMFQ8Q5F","disposition-schema","Use when dispatching parallel agents to verify or adjudicate findings (adversarial verify, security disposition, council fires), or before you consolidate their outputs and risk an ID collision.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Forchestration\u002Fdisposition-schema\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M74JHDMFE7VN27QTC6YRPW22","decision-rights","Use when writing a handoff, plan, ADR or subagent brief, or one says \"do not re-litigate\" or \"final\". Separates evidence access from decision rights and marks what is non-negotiable.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Forchestration\u002Fdecision-rights\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M74JHARZJ246DYV6SSXFRNXT","dead-predicate","Use when a hook didn't fire, a reminder never arrived, or before claiming a rule is hook-enforced: a live router rule can match nothing (missing word, JSON escape, shadowing, stale name).","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fmeta\u002Fdead-predicate\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M74JH7P66AGN3RHKH7DVA5Y4","vacuous-check","Fail-open success checks. Use when a script says OK but nothing happened, a probe batch returns a false negative or 0 results, or `String(got) === String(want)` passes on a type mismatch.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fvacuous-check\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M74JH59H7FJZW0VR6EXMHQJ5","stale-deploy","Use when asking \"is it live\", a deploy looks stale, or a poll loop exits instantly. Verify a GitHub Pages or CDN deploy serves new content: poll a marker new to this deploy.","https:\u002F\u002Fgithub.com\u002FMrBinnacle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fstale-deploy\u002FSKILL.md",[],[]]