Convert Cursor IDE rules to Claude AI markdown format
npm install @hostingglobal/c2cConvert Cursor IDE rules (.mdc files) to Claude AI markdown format with intelligent metadata parsing and categorization.
> Note: If the video doesn't play, download assets/demo.mp4 to view the demonstration.
https://github.com/user-attachments/assets/407cd34e-c4c0-4a1b-981d-817b85decf20
``bash`
npx @hostingglobal/c2c
- š Automatic Discovery: Recursively finds all .cursor directories in your project.mdc
- š Metadata Parsing: Extracts YAML frontmatter (alwaysApply, description, globs) from filesc2c-rules
- šļø Smart Categorization: Organizes rules by priority (always apply ā description ā globs)
- š Separate Directories: Creates directories next to each .cursor directory_root.md
- š Auto-linking: Generates index files with proper relative paths
- š CLAUDE.md Integration: Automatically updates or creates CLAUDE.md with sections
Run the command in any directory containing .cursor folders:
`bash`
npx @hostingglobal/c2c
The tool will:
1. Recursively find all .cursor directories in your project tree*.mdc
2. Locate all files within them (including nested subdirectories)c2c-rules
3. Parse YAML metadata from each file's frontmatter
4. Create directories next to each .cursor directory_root.md
5. Convert files to markdown format (stripping metadata)
6. Generate index files with categorized referencesCLAUDE.md
7. Update or create files with proper rule references
Found Files:
!Found Files
Generated Content:
!Generated Content
Given this structure with metadata:
``
project/
āāā .cursor/
ā āāā global.mdc (with alwaysApply: true)
āāā frontend/
ā āāā .cursor/
ā āāā rules.mdc (with description: "React component guidelines")
ā āāā components/
ā āāā ui-rules.mdc (with globs: "*/.tsx")
āāā backend/
āāā .cursor/
āāā api/
āāā guidelines.mdc (with globs: "/api/")
Running npx @hostingglobal/c2c will create:
``
project/
āāā CLAUDE.md (updated with
āāā c2c-rules/
ā āāā _root.md
ā āāā global.md
āāā frontend/
ā āāā CLAUDE.md (updated with
ā āāā c2c-rules/
ā āāā _root.md
ā āāā rules.md
ā āāā components/
ā āāā ui-rules.md
āāā backend/
āāā CLAUDE.md (updated with
āāā c2c-rules/
āāā _root.md
āāā api/
āāā guidelines.md
Each _root.md will contain categorized rules, for example in frontend/c2c-rules/_root.md:
`markdownRules Collection
read below rules if description matches with your requirement:
- rules
- description: React component guidelines
- path: rules.md
read below rules if glob pattern matches with requirement related files:
- ui-rules
- glob: \*_/_.tsx
- path: components/ui-rules.md
`
Each CLAUDE.md will be updated with:
`markdown`
- @c2c-rules/_root.md
.mdc files can include YAML frontmatter:
`yaml`
---
alwaysApply: true # Rule always applies (highest priority)
description: string # Rule description for matching (medium priority)
globs: string # Glob pattern for file matching (lowest priority)
---
Your actual rule content goes here...
`bashInstall dependencies
pnpm install
Architecture
This tool uses a layered architecture:
- Presentation Layer: CLI interface using Commander.js
- Application Layer: Core business logic services
-
FileExplorerService: Finds .cursor directories and .mdc files
- MetadataParserService: Extracts YAML frontmatter
- FileConverterService: Converts files and manages output directories
- AdvancedRootFileGeneratorService: Generates categorized index files
- ClaudeMdService: Updates CLAUDE.md files
- Domain Layer: Type definitions for FileInfo and CursorRuleMetadata`MIT