AI Tools Compared

Transfer your Cursor Composer prompts to Claude Code by exporting prompts, adapting them to Claude’s format, and organizing them in Claude’s library. This guide shows the conversion process that preserves your prompt investments.

Why Migrate from Cursor Composer to Claude Code

Cursor Composer offers a powerful prompt interface, but many developers are making the switch to Claude Code for several compelling reasons. Claude Code provides more consistent context retention across long conversations, which is crucial when working with large codebases. Its tool-use capabilities allow for more sophisticated automation workflows, and many developers find that Claude Code produces cleaner, more maintainable code with fewer hallucinations.

Beyond technical advantages, having your prompt library in Claude Code gives you flexibility. You can use Claude Code’s CLI capabilities to integrate prompts into CI/CD pipelines, use them with custom scripts, and take advantage of a more open ecosystem.

Exporting Your Cursor Composer Prompts

Before you can transfer your prompts to Claude Code, you need to export them from Cursor. There are two main approaches depending on how you have organized your prompts.

Method 1: Manual Export Through Cursor Settings

Open Cursor and navigate to the Composer settings. Look for an option to export your custom prompts. If you have been using Cursor’s built-in prompt management, you should find an export function that saves your prompts as a JSON file.

  1. Open Cursor and go to Settings (Cmd+, on Mac)

  2. Navigate to Composer > Custom Prompts

  3. Look for an “Export” button or menu option

  4. Save the exported file to a convenient location

This method works well if you have been using Cursor’s native prompt system and want a quick one-time export.

Method 2: Extracting Prompts from Project Files

If you have been storing prompts as separate files in your project, you can locate them directly in your project structure. Look for folders named prompts, .cursor/rules, or similar locations where you may have stored prompt files.

# Search for prompt files in your project
find . -type f -name "*.md" | xargs grep -l "system\|prompt" 2>/dev/null
find . -type d -name "*prompt*" 2>/dev/null

This approach gives you more control over which prompts to export and allows you to review them before migration.

Converting Prompts for Claude Code

Once you have exported your prompts, you need to format them for Claude Code. The two systems have slightly different prompt formats, so some conversion is necessary.

Understanding the Format Differences

Cursor Composer prompts often use a specific YAML-like format with instructions, context sections, and example blocks. Claude Code uses a more flexible markdown-based format that works well with its conversation interface.

Here is a simple example of converting a Cursor prompt to Claude Code format:

Original Cursor Composer Prompt:

---
name: Code Review
instruction: Review the following code for bugs and improvements
context: Include file paths and line numbers
---

Converted Claude Code Format:

You are a code review assistant. Your task is to review the following code for bugs and improvements. When providing feedback, include the file paths and line numbers for each issue you identify.

Batch Conversion Script

For larger prompt libraries, create a conversion script:

#!/usr/bin/env python3
import os
import re
import json
from pathlib import Path

def convert_cursor_prompt(content):
    """Convert Cursor prompt format to Claude Code format."""
    # Remove front matter if present
    content = re.sub(r'^---.*?---\n', '', content, flags=re.DOTALL)

    # Clean up formatting
    content = content.strip()

    # Add clear instructions if missing
    if not content.startswith('You are') and not content.startswith('I want'):
        content = "You are a helpful assistant. " + content

    return content

def process_prompt_file(input_file, output_file):
    """Process a single prompt file."""
    with open(input_file, 'r') as f:
        content = f.read()

    converted = convert_cursor_prompt(content)

    with open(output_file, 'w') as f:
        f.write(converted)

    print(f"Converted: {input_file} -> {output_file}")

# Example usage
if __name__ == "__main__":
    import sys
    if len(sys.argv) > 1:
        input_path = sys.argv[1]
        output_path = sys.argv[2] if len(sys.argv) > 2 else input_path
        process_prompt_file(input_path, output_path)

Save this script as convert_prompts.py and run it against your exported prompts.

Importing Prompts into Claude Code

With your prompts converted, you can now import them into Claude Code. There are several ways to do this depending on your workflow.

Method 1: Using.claude Directory

Claude Code recognizes prompts stored in a .claude directory at the project root. Create a structure like this:

mkdir -p .claude/prompts
cp converted-prompts/*.md .claude/prompts/

You can then reference these prompts in your conversations using /prompt or by including them directly.

Method 2: Creating Custom Commands

For frequently used prompts, create custom commands in Claude Code. Edit your CLAUDE.md file in the project root:

# Custom Commands

## /review
When I type /review, use the following prompt:

You are a code review expert. Analyze the provided code for:
1. Security vulnerabilities
2. Performance issues
3. Code quality improvements
4. Best practice violations

Provide specific, actionable feedback with file paths and line numbers.

## /explain
When I type /explain, respond with:

Explain the following code in simple terms. Include:
1. What the code does
2. How it works
3. Any potential issues or concerns

Method 3: Using Include Directive

For complex prompts, store them as separate files and include them when needed:

<!-- At the start of your conversation -->
Please analyze the following code using the guidelines from ./claude/prompts/security-review.md

Best Practices for Prompt Migration

When moving your prompt library to Claude Code, keep these tips in mind for the best results.

Test each prompt individually after migration. Claude Code’s conversation model may interpret prompts slightly differently than Cursor Composer, so verify that each prompt produces the expected behavior.

Organize your prompts by function. Create a clear directory structure in your .claude/prompts folder, such as prompts/code-review/, prompts/refactoring/, and prompts/testing/.

Version control your prompts. Store your prompt library in git so you can track changes and roll back if needed. This also makes it easy to share prompts across team members.

Document prompt purpose and usage. Add comments or a separate README in your prompts directory explaining when and how to use each prompt.

Automating the Migration

For teams with large prompt libraries, consider creating an automated migration pipeline:

#!/bin/bash
# migrate-prompts.sh

PROMPTS_DIR="./cursor-prompts"
CLAUDE_DIR=".claude/prompts"

mkdir -p "$CLAUDE_DIR"

for prompt in "$PROMPTS_DIR"/*.md; do
    filename=$(basename "$prompt")
    python3 convert_prompts.py "$prompt" "$CLAUDE_DIR/$filename"
done

echo "Migration complete. Prompts converted and copied to $CLAUDE_DIR"

Run this script whenever you update your prompt library to keep both systems in sync.

Built by theluckystrike — More at zovo.one