mdc-files

A set of writing rules for .mdc files, which are Cursor rule files that give an AI coding assistant project-specific guidance. It covers required metadata, file patterns, headings, and content structure.

In plain words
What is it for?
Use it when creating or reviewing Cursor rules, especially their YAML frontmatter, file-matching patterns, automatic-application setting, and document layout.
Why use it?
It helps keep these rule files consistent and ensures they apply to the intended files or situations. This reduces unclear instructions and rules that are missing required settings.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/khan/wonder-blocks/mdc-files
Clone the repo
git clone --depth 1 https://github.com/Khan/wonder-blocks

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,103 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03103
Opus 5 $0.00000 $0.01551
Sonnet 5 $0.00000 $0.00621
Haiku 4.5 $0.00000 $0.00310

Measured 3d ago against content hash f8e57a2247fb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mdc-files scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/mdc-files.mdc · 521 lines

How it starts

The opening of the file, as written. The whole thing — 521 lines — stays where its author put it; the contents beside it link to each section on GitHub.

MDC Files Best Practices

This guide covers conventions and best practices for creating and maintaining .mdc cursor rules files that provide context and guidance to AI assistants.

File Structure

Frontmatter Block

⚠️ ALWAYS include YAML frontmatter at the top of every .mdc file:

---
description: Brief description of what this rules file covers
globs: *.ext,*.pattern
alwaysApply: false
---

Frontmatter Properties:

  • description: Short, clear description of the file's purpose (one line)
  • globs: Comma-separated list of file patterns that trigger this rule (e.g., *.test.ts,*.test.tsx)
  • alwaysApply: Boolean (true or false) - whether this rule applies to all contexts

✅ DO: Use specific glob patterns

---
description: Jest testing best practices and patterns for unit tests
globs: *.test.ts,*.test.tsx
alwaysApply: false
---

❌ DON'T: Use vague descriptions or missing properties

---
description: Some rules
globs:
alwaysApply: false
---

Document Title

✅ ALWAYS start content with a single H1 heading:

# Document Title

Introduction paragraph explaining the document's purpose and scope.

Best practices:

  • ✅ Use a clear, descriptive title
  • ✅ Match the title to the description in frontmatter
  • ✅ Include a brief introduction after the H1
  • ❌ Never use multiple H1 headings in a single document

Markdown Structure

Heading Hierarchy

✅ Use proper heading levels (H1 → H2 → H3 → H4):

# Main Title (H1)

## Major Section (H2)

### Subsection (H3)

#### Sub-subsection (H4)

##### Rarely needed (H5)

Best practices:

  • ✅ Use H1 for document title only
  • ✅ Use H2 for major sections
  • ✅ Use H3 for subsections within major sections
  • ✅ Maintain consistent nesting (don't skip levels)
  • ❌ Never jump from H2 to H4 without H3

Visual Indicators

✅ Use emoji symbols for emphasis and clarity:

  • Checkmark: Recommended patterns, correct examples
  • Cross mark: Anti-patterns, incorrect examples
  • ⚠️ Warning: Critical rules, important notes
  • 🥇 Medal: Priority or ranking indicators

Read the full file on GitHub · 521 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 521 lines · 3,103 tokens per session scan A f8e57a2247fb

Subscribe to this mod's changes

mdc-files is a cursor rule published in the GitHub repository Khan/wonder-blocks (163 stars, last pushed 5d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,103 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.