You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LED-234: Document conditional hook patterns for Claude Code
Add section showing if field usage for PreToolUse and PreCommit
hooks with path_matches and input_contains conditions.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: hooks/index.html
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,55 @@ <h2>PATH Shim Integration</h2>
61
61
<pre><code>delimit activate
62
62
# Adds ~/.delimit/shims to PATH via shell profile</code></pre>
63
63
64
+
<h2>Conditional Hooks (Claude Code)</h2>
65
+
<p>Claude Code supports an <code>if</code> field on hooks that lets Delimit fire governance checks only when they matter. This keeps hooks invisible during normal coding and active only when API specs are touched.</p>
66
+
67
+
<h3>PreToolUse: Lint only on spec edits</h3>
68
+
<p>This hook fires only when an Edit or Write targets an OpenAPI or Swagger file:</p>
<p>The session-start hook always fires to show governance status and ledger context:</p>
99
+
<pre><code>{
100
+
"hooks": {
101
+
"SessionStart": [
102
+
{
103
+
"type": "command",
104
+
"command": "npx delimit-cli hook session-start"
105
+
}
106
+
]
107
+
}
108
+
}</code></pre>
109
+
110
+
<h3>Automatic installation</h3>
111
+
<p>Running <code>delimit setup</code> or <code>delimit activate</code> installs these conditional hooks automatically. Existing hooks without <code>if</code> conditions are upgraded in place.</p>
112
+
64
113
<h2>Cross-Model Compatibility</h2>
65
114
<p>Hooks work the same way regardless of whether changes are made by:</p>
0 commit comments