CR-2026-03-25: Claude Code AsciiDoc Attribute Validation Hook
Change Summary
| Field | Value |
|---|---|
Change ID |
CR-2026-03-25-claude-code-hooks-001 |
Requested By |
Self (PRJ-claude-code-features) |
Target Date |
2026-03-25 |
Systems Affected |
|
Risk Level |
Medium (workflow impact on failure) |
Rollback Time |
< 1 minute (restore backup) |
Change Window |
Any (personal development environment) |
Category |
Normal (follows full process) |
Business Justification
Problem Statement
AsciiDoc files in the domus-* documentation ecosystem use Antora attributes ({attribute-name}) defined in antora.yml. When Claude Code edits .adoc files, undefined attributes cause:
-
Build warnings - Antora logs "skipping reference to missing attribute"
-
Broken rendering - Literal
{attribute-name}appears instead of value -
Delayed detection - Errors found at build time, not edit time
-
Rework cycles - Must stop, identify, fix, rebuild, verify
Root Cause History
| Incident | Impact | Resolution Time |
|---|---|---|
RCA-2026-02-26-001 |
6 missing attributes across 3 files |
45 minutes |
RCA-2026-03-19-001 |
Relative xrefs in nested directories |
30 minutes |
Ad-hoc occurrences |
~2 per week average |
15-30 minutes each |
Benefits (Quantified)
| Benefit | Measurement | Value |
|---|---|---|
Error prevention |
Catch undefined attrs at edit time |
~2 incidents/week × 30 min = 1 hour/week saved |
Reduced context switches |
No need to stop work, debug, rebuild |
Improved focus and flow state |
Documentation quality |
Guaranteed attribute resolution |
Zero broken renders from attrs |
Learning reinforcement |
Immediate feedback on patterns |
Faster antora.yml familiarity |
ROI Estimate: 1 hour/week × 52 weeks = 52 hours/year recovered
Technical Specification
Hook Architecture
Claude Code hooks execute shell commands at defined lifecycle events. This change adds a PostToolUse hook for the Edit tool targeting .adoc files.
Environment Variables
| Variable | Description |
|---|---|
|
JSON string containing tool arguments (includes |
|
Full |
|
Tool that triggered the hook (e.g., "Edit") |
|
Result of tool execution (PostToolUse only) |
Exit Code Semantics
| Code | Meaning | Behavior |
|---|---|---|
|
Success (may include warnings) |
Tool execution proceeds/completes |
|
Script error |
Logged, tool continues |
|
Blocking error (with JSON) |
Tool execution blocked, user sees message |
This hook uses exit 0 for all cases (including warnings) to avoid blocking edits. Warnings are informational, not blocking.
Official Documentation
Anthropic Claude Code Hooks
| Resource | URL |
|---|---|
Hooks User Guide |
|
hooks.json Schema |
|
Best Practices |
|
Example Hooks |
hooks.json Schema Reference
{
"hooks": {
"<HookEvent>": [
{
"matcher": "<tool-name-regex>",
"hooks": [
{
"type": "command",
"command": "<shell-command>",
"timeout": <seconds>
}
]
}
]
}
}
Valid <HookEvent> values:
-
PreToolUse- Before tool execution -
PostToolUse- After tool execution -
SessionStart- When Claude Code session begins -
UserPromptSubmit- When user submits prompt