PhilRobinluo/ai-coevolution-skills / skills/lls-mermaid-validator
lls-mermaid-validator
Verified生成并实际编译 Mermaid 图,同时检查图的语义、中文标签和无障碍文字备份。 当用户要处理相关材料并需要可验证交付物时使用。
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 1.8 KB |
| SKILL.md | skill md | 4.5 KB |
| references/compile-and-semantic-review.md | markdown | 375 B |
| scripts/validate-mermaid.shexecutable | script | 1.3 KB |
| tests/test_validate.shexecutable | script | 535 B |
scripts/validate-mermaid.sh
View on GitHub#!/usr/bin/env bash
set -euo pipefail
file=""; output=""; report=""; dry_run=false
while [[ $# -gt 0 ]]; do case "$1" in --output) output=${2:?}; shift 2;; --report) report=${2:?}; shift 2;; --dry-run) dry_run=true; shift;; -h|--help) echo 'validate-mermaid.sh diagram.mmd [--output diagram.svg] [--report report.json] [--dry-run]'; exit 0;; *) [[ -z "$file" ]] && { file=$1; shift; } || { echo "未知参数 $1" >&2; exit 2; };; esac; done
[[ -n "$file" && -f "$file" ]] || { echo '缺少可读 diagram.mmd' >&2; exit 2; }
output=${output:-"${file%.*}.validated.svg"}
[[ ! -e "$output" ]] || { echo '输出已存在,请更换路径' >&2; exit 3; }
if command -v mmdc >/dev/null 2>&1; then cmd=(mmdc -i "$file" -o "$output")
elif command -v npx >/dev/null 2>&1 && npx --no-install mmdc --version >/dev/null 2>&1; then cmd=(npx --no-install mmdc -i "$file" -o "$output")
else echo '未找到本地 Mermaid CLI;请先安装 @mermaid-js/mermaid-cli' >&2; exit 4; fi
if $dry_run; then printf 'DRY_RUN '; printf '%q ' "${cmd[@]}"; echo; exit 0; fi
"${cmd[@]}" >/dev/null
[[ -s "$output" ]] || { echo '渲染未产生非空 SVG' >&2; exit 5; }
if [[ -n "$report" ]]; then mkdir -p "$(dirname "$report")"; printf '{"ok":true,"input":"%s","output":"%s","bytes":%s}\n' "$file" "$output" "$(wc -c < "$output" | tr -d ' ')" > "$report"; fi
echo "PASS: $file -> $output"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |