# 3.2 Prompts Management

## Overview

The Prompts feature manages system prompt presets. System prompts influence the AI's behavior and response style.

With CC Switch, you can:

- Create multiple prompt presets
- Quickly switch prompts for different scenarios
- Sync prompt configurations across devices

## Open the Prompts Panel

Click the **Prompts** button in the top navigation bar.

## Panel Overview

![image-20260108010110382](../../assets/image-20260108010110382.png)

## Create a Preset

### Steps

1. Click the **+** button in the top-right corner
2. Enter a preset name
3. Write the prompt in the Markdown editor
4. Click "Save"

### Markdown Editor

The editor provides:

- Syntax highlighting
- Live preview
- Common format shortcuts

### Prompt Writing Tips

**Structured format**:

```markdown
# Role Definition

You are a professional code review expert.

## Core Capabilities

- Code quality analysis
- Performance optimization suggestions
- Security vulnerability detection

## Response Style

- Clear and concise
- Provide specific examples
- Give improvement suggestions

## Notes

- Do not modify business logic
- Maintain consistent code style
```

## Activate a Preset

### How to Activate

Click the toggle switch on the preset item to change its activation status.

### Single Activation

Only one preset can be active at a time. Activating a new preset automatically deactivates the previous one.

### Sync Target

After activation, the prompt is written to the corresponding app's file:

| Application | File Path |
|-------------|-----------|
| Claude | `~/.claude/CLAUDE.md` |
| Codex | `~/.codex/AGENTS.md` |
| Gemini | `~/.gemini/GEMINI.md` |
| OpenCode | `~/.config/opencode/AGENTS.md` |

## Edit a Preset

1. Click the "Edit" button on the preset item
2. Modify the name or content
3. Click "Save"

If the currently active preset is edited, changes are immediately synced to the configuration file.

## Delete a Preset

1. Click the "Delete" button on the preset item
2. Confirm deletion

Active presets cannot be deleted. Deactivate the preset first before deleting.

## Smart Backfill

CC Switch provides a smart backfill protection mechanism to ensure your manual modifications are not lost.

### How It Works

1. Before switching presets, automatically reads the current configuration file content
2. Compares file content with the preset in the database
3. If the content differs, it means the user has manually modified it
4. Saves the manually modified content to the current preset
5. Then switches to the new preset

### Protection Scenarios

| Scenario | Handling |
|----------|----------|
| Directly editing `CLAUDE.md` in CLI | Changes auto-saved to current preset |
| Modifying config file with external editor | Changes auto-saved to current preset |
| Switching to another preset | Current changes saved first, then switched |

### Technical Details

The backfill mechanism triggers at these moments:

- **When switching presets**: Saves current live file content to the current preset
- **When editing the current preset**: Reads latest content from the live file
- **On first launch**: Automatically imports existing live file content

### Notes

- Backfill only triggers when switching to a different preset
- If no preset is currently active, backfill is not triggered
- Backfill failure does not affect the switching process

## Cross-app Usage

Prompts are managed separately per app:

- When switched to Claude, Claude's presets are shown
- When switched to Codex, Codex's presets are shown
- When switched to Gemini, Gemini's presets are shown
- When switched to OpenCode, OpenCode's presets are shown

To use the same prompt across multiple apps, you need to create them separately.

## Import & Export

### Share via Deep Link

You can generate deep links to share presets:

```
ccswitch://import/prompt?data=<base64-encoded preset>
```

### Via Configuration Export

Exporting configuration includes all presets, which can be restored upon import.
