Cursor setup with rules, mdc, agents.md and hooks

I need some best practices here. Is there a repo on github with all the things in the title setup?

Is this correct:
An agents.md within a subdirectory has the same effect as an .mdc file within root but with a glob of that subdirectory?

Let’s say the code base uses python, java and typescript. Where and how would I put coding style guidlines? In .mdc files within cursor/rules ?

When should I create skills or hooks? What’s even the difference?

Thanks!

As a follow up question, for example this tool GitHub - rtk-ai/rtk: CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies · GitHub, just looking at cursor it exists as a hook. Could this also have been implemented as a skill? Why a hook?

To answer my follow-up question: I assume rtk is implemented as a hook because if it was a skill, it would not reduce any tokens used as the LLM needs “think” and thus even increases token usage. Yes, it may reduce the ultimate shell command but to get there it probably would have tried out different things first that increases token usage.

Hey, point by point:

  1. A ready-made repo with the full setup
    There isn’t a single official canonical example. Each feature has its own docs:
  1. AGENTS.md in a subdirectory equals an .mdc rule with globs
    Not exactly. AGENTS.md has no frontmatter and no glob scoping. It’s loaded when the agent works with files in that directory, and it applies in full, not per file type. With .cursor/rules/*.mdc and globs: you get finer control by extension, auto-attach, and descriptions for on-demand loading. Related thread: Agents.md isolated within a subdirectory is applied to root?.

  2. Style guides for Python, Java, TypeScript
    Yep, .cursor/rules/*.mdc with globs is the best approach:

  • .cursor/rules/python-style.mdcglobs: ["**/*.py"]
  • .cursor/rules/java-style.mdcglobs: ["**/*.java"]
  • .cursor/rules/typescript-style.mdcglobs: ["**/*.ts", "**/*.tsx"]

In a monorepo it’s the same idea, plus you can put local .cursor/rules/ inside subprojects too. More: Cursor Rules in Monorepos.

  1. Skills vs Hooks vs Rules
    Quick version:
  • Rules are style and context hints, auto-attached via globs. The model can ignore them.
  • Skills are multi-step workflows you sometimes want to run. The agent may call them, or you can call them with @. Still optional for the model.
  • Hooks are deterministic scripts that run on specific lifecycle events. Key difference is the model can’t ignore a hook since it runs programmatically.

Full write-up with examples: Rules vs Skills vs Commands vs Hooks.

About RTK your follow-up
Your logic is basically right. A hook gives you two things a skill won’t:

  • Determinism: the command will always run on the trigger, no chance the LLM decides to do something else.
  • No tokens spent on reasoning: a hook doesn’t use the model at all, it’s just a script on an event.

A skill would only work if the model remembers to call it, plus it costs tokens for reasoning and parameters. So for deterministic enforcement like formatting, linting, guards, use a hook. For an sometimes run this multi-step process workflow, use a skill.

thanks, that helps but I was hoping for an open source project or dummy repo that shows it.