Claude Session Hooks Template — AI skill for Claude Code
Template for AI agents to create Claude Code session hook plugins - includes SessionStart, UserPromptSubmit, Stop, PreToolUse, PostToolUse hooks with examples.
How to install Claude Session Hooks Template
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open johnlindquist/claude-session-hooks-template and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Session Hooks Template does
Template for AI agents to create Claude Code session hook plugins - includes SessionStart, UserPromptSubmit, Stop, PreToolUse, PostToolUse hooks with examples.
Alternatives in AI
- Open Dots — Open-source, self-hosted AI agent workspace and alternative to OpenAI Dots, Meta Muse, Grok Bot, Instinct, Man 5.5k ★
- Manifest — Real-time cost observability for OpenClaw agents — track tokens, costs, messages, and model usage 4.1k ★
- Memory Forge Rs — Stop resetting satisfying AI chats — edit the memory instead 474 ★
README
Session Hooks Template
A template for creating Claude Code session hook plugins. Fork this repo to build your own custom session behaviors.
What Are Session Hooks?
Claude Code plugins can hook into various session events to:
- Inject context into conversations
- Block or modify tool calls
- Enforce conditions before task completion
- Track state across the session
- Trigger external actions based on events
This template provides ready-to-use hook scripts for all major hook types with extensive documentation and examples.
Quick Start
**Fork/Clone this template**
# Clone the template git clone https://github.com/johnlindquist/claude-session-hooks-template.git my-plugin cd my-plugin # Install dependencies bun install**Customize the plugin**
- Edit
package.jsonand.claude-plugin/plugin.jsonwith your plugin name - Modify the hook scripts in
scripts/for your use case - Update
STATE_FILE_PREFIXinsrc/state.ts
- Edit
**Install and test**
# Install as local plugin claude plugin install . --scope local # Test your changes claude # Start a session and try your hooks
Available Hooks
| Hook | File | When It Fires |
|---|---|---|
| SessionStart | scripts/SessionStart.ts |
When a session begins |
| UserPromptSubmit | scripts/UserPromptSubmit.ts |
On every user prompt |
| Stop | scripts/Stop.ts |
When Claude tries to stop |
| PreToolUse | scripts/PreToolUse.ts |
Before any tool executes |
| PostToolUse | scripts/PostToolUse.ts |
After a tool completes |
Hook Data Flow
┌──────────────────────────────────────────────────────────────┐
│ Claude Code Session │
├──────────────────────────────────────────────────────────────┤
│ │
│ SessionStart ─────► User types prompt │
│
Related Skills
Agent Manual
The manual for AI coding agent hooks, configs, PreToolUse/PostToolUse, MCP, and skills - covering Claude Code,
Skillranker
Rust CLI powered by Jev from TypeSafe.ai that ranks agent skills for the next step using live session context.
AI Agent Guardrails Windows Guide
Verified guide: a global guardrail that blocks catastrophic shell commands from AI agents on Windows (Claude C
Bleep
Stops AI coding agents (Claude Code, Codex, Copilot) from leaking private/company repository names onto public
Smart Context Delegation
Cut coding-agent token usage by ~90%: a PreToolUse hook blocks large file reads; bulk-read/code-write delegate
Gradient Starter Kit
A starter kit for building with DigitalOcean Gradient AI — includes serverless inference examples, OpenAI SDK
Related Agents
Transcript Inspector
Specialist agent for diagnosing stop hook failures by reading Claude Code session transcripts. Use when the st
Comment Pruner
Autonomously prune bad comments from code added in the current session. Dispatched by the comment-pruner Stop
React Hooks Docs Writer
Use this agent when you need to create or improve technical documentation for custom React hooks. Examples inc