skills-vault/skills/fix-title/SKILL.md

2.4 KiB

name description
fix-title Use when a pasted ChatGPT or LLM Markdown reply has heading levels that need to be shifted down before insertion under a parent section such as "## GPT"; also use for Markdown title repair, heading nesting fixes, ATX header adjustment, and adding one or more

Fix Title

Overview

Fix Markdown heading depth for copied LLM replies before inserting them into a discussion record. Use the bundled script for deterministic file edits instead of asking the model to rewrite the document.

The default operation adds two heading levels, turning # Title into ### Title, which fits content placed under a parent heading like ## GPT.

Workflow

  1. Confirm the input is a Markdown file containing the raw reply to adjust.
  2. Choose the number of levels to add. Default to 2 unless the user specifies another value.
  3. Run scripts/fix_markdown_titles.py on the file.
  4. If the target is important or the requested level shift is unusual, use --dry-run or --output first and inspect the result.
  5. Report the path modified and the level shift used.

Commands

python scripts/fix_markdown_titles.py path/to/reply.md
python scripts/fix_markdown_titles.py path/to/reply.md --levels 1
python scripts/fix_markdown_titles.py path/to/reply.md --levels 3 --dry-run
python scripts/fix_markdown_titles.py path/to/reply.md --levels 2 --output path/to/fixed.md

On Windows PowerShell, quote paths that contain spaces:

python .\scripts\fix_markdown_titles.py "C:\path with spaces\reply.md" --levels 2

Behavior

Input --levels 2 output
# A ### A
## B #### B
###### C ###### C

The script only changes ATX headings: lines beginning with up to three spaces followed by # through ###### and then whitespace. It does not change headings inside fenced code blocks, quoted lines such as > # text, or indented code.

Common Mistakes

  • Do not use a broad replace like # to ###; it will corrupt code blocks, quoted content, tags, and inline text.
  • Do not increase headings past level six; Markdown ATX headings stop at ######.
  • Do not change the recorder's outer headings such as # 1 or ## GPT unless the user explicitly points the skill at the recorder file and requests that behavior.
  • Do not use prompt rewriting for this task when the script can perform the edit directly.