From Spec-Driven Development (SDD)
SPEC.md condenser — token-budget sweep. Triggers when user invokes `/sdd:condense` or asks to condense spec or /sdd:check emits `## advisory` token-budget overflow line. Phrasings: "/sdd:condense", "condense SPEC.md", "SPEC too big", "shrink the spec", "token budget".
How this skill is triggered — by the user, by Claude, or both
Slash command
/sdd:condensesonnetThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Operator-triggered six-prong sweep. Scope: SPEC.md + `SPEC.archive.md` + `.claude/check-extras.md`. Not auto-fire — /sdd:check emits advisory when token estimate > 20k; operator invokes next turn. Single atomic commit (all firing prongs or none); rollback `git revert`. Writes serialize main-thread; per-prong scan reads delegable to sub-agents.
Operator-triggered six-prong sweep. Scope: SPEC.md + SPEC.archive.md + .claude/check-extras.md. Not auto-fire — /sdd:check emits advisory when token estimate > 20k; operator invokes next turn. Single atomic commit (all firing prongs or none); rollback git revert. Writes serialize main-thread; per-prong scan reads delegable to sub-agents.
Multi-phase run per response-shape invariant → emit live harness checklist. Phases: LOAD, PROPOSE (six-prong scan), CONFIRM, EXECUTE. TaskCreate one task per phase @ LOAD start; TaskUpdate in_progress @ phase entry → completed @ phase exit. CONFIRM cancel / subset-skip → unreached phases deleted, not completed. Checklist = ephemeral harness UI: never repo state, never substitutes the ## Next block.
SPEC.md. Missing → "no spec, nothing to condense." Stop.${CLAUDE_PLUGIN_ROOT}/SPEC-FORMAT.md — row schema + section catalog.check-mechanical.py TOKEN_RATIO (single source; not hardcode divisor). Record.Six prongs, execution order 1 → 6. Per prong: scan SPEC.md for trigger match; emit firing-set + skip-set w/ 1-line rationale each.
Script modes below run python3 ${CLAUDE_PLUGIN_ROOT}/scripts/check-mechanical.py <mode>; ${CLAUDE_PLUGIN_ROOT} no-expand in frontmatter → python3 grant pinned mid-glob Bash(python3 */check-mechanical.py *) (script-sole use, leading * absorbs the plugin-root prefix) per tooling-preference invariant.
Fold pattern-mirrored sibling §V rows into target row inline. Seed script-computed: check-mechanical.py emit-fold-seeds emits cluster_members|co_citers table — connected components of live §V rows sharing a citer (§T cites or §B fix naming ≥ 2 live §V rows). Seed advisory not auto-apply: co-citation is candidacy signal not proof; operator confirms each fold @ CONFIRM (LLM judges topic coherence). Augment seed w/ topic-keyword overlap (shared scope tokens / procedure refs / verb pattern) where co-citation thin. Fires first — fold reshapes later prongs (prong 6 inherits folded shape).
Candidates script-computed: check-mechanical.py emit-superseded emits tid|superseded_v|original_cites table — closed §T (status x) whose §V cite resolves into no live §V row (only archived §V.retired block or nowhere) → SUPERSEDED candidate. Live-only resolution — distinct from cite-DAG audit live+archive scope. Consume table; not by-hand per-cite resolution. Operator confirms each (content-amend-away not cite-detectable). Replace task body wholesale: T<n>|x|SUPERSEDED — §V.<m> amend|<original cites>. Preserves row id; closes cite-DAG-miss audit noise.
Trigger: closed §T rows > 50. Older closed rows → SPEC.archive.md (repo-root sibling, committed, id ascending). §T/§B gain per-section marker ## archived: §<S>.<a>..§<S>.<b> → SPEC.archive.md (<n> rows). Archive carries verbatim row text. /sdd:check cite-DAG sweep eager-probes archive; archived rows stable so memo HOLD-SINCE-CLEAN across runs.
Prune history residue across live §V/§T/§B row bodies — SPEC.md is clean current design; history lives in commit log + archive. Pattern set single-sourced by freshness-contract invariant (shared w/ /sdd:check audit + /sdd:spec write-time prune):
(∆) markers → drop.retired YYYY-MM-DD clause inlined in live row → drop (wholesale-retired row is reorganize archival job).pre-amend …, prior … retired/dropped/superseded, recurrence-class lineage, surfaced-by prose. Commit msg + §B.cause/§T.cites cite-DAG preserve narrative.Closes §B.<x> sentence → (closes §B.<x>) suffix on prior clause.§T body-trim — owned here because /sdd:build flips status cell only, so §T body not reachable by /sdd:spec write-time prune: oversized task cell carrying step-by-step transcript → one-line goal; surplus → commit-msg body. Mirrors §B cause one-line trim.
Pre-filters (match exempt): backtick-wrapped tokens (pattern-definition rows not self-flag); cite-modifier §V.<n>(∆); wholesale-retired V<n>: retired YYYY-MM-DD rows pending reorganize. Verbatim-preservation holds: code, paths, URLs, identifiers, error strings, regex.
Rewrite embedded English connectives per telegraph skill. Targets: Why:, For example, In other words, explanatory because / due to clauses. Verbatim-preservation holds: code, paths, URLs, identifiers, numbers, versions, error strings, SQL, regex, JSON, YAML, quoted strings.
Heavy set script-computed: check-mechanical.py emit-v-weights emits v_row|bytes|tokens|cum_pct|heavy table, heaviest first; heavy = top rows whose cumulative weight first reaches ≥ 50% of §V-section total (tie-break descending weight then ascending id — run-stable). Not by inspection. Heavy rows: extract audit-recipe content → .claude/check-extras.md (REPO-LOCAL extension); SPEC.md row keeps 1-line ref. Check skill loader already path-probes .claude/check-extras.md — no check-skill amend.
Always fires post-PROPOSE. Single bulk AskUserQuestion covers full sweep — mid-flow re-prompt not allowed:
Condense SPEC.md: prongs {<firing-set>} firing, {<skip-set>} skipped. Baseline ~<n>k tokens, est. ~<m>k post-sweep. Apply?Condense gateapply all firing prongs → EXECUTE full firing set.force-skip prong 3 → EXECUTE minus prong 3 (archive split deferred; prong 3 load-bearing so explicit override).subset → user supplies N in {1..6} via Other-typed input; EXECUTE prong N only.cancel → no mutation; PROPOSE report retained as final output.Single atomic commit:
git add SPEC.archive.md.git add .claude/check-extras.md.SPEC.md (git add), then path-scoped commit git commit -m <subject> -- <staged artifacts> SPEC.md (write-ownership invariant — commit scopes to staged owned set, pre-staged files never leak; -m flags ! precede --); auto-commit msg condense SPEC.md: prongs {<firing-set>} (~<n>k → ~<m>k tokens); no user prompt.EXECUTE ends @ commit. Rollback git revert <condense-sha>. Drift cascade → Next-block item #1; operator dispatches next turn.
Recipe end → before the ## Next block, scan this run for a mechanization candidate. Candidate = any of:
Hit → emit exactly one ## Next item naming the observed pattern + proposed script mode; none → no item. Never self-implement the mechanization mid-run (recipe-step-no-dispatch + write-ownership invariants). Route by cwd:
mechanization-candidate path (monitor-protocol invariant).claude/check-extras rowHeading ## Next; 1–5 atomic items (one sentence each, no Reply prefix); positional dispatch (run <int> or run /<plugin>:<cmd> [args]). Optional ## Hint (≤ 3 lines) precedes when item selection needs hidden state. State-mutator → post-EXECUTE prefer /sdd:check (confirm cite-DAG + format-layer + token-budget clean).
Example after EXECUTE (firing-set {1,2,3,4,5}; commit auto-fired):
## Next
1. /sdd:check — cascade scan over condensed SPEC.md
2. /sdd:build --next — start the next pending §T row
3. git revert <condense-sha> — rollback if condensation breaks downstream
Variants: CONFIRM cancel (no commit) → swap item 1 for /sdd:condense (re-run to apply after spec review), drop item 3. CONFIRM subset → Next-block unchanged.
check-mechanical.py constants; retune via /sdd:spec AMEND + sync the script constant same commit.Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub kborovik/spec-driven-dev --plugin sdd