Skip to content

JordanGunn/nunchuck / skills/md/md-split

md-split

Verified

Splits a Markdown file by H2 headings into numbered documents and generates an index file.

FileKindSize
SKILL.mdskill md529 B
assets/EXAMPLE.mdmarkdown445 B
references/00_ROUTER.mdmarkdown468 B
references/01_SUMMARY.mdmarkdown1023 B
references/02_TRIGGERS.mdmarkdown831 B
references/03_ALWAYS.mdmarkdown696 B
references/04_NEVER.mdmarkdown569 B
references/05_PROCEDURE.mdmarkdown1.3 KB
references/06_FAILURES.mdmarkdown973 B
scripts/index.ps1script818 B
scripts/index.shexecutablescript1.2 KB
scripts/skill.ps1script1.9 KB
scripts/skill.shscript2.1 KB
scripts/split.ps1script5.7 KB
scripts/split.shexecutablescript8.3 KB

scripts/skill.ps1

View on GitHub
$ErrorActionPreference = "Stop"

$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path

function Show-Help {
    @"
md-split - Split a markdown file by H2 headings

Commands:
  help
  validate

Usage:
  md-split -in <source.md> [-out <dir>] [-prefix <NN>] [-dryRun] [-force] [-noIntro]
  md-split help
  md-split validate

Deterministic behavior:
- Runs scripts/split.ps1 to generate chunk files and .SPLIT.json
- Runs scripts/index.ps1 to generate .INDEX.md
"@
}

function Invoke-Validate {
    $errors = 0

    $split = Join-Path $ScriptDir "split.ps1"
    $index = Join-Path $ScriptDir "index.ps1"

    if (-not (Test-Path $split)) {
        Write-Error "error: missing $split"
        $errors++
    }

    if (-not (Test-Path $index)) {
        Write-Error "error: missing $index"
        $errors++
    }

    if ($errors -gt 0) {
        exit 1
    }

    Write-Output "ok: md-split skill is runnable"
}

function Invoke-SplitAndIndex {
    param([string[]]$Arguments)

    # Pass args through to split.ps1
    & (Join-Path $ScriptDir "split.ps1") @Arguments

    # Derive output directory (split.ps1 default behavior)
    $inFile = $null
    $outDir = $null

    for ($i = 0; $i -lt $Arguments.Count; $i++) {
        if ($Arguments[$i] -eq "-in") {
            $inFile = $Arguments[$i + 1]
        }
        if ($Arguments[$i] -eq "-out") {
            $outDir = $Arguments[$i + 1]
        }
    }

    if (-not $outDir) {
        if (-not $inFile) {
            Write-Error "error: -in is required"
            exit 1
        }
        $item = Get-Item $inFile
        $baseName = $item.BaseName.ToLower()
        $outDir = Join-Path $item.DirectoryName $baseName
    }

    & (Join-Path $ScriptDir "index.ps1") -dir $outDir
}

$command = if ($args.Count -gt 0) { $args[0] } else { "" }

switch ($command) {
    "help" { Show-Help }
    "validate" { Invoke-Validate }
    default { Invoke-SplitAndIndex -Arguments $args }
}
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
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: 194kUpdated Claude CodeCodexVerifiedInstall