Claude Session Hooks Template
Description
Template for AI agents to create Claude Code session hook plugins - includes SessionStart, UserPromptSubmit, Stop, PreToolUse, PostToolUse hooks with examples
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
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
Agency Agents
A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy inject
AI Firecrawl
🔥 The API to search, scrape, and interact with the web for AI
AI Artifacts Builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web tech
AI CrewAI
Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewA
AI TrendRadar
⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的
AI mem0
| Universal memory layer for AI Agents | 51341 | 221 | 1 |
AI