Skip to content

Document prompt-based stop hooks issue and update templates#144

Merged
nhorton merged 6 commits intomainfrom
claude/document-stop-hooks-issue-ZaoBV
Jan 24, 2026
Merged

Document prompt-based stop hooks issue and update templates#144
nhorton merged 6 commits intomainfrom
claude/document-stop-hooks-issue-ZaoBV

Conversation

@nhorton
Copy link
Contributor

@nhorton nhorton commented Jan 23, 2026

Summary

This PR documents a critical issue with prompt-based stop hooks in Claude Code and updates all documentation and templates to reflect the current limitations. Prompt-based hooks (type: prompt) for Stop and SubagentStop events do not currently work properly, so templates and guidance have been updated to use alternative approaches.

Key Changes

  • Added "Known Issues" sections to hooks.md and hooks_system.md documenting the prompt-based stop hooks issue with reference to GitHub issue #20221
  • Updated hook examples in documentation to show command-type hooks instead of prompt-based hooks for Stop events
  • Replaced quality validation pattern from prompt-based stop hooks to explicit sub-agent review instructions in command content
  • Modified Jinja template (skill-job-step.md.jinja) to:
    • Filter out prompt hooks for Stop/SubagentStop events
    • Only generate command-type hooks for Stop events
    • Include sub-agent review instructions in the Quality Validation section instead of relying on automatic hook validation
  • Updated agent guidance (AGENTS.md) to instruct template authors not to use prompt-based stop hooks and to use sub-agent review pattern instead
  • Updated comparison table to clarify that prompt hooks for Stop/SubagentStop don't work and quality validation uses sub-agent review

Implementation Details

  • The workaround uses explicit instructions directing agents to spawn a sub-agent (e.g., Haiku) to review work against quality criteria
  • Command-type hooks (shell scripts) continue to work and are still generated for Stop events
  • All changes include references to the GitHub issue for future updates when the issue is resolved
  • Documentation maintains backward compatibility notes for when prompt hooks are fixed

…lates

Prompt-based stop hooks (type: prompt for Stop/SubagentStop events) do not
currently work in Claude Code. This change:

1. Updates AGENTS.md with prominent warning and reference to issue #20221
2. Removes prompt hook generation from skill-job-step.md.jinja template
3. Updates template to use sub-agent review for quality validation instead
4. Documents the limitation in hooks.md and hooks_system.md

When Claude Code fixes this issue (see github.com/anthropics/claude-code/issues/20221),
these changes should be reversed to re-enable prompt-based stop hooks.
Disables prompt-based stop hooks due to upstream bug and uses sub-agent
review pattern for quality validation instead.

- Remove prompt hook generation from jinja templates
- Add sub-agent review instructions for quality_criteria
- Update tests to reflect new behavior (prompt hooks not generated)
- Add test for script-type hooks (still generated)
@nhorton nhorton force-pushed the claude/document-stop-hooks-issue-ZaoBV branch from 416f1ec to 729edcb Compare January 23, 2026 23:40
Add inline comments after endif/endfor tags to clarify what each
closing tag corresponds to. Use {#- prefix for whitespace control.
@nhorton nhorton force-pushed the claude/document-stop-hooks-issue-ZaoBV branch from c6633be to bbbe4ba Compare January 24, 2026 18:33
@nhorton nhorton merged commit 836e7d1 into main Jan 24, 2026
4 checks passed
@nhorton nhorton deleted the claude/document-stop-hooks-issue-ZaoBV branch January 24, 2026 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants