There are some good videos on youtube about it. I don’t think hooks are standardized across AI coding tools so would only work in Cursor, I think. I think they allow you to interrupt the Agent during its tasks for custom behavior, like injecting content.
edit: i just tested the glob scoping and it’s worth calling out. if you create a rule like:
---
globs: ["*.tsx"]
alwaysApply: false
---
Always add a data-testid to root elements
that rule only fires when the agent is working on .tsx files. i asked it to create the same component as both .tsx and .js, and the .tsx version got the data-testid, the .js one didn’t. the glob scoping actually works.
for comparison, if you put the same instruction in AGENTS.md (no frontmatter, just the text), it applies to everything. there’s no way to scope it to specific file types. so if you need rules that only kick in for certain files, .mdc with globs is the way to go.
yeah i feel this. i’ve been using rules files for a while now and they work, but every time cursor updates there’s some new layer on top and i’m never sure if i should migrate to it or keep doing what works.
skills and commands seem like they’re aimed at more structured workflows? like if you want the agent to run specific tools or follow a multi-step process. rules are more “here’s how i want you to write code.” at least that’s my read on it but i haven’t actually tried skills yet so i might be off.
hooks i genuinely don’t understand the use case for. if anyone’s using them i’d love to hear what for.