refactor(skills): retrofit the corpus to the ADR-0020 context contract (#129)
Retrofits all 39 skills to ADR-0020's description/body context contract, then fixes what six rounds of independent review found in that retrofit — including four ways the hot gate itself failed open. Closes #99, #107, #108, #110, #111, #114, #115, #120. ## The retrofit (waves 1-5) | | Start | Now | |---|---|---| | Description FAILs (>400 chars) | 26 | **0** | | Body FAILs (>900 words, body-only) | 9 | **0** | | Dangling routing targets | 2 | **0** | | `Kyberforge.CompositionNote` | 10 | **0** | | Preload tax | 21,005 chars | **~10,500** | Under the 12,000-char success criterion. Per-wave detail is on #99. ## The review fixes **The gate failed open four ways, three of them found after the retrofit shipped.** An unrecognised follower token made a dangling target vanish. A skill directory with no `SKILL.md` resolved as a valid target, so a commit could be green locally and red in a fresh clone — three existing fixtures were relying on that, one of which made the install-leak A/B pass vacuously. Then the free-standing `/name` sweep turned out to be gated on the sentence carrying a boundary marker, so route notation in any other sentence was invisible — not an ERROR, not a SUGGESTION, not an INFO — which left the documented "`/name` always blocks" promise false from a second direction. All four fixed and pinned. **Two checks were silently not running.** `validate-provenance.sh` checks 7-8 were dead across nine skills. Waking them exposed a deeper problem: they assume `Research doc:` names a source index, but 30 of 121 entries point at topic content documents, so every new check-7 INFO was a false positive and check 8 was saved from a false-FAIL flood only by an *unannounced* skip. Checks 7/8 are now scoped to source indexes and every skip announces itself (#121). **The retrofit's own anti-goal, four times.** ADR-0020 warns that a blunt gate gets satisfied by deleting content rather than relocating it. `diagnose` and `skill-audit` relocated prose and then read it unconditionally; `prototype` and `vale-config` deleted rules outright that survived nowhere. All four addressed. ## Verification - `bash tests/run-tests.sh --strict` — 24 suites, 0 skipped, 0 failed - `bash tests/run-bats.sh` — 325 tests, 0 failures - `pre-commit run --all-files` — 17/17 - `pre-commit run --hook-stage pre-push --all-files` — 16/16, with `apm marketplace check` and `apm pack --check-clean` run against the remote, not skipped - `scripts/skill-size-check.sh` over all 39 skills — rc 0, 0 ERROR/FAIL, SUGGESTION-only - Preload tax measured at **10,498 chars**, max description 390 — both inside budget - Every new test proven non-vacuous by a deliberate mutation of the behaviour it covers **Per-commit sync, stated accurately:** the ten commits from the latest review round each pass `check-plugin-content-sync` in isolation, verified by checking each out in a detached worktree with a clean between. The earlier gitea window (`dfacf05..bedbd1d`, nine commits) does **not** — its mirror was regenerated in one batch at `bbc7300`. An earlier revision of this description claimed the property held for every commit; it does not, and a bisect through that window lands on a red commit. **Squash-merge** to collapse it, or accept that this range is not bisectable. ## Version bump Six plugins and the catalog take a **patch**, not a minor. The branch is **89 commits — 40 `fix` / 30 `refactor` / 12 `docs` / 5 `chore` / 2 `test` — zero `feat`, zero `!`, zero `BREAKING CHANGE`** — and adds no skill, agent, command or hook. (Two earlier revisions of this section cited a stale histogram, most recently 78 commits; the figures above are measured at HEAD.) Both rules this repo ships (`forge/references/version-bump.md`, landing in this PR, and `git-commits/references/conventional-commits-spec.md`) make that a patch, and the catalog set is unchanged at 7 entries. Not settled by that: four published files were removed from the installed tree, three moved, and `caveman` gained `disable-model-invocation`, retiring its old triggers. Under a strict reading those are major-class and currently ship under `refactor:` with no marker. Whether the deployed skill surface is a public contract is written down nowhere — worth deciding, but it outlives this PR. ## Deliberately not in scope #112 (cherry-pick ownership, now resolved in favour of `git-commits`), #113 (`rtk git` normalisation), #116 (research fan-out), #101 (audit-skill merge), #122 (non-spec skill-root files), #123 (no PRD producer) stay open. #117 is the one worth reading: the contract's remedy is to move prose into `references/`, which is exactly where neither the size gate nor Vale looks — and the blind spot is wider than #117 currently records, since there is no root `.vale.ini` at all, so every ADR, `CONTEXT.md` and `README.md` is unlinted too. That blind spot let this branch carry two `level: error` `Kyberforge.SentenceOpenerThereIs` violations into `references/` files it created — `provider-adapter-author/references/provider-matrix.md:31` and `agent-audit/references/finding-criteria.md:95`. Both are reworded in `afadaae`, confirmed by routing each file through the audit's own `vale-wrap.sh` (1 error each before, 0 after). Five further occurrences sit in `references/` files already on `main`; those are the pre-existing corpus and stay with #117, which is the real fix. Also unfixed and not this PR's: `apm install` appends a duplicate `SessionStart` entry to `.claude/settings.json`, so a fresh clone cannot get pre-push green without an edit AGENTS.md warns against. Reproduces identically on `main`. Co-authored-by: Defame1297 <gitea@rkdr.net> Reviewed-on: https://git.dev.rkdr.net/Defame1297/holocron/pulls/129 Co-authored-by: Claude Code AI - Gitea MCP <claude@noreply.git.dev.rkdr.net> Co-committed-by: Claude Code AI - Gitea MCP <claude@noreply.git.dev.rkdr.net>
This commit was merged in pull request #129.
This commit is contained in:
@@ -19,6 +19,8 @@ Invoke with no arguments. The skill determines from context whether to create a
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `SKILL.md` | Skill instructions for agents |
|
||||
| `references/create-config.md` | Loaded when the repo has no `.pre-commit-config.yaml` — the create-from-scratch flow |
|
||||
| `references/modify-config.md` | Loaded when a `.pre-commit-config.yaml` already exists — add, remove, top-level keys, rev staleness |
|
||||
| `references/hooks-by-language.md` | Hook recommendations by detected language/extension |
|
||||
| `references/README.md` | Index of files in references/ |
|
||||
| `references/sources.md` | Provenance — research sources that informed this skill |
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
---
|
||||
name: pc-author
|
||||
description: >
|
||||
Use when the user wants to create, add hooks to, remove hooks from, update,
|
||||
or configure .pre-commit-config.yaml. Triggers on: "set up pre-commit",
|
||||
"add a hook", "remove this hook", "configure pre-commit", "create a pre-commit
|
||||
config", "disable trailing whitespace hook", "add shellcheck", "update my
|
||||
pre-commit config", even if the user does not name pre-commit explicitly.
|
||||
Do not use for running hooks, installing git hooks, or bumping revision pins
|
||||
— use pc-run for those.
|
||||
Use when the user wants to create or edit `.pre-commit-config.yaml` — add,
|
||||
remove, or configure hooks — even when they name only the tool ("add
|
||||
shellcheck"). Not running, installing, or updating hooks -> `pc-run`.
|
||||
allowed-tools: Bash Read Write Edit
|
||||
metadata:
|
||||
category: devtools
|
||||
@@ -20,72 +16,22 @@ metadata:
|
||||
|
||||
## Gotchas
|
||||
|
||||
- `rev` must be an immutable tag or commit SHA — never a branch name. `pre-commit autoupdate` breaks silently on branches.
|
||||
- Fixers (`trailing-whitespace`, `end-of-file-fixer`, `pretty-format-json`) modify files but do NOT auto-stage them. The commit is blocked; the user must re-stage and recommit. Warn when adding fixers.
|
||||
- `pre-commit validate-config` catches YAML structure errors but does NOT check whether hook `id`s exist in the target repo's manifest, and does NOT download or run hooks. It is fast; run it after every write.
|
||||
- When removing a hook leaves its repo block with zero hooks, delete the entire repo block — an empty `hooks: []` causes `validate-config` to fail.
|
||||
- `language: system` and `language: script` are deprecated names. Use `language: unsupported` and `language: unsupported_script` for new local hooks.
|
||||
- `rev` must be an immutable tag or commit SHA, never a branch name. A branch looks like it works and then breaks `pre-commit autoupdate` silently.
|
||||
- `pre-commit validate-config` checks YAML structure only — it never confirms a hook `id` exists upstream, so a config it accepts can still fail on first use.
|
||||
|
||||
## Route
|
||||
|
||||
Check before acting:
|
||||
| Condition | Flow | Read |
|
||||
|---|---|---|
|
||||
| No `.pre-commit-config.yaml` in the repo | Create | `references/create-config.md` |
|
||||
| `.pre-commit-config.yaml` exists | Modify | `references/modify-config.md` |
|
||||
|
||||
- `.pre-commit-config.yaml` does not exist → **Create from scratch**
|
||||
- File exists → **Modify existing**
|
||||
Read only the file matching the resolved flow — each is self-contained.
|
||||
|
||||
## Create from scratch
|
||||
The target is always `.pre-commit-config.yaml`, the config that consumes hooks. A request to publish hooks for other repos to consume means `.pre-commit-hooks.yaml`, a different file this skill does not author.
|
||||
|
||||
1. Run a shallow extension scan:
|
||||
```bash
|
||||
git ls-files | grep -oE '\.[a-z]+$' | sort | uniq -c | sort -rn
|
||||
```
|
||||
2. Read `references/hooks-by-language.md` to map detected extensions to recommended hooks. For a minimal starting point instead of a full recommendation set, `pre-commit sample-config > .pre-commit-config.yaml` prints a small starter config to build on.
|
||||
3. State the proposed config in full before writing. Wait for user confirmation.
|
||||
4. Write `.pre-commit-config.yaml`.
|
||||
5. Run `pre-commit validate-config`. If non-zero: show the error, fix it, re-validate. Never leave a broken config.
|
||||
## Gates common to both flows
|
||||
|
||||
## Modify existing
|
||||
|
||||
Read `.pre-commit-config.yaml` first. Note any stale `rev` values (see **Rev staleness** below) but do not change them.
|
||||
|
||||
### Adding a hook
|
||||
|
||||
1. Run a shallow extension scan to detect languages in the repo:
|
||||
```bash
|
||||
git ls-files | grep -oE '\.[a-z]+$' | sort | uniq -c | sort -rn
|
||||
```
|
||||
2. Read `references/hooks-by-language.md` for the correct repo URL, rev, and recommended args for any hook before writing.
|
||||
3. Check for duplicates — if the same hook ID or equivalent tool already exists in the config, say so and stop.
|
||||
4. To sanity-check a hook against the repo's actual files before committing to it in config, smoke-test it with `pre-commit try-repo <repo-url> <hook-id> --verbose` (or a local path for hooks under development). This runs the hook without writing anything.
|
||||
5. If the hook's source repo already exists in the config, add the hook under that repo block. Otherwise append a new repo block.
|
||||
6. State the proposed addition. Wait for confirmation.
|
||||
7. Write. Run `pre-commit validate-config`. If non-zero: show error, fix, re-validate.
|
||||
|
||||
### Removing a hook
|
||||
|
||||
1. Identify the hook entry and its repo block.
|
||||
2. State what will be removed: hook ID, and whether the parent repo block will also be deleted (if it would have zero hooks remaining). Wait for confirmation.
|
||||
3. Remove the hook entry. If the repo block now has zero hooks remaining, remove the entire repo block.
|
||||
4. Write. Run `pre-commit validate-config`. If non-zero: revert the edit, show the error, and stop — do not leave a broken config (removal edits are not safely auto-fixable, unlike a bad new hook block, which can usually be corrected in place).
|
||||
|
||||
### Configuring top-level keys
|
||||
|
||||
Only when the user explicitly asks. Valid keys: `fail_fast`, `default_stages`, `default_language_version`, `minimum_pre_commit_version`, `exclude`, `files`, `default_install_hook_types`.
|
||||
|
||||
State the proposed change and wait for confirmation before writing.
|
||||
|
||||
## Rev staleness
|
||||
|
||||
When reading the config, for each repo listed in `references/hooks-by-language.md`, compare its `rev` in the user's config against the rev in that file. Flag any mismatch as potentially outdated and tell the user to run `pc-run` to autoupdate. Repos not in the reference cannot be checked — skip them silently. Do not modify `rev` values yourself.
|
||||
|
||||
The reference table's pins can themselves go stale between updates — treat a mismatch as a prompt to check, not a certainty. `pre-commit autoupdate` (via `pc-run`) is the authoritative source for what the current rev actually is.
|
||||
|
||||
## Scope boundary
|
||||
|
||||
This skill manages `.pre-commit-config.yaml` only. It does not:
|
||||
- Author `.pre-commit-hooks.yaml` (publishing hooks for external consumers)
|
||||
- Run `pre-commit install`
|
||||
- Execute hooks or run the test suite
|
||||
- Bump `rev` values
|
||||
|
||||
For those operations, use `pc-run`.
|
||||
1. State the proposed config or edit in full and wait for confirmation before writing. Hook choices are opinions imposed on everyone else's commit loop, not defaults to assume.
|
||||
2. Run `pre-commit validate-config` after every write. On a non-zero exit, show the error and resolve it before reporting done — never leave a config that cannot be parsed.
|
||||
3. Never edit a `rev` value. Report staleness and hand the bump to `pc-run`, which runs `autoupdate` against the hook repos themselves.
|
||||
|
||||
@@ -10,5 +10,7 @@ source_keys:
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `create-config.md` | The create flow — read when the repo has no `.pre-commit-config.yaml` |
|
||||
| `modify-config.md` | The modify flow — read when a `.pre-commit-config.yaml` already exists |
|
||||
| `hooks-by-language.md` | Hook recommendations by language/context — repo, rev, and rationale for adding hooks |
|
||||
| `sources.md` | Provenance: research sources that informed this skill |
|
||||
|
||||
31
plugins/git/skills/pc-author/references/create-config.md
Normal file
31
plugins/git/skills/pc-author/references/create-config.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source_keys:
|
||||
- context7-pre-commit-com
|
||||
- pre-commit-com
|
||||
---
|
||||
|
||||
# Creating a `.pre-commit-config.yaml`
|
||||
|
||||
Reached from `SKILL.md`'s Route table when the repo has no config yet. Self-contained — the modify
|
||||
flow's file is not needed here. `SKILL.md`'s three common gates still apply.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Detect what languages are actually in the repo with a shallow extension scan, rather than
|
||||
inferring them from the project's name or README:
|
||||
|
||||
```bash
|
||||
git ls-files | grep -oE '\.[a-z]+$' | sort | uniq -c | sort -rn
|
||||
```
|
||||
|
||||
2. Read `references/hooks-by-language.md` and map the detected extensions to recommended hooks.
|
||||
Take the repo URL, `rev` and args from that file rather than from memory — a `rev` that does not
|
||||
exist is the most common way a fresh config fails on its first run.
|
||||
|
||||
For a deliberately minimal starting point instead of a full recommendation set,
|
||||
`pre-commit sample-config > .pre-commit-config.yaml` prints a small starter config to build on.
|
||||
|
||||
3. State the proposed config in full and wait for the user's confirmation.
|
||||
|
||||
4. Write `.pre-commit-config.yaml`, then run `pre-commit validate-config`. If it exits non-zero,
|
||||
show the error, fix it in place, and re-validate.
|
||||
@@ -11,6 +11,11 @@ source_keys:
|
||||
Use this table when creating a config from scratch or recommending hooks to add.
|
||||
Always check the existing config for duplicates before proposing.
|
||||
|
||||
Fixer hooks (`trailing-whitespace`, `end-of-file-fixer`, `pretty-format-json` and the like) rewrite
|
||||
files but do NOT re-stage them, so the commit is still blocked and the user has to stage and commit
|
||||
again. Say so when proposing one — otherwise the first blocked commit reads as the hook being
|
||||
broken.
|
||||
|
||||
## Universal (recommend for every repo)
|
||||
|
||||
| Hook ID | Repo | Rev | Rationale |
|
||||
@@ -101,6 +106,9 @@ Use for repo-specific scripts that don't belong in an external hook repo.
|
||||
stages: [pre-push]
|
||||
```
|
||||
|
||||
`language: system` and `language: script` are deprecated names for the first two below.
|
||||
New local hooks use `unsupported` and `unsupported_script`.
|
||||
|
||||
Language choices for local hooks:
|
||||
- `unsupported` — system PATH tool (pre-commit does not manage env)
|
||||
- `unsupported_script` — script at a repo-relative path
|
||||
@@ -117,4 +125,4 @@ Language choices for local hooks:
|
||||
|
||||
## Rev pin freshness
|
||||
|
||||
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since `pc-author`'s "Rev staleness" check treats this table as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against this table.
|
||||
The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats this table as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against this table.
|
||||
|
||||
75
plugins/git/skills/pc-author/references/modify-config.md
Normal file
75
plugins/git/skills/pc-author/references/modify-config.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
source_keys:
|
||||
- context7-pre-commit-com
|
||||
- pre-commit-com
|
||||
---
|
||||
|
||||
# Modifying an existing `.pre-commit-config.yaml`
|
||||
|
||||
Reached from `SKILL.md`'s Route table when the repo already has a config. Self-contained — the
|
||||
create flow's file is not needed here. `SKILL.md`'s three common gates still apply.
|
||||
|
||||
Read the existing `.pre-commit-config.yaml` before editing. Note any stale `rev` values (see
|
||||
**Rev staleness** below) but do not change them.
|
||||
|
||||
## Adding a hook
|
||||
|
||||
1. Run a shallow extension scan, so the addition is judged against the languages actually present:
|
||||
|
||||
```bash
|
||||
git ls-files | grep -oE '\.[a-z]+$' | sort | uniq -c | sort -rn
|
||||
```
|
||||
|
||||
2. Read `references/hooks-by-language.md` for the correct repo URL, `rev` and recommended args
|
||||
before writing anything.
|
||||
|
||||
3. Check for duplicates. If the same hook ID, or an equivalent tool, is already configured, say so
|
||||
and stop rather than adding a second one.
|
||||
|
||||
4. To sanity-check a hook against the repo's real files before committing to it, smoke-test it:
|
||||
|
||||
```bash
|
||||
pre-commit try-repo <repo-url> <hook-id> --verbose
|
||||
```
|
||||
|
||||
Use a local path in place of the URL for a hook under development. This runs the hook without
|
||||
writing anything.
|
||||
|
||||
5. If the hook's source repo is already a block in the config, add the hook under that block.
|
||||
Otherwise append a new repo block.
|
||||
|
||||
6. State the proposed addition, wait for confirmation, write, and run `pre-commit validate-config`.
|
||||
On a non-zero exit, show the error, fix it, and re-validate.
|
||||
|
||||
## Removing a hook
|
||||
|
||||
1. Identify the hook entry and its parent repo block.
|
||||
|
||||
2. State what will be removed — the hook ID, and whether the parent repo block goes with it because
|
||||
it would be left with zero hooks. Wait for confirmation.
|
||||
|
||||
3. Remove the hook entry. If the repo block now has no hooks left, remove the whole block: an empty
|
||||
`hooks: []` fails `validate-config`.
|
||||
|
||||
4. Write, then run `pre-commit validate-config`. On a non-zero exit, **revert the edit**, show the
|
||||
error, and stop. A removal is not safely fixable in place the way a malformed new hook block is,
|
||||
so recovering the prior state beats patching forward.
|
||||
|
||||
## Configuring top-level keys
|
||||
|
||||
Only when the user explicitly asks. Valid keys: `fail_fast`, `default_stages`,
|
||||
`default_language_version`, `minimum_pre_commit_version`, `exclude`, `files`,
|
||||
`default_install_hook_types`.
|
||||
|
||||
State the proposed change and wait for confirmation before writing.
|
||||
|
||||
## Rev staleness
|
||||
|
||||
For each repo in the config that also appears in `references/hooks-by-language.md`, compare the
|
||||
two `rev` values. Flag a mismatch as potentially outdated and tell the user to run `pc-run` to
|
||||
autoupdate. Repos absent from the reference cannot be checked — skip them silently. Do not modify
|
||||
any `rev` yourself.
|
||||
|
||||
The reference table's own pins go stale between updates, so treat a mismatch as a prompt to check
|
||||
rather than proof of staleness. `pre-commit autoupdate`, via `pc-run`, is the authoritative answer
|
||||
to what the current `rev` actually is.
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
- **URL:** context7:/pre-commit/pre-commit.com
|
||||
- **Description:** Official pre-commit.com documentation — installation, configuration schema, CLI reference, hook authoring, advanced features, troubleshooting
|
||||
- **Contributing files:** SKILL.md, references/hooks-by-language.md
|
||||
- **Contributing files:** SKILL.md, references/create-config.md, references/modify-config.md, references/hooks-by-language.md
|
||||
- **Research doc:** plugins/git/docs/research/docs/pre-commit/{overview,configuration,cli-reference,hook-authoring}.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
- **URL:** https://pre-commit.com/
|
||||
- **Description:** Pre-commit framework homepage — full docs covering install, config, CLI, hook authoring, stages, local hooks, meta hooks, hazmat helpers, CI integration
|
||||
- **Contributing files:** SKILL.md, references/hooks-by-language.md
|
||||
- **Contributing files:** SKILL.md, references/create-config.md, references/modify-config.md, references/hooks-by-language.md
|
||||
- **Research doc:** plugins/git/docs/research/docs/pre-commit/{overview,configuration,cli-reference,hook-authoring}.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user