← All guides Convert

Convert rules between Cursor, Windsurf, and Claude Code

Bidirectional conversion between .mdc, .cursorrules, CLAUDE.md, and Windsurf formats.

What rule-porter does

Different AI editors use different rule formats. rule-porter converts between them so you can switch editors without rewriting your rules from scratch.

Supported formats:

Running the command

The tool auto-detects your source format and prompts you to choose a target:

npx rule-porter

Or specify source and target explicitly:

npx rule-porter --from cursor --to claude-md

The converter reads your rules, translates them to the target format, and writes the output to the appropriate location for that editor.

Direction flags

Use --from and --to to control conversion direction:

npx rule-porter --from cursor --to windsurf
npx rule-porter --from claude-md --to cursor
npx rule-porter --from cursorrules-legacy --to cursor

Supported values:

What gets translated

The converter handles format differences automatically:

Frontmatter to comments

Cursor's YAML frontmatter becomes comments in formats that don't support structured metadata:

# From .mdc frontmatter:
---
description: TypeScript naming conventions
globs: ["**/*.ts"]
---

# To CLAUDE.md:
# Rule: TypeScript naming conventions
# Applies to: **/*.ts

Globs to file paths

Some formats don't support globs. The converter notes where a rule was intended to apply but can't enforce scoping in the target format.

Multiple files to single file

When converting from .mdc (multiple files) to CLAUDE.md (single file), the tool merges all rules with section headers based on the original filenames.

All conversions are free

Every conversion direction is included for free, including:

Use --dry-run to preview the output before writing files.

Checking the output

After conversion, check the output manually. The tool handles structure but can't guarantee every rule makes sense in the target editor's context.

Limits of conversion

Some things don't translate perfectly between formats:

When to use it

The converter is useful when:

It's a starting point, not a perfect translation. Expect to refine the output manually.

Related guides

Convert your rules

Switch between Cursor, Windsurf, and Claude Code without rewriting your rules from scratch.

npx rule-porter