JordanGunn/nunchuck / skills/md/md-split
md-split
VerifiedSplits a Markdown file by H2 headings into numbered documents and generates an index file.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 529 B |
| assets/EXAMPLE.md | markdown | 445 B |
| references/00_ROUTER.md | markdown | 468 B |
| references/01_SUMMARY.md | markdown | 1023 B |
| references/02_TRIGGERS.md | markdown | 831 B |
| references/03_ALWAYS.md | markdown | 696 B |
| references/04_NEVER.md | markdown | 569 B |
| references/05_PROCEDURE.md | markdown | 1.3 KB |
| references/06_FAILURES.md | markdown | 973 B |
| scripts/index.ps1 | script | 818 B |
| scripts/index.shexecutable | script | 1.2 KB |
| scripts/skill.ps1 | script | 1.9 KB |
| scripts/skill.sh | script | 2.1 KB |
| scripts/split.ps1 | script | 5.7 KB |
| scripts/split.shexecutable | script | 8.3 KB |
scripts/skill.sh
View on GitHub#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cmd_help() {
cat <<'EOF'
md-split - Split a markdown file by H2 headings
Commands:
help Show this help message
validate Verify the skill is runnable (read-only)
Usage:
md-split --in <source.md> [--out <dir>] [--prefix <NN>] [--dry-run] [--force] [--no-intro] [--manifest|--no-manifest]
md-split help
md-split validate
Deterministic behavior:
- Runs scripts/split.sh (or split.ps1 on Windows) to generate chunk files and .SPLIT.json
- Runs scripts/index.sh (or index.ps1 on Windows) to generate .INDEX.md
EOF
}
cmd_validate() {
local errors=0
if ! command -v bash &>/dev/null; then
echo "error: bash not found" >&2
errors=$((errors + 1))
fi
if [[ ! -f "$SCRIPT_DIR/split.sh" ]]; then
echo "error: missing $SCRIPT_DIR/split.sh" >&2
errors=$((errors + 1))
fi
if [[ ! -f "$SCRIPT_DIR/index.sh" ]]; then
echo "error: missing $SCRIPT_DIR/index.sh" >&2
errors=$((errors + 1))
fi
if [[ $errors -gt 0 ]]; then
return 1
fi
echo "ok: md-split skill is runnable"
}
cmd_split_and_index() {
bash "$SCRIPT_DIR/split.sh" "$@"
local out_dir=""
local in_file=""
local args=("$@")
for ((i=0; i<${#args[@]}; i++)); do
if [[ "${args[$i]}" == "--in" ]]; then
in_file="${args[$((i+1))]}"
fi
if [[ "${args[$i]}" == "--out" ]]; then
out_dir="${args[$((i+1))]}"
fi
done
if [[ -z "$out_dir" ]]; then
if [[ -z "$in_file" ]]; then
echo "error: --in is required" >&2
exit 1
fi
local filename
filename="$(basename "$in_file")"
local base_name
base_name="${filename%.*}"
local out_dir_name
out_dir_name="$(echo "$base_name" | tr '[:upper:]' '[:lower:]')"
out_dir="$(dirname "$in_file")/$out_dir_name"
fi
bash "$SCRIPT_DIR/index.sh" --dir "$out_dir"
}
case "${1:-}" in
help)
cmd_help
;;
validate)
cmd_validate
;;
*)
cmd_split_and_index "$@"
;;
esac
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: 197k | 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 |