---
name: jira-export
description: Export tickets from the local ticket database to Jira-compatible CSV format. Use this skill when the user wants to migrate tickets to Jira, create a Jira backlog from requirements, or export tickets for external project management tools.
---

# Jira Export Skill

**Version**: 1.0.0
**Category**: Integration
**Execution Time**: Fast (<10 seconds)
**Complexity**: Low

## Purpose

Export tickets from the ticket database to Jira-compatible CSV format for importing into Jira or other project management tools.

## When to Use

- Migrating tickets from local database to Jira
- Creating Jira backlog from requirements
- Sharing tickets with teams using Jira
- Backup/export tickets for external tools

## Commands

### export

Export all tickets to Jira CSV format:

```bash
jira-export.sh export [database] [output.csv]
```

**Parameters**:
- `database`: Path to .artifex/tickets.db (default: ./tickets.db)
- `output.csv`: Output filename (default: jira-import.csv)

**Output**: Creates CSV file ready for Jira import

**Example**:
```bash
jira-export.sh export
jira-export.sh export ./project/.artifex/tickets.db my-export.csv
```

### export-epic

Export single epic and its stories:

```bash
jira-export.sh export-epic <epic-id> [database] [output.csv]
```

**Parameters**:
- `epic-id`: Epic ID to export (e.g., "1")
- `database`: Path to .artifex/tickets.db (default: ./tickets.db)
- `output.csv`: Output filename (default: jira-import-epic-<id>.csv)

**Example**:
```bash
jira-export.sh export-epic 1
jira-export.sh export-epic 2 .artifex/tickets.db sprint-1.csv
```

### preview

Preview what will be exported without creating file:

```bash
jira-export.sh preview [database]
```

**Output**: Shows epic/story counts and status breakdown

**Example**:
```bash
jira-export.sh preview
```

## CSV Format

Exports to standard Jira CSV import format:

**Fields**:
- **Summary**: Ticket title
- **Issue Type**: "Epic" or "Story"
- **Description**: Full description with acceptance criteria and technical notes
- **Priority**: Mapped from complexity (Low→Low, Medium→Medium, High→High, Very High→Highest)
- **Epic Link**: Story's parent epic title
- **Labels**: Tags (epic/story, epic-id)
- **Status**: Jira status (To Do, In Progress, Done)

**Status Mapping**:
- TODO → "To Do"
- IN_PROGRESS → "In Progress"
- DONE → "Done"

## Integration with Jira

### Import Process

1. **Export from database**:
   ```bash
   jira-export.sh export
   ```

2. **Open Jira**:
   - Navigate to: **System > External System Import > CSV**

3. **Upload CSV**:
   - Select jira-import.csv

4. **Map Fields**:
   - Jira will prompt to map CSV columns to Jira fields
   - Accept default mappings (fields are pre-named for Jira)

5. **Complete Import**:
   - Review and confirm
   - Jira creates all epics and stories

## Integration with ticket-manager

### Complete Workflow

```bash
# 1. Manage tickets locally
ticket-manager.sh init
ticket-manager.sh import requirements.json

# 2. Work on tickets with ticket-implementation agent
# (implement tickets...)

# 3. Export to Jira when ready
jira-export.sh export

# 4. Import to Jira
# (upload jira-import.csv to Jira)
```

## Usage Patterns

### Pattern 1: Full Export

User wants all tickets in Jira:

```bash
User: Export all my tickets to Jira

Claude:
1. Export tickets to CSV
   [runs: jira-export.sh export]

✓ Exported 3 epics, 12 stories
✓ Created jira-import.csv

Next: Upload jira-import.csv to Jira via CSV import
```

### Pattern 2: Single Epic Export

User wants to export one epic for sprint planning:

```bash
User: Export Epic 1 to Jira for our next sprint

Claude:
1. Export epic 1 with all stories
   [runs: jira-export.sh export-epic 1]

✓ Exported Epic 1: User Authentication
✓ 4 stories included
✓ Created jira-import-epic-1.csv

Ready to import into Jira sprint
```

### Pattern 3: Preview Before Export

User wants to see what will be exported:

```bash
User: What tickets do I have ready to export?

Claude:
1. Preview export
   [runs: jira-export.sh preview]

Export will include:
  Epics: 3
  Stories: 12
  Total: 15 issues

Stories by status:
  TODO: 8
  IN_PROGRESS: 2
  DONE: 2
```

## Dependencies

- `sqlite3`: SQLite database access (standard on macOS/Linux)
- `bash`: Version 3.2+ (standard on macOS/Linux)

## Output Messages

**Success**:
- `✓ Export complete`
- `Exported: X epics, Y stories`
- `Output: jira-import.csv`

**Errors**:
- `Error: Database not found: <file>`
- `Error: Epic X not found`

## Best Practices

1. **Preview before export**: Check what will be exported
2. **Export by epic**: For sprint planning, export one epic at a time
3. **Verify CSV**: Open CSV in text editor to verify before importing
4. **Test import**: Import to Jira test project first
5. **Map fields**: Ensure Jira field mapping is correct during import

## Tips

- Export includes all ticket data (acceptance criteria, technical notes)
- Status is preserved in export (To Do, In Progress, Done)
- Epic links automatically connect stories to epics in Jira
- Labels help filter tickets after import
- Priority mapping can be adjusted by editing CSV before import

## Limitations

- Cannot export to Jira directly (requires manual CSV upload)
- Epic Link uses epic title (ensure titles are unique)
- Custom fields not supported (only standard Jira fields)
- Attachments not exported
- Comments/history not exported
- Assignees not exported (no user data in ticket database)

## Version History

- **1.0.0** (2025-10-28): Initial jira-export skill
