What is a .mdc file?

When adding a new rule file to cursor/rules, cursor automatically creates a .mdc file. There is no mention of this file type or how the actual description of the rule should be formatted. So, I have a few questions:

  1. is this some kind of markdown extension? The most likely candidate I could find is mdc which afaict was born out of the nuxt front end framework.

  2. Should these files be formatted as markdown? It looks like the .mdc extension exists so that xml can be embedded in a markdown file. So should these rules be encoded as xml? Can we just treat these as plaintext and assume the model will figure it out? It would be great to know what the intention of the cursor developers is here.

This is what I found when I asked cursor about it with @web

This is similar to how other specialized Markdown variants have their own extensions. For example, from the search results we can see:

  • .md or .markdown for standard Markdown files

  • .mdc for Cursor’s rule files

  • Other variants like RMarkdown have their own extensions too

The .mdc extension helps Cursor identify which files should be processed as rules, just like how .md helps systems identify regular Markdown files. It’s a way of telling Cursor “this is a rules file” rather than just a regular Markdown or YAML file.

[Source: Using the "project-rules" in 0.45.2]

#You might find this helpful.

2 Likes

Seems it comes from Nuxt. Markdown - Nuxt Content

Basically looks like YAML front matter to me.

1 Like

I did a bit of digging for this, because the docs don’t talk about the file format. This is what I was able to confirm:

  1. File format

    Cursor engineer Michael Feldstein (@msfeldstein) mentioned on Twitter that it’s only a Markdown file with structure:

    It’s just a markdown file with structured frontmatter that we render a custom editor for so you can @-mention files in your codebase and to make sure the metadata stays intact.

    Tweet: https://x.com/msfeldstein/status/1884805975556985051

  2. File extension

    Michael also mentioned that the “MDC” in the .mdc file extension means “Markdown Cursor”:

    It means “Markdown Cursor” we just needed a unique extension so we could use the custom editor for these but not for regular markdown files.

    GitHub comment: docs: updated readme and add overviews by bgrenon · Pull Request #1 · neondatabase-labs/ai-rules · GitHub

2 Likes