Scan repos in an org for standards drift and propagate fixes via worktree PRs
Scan all repos in a GitHub org (or local org folder) for standards drift, then apply fixes.
Two-phase approach: update the .github shared repo first, then propagate to individual repos.
Run from ~/code/{org}/ or pass the org name as an argument.
Read bot_account, owner_account from the org's CLAUDE.md ## Automation config table.
A pre-built script at ~/.claude/scripts/org-standards.sh collects config file presence across all repos in one pass.
Run it first to avoid spending tokens checking files individually.
~/.claude/scripts/org-standards.sh <org-name> > /tmp/org-standards.json
If the script is missing or not executable, run /setup-scripts to regenerate it.
The script outputs a JSON object with:
org, gh_orgdot_github: shared .github repo info (shared_workflows, shared_templates, has_taskfile)declined: previously declined suggestions (from CLAUDE.md ## Declined standards)open_standards_prs: open PRs on the .github repo from botrepos: array of per-repo entries with config booleans, ci_files, uses_shared_workflows, taskfile, badge_countThe org's CLAUDE.md has a ## Declined standards section listing suggestions that were previously rejected.
Never re-suggest anything listed there.
Format for declined entries:
## Declined standards
- `pre-commit-config`: Not using pre-commit in this org (2025-01-15)
- `pkgdown/baselinenowcast`: Custom docs setup preferred (2025-02-01)
When a suggestion is declined (by 👎 on the PR, or explicit rejection):
## Declined standards with the date and reasonPick the most complete repo in the org as the reference, then compare others against it.
From the JSON, identify:
.github repoIf there are open standards PRs: report their status and do not duplicate their changes.
Before touching individual repos, ensure shared configs are up to date in the .github repo.
This means shared workflows, templates, and Taskfile.yml live centrally.
Things that belong in .github:
.github/workflows/)For each missing shared config:
.github repoPresent a table of repos vs standards, showing what needs updating. Group by priority:
Exclude anything in the declined list.
Exclude anything covered by an open, unmerged .github PR.
Ask the user which fixes to apply. For each fix:
For bot/owner-owned repos: apply directly with a clear commit message. For repos owned by others: open a PR making it clear the suggestions are optional.
If more than 3 repos need fixes, spawn a team. Each teammate handles one repo's fixes as a worktree PR. The lead coordinates and reports results.
Check for reactions/comments on previously opened standards PRs:
## Declined standards in CLAUDE.md with date and reason# Check PR status
gh pr view <number> -R <org>/<repo> --json state,reviews
IMPORTANT: If this command is being run as a standalone request, automatically exit after completing all phases successfully.