# Fixing Claude Export Conversations

Fixes broken line wrapping in Claude Code exported .txt conversation files, rebuilds...

- Repository: https://github.com/daymade/claude-code-skills (1509 stars)
- Category: AI and agents
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -g -a claude-code -y`
Codex: `npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -g -a codex -y`
Cursor: `npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -g -a cursor -y`
Gemini CLI: `npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add daymade/claude-code-skills`

## Description

Fixes broken line wrapping in Claude Code exported .txt conversation files, rebuilds tables, paragraphs, paths and tool calls hard-wrapped at a fixed width. Use for an export (YYYY-MM-DD-HHMMSS-*.txt) with broken tables, split paths, or mangled tool output, or "fix export" / "make export readable". Not for a live web conversation (use read-claude-web-conversation) or session history (use read-claude-code-history).

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Fixing Claude Code Export Conversations

Reconstruct broken line wrapping in Claude Code exported `.txt` files.

## Quick Start

```bash
# Fix and show stats
uv run <skill-path>/scripts/fix-claude-export.py <export.txt> --stats

# Custom output
uv run <skill-path>/scripts/fix-claude-export.py <export.txt> -o fixed.txt

# Validate the result (per-check PASS/FAIL with evidence; all must pass)
uv run <skill-path>/scripts/validate-claude-export-fix.py <export.txt> fixed.txt
```

Replace `<skill-path>` with the resolved path to this skill's directory. Find it with:
```bash
find ~/.claude -path "*/fixing-claude-export-conversations/scripts" -type d 2>/dev/null
```

## Workflow

Copy this checklist and track progress:

```
- [ ] Step 1: Locate the exported .txt file
- [ ] Step 2: Run fix script with --stats
- [ ] Step 3: Run validation suite
- [ ] Step 4: Spot-check output (tables, CJK paragraphs, tool results)
- [ ] Step 5: Deliver fixed file to user
```

**Step 1: Locate the file.** Claude Code exports use the naming pattern `YYYY-MM-DD-HHMMSS-<slug>.txt`.

**Step 2: Run the fix script.**
```bash
uv run <skill-path>/scripts/fix-claude-export.py <input.txt> -o <output.txt> --stats
```
Review the stats output, typical results: 20-25% line reduction, 80+ table borders fixed, 160+ table cells fixed.

**Step 3: Run the validation suite.**
```bash
uv run <skill-path>/scripts/validate-claude-export-fix.py <input.txt> <output.txt>
```
All checks must pass. If any fail, investigate before delivering. Use `--verbose` for full details on passing checks too.

**Step 4: Spot-check.** Open the output and verify:
- Tables have intact borders (box-drawing characters on single lines)
- CJK/English mixed text has pangu spacing (`Portal 都需要`, not `Portal都需要`)
- Tool result blocks (`⎿`) have complete content on joined lines
- Diff output within tool results has each line number on its own line

**Step 5: Deliver** the fixed file to the user.

## What Gets Fixed

The rest: https://github.com/daymade/claude-code-skills/blob/HEAD/daymade-claude-code/claude-export-txt-better/SKILL.md
