Skip to main content
skill CX Codex

fixing-claude-export-conversations — Claude Code skill: repair exports

Repairs a Claude conversation exported as a .txt file: rejoins paragraphs, rebuilds tables and paths that hard wrapping tore apart.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -a claude-code
npx skills add daymade/claude-code-skills --skill claude-export-txt-better -a claude-code
Open on GitHub

What fixing-claude-export-conversations does

A conversation exported from Claude into .txt often arrives mangled. Paragraphs sit split across lines, table borders drift, a file path breaks in the middle, tool output turns into mush. The skill runs fix-claude-export.py over the file and rebuilds each content type separately: user prompts, responses, tables, tool calls and tool results, plan text, the agent tree.

It decides whether a break is a wrap by inspecting the next line rather than measuring width. A line starting lowercase, with a CJK ideograph, a bracket or a hyphen counts as a continuation. Joins between Latin and CJK text get a space inserted; identifiers, paths and hyphenated names get none.

You need Python 3.10+ and uv. Nothing outside the standard library is used. A second script, validate-claude-export-fix.py, checks the output: marker counts for ❯, ●, ✻, ⎿, … must match the input, and overlong merged lines raise a warning. The original file is never written to. Live web conversations and session history need different tools, so this one won't help there.

What it helps with

  • rejoin paragraphs that the export split into lines
  • rebuild table borders and cells inside a transcript
  • stitch a file path broken by a line wrap
  • tidy tool results and diff output
  • check the repaired file with automated validation

Example prompts for the agent

  • Fix the export 2025-04-12-183045-refactor.txt and then run the validation checks
  • Rebuild the tables in this export, wrapping wrecked them
  • Give me a readable version of the export with the fix stats

How to install fixing-claude-export-conversations

1Skills CLI (Vercel)

npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -a claude-code
npx skills add daymade/claude-code-skills --skill claude-export-txt-better -a claude-code

2Manually: put the files in place

~/.claude/skills/claude-export-txt-better/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/claude-export-txt-better/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about fixing-claude-export-conversations

How do I install fixing-claude-export-conversations in Claude Code?

Run npx skills add daymade/claude-code-skills --skill fixing-claude-export-conversations -a claude-code. Then locate the scripts folder with find ~/.claude -path "*/fixing-claude-export-conversations/scripts" -type d.

What does fixing-claude-export-conversations do?

It rebuilds hard-wrapped lines in an exported .txt: paragraphs, tables, paths and tool output. The original file stays unchanged.

What do I need to run it?

Python 3.10+ and uv run. No external packages — the script relies on the standard library only.

Source text

SKILL.md · MIT
---
name: fixing-claude-export-conversations
disable-model-invocation: true
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).
---

# 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 script handles 10 content types using a state-machine with next-line look-ahead:

- **User prompts** (`❯` prefix, dw=76 padding) — paragraph joins with pangu spacing
- **Claude responses** (`●` prefix) — narrative, bullet, and numbered list joins
- **Claude paragraphs** (2-space indent) — next-line look-ahead via `_is_continuation_fragment`
- **Tables** — border reconstruction, cell re-padding with pipe-count tracking
- **Tool calls** (`● Bash(` etc.) — path and argument reconstruction
- **Tool results** (`⎿` prefix) — continuation joins including deeper-indented fragments
- **Plan text** (5-space indent) — next-line look-ahead via `_is_plan_continuation_fragment`
- **Agent tree** (`├─`/`└─`) — preserved structure
- **Separators** (`────`, `---`) — never joined
- **Tree connectors** (standalone `│`) — preserved

## Key Design Decisions

**Next-line look-ahead** (not dw thresholds): Instead of asking "was this line wrapped?" (fragile threshold), the script asks "does the next line look like a continuation?" by examining its content patterns — lowercase start, CJK ideograph start, opening bracket, hyphen/slash/underscore continuation.

**Pangu spacing**: Inserts spaces between ASCII alphanumeric characters and CJK ideographs at join boundaries. Also triggers for `%`, `#`, `+`, `:` adjacent to CJK.

**Mid-token detection**: Joins without space when boundaries indicate identifiers (`BASE_` + `URL`), paths (`documents` + `/05-team`), or hyphenated names (`ready` + `-together`). Exception: `--` prefix gets a space (`run` + `--headed`).

## Safety

- Never modifies the original file
- Marker counts verified: `❯`, `●`, `✻`, `⎿`, `…` must match input/output
- Runaway join detection: warns if any line exceeds 500 display-width
- Strict UTF-8 encoding — no silent fallbacks

## Dependencies

Python 3.10+ via `uv run` — zero external packages (stdlib only: `unicodedata`, `argparse`, `re`, `pathlib`, `dataclasses`).

© daymade · MIT · daymade/claude-code-skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set68

repomix-unmixer Extracts packed Repomix repositories back into original file trees. Useful when inspecting or unpacking projects bundled into single XML, Markdown, or JSON files. CX Codex +1 882installs product-analysis This skill sends parallel agents to inspect a project and combines their findings into an improvement plan. Use it to review UX, APIs, architecture, or docs. CX Codex +1 873installs doc-to-markdown Turns DOCX, PDF, PPTX and saved HTML into clean Markdown and fixes the usual conversion damage on its own. Useful when you need the text out of a document without hand-editing. CX Codex +1 872installs scrapling-skill A skill that walks the agent through installing Scrapling CLI, picking a static or browser-backed fetcher, and checking the saved file instead of trusting an exit code. CX Codex +1 788installs douban-skill Pulls books, movies, music and games out of a Douban profile into CSV files, with RSS sync for new entries. CX Codex +1 749installs terraform-skill Works out why terraform plan says "No changes" while the site is down, and keeps a rollout from touching someone else's service on a shared host. CX Codex +1 710installs marketplace-dev Turns a skills repo into a Claude plugin marketplace: generates marketplace.json, adds plugin entries, and moves skills between suites. CX Codex +1 695installs tunnel-doctor Diagnoses network routing and throughput failures caused by Tailscale, proxy, and TUN conflicts on macOS or Windows/WSL. Helps when pings succeed but SSH or HTTP fails. CX Codex +1 678installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor