From github-maintenance
Periodic, repo-agnostic doctor for AI-context files (CLAUDE.md, AGENTS.md, .cursorrules, .github/copilot-instructions.md). Verifies every concrete claim against the current repo, lints against an opinionated quality spec, surfaces newly-added subsystems the doc misses, and proposes the minimum edits to restore health. Conservative pruning. No-op when files are already healthy — safe to run on a cron.
How this skill is triggered — by the user, by Claude, or both
Slash command
/github-maintenance:agent-context-sync [--dry-run] [--files=<comma-separated-paths>] [--canonical=<path>] [--since=<git-revision>][--dry-run] [--files=<comma-separated-paths>] [--canonical=<path>] [--since=<git-revision>]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Keep a repository's AI-context files accurate, lean, and useful. This skill is **user-triggered only** — never auto-invoke it. It edits documentation (or opens a PR), which the user must explicitly approve via the slash command.
Keep a repository's AI-context files accurate, lean, and useful. This skill is user-triggered only — never auto-invoke it. It edits documentation (or opens a PR), which the user must explicitly approve via the slash command.
These rules apply to every run. Do not restate them, just follow.
unverifiable in the report. Don't replace it with a guess.quality-spec.md, verification-patterns.md, and file-format-conventions.md before phase 2.Logging format (mandatory):
[ACS-Pn] [ACTION|RESULT|DECISION|COMPLETE] message
where n is the phase number.
--dry-run — print the structured report to stdout. No file edits, no branch, no PR. Default is PR mode.--files=<paths> — comma-separated list of AI-context files to check. Overrides discovery. Useful for non-standard layouts.--canonical=<path> — designate one file as the canonical source for cross-file divergence comparisons. Defaults to CLAUDE.md if present, else the most recently modified file.--since=<git-revision> — git revision to diff against for the augmentation phase. Defaults to the canonical file's last-modifying commit.Run in order. Do not skip. Do not reorder.
git rev-parse --show-toplevel. If not, print an error and stop.git status --porcelain). If dirty and not --dry-run, refuse: tell the user to stash or commit first. Dirty trees are allowed in --dry-run.--dry-run, you'll be creating a new branch in Phase 5 — that's fine.quality-spec.md, verification-patterns.md, file-format-conventions.md.Log: [ACS-P0] [COMPLETE] preflight ok, repo=<name>, branch=<current>, dry-run=<bool>
Find AI-context files. Check in this exact order, recording which exist and their last-modified commit (git log -1 --format=%H:%ct -- <path>):
| Path | Format |
|---|---|
CLAUDE.md | Markdown |
AGENTS.md | Markdown |
.cursorrules | Plain text |
.github/copilot-instructions.md | Markdown |
Also check if --files overrides this list. If yes, only operate on those.
Canonical selection:
--canonical provided, use it.CLAUDE.md exists, it's canonical.If zero AI-context files exist:
--dry-run: print a report recommending creation of CLAUDE.md based on detected stack, with a suggested skeleton. Exit.[ACS-P1] [DECISION] no AI-context files found — bootstrapping is out of scope for this skill. Create a starter CLAUDE.md manually first, then re-run. Exit.Log each discovered file: [ACS-P1] [RESULT] found=<path> last_modified=<iso8601> bytes=<n> lines=<n>
For each discovered file, extract verifiable claims using the patterns in verification-patterns.md and run each check. Build a per-file finding list. Each finding has:
{
file: <path>,
line: <n>,
claim: <verbatim quote>,
pattern: <which extraction pattern matched>,
check: <what was tested>,
status: ok | wrong | stale | unverifiable,
evidence: <command output or file contents proving the status>,
proposed_fix: <if status is wrong/stale, the corrected text — else null>
}
Status definitions:
ok — check passed, claim is current.wrong — check failed and there is a clearly correct replacement (e.g. file says "version 1.0.4" but plugin.json says "2.0.0").stale — check failed and there is no clear replacement (e.g. claim references a deleted directory). Conservative pruning means: flag, but only delete if also referenced by another wrong finding that supersedes it.unverifiable — pattern matched but the check can't be run automatically (e.g. claim about runtime behavior, "the cache invalidates every 5 minutes"). Always left in place.Do not produce findings for content that doesn't match any extraction pattern. Lint handles unstructured concerns separately.
Cross-file divergence pass: for each verifiable fact appearing in 2+ files (e.g. a version number, a build command), if the files disagree, emit a divergence finding scoped to the non-canonical files with the canonical value as proposed_fix. Note: divergence findings are advisory — they are reported but NOT auto-fixed even in PR mode, because the non-canonical file might intentionally lag (e.g. .cursorrules is rebuilt by a separate tool).
Log a summary per file: [ACS-P2] [RESULT] file=<path> ok=<n> wrong=<n> stale=<n> unverifiable=<n>
For each file, run the checks in quality-spec.md:
lint:missing-section findings.quality-spec.md. Produce lint:length finding if outside soft cap; lint:length-critical if outside hard cap.quality-spec.md (directory catalogue, fluff, redundant style rules, manifest duplication, stale TODOs). Produce lint:anti-pattern findings with the matched lines.Anti-pattern findings are advisory only under the conservative pruning policy. They surface in the report but are not auto-removed.
Log: [ACS-P3] [RESULT] file=<path> lint_findings=<n> antipatterns=<n>
Look for material additions to the repository that the canonical file does not mention.
--since argument, or the canonical file's last-modifying commit (git log -1 --format=%H -- <canonical>).git log --since-as-of=<sha> --name-status to get changed paths. Group by top-level directory.missing-coverage finding with:
plugins/github-maintenance/")Filter: do NOT propose additions for content an AI could discover by grep in 30 seconds. Examples to skip: a new test file, a renamed variable, a CSS tweak, a single new endpoint within an already-documented subsystem.
Log: [ACS-P4] [RESULT] missing_coverage_findings=<n>
--dry-run:Print a single Markdown report to stdout with this structure:
# agent-context-sync report
**Repo:** <owner>/<name>
**Canonical file:** <path>
**Run mode:** dry-run
**Result:** <healthy | findings>
## Summary
| File | OK | Wrong | Stale | Lint | Missing coverage |
|------|----|----|------|------|------------------|
| ... | ... | ... | ... | ... | ... |
## Findings
### <file>
#### Wrong (will fix in PR mode)
- **Line N:** `<claim>` — <reason>. Proposed: `<fix>`.
#### Stale (will fix in PR mode)
- ...
#### Lint (advisory, not auto-fixed)
- ...
#### Missing coverage (will add in PR mode)
- ...
#### Cross-file divergence (advisory, not auto-fixed)
- ...
## Recommended actions
- <bulleted list, prioritized>
If there are zero findings of any kind, print only:
[agent-context-sync] healthy — no changes proposed.
Exit.
Print the healthy banner (same as above). Do not create a branch. Do not open a PR. Exit.
claude/agent-context-sync-<YYYYMMDD-HHMM> from the current branch.wrong and stale finding with a proposed_fix, apply the edit. Use exact-string replacement; preserve surrounding context including indentation and whitespace.missing-coverage finding, insert the suggested addition into the most appropriate existing section. If no section fits, append a new section in the file's existing style.docs: refresh AI-context files (agent-context-sync)
- <count> wrong claims corrected
- <count> stale references removed
- <count> new subsystems documented
Lint findings and cross-file divergences reported but not auto-fixed (conservative policy).
docs: refresh AI-context files (agent-context-sync)Log: [ACS-P5] [COMPLETE] mode=<dry-run|pr> findings_applied=<n> pr_url=<url-or-null>
Always print exactly one report or one healthy banner per run. Never print partial progress to stdout — use the [ACS-Pn] log lines for that, on stderr if your environment separates streams.
The report is the deliverable. The PR (when in PR mode) is a delivery mechanism for the same report plus the corresponding edits. A human reading the PR must be able to understand every change by reading only the report.
npx claudepluginhub shaharia-lab/claude-power-user --plugin github-maintenanceGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.