Validate ASCII diagram alignment in markdown. TRIGGERS - diagram alignment, ASCII art, box-drawing diagrams.
Validate and fix alignment issues in ASCII box-drawing diagrams commonly used in architecture documentation, README files, and code comments.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed ā fix this file immediately, don't defer. Only update for real, reproducible issues.
ASCII diagrams using box-drawing characters (āāāāāāāā¤ā¬ā“ā¼ and double-line variants āāāāāāā ā£ā¦ā©ā¬) require precise column alignment. This skill provides:
Invoke when:
Corners: ā ā ā ā
Lines: ā ā
T-joins: ā ⤠⬠ā“
Cross: ā¼
Corners: ā ā ā ā
Lines: ā ā
T-joins: ā ⣠⦠ā©
Cross: ā¬
ā ā ⤠⧠⪠ā«
/usr/bin/env bash << 'PREFLIGHT_EOF'
uv run "$(cc-plugin-root doc-tools)/skills/ascii-diagram-validator/scripts/check_ascii_alignment.py" docs/ARCHITECTURE.md
PREFLIGHT_EOF
/usr/bin/env bash << 'PREFLIGHT_EOF_2'
uv run "$(cc-plugin-root doc-tools)/skills/ascii-diagram-validator/scripts/check_ascii_alignment.py" docs/*.md
PREFLIGHT_EOF_2
/usr/bin/env bash << 'PREFLIGHT_EOF_3'
uv run "$(cc-plugin-root doc-tools)/skills/ascii-diagram-validator/scripts/check_ascii_alignment.py" docs/
PREFLIGHT_EOF_3
The script outputs issues in a compiler-like format for easy navigation:
docs/ARCHITECTURE.md:45:12: error: vertical connector 'ā' at column 12 has no matching character above
ā Suggestion: Add 'ā', 'ā', 'ā¤', 'ā¬', or 'ā¼' at line 44, column 12
docs/ARCHITECTURE.md:67:8: warning: horizontal line 'ā' at column 8 has no terminator
ā Suggestion: Add 'ā', 'ā', 'ā¤', 'ā“', or 'ā¼' to close the line
| Level | Description |
|---|---|
| error | Broken connections, misaligned verticals |
| warning | Unterminated lines, potential issues |
| info | Style suggestions (optional cleanup) |
The script checks for:
| Code | Meaning |
|---|---|
| 0 | No issues found |
| 1 | Errors detected |
| 2 | Warnings only (errors ignored with --warn-only) |
When Claude Code creates or edits ASCII diagrams:
/usr/bin/env bash << 'PREFLIGHT_EOF_4'
# After editing docs/ARCHITECTURE.md
uv run "$(cc-plugin-root doc-tools)/skills/ascii-diagram-validator/scripts/check_ascii_alignment.py" docs/ARCHITECTURE.md
# If errors found, Claude Code can read the output and fix:
# docs/ARCHITECTURE.md:45:12: error: vertical connector 'ā' at column 12 has no matching character above
# ā Edit line 44, column 12 to add the missing connector
PREFLIGHT_EOF_4
| Script | Purpose |
|---|---|
scripts/check_ascii_alignment.py |
Main validation script |
| Issue | Cause | Solution |
|---|---|---|
| Script not found | Plugin not installed | Verify plugin installed with claude plugin list |
| False positives with tabs | Tab characters misalign | Convert tabs to spaces before validation |
| Mixed ASCII not detected | Using +---+ style |
Script only validates Unicode box-drawing chars |
| Column numbers off | Unicode width calculation | Use pre-composed characters, avoid combining marks |
| No issues but looks wrong | Aesthetic spacing not checked | Validator checks structure, not visual spacing |
| Exit code 2 unexpected | warnings only mode | Use --warn-only flag to treat warnings as success |
| Can't find validation error | Complex nested diagram | Check line numbers in output, validate section only |
| Unicode chars not rendering | Terminal font missing glyphs | Use font with full Unicode box-drawing support |
After this skill completes, check before closing:
Only update if the issue is real and reproducible ā not speculative.