chat-format

Convert exported AI chat transcripts into Q-numbered Markdown documents with navigable tables of contents.

Updated Nov 21, 2025
One-click install
npx skills add https://github.com/alatyshau/duet --skill chat-format-alatyshau
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: chat-format
Source: https://github.com/alatyshau/duet/tree/main/packages/skills/tools/chat-format
Command: npx skills add https://github.com/alatyshau/duet --skill chat-format-alatyshau

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires katex, and includes scripts (resource) components.

What problem does it solve? Exported chats from Gemini, ChatGPT, Claude, or DeepSeek are flat streams of generic Prompt/Response markers, making it impossible to navigate long conversations or generate a useful table of contents for PDF rendering. ## Core Features & Use Cases - Q-Numbered Restructuring: Collapses each prompt/response pair into a single ## Q01 — Title heading with a horizontal rule separating the user's message from the assistant's reply, producing a scannable TOC. - Source-Specific HTML Cleanup: A dedicated DeepSeek pass converts HTML bodies (KaTeX spans, code-block chrome, thinking blocks, tables) into clean Markdown before numbering. - Math Render Validation: An optional KaTeX-based checker flags unrenderable formulas and bare tikzcd diagrams, with a fix catalog for converting them to KaTeX's CD environment. - Use Case: You exported a 30-turn DeepSeek conversation about SAP migration and want a PDF with proper bookmarks — run the cleanup, draft titles, apply Q-numbering, and the sidebar TOC reads like a real table of contents. ## Quick Start Format the attached exported chat file into numbered Q-sections with brief descriptive titles so I can navigate it by topic.

Frequently Asked Questions about chat-format

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I format an exported ChatGPT or Gemini chat into a readable document?

Detect the prompt/response markers in the export, draft a 2-6 word title per exchange, then run the qnumber.js script with your markers and titles file. It collapses each pair into a numbered `## Q01 — Title` heading with a horizontal rule between turns.

How to convert a DeepSeek share-page export to clean Markdown?

Run the deepseek_cleanup.js script on the export file. It strips thinking blocks, converts KaTeX spans back to $-delimited LaTeX, extracts code from UI chrome, and converts HTML tables, leaving clean Markdown ready for Q-numbering.

Why does my exported chat show raw HTML tags after formatting?

DeepSeek exports contain HTML message bodies, not plain Markdown, so naive marker substitution leaves divs and spans behind. Run the source-specific cleanup pass first, which exits non-zero and lists leftover tags if it encounters artifacts it cannot handle.

Can KaTeX render tikzcd commutative diagrams from chat exports?

No, KaTeX cannot render tikzcd at all, even inside $$ delimiters. Convert each diagram to KaTeX's CD environment by folding diagonals into equivalent commutative squares, then verify with the check_math.js script until it reports OK.

What happens when chat markers do not alternate cleanly?

The qnumber.js script refuses to run when prompt, response, and title counts disagree, since a mismatch signals a malformed pair like an orphan opening answer. In that case, map markers to Q-headings manually and title orphan answers from their own content.