/h2t-dev:docs-lintfrom h2t-dev
Audit and maintain documentation/structure health in h2t-stack repos. Full pipeline: sniff → gate → analyze → plan → issues → fixes → validate. Scoped to repos using Claude Code + h2t standards.
Ships in h2t-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Scope: h2t-stack repos (Claude Code, .claude/rules/, docs/superpowers/, h2t standards).
Run this before any other command of this skill:
h2t-ops version --expect 4.1.3 --json
Act on the result, in this order:
"ok": true — continue."ok": false — show the user error.hint as it is and stop this skill until
it is resolved. Do not run anything the hint names unless the user asks you to: on
reason: path it is a command for the user to decide on. error.details.reason names the
case: not_installed, version or path.command not found — read ~/.h2t/run/install.env
(grep -E '^(STATE|H2T_HOOK)=' ~/.h2t/run/install.env). With STATE=ready the install
is fine and PATH does not reach it: show the directory of the H2T_HOOK= path, ask the
user to restart the harness, and offer uv tool update-shell for them to run. Without
it there is no install: give the user uvx --isolated --python 3.12.11 --managed-python -c "https://github.com/lichtpfad/h2t-skills/releases/download/v4.1.3/constraints.txt" --from "h2t-ops @ https://github.com/lichtpfad/h2t-skills/releases/download/v4.1.3/h2t_ops-4.1.3-py3-none-any.whl" h2t-setup sync.uvx --isolated --python 3.12.11 --managed-python -c "https://github.com/lichtpfad/h2t-skills/releases/download/v4.1.3/constraints.txt" --from "h2t-ops @ https://github.com/lichtpfad/h2t-skills/releases/download/v4.1.3/h2t_ops-4.1.3-py3-none-any.whl" h2t-setup sync.The linter is the h2t-docs-lint command; no interpreter or script path is involved.
ROOT="${1:-.}"
DRY_RUN="${2:-}" # pass "--dry-run" to skip issue creation and commits
Run in parallel:
git -C "$ROOT" ls-files --cached --others --exclude-standard 2>/dev/null | head -500
h2t-docs-lint doctor --json --root "$ROOT" 2>/dev/null
cat "$ROOT/CLAUDE.md" 2>/dev/null | head -80
cat "$ROOT/.h2t/docs-lint.yaml" 2>/dev/null
ls "$ROOT/.claude/rules/" 2>/dev/null
Also read first 30 lines of pyproject.toml or package.json if present.
If a reference is missing from references/, skip that dimension and log:
[dim-N] reference missing — skipped.
Autodetect project_type (first match):
.h2t/docs-lint.yaml → project_typeCLAUDE.md first 50 lines — keyword scanpyproject.toml + plugins/ → plugin-packpyproject.toml only → standalone-toolpackage.json → frontend-toolunknownOutput exactly 3 lines:
Тип: <project_type>, <organic-grow|structured|greenfield>
Состояние: <1-line summary>
Сигнал: <порядок|хаос|зрелый> → рекомендую (<stage>)
Стадия проекта:
(1) cleanup — organic-grow, нужен полный аудит
(2) mature — стабильная структура, maintenance lint
(3) greenfield — новый репо, setup-ориентированный аудит
(4) archived — read-only, только анализ
# Read last valid state (schema=1, handle corrupt lines)
# -R reads raw lines and fromjson? drops the corrupt ones; the last schema-1 line wins.
LAST_STATE=$(jq -cR 'fromjson? | select(.schema == 1)' "$ROOT/.h2t/lint-state.jsonl" 2>/dev/null | tail -1)
# If no valid state → fall back to full audit
if [ -z "$LAST_STATE" ]; then
echo "No previous state — running full audit instead."
# → continue as stage (1) cleanup
fi
# Capture current finding IDs via doctor --json
h2t-docs-lint doctor --json --root "$ROOT" > /tmp/lint-current.json 2>/dev/null
CURRENT_IDS=$(jq '[.findings[].id]' /tmp/lint-current.json 2>/dev/null || echo "[]")
LAST_IDS=$(echo "$LAST_STATE" | jq '.finding_ids // []' 2>/dev/null || echo "[]")
# Delta = IDs in current but not in last
NEW_IDS=$(jq -n --argjson cur "$CURRENT_IDS" --argjson last "$LAST_IDS" '$cur - $last')
# Apply safe fixes automatically
h2t-docs-lint fix-safe --root "$ROOT"
# Show only delta
jq -r '.[]' <<< "$NEW_IDS" | while read id; do echo " [NEW] $id"; done
Append state:
mkdir -p "$ROOT/.h2t"
AFTER_IDS=$(jq '[.findings[].id]' /tmp/lint-current.json 2>/dev/null || echo "[]")
AFTER_COUNT=$(jq '.findings | length' /tmp/lint-current.json 2>/dev/null || echo 0)
jq -n \
--arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--argjson after_count "$AFTER_COUNT" \
--argjson new_ids "$NEW_IDS" \
--argjson after_ids "$AFTER_IDS" \
'{schema:1,ts:$ts,mode:"maintenance",findings_after:$after_count,new:$new_ids,finding_ids:$after_ids}' \
>> "$ROOT/.h2t/lint-state.jsonl"
rm -f /tmp/lint-current.json
# Dirty worktree — warn on ANY uncommitted changes
DIRTY=$(git -C "$ROOT" status --porcelain 2>/dev/null | grep -v '^??' | head -1)
if [ -n "$DIRTY" ]; then
BRANCH=$(git -C "$ROOT" branch --show-current 2>/dev/null)
echo "WARNING: uncommitted changes on branch '$BRANCH'. Continue? (y/n)"
# Wait for user input — do not proceed if 'n'
fi
# gh auth (skip issue creation if fails)
GH_AUTH_OK=0
gh auth status 2>/dev/null && GH_AUTH_OK=1 || echo "gh auth failed — issues will be skipped"
# Duplicate issue check
[ "$GH_AUTH_OK" = "1" ] && \
gh issue list --label "type:docs-lint" --json number,title --limit 20 2>/dev/null || true
Dry-run mode ($DRY_RUN = --dry-run): skip commits and issue creation throughout.
mkdir -p "$ROOT/.h2t"
h2t-docs-lint doctor --json --root "$ROOT" > "$ROOT/.h2t/lint-before.json" 2>/dev/null
BEFORE_COUNT=$(jq '.findings | length' "$ROOT/.h2t/lint-before.json" 2>/dev/null || echo 0)
Load references on demand (skip with log if missing):
$(h2t-dev root)/references/standards/documentation-structure.md — dims 1,2,6$(h2t-dev root)/references/standards/code-organization.md — dims 3,4$(h2t-dev root)/skills/docs-lint/references/non-standard-resolution.md — dim 8| # | Dimension | Source |
|---|---|---|
| 1 | Docs structure | doctor --json type=orphan,structure + documentation-structure.md |
| 2 | Naming | type=naming + naming-conventions.md |
| 3 | Code organization | git ls-files + code-organization.md |
| 4 | Data storage | git ls-files root dirs |
| 5 | Agent accessibility | CLAUDE.md + .claude/rules/ |
| 6 | Frontmatter | type=frontmatter |
| 7 | Root hygiene | type=structure (root count) |
| 8 | Non-standard dirs | git ls-files vs template + non-standard-resolution.md |
Stage 4 (archived): collect findings, mark all destructive suggestions [ANALYSIS ONLY].
## docs-lint audit — {project} — {date}
### Critical
- [dim-N] <path>: <message>
### Important
- [dim-N] <path>: <message>
### Low
- [dim-N] <path>: <message>
### Config warnings
- [stale-exception] ...
- [orphan-exception] ...
PLAN_FILE="$ROOT/docs/superpowers/plans/$(date +%Y-%m-%d)-docs-audit.md"
# Write findings to $PLAN_FILE
if [ "$DRY_RUN" != "--dry-run" ]; then
git -C "$ROOT" add "$PLAN_FILE"
git -C "$ROOT" commit -m "docs: docs-lint audit $(date +%Y-%m-%d)"
fi
Only if GH_AUTH_OK=1 AND stage ≠ 4 AND DRY_RUN is empty.
# Check for existing issue first
EXISTING=$(gh issue list --label "type:docs-lint" \
--search "$ISSUE_TITLE" --json number,title 2>/dev/null | jq '.[0].number // empty')
if [ -n "$EXISTING" ]; then
echo "Existing issue #$EXISTING. Update or create new? (u/n)"
else
# Create labels if missing
gh label create "type:docs-lint" --color "0075ca" \
--description "docs-lint audit finding" 2>/dev/null || true
gh label create "priority:p0" --color "b60205" 2>/dev/null || true
gh label create "priority:p1" --color "d93f0b" 2>/dev/null || true
# One issue per dimension with findings
gh issue create \
--title "$ISSUE_TITLE" \
--body "$ISSUE_BODY" \
--label "type:docs-lint" \
--label "$PRIORITY_LABEL"
fi
Dry-run: print issue titles/bodies to stdout instead.
Safe (automatic):
h2t-docs-lint fix-safe --root "$ROOT"
h2t-docs-lint fix-index --root "$ROOT" --apply
Destructive (confirm each before running):
git mv <old> <new> and wait for "y"git rm <path> and wait for "y"Stage 4: skip all fixes.
h2t-docs-lint doctor --json --root "$ROOT" > "$ROOT/.h2t/lint-after.json" 2>/dev/null
DELTA=$(jq -n \
--slurpfile before "$ROOT/.h2t/lint-before.json" \
--slurpfile after "$ROOT/.h2t/lint-after.json" \
'($before[0].findings | map(.id)) as $b_ids |
($after[0].findings | map(.id)) as $a_ids |
{
fixed: ($b_ids - $a_ids | length),
remaining: ($after[0].findings | length),
new: ($a_ids - $b_ids),
pass: (($a_ids - $b_ids | length) == 0)
}')
FIXED=$(echo "$DELTA" | jq '.fixed')
AFTER_COUNT=$(jq '.findings | length' "$ROOT/.h2t/lint-after.json")
NEW_IDS=$(echo "$DELTA" | jq '.new')
PASS=$(echo "$DELTA" | jq '.pass')
AFTER_IDS=$(jq '[.findings[].id]' "$ROOT/.h2t/lint-after.json")
PROJECT_TYPE=$(jq -r '(.project_type // .template // "unknown")' \
"$ROOT/.h2t/docs-lint.yaml" 2>/dev/null || echo "unknown")
echo "findings_before: $BEFORE_COUNT findings_after: $AFTER_COUNT fixed: $FIXED new: $NEW_IDS $([ "$PASS" = "true" ] && echo PASS || echo FAIL)"
rm -f "$ROOT/.h2t/lint-before.json" "$ROOT/.h2t/lint-after.json"
jq -n \
--arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--arg pt "$PROJECT_TYPE" \
--argjson before_count "$BEFORE_COUNT" \
--argjson after_count "$AFTER_COUNT" \
--argjson fixed "$FIXED" \
--argjson new_ids "$NEW_IDS" \
--argjson pass_val "$PASS" \
--argjson after_ids "$AFTER_IDS" \
'{schema:1,ts:$ts,mode:"full",project_type:$pt,
findings_before:$before_count,findings_after:$after_count,
fixed:$fixed,new:$new_ids,pass:$pass_val,finding_ids:$after_ids}' \
>> "$ROOT/.h2t/lint-state.jsonl"
newGenerate a correctly-named file with required frontmatter (fields sourced from
FRONTMATTER_RULES, so the output never drifts from the validator). Prefer this
over hand-writing — hand-written files trigger frontmatter findings.
h2t-docs-lint new plan <slug> --root . [--milestone M3] [--title "..."]
h2t-docs-lint new spec <slug> --root . [--milestone M3]
h2t-docs-lint new adr <slug> --root .
plan/spec → docs/superpowers/{plans,specs}/YYYY-MM-DD-<slug>.md (date = today)adr → docs/adr/NNNN-<slug>.md (next 4-digit number, status: proposed)fix-safe --only=frontmatter.retireThe only sub-command that lowers the debt count. Lists open plans/specs older
than --older-than days (60 by default) with their evidence: age, how many
commits touched the file, and how many of those also touched code.
Read the second number. The raw count does not discriminate — on h2t-skills the
modal value was 2, and for dozens of files the second commit was one bulk
docs-lint --fix-frontmatter sweep. с кодом = 0 means no commit ever changed
the document and something outside docs/ together: the plan was written and
nothing shipped under it (69 of 111 here).
h2t-docs-lint retire --root . --json # list candidates
h2t-docs-lint retire --root . --older-than 90 --json # a stricter cut
h2t-docs-lint retire --root . --apply --json # git mv into docs/archive/
h2t-docs-lint retire --root . --never-shipped --json # only `с кодом = 0`
--never-shipped narrows the list to that second number being zero. It selects,
it does not conclude: "nothing shipped alongside" is what was measured, and a
single code-touching commit is far too weak to write status: done into a file.
The 2026-08-26 migration used it to move 69 of 111 by command and leave the
other 42 to be read one at a time.
--apply stages the moves; it never commits and never overwrites an existing
archive entry. Run fix-index --apply afterwards — docs/README.md still links
the old paths. Deliberately manual: no automatic signal separates "done and
never updated" from "abandoned" (a plan slug appears in 7 of 60 merged PR bodies
on h2t-skills), so the judgement is a person's and this only makes it cheap.
h2t-docs-lint audit --root .
h2t-docs-lint plan --root . --json
h2t-docs-lint fix-safe --root .
h2t-docs-lint fix-index --root .
h2t-docs-lint doctor --json --root .
h2t-docs-lint retire --root . --json
Load on demand:
$(h2t-dev root)/references/standards/documentation-structure.md$(h2t-dev root)/references/standards/naming-conventions.md$(h2t-dev root)/references/standards/code-organization.md$(h2t-dev root)/skills/docs-lint/references/non-standard-resolution.mdWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/docs-sync-labelsSync canonical GitHub labels (from references/standards/labels.json) to the repositories you name, or those in your repo mapping, via gh CLI. Triggers on "sync labels", "update labels", "apply labels to repos", "docs-sync-labels"./github-issuesThis skill should be used when creating or updating GitHub issues. The issue contract itself lives in the repository's issue forms; this skill covers what the forms cannot — sizing, labels, milestones, duplicate check, and the gh command shape. Triggers on "create issue", "add to backlog", "github issue"./milestone-closureThis skill should be used when all issues in a GitHub milestone are closed and the phase is complete. Triggers on "close milestone", "milestone done", "phase complete", "закрыть milestone", or when the last issue in a milestone is closed.npx claudepluginhub lichtpfad/h2t-skills --plugin h2t-dev