Skip to main content
Everything Claude Code provides full Cursor IDE support with hooks, rules, agents, skills, commands, and MCP configs adapted for Cursor’s native format.

Overview

Cursor has more hook events than Claude Code (20 vs 8), providing richer automation capabilities. ECC leverages this with a DRY adapter pattern that reuses existing hook logic.

What’s Included

Installation

Quick Install

The installer:
  • Copies rules to .cursor/rules/ with YAML frontmatter
  • Creates hook scripts in .cursor/hooks/
  • Sets up the DRY adapter pattern
  • Configures language-specific settings

Manual Installation

Hook Architecture (DRY Adapter Pattern)

Cursor’s extensive hook system (20 events) is more powerful than Claude Code’s (8 events). The .cursor/hooks/adapter.js module transforms Cursor’s stdin JSON to Claude Code’s format, allowing existing scripts/hooks/*.js to be reused without duplication.

Architecture Benefits

DRY Principle

Hook logic written once, works on both platforms

Zero Duplication

No need to maintain separate hook implementations

Cursor Advantages

More events = richer automation than Claude Code

Easy Maintenance

Bug fixes apply to both platforms automatically

Example Hook

15 Hook Events

Cursor provides these hook events:
  • sessionStart — Load context on session start
  • sessionEnd — Save state on session end
  • sessionIdle — Suggest compaction when idle
  • beforeFileRead — Validate file access permissions
  • afterFileEdit — Auto-format, run type checks
  • beforeFileWrite — Block writes to protected files
  • beforeTabFileRead — Block Tab from reading .env, .key, .pem files
  • beforeShellExecution — Block dev servers outside tmux, git push review
  • afterShellExecution — Log command results, detect failures
  • beforeSubmitPrompt — Detect secrets (sk-, ghp_, AKIA) in prompts
  • afterPromptResponse — Extract learnings from responses
  • beforeMCPExecution — Audit MCP tool calls
  • afterMCPExecution — Log MCP results
  • beforeToolUse — Generic pre-tool validation
  • afterToolUse — Generic post-tool actions

Key Hooks in Action

Rules Format

Cursor rules use YAML frontmatter with description, globs, and alwaysApply:

Type Safety

Use strict TypeScript settings. Avoid any.
Python
Go
Swift

Configuration Example

.cursor/settings.json:

Feature Comparison

Cursor Advantages: More hook events, richer automation, native IDE integration

Usage Examples

Starting a Feature

Auto-Formatting on Save

Cursor’s afterFileEdit hook automatically:
  1. Runs Prettier on TypeScript/JavaScript files
  2. Runs TypeScript compiler check
  3. Warns if console.log detected
  4. Updates documentation if needed
No manual action required!

Secret Detection

Best Practices

Use AGENTS.md

Keep project-specific context in AGENTS.md at repo root

Leverage Hooks

Cursor’s 15 hook events enable rich automation

Language Rules

Install only rules for languages you use

Test Hooks

Verify hooks work by triggering events manually

Troubleshooting

  1. Check .cursor/hooks/ exists and scripts are executable
  2. Verify cursor.ai.enableHooks is true in settings
  3. Check hook script exit codes (0 = allow, 2 = block)
  4. View Cursor logs for hook execution errors
  1. Verify rules are in .cursor/rules/
  2. Check YAML frontmatter is valid
  3. Ensure globs match your file extensions
  4. Common rules need alwaysApply: true
  1. Place AGENTS.md at repository root
  2. Restart Cursor
  3. Open a file in the project
  4. Check Cursor AI panel for context loading

Next Steps

Hook Examples

See all 16 hook scripts in detail

Rules Guide

Learn about the 29 rules and how to customize

Agents

Explore shared agent system

Skills

Browse 50+ skills available in Cursor