- Stop operations before they cause problems (like creating
.jsfiles in a TypeScript project) - Learn from what’s happening and build up project knowledge over time
- Monitor performance and catch issues as they emerge
- Track everything for analytics or compliance
- Trigger external tools or services at the right moments
Getting Started

Hooks work across all platforms: Windows, macOS, and Linux. The bash examples in this documentation work with standard shells on all platforms (including Git Bash or WSL on Windows).
1
Access the Hooks Interface
Navigate to the Hooks management interface:

- Open Cline (ensure hooks are enabled in settings)
- Look for the Hooks tab at the top (alongside Rules and Workflows)
- Click on Hooks to open the hooks management panel
2
Understand Hook Locations
Hooks are automatically organized by location in the interface:Global Hooks - Apply to all workspaces:
- Stored in
~/Documents/Cline/Rules/Hooks/ - Perfect for personal coding standards and universal rules
- Stored in
.clinerules/hooks/within your repo - Great for project-specific validation and team workflows
- Can be committed to version control for team sharing
3
Create Your First Hook
Use the intuitive interface to create hooks:



- Choose your location: Decide between Global Hooks or project-specific hooks
- Select hook type: Click the “New hook…” dropdown in your chosen location
- Pick a hook type: The dropdown shows all available hook types that haven’t been created yet in this location. Only one of each hook type is allowed per hooks directory, so the dropdown automatically filters to show only the remaining available types.

- Review and edit the hook: Click the pencil icon to review the hook’s code and add your custom logic
- Enable the hook: Once you understand and approve of the hook’s behavior, toggle the switch to activate it

4
Test Your Hook
To develop and refine your hook, you’ll need to trigger it multiple times during testing. Each hook type is triggered by different events in Cline’s workflow. For example:
- TaskStart hooks trigger when you start a new task
- PreToolUse hooks trigger before Cline executes tools like file editing
- PostToolUse hooks trigger after tool execution completes
- UserPromptSubmit hooks trigger when you submit a message to Cline
What You Can Build
Once you understand the basics, hooks open up creative possibilities:Intelligent Code Review
Run linters or custom validators before files get saved. Block commits that don’t pass checks. Track code quality metrics over time.
Security Enforcement
Prevent operations that violate security policies. Detect when sensitive data might be exposed. Audit all file access for compliance.
Development Analytics
Measure how long different operations take. Identify patterns in how the AI works. Generate productivity reports from hook data.
Integration Hub
Connect to issue trackers when certain keywords appear. Update project management tools. Sync with external APIs at the right moments.
Explore the Documentation
Hook Reference
Complete API reference for all hook types, JSON schemas, and field documentation.
Samples
Practical examples and complete working scripts for common use cases.
Related Features
Hooks complement other Cline features:- Cline Rules define high-level guidance that hooks can enforce
- Checkpoints let you roll back changes if a hook didn’t catch an issue
- Auto-Approve works well with hooks as safety nets for automated operations

