Restore Blocking Stop Command Hooks in Claude Code
Request: Restore Blocking Stop Command Hooks in Claude Code
The Problem
We need to create guardrails and context managers for Claude Code, but the blocking stop command hook functionality has been removed.
Currently, even when our hooks return exit code 2 and proper JSON with "decision": "block", Claude Code ignores the blocking signal and continues execution. This fundamentally breaks our ability to enforce code quality standards in real-time.
Our Specific Need
We want to implement automated quality gates that:
- Check accessibility requirements on all React components
- Enforce directory-specific coding standards
- Validate changes before they're written to disk
- Actually prevent Claude from proceeding when standards aren't met
Why Current Alternatives Don't Work
Pre-commit hooks
- Too late in the process - files are already written
- Requires separate cleanup when standards fail
- Doesn't guide Claude to fix issues in real-time
Pre-tool use hooks
- Can warn but can't effectively block
- Claude acknowledges warnings but often proceeds anyway
- No guarantee that Claude will address the issues
Post-tool use hooks
- Again, only warnings that Claude may ignore
- Files already modified by the time we can check them
- No way to force Claude to fix issues before moving on
What We Need: True Blocking Stop Hooks
The stop command hook with blocking capability would enable us to:
- Pause Claude's execution when quality issues are detected
- Force acknowledgment and resolution of issues before continuing
- Create checkpoint-based workflows where Claude validates its own work
- Build trust by ensuring standards are met throughout development
The Vision: Context-Aware AI Development
With effective blocking hooks, we can transform how we work with Claude:
- Give Claude entire features to implement, knowing quality gates will enforce standards
- Reduce PR review cycles by catching issues during development
- Create "side quests" where Claude fixes issues before proceeding
- Build context managers that keep Claude focused on quality
Why This Matters
When taught to use stop hooks effectively, teams can:
- Create sophisticated quality workflows
- Implement domain-specific requirements
- Ensure compliance (accessibility, security, etc.)
- Trust Claude with larger, more complex tasks
Without blocking hooks, we're limited to:
- Constant human supervision
- Small, incremental tasks
- Extensive post-hoc review
- Lower overall productivity
Our Request
Please restore the blocking functionality for stop command hooks.
We understand there may have been reasons for removing this feature, but we believe that with proper documentation and examples, teams can use blocking hooks to give Claude Code even more superpowers than it has today.
The ability to create checkpoints and enforce standards programmatically is the difference between Claude as a coding assistant and Claude as a trusted autonomous team member.
Technical Details
What worked before (and what we need):
# Hook returns exit code 2
sys.exit(2)
# With JSON output
{
"decision": "block",
"reason": "Please fix the following accessibility violations before proceeding: ..."
}
This should:
- Stop Claude's current execution
- Display the blocking reason
- Require user intervention or Claude to address issues before continuing
Impact
For our team alone, restored blocking hooks would:
- Reduce accessibility violations by 90%+
- Cut PR review time by 40%
- Enable 3-5x larger task delegation to Claude
- Ensure compliance with WCAG standards
Multiply this across all teams using Claude Code, and the productivity gains are enormous.
---
Please consider restoring this critical functionality. The stop hook blocking capability is not just a nice-to-have - it's the key to unlocking Claude Code's full potential as an autonomous engineering partner.
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗