/export-rules — Cross-IDE Rule Export
Convert Claude Hangar skills and rules into formats compatible with other AI coding tools.
Supported Formats
| Target | Format | Output Location |
|---|---|---|
| Cursor | .cursor/rules/*.mdc |
One .mdc file per rule |
| Windsurf | .windsurfrules |
Single rules file |
| GitHub Copilot | .github/copilot-instructions.md |
Single instructions file |
| Cline | .clinerules |
Single rules file |
Instructions
Step 1: Determine Target
From $ARGUMENTS:
cursor→ Generate Cursor .mdc ruleswindsurf→ Generate Windsurf rules filecline→ Generate Cline rules filecopilot→ Generate Copilot instructionsall→ Generate all formats- No argument → Ask which format(s) to generate
Step 2: Gather Source Material
Read these Hangar sources (in order of importance):
- Project CLAUDE.md (if exists in cwd)
~/.claude/rules/common/*.md— Governance rules~/.claude/rules/{lang}/*.md— Language-specific rules (detect from project)- Active skills in
~/.claude/skills/*/SKILL.md— Extract key patterns
Step 3: Generate — Cursor (.mdc)
Create .cursor/rules/ directory and generate one .mdc file per rule category:
---
description: {{Rule description for Cursor context matching}}
globs: {{file patterns this rule applies to, e.g. "**/*.ts"}}
alwaysApply: {{true for universal rules, false for file-specific}}
---
{{Rule content — concise, actionable instructions}}
Mapping:
rules/common/coding-style.md→.cursor/rules/coding-style.mdc(alwaysApply: true)rules/common/security.md→.cursor/rules/security.mdc(alwaysApply: true)rules/typescript/patterns.md→.cursor/rules/typescript.mdc(globs:**/*.ts,**/*.tsx)rules/python/patterns.md→.cursor/rules/python.mdc(globs:**/*.py)
Step 4: Generate — Windsurf
Create a single .windsurfrules file at the project root:
# Project Rules
## Code Quality
{{Extracted from coding-style.md}}
## Security
{{Extracted from security.md}}
## Language-Specific
{{Extracted from detected language rules}}
## Workflow
{{Extracted from development-workflow.md}}
Step 5: Generate — Cline
Create a single .clinerules file at the project root:
# Project Rules
## Code Quality
{{Extracted from coding-style.md}}
## Security
{{Extracted from security.md}}
## Language-Specific
{{Extracted from detected language rules}}
## Workflow
{{Extracted from development-workflow.md}}
Note: Cline uses a flat rules file similar to Windsurf. The format is identical but the filename differs (.clinerules vs .windsurfrules).
Step 6: Generate — GitHub Copilot
Create .github/copilot-instructions.md:
# Copilot Instructions
## Project Context
{{From CLAUDE.md}}
## Code Standards
{{From coding-style.md, testing.md}}
## Security Requirements
{{From security.md}}
Step 7: Report
## Export Complete
| Format | Files | Location |
|--------|-------|----------|
| Cursor | N rules | .cursor/rules/*.mdc |
| Windsurf | 1 file | .windsurfrules |
| Cline | 1 file | .clinerules |
| Copilot | 1 file | .github/copilot-instructions.md |
Total rules exported: N
Rules
- Preserve the intent and strictness of original rules
- Adapt format but not content — don't weaken rules for compatibility
- Skip Hangar-specific references (hook-gate, skills, statusline)
- Include only rules relevant to the detected project stack
- Don't export hooks (these are Claude Code-specific)