setup
Verify markdown-format's prerequisites and configuration here, and register its git pre-commit entry. Use when: 'set up markdown-format', 'configure markdown-format', 'is markdown-format working', formatting silently isn't happening, or a hook reported a missing prerequisite or drifted git hook. Actions: check (read-only, default) | apply [install-lint] | apply install-git-hooks [scope=local|shared]. Re-runnable.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 30
- Forks
- 7
01 前言 Front Matter
- shell
- bash
- description
- Verify markdown-format's prerequisites and configuration here, and register its git pre-commit entry. Use when: 'set up markdown-format', 'configure markdown-format', 'is markdown-format working', formatting silently isn't happening, or a hook reported a missing prerequisite or drifted git hook. Actions: check (read-only, default) | apply [install-lint] | apply install-git-hooks [scope=local|shared]. Re-runnable.
- allowed-tools
- [ "Bash(command -v jq*)", "Bash(node \"${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs\" verify:*)", "Bash(node ${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs verify:*)", "Bash(node \"${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs\" plan:*)", "Bash(node ${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs plan:*)" ]
- argument-hint
- [check|apply [install-lint|install-git-hooks [scope=local|shared]]]
- user-invocable
- true
- disable-model-invocation
- true
02 资源文件 1
- 参考文档reference/git-hook-decisions.md5.0 KB
03 SKILL.md 正文
Pre-computed context
check's jq probe ran at load time. Read this row instead of re-issuing it; it shows
the tool's path when present, or absent when missing:
jq: !command -v jq 2>/dev/null || echo absent
A row missing, reading as literal command text, or reading [shell command execution disabled by policy] carries no result: run that tool's command -v probe via Bash instead.
- Pointer: for the placeholder a skipped load-time command leaves, fetch skills § Inject dynamic context live.
- As of: 2026-11-11
- Recheck trigger: the placeholder text changes.
Purpose
Thin check-centric setup per the uniform setup contract (docs/plugin-philosophy.md
"Setup is explicit and repeatable" in the marketplace repository): check inspects and
reports, apply resolves. The only consumer-project files this plugin owns are its git-hook
entry copies, which apply install-git-hooks writes. Rules come from the repository's own
markdownlint config, and the tunables are the native userConfig options (the on/off toggle,
the gitignored-file switch and the end-of-turn check). apply is otherwise guidance-and-verify,
with one more write path: the explicitly invoked apply install-lint dependency install
described below.
Action routing: no argument or check runs the check; apply runs the check first, then
remediation; apply install-lint additionally authorizes the consumer-repo dependency
install described below. All are non-interactive. Never prompt when the action is given.
apply install-git-hooks asks only where its section says to.
check (read-only)
The hook script (${CLAUDE_PLUGIN_ROOT}/hooks/markdown-format.sh) and the gates it shares with
the pre-commit entry (${CLAUDE_PLUGIN_ROOT}/git-hooks/markdown-gates.sh) are the single source
of truth for what the plugin requires and how it resolves things.
Read them first. Probe what they actually do, don't recite this file. Then read the
pre-computed jq row, run the remaining probes via Bash, and report a PASS/FAIL/INFO
table with one remediation line per FAIL. Do not modify anything.
Read each option value from this text; never put a ${user_config.*} string in a shell command.
Open plugin files by the ${CLAUDE_PLUGIN_ROOT} paths this skill names; never Glob or Grep the plugin directory.
When the plugin's toggle is disabled, every prerequisite absence except Node.js (item 1)
downgrades from FAIL to INFO. The hook and the SessionStart probe both exit through the
enabled gate before probing anything, so a deliberately disabled plugin is not broken.
Node.js stays FAIL: Claude Code must spawn node for the hook row before that gate can run.
A tool the git pre-commit entry needs keeps the grade it gets with the toggle on while that entry
is installed (item 9 reports it as a tool line beside an ok, stale or modified entry): the
entry runs at commit outside Claude Code and reads no toggle.
Report the probes informationally and note that re-enabling restores the FAIL semantics.
- Node.js. Every hook row starts through
node hooks/exec-bash.mjs, so withoutnodeonPATHno hook launches and nothing is enforced. Probe it via Bash withnode --version(a hook cannot report its own missing launcher; a stale version-manager shim resolves onPATHyet cannot run, so resolution alone is not a PASS). FAIL if it is absent or exits non-zero, in every toggle state; the remediation is to install or repair Node.js (README Requirements). - Bash version. Check against the hooks' floor, Bash 3.2 or newer (
${CLAUDE_PLUGIN_ROOT}/hooks/hook-utils.sh). jq. The pre-computedjqrow, or the Bash probe when that row carries no result. The batch hook reads the file paths withjqand does nothing, silently, without it. FAIL if absent and the repository opted in per item 5; INFO otherwise, because without a config nothing would run anyway and the missing config, not jq, is why.markdownlint-cli2. Resolve it exactly the way the gates'md_local_binand the hook's PATH lookup do:PATHfirst, thennode_modules/.bin/markdownlint-cli2walking up from a Markdown file's directory to the repository root, with the shim's symlinks followed and its physical target required to stay inside the repository'snode_modulestree. A binary or shim the hook would reject must not PASS here. Then confirm the resolved tool actually executes, loading no repository config or module: run it with--help, never-h,--versionor a bare glob. It executed when its first output line is the tool's version banner, whatever the exit code (a repo shim can resolve yet still be broken: missing Node interpreter, dangling target). Anything else is FAIL, with the execution error in the remediation line. FAIL when nothing the hook would accept resolves.- Probe:
markdownlint-cli2--helpand--version. As of: 2026-11-04. Recheck trigger: amarkdownlint-cli2release changes what--helpprints first, or adds a--versionflag.
- Probe:
- Consumer markdownlint config, the opt-in. This is what activates the plugin, not a
style detail. Mirror the gates'
md_config_statewalk: from a Markdown file's directory up to the repo root, so nested configs apply to nested files and the opt-in is per-path (a root config covers the tree; adocs/config covers onlydocs/). Where that walk finds nothing the hook exits silently: no--fix, no findings, and no notice, not even a missing prerequisite. TheSessionStartprobe does not check for a config, so it can still report a missingmarkdownlint-cli2in a repository that never opted in. Search the whole tree (skipnode_modules), report the root config the cascade discovers, list nested configs with their directory scope, and report as INFO, gated, every config the gates'md_classifyflags (a.cjsor.mjsconfig, or one namingcustomRules,markdownItPluginsoroutputFormatters, or holding a backslash in a quoted string): the plugin runs markdownlint-cli2 under it only after the user approves that config state (README "Trust model"), so until then the files it governs are neither rewritten nor checked. Never create the approval marker yourself: approval is the user's. For a path no config governs, report the plugin as INFO, inactive, not PASS: nothing is broken, the repository simply never opted in, and that is the whole reason formatting is not happening. Name the remediation in the same line rather than leaving the reader to infer it: the user can add a markdownlint config to opt in. Do not offer to create one. Never report markdownlint's own default rules as the fallback. An unconfigured repo gets no rules, not the defaults. - Path scope, the repository's
.gitignore. INFO: the batch hook leaves a gitignored file alone, because a path the repository excludes is not part of the reviewable artifact. (The pre-commit entry only sees files git stages, so it needs no such rule.) List the ignored Markdown the repository carries as out of scope withgit ls-files --others --ignored --exclude-standard -- '*.md' '*.mdc', and note that a tracked file is never treated as ignored even when a pattern matches it. Report the effective${user_config.markdown_format_lint_gitignored}value (unexpanded or empty means defaultfalse, i.e. gitignored files are skipped);truerestores rewriting there. - Hook toggle. Report the effective
markdown_format_enabledvalue:${user_config.markdown_format_enabled}(unexpanded or empty means defaulttrue). Also reportmarkdown_format_end_of_turn:${user_config.markdown_format_end_of_turn}(unexpanded or empty means unset, the default), as INFO: unset, the Stop row shows you the findings in the uncommitted changes when a turn ends and the turn ends;true, it hands them back to Claude once per turn;false, only the batch rewrite and the git pre-commit entry run. - Hook registration. INFO: confirm the plugin is enabled for this project
(
/plugin→ Installed) rather than parsing settings files. - Git pre-commit entry. Run
node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" verifyfrom the repository. Each line is<state>\t<entry>[\t<detail>]:okis PASS,declinedis INFO (this clone said no; silent at session start), andmissing,stale,modifiedorsupersededis a FAIL whose remediation isapply install-git-hooks; asupersededdetail lists what an install under an earlier plugin name left, which that action removes on the user's yes. Atool\t<tool>\tmissingline means the installed entry cannot run here: list every such tool with its install method from the${CLAUDE_PLUGIN_ROOT}/prerequisites.json(Read that path), so a lane or cloud setup script can provision it before an auto-mode session commits. Outside a git repository, report INFO and skip the step.
apply install-git-hooks [scope=local|shared]
Registers the plugin's git-hook entries (git-hooks/entries.json) with the repository's hook
manager. The installer script only detects, renders and writes files the plugin owns; every step
that needs judgment comes back to you as a decisions[] item, which you reason about and apply
with your own edit tools.
- Scope. Use the argument when given. Otherwise, when the user is present, ask:
local(this clone only, nothing committed) orshared(committed under.githooks/markdown-format/, so every teammate and agent gets it). When nobody can answer, uselocal. - Plan. Run
node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" plan --scope <scope>and read the JSON:manager,actions[],decisions[]. - Manager conflict. A
manager-conflictdecision lists the evidence (two managers, or one this installer does not drive, such as the pre-commit framework). Show it and ask which manager should carry the entry; rerunplanwith--manager lefthook|husky|plain. Without an answer, stop here and report. - Actions. When
actions[]holdscopyitems, runnode "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" copy --scope <scope>(plus the same--managerwhen you passed one). It printsinstalled,refreshed,unchanged,refusedorblockedper entry;refusedmeans a locally edited copy, which themodifieddecision covers, andblockedmeans another tool owns the local hooks directory, which thehooks-path-owneddecision covers. - Decisions. Read reference/git-hook-decisions.md for
what each kind asks of you, apply each one, then rerun
planuntil only the decisions you chose to leave remain. - Verify. Run
verifyand report its lines ascheckstep 9 does.
The entry rewrites: at commit it formats the staged Markdown files and stages the result, so tell the user that a commit can change the files it contains, and that a partly staged Markdown file is refused untouched.
When the user does not want an entry in this clone, run
node "${CLAUDE_PLUGIN_ROOT}/lib/git-hooks/install.mjs" decline --entry markdown-check; the
session-start drift line then stays silent until verify runs by hand, and --undo reverses it.
Add --global (with or without --undo) to decline the entry in every clone;
git config --global checks.git-hooks.declined true declines every entry of every plugin, and an
entry's own key set to false in a clone opts that entry back in. The adoption
path explains to the user each scope and why a formatter's cleanup PR comes first.
apply (idempotent)
Run check, then for each FAIL offer the resolution. Never install anything without the
consumer's explicit go-ahead in the invocation. apply install-lint adds
markdownlint-cli2 as a dev dependency in the consumer repository using the
repository's own package manager, resolved in order: lockfile (pnpm-lock.yaml →
pnpm add -D, yarn.lock → yarn add -D, bun.lock/bun.lockb → bun add -d,
package-lock.json or npm-shrinkwrap.json → npm install --save-dev), then the
package.json "packageManager" field when no lockfile exists, then npm only when
neither signal is present. With no package.json, an ambiguous multi-lockfile state, or a lockfile that
contradicts packageManager, stop with manager-specific guidance instead of guessing.
Never introduce a competing lockfile. The change is stated before running. For a Yarn repository, don't infer the linker. Ask
the repo's own Yarn: run yarn config get nodeLinker in the repo. pnp → skip the install
and give guidance, because Plug'n'Play generates a loader file, not the node_modules/.bin
shim the hook resolves; install markdownlint-cli2 on PATH or switch the linker.
node-modules/pnpm, or Yarn Classic → install. For the setting's values and default, fetch
nodeLinker live. The
verify-after-remediation rule below is the backstop when an install still yields no
usable shim. After ANY remediation, re-run the
relevant check probe live via Bash (a pre-computed row predates the remediation) and report
its actual result. Never claim resolved on the
install command's exit code alone. For everything else apply only points:
-
missing
jq/ Bash / Node.js: platform install instructions from the README Requirements section; this skill never installs system packages. -
toggle off: set
markdown_format_enabledtotruethrough Claude Code's native flow, interactively with/plugin configure markdown-format@<marketplace>or by a headless route, as the marketplace's plugin-reconfiguration convention gives them in § The routes (it owns the verified-version record). Apply the scope and failure-signal caveats in its § Caveats every setup skill's short form carries. Read both sections and print what they give, the fallback route, its behavior on an already-installed plugin and the scope to pass included, rather than only naming them, and leave out the verified-version record. Never uninstall to reconfigure; that section links what an uninstall deletes. This skill never writes user settings orpluginConfigs. Afterwards reruncheckin a fresh session, since a same-sessioncheckcan still show the old value, and report the observed effective value, never an unobserved change.- Pointer: for the headless command's flags, how it reports a saved or refused value, and when a saved value applies, fetch plugin CLI reference § plugin configure live.
-
no markdownlint config: this is why the plugin does nothing here, so lead with it rather than leaving it as a footnote under the passing prerequisites. Then offer to create a minimal
.markdownlint-cli2.jsoncin the repository root only when explicitly asked. The plugin imposes no rules of its own, and which rules a repository adopts is its own decision, never this skill's.
Re-running apply after everything passes changes nothing and reports "already configured".
What this skill does NOT do
- Run the formatter. Editing any
.mdfile exercises the batch hook end-to-end, andgit commitexercises the installed pre-commit entry. The only executioncheckperforms is the--helpliveness probe of the resolved linter; it never lints, fixes, touches repository content, or loads a repository config or module. - Write the plugin cache, Claude Code user settings, or
pluginConfigs. - Download anything during
check; network use happens only in an explicitly requestedapply install-lintinside the consumer repository.
04 同仓库更多 Skills
track
Backlog reads through the bound tracker: search open and closed items, view one item with its comments and state history. Use when another skill searches or reads tracker items.
reviewer-media
Reviewer media for one pull request: decides whether it needs a narrated walkthrough, builds the storyboard from /review:explain-change's digest, has /explainer-video:produce render it and hands the manifest to /source-control:pull-request media. Use when asked for 'reviewer media', 'a walkthrough video for this PR', 'a produced video of this change', or when pull-request ready or monitor hands a PR over.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
route
Model and effort per agent role (orchestrator, worker, verifier, retrieval) for a multi-agent run, resolved through the bundled defaults and the user, team and personal override config layers into fenced JSON with single-agent and fan-out variants and the layer behind each value. Use when asked 'which model for the subagents', 'route the roles' or 'model routing', or before a skill passes a role's model on a spawn.
principles
Module-design vocabulary for architecture findings, and the checks built on it. Use when: 'what is a deep module', 'what is a seam', 'deep vs shallow module', 'what is the deletion test', 'leverage and locality', 'module design vocabulary', 'which word do we use for X in architecture findings'. Scanning a codebase for friction is /architecture:improve.
write
Structured five-field bug report (title, steps to reproduce, expected vs actual, justified severity, suggested fix location) from an informal description, read-only. Use when the user names a defect they observed, or asks for one written up ('report a bug', 'file a bug', 'write this up as a bug').