fixing-claude-export-conversations
Fixes broken line wrapping in Claude Code exported conversation files (.txt), reconstructing tables, paragraphs, paths, and tool calls that were hard-wrapped at fixed column widths. Includes an automated validation suite (generic, file-agnostic checks). Triggers when the user has a Claude Code export file with broken formatting, mentions "fix export", "fix conversation", "exported conversation", "make export readable", references a file matching YYYY-MM-DD-HHMMSS-*.txt, or has a .txt file with broken tables, split paths, or mangled tool output from Claude Code.
Best use case
fixing-claude-export-conversations is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Fixes broken line wrapping in Claude Code exported conversation files (.txt), reconstructing tables, paragraphs, paths, and tool calls that were hard-wrapped at fixed column widths. Includes an automated validation suite (generic, file-agnostic checks). Triggers when the user has a Claude Code export file with broken formatting, mentions "fix export", "fix conversation", "exported conversation", "make export readable", references a file matching YYYY-MM-DD-HHMMSS-*.txt, or has a .txt file with broken tables, split paths, or mangled tool output from Claude Code.
Teams using fixing-claude-export-conversations should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/claude-export-txt-better/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How fixing-claude-export-conversations Compares
| Feature / Agent | fixing-claude-export-conversations | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Fixes broken line wrapping in Claude Code exported conversation files (.txt), reconstructing tables, paragraphs, paths, and tool calls that were hard-wrapped at fixed column widths. Includes an automated validation suite (generic, file-agnostic checks). Triggers when the user has a Claude Code export file with broken formatting, mentions "fix export", "fix conversation", "exported conversation", "make export readable", references a file matching YYYY-MM-DD-HHMMSS-*.txt, or has a .txt file with broken tables, split paths, or mangled tool output from Claude Code.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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 (53 automated checks) 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`).
Related Skills
torchscript-exporter
Torchscript Exporter - Auto-activating skill for ML Deployment. Triggers on: torchscript exporter, torchscript exporter Part of the ML Deployment skill category.
model-export-helper
Model Export Helper - Auto-activating skill for ML Deployment. Triggers on: model export helper, model export helper Part of the ML Deployment skill category.
continue-claude-work
Recover actionable context from local `.claude` session artifacts and continue interrupted work without running `claude --resume`. This skill should be used when the user provides a Claude session ID, asks to continue prior work from local history, or wants to inspect `.claude` files before resuming implementation.
claude-skills-troubleshooting
Diagnose and resolve Claude Code plugin and skill issues. This skill should be used when plugins are installed but not showing in available skills list, skills are not activating as expected, or when troubleshooting enabledPlugins configuration in settings.json. Triggers include "plugin not working", "skill not showing", "installed but disabled", or "enabledPlugins" issues.
claude-md-progressive-disclosurer
Optimize CLAUDE.md files using progressive disclosure. Goal: Maximize information efficiency, readability, and maintainability. Use when: User wants to optimize CLAUDE.md, information is duplicated across files, or LLM repeatedly fails to follow rules.
claude-code-history-files-finder
Finds and recovers content from Claude Code session history files. This skill should be used when searching for deleted files, tracking changes across sessions, analyzing conversation history, or recovering code from previous Claude interactions. Triggers include mentions of "session history", "recover deleted", "find in history", "previous conversation", or ".claude/projects".
Markdown Exporter
Markdown Exporter is an Agent Skill that transforms your Markdown text into a wide variety of professional format files.
claude-md-enhancer
Analyzes, generates, and enhances CLAUDE.md files for any project type using best practices, modular architecture support, and tech stack customization. Use when setting up new projects, improving existing CLAUDE.md files, or establishing AI-assisted development standards.
running-claude-code-via-litellm-copilot
Use when routing Claude Code through a local LiteLLM proxy to GitHub Copilot, reducing direct Anthropic spend, configuring ANTHROPIC_BASE_URL or ANTHROPIC_MODEL overrides, or troubleshooting Copilot proxy setup failures such as model-not-found, no localhost traffic, or GitHub 401/403 auth errors.
difficult-workplace-conversations
Structured approach to workplace conflicts, performance discussions, and challenging feedback using preparation-delivery-followup framework. Use when preparing for tough conversations, addressing conflicts, giving critical feedback, or navigating sensitive workplace discussions.
varlock-claude-skill
Secure environment variable management ensuring secrets are never exposed in Claude sessions, terminals, logs, or git commits
test-fixing
Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.