repo-standardizer

软件研发 工程通用 22 文件 EN 原文

Polish any GitHub repository's surface — labels

Polish any GitHub repository's surface — labels (emoji rating tiers, P0–P3 priority, impact severity), issue forms, PR template, CI workflows, CODEOWNERS, rulesets, docs. Repo meta & config only — no code logic touched. Use when creating a new repo or polishing an existing one.

说明语言:英文

来源githubawesome-copilot ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/github/awesome-copilot --skill repo-standardizer

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: repo-standardizer description: Polish any GitHub repository's surface — labels (emoji rating tiers, P0–P3 priority, impact severity), issue forms, PR template, CI workflows, CODEOWNERS, rulesets, docs. Repo meta & config only — no code logic touched. Use when creating a new repo or polishing an existing one. ---

GitHub Repo Standardizer

Detect a repository's current state, then polish its surface: issue forms, PR template, label taxonomy, CI, CODEOWNERS, rulesets, docs. Works on repo metadata and config files only — code logic is never touched. Idempotent — safe to re-run; fills gaps and reconciles drift without duplicating or clobbering.

When to use

Preflight (mandatory, in order)

Requires: gh CLI (authenticated), git, jq, python3 — verify they exist before starting (which gh git jq python3).

1. Authenticate — check gh login first

gh auth status 2>/dev/null || echo "NOT_LOGGED_IN"

Verify the acting account can write to the target:

# user repos: no extra check needed beyond token scopes
# org repos: must be a member/admin of the org
gh api "orgs/ORG/memberships/$(gh api user -q .login)" -q .role 2>/dev/null || echo "NO_ORG_ACCESS"

2. Detect repository type

gh repo view OWNER/REPO --json name,owner,visibility,defaultBranchRef,isArchived,isFork \
  -q '{name:.name, ownerType:.owner.type, visibility:.visibility, defaultBranch:.defaultBranchRef.name, archived:.isArchived, fork:.isFork}'
FieldMeaningConsequence
ownerTypeUser = personal, Organization = orgOrg repos can also use org-level rulesets; both support repo-level rulesets
visibilityPUBLIC / PRIVATE / INTERNALPrivate: skip public-facing docs pressure, keep CI secrets minimal; public: README badges + CONTRIBUTING/SECURITY matter
archived / forkRead-only / forkSkip write modules; report why

If the repo was not explicitly named by the user, confirm before touching an org or private repository.

3. Audit current state

gh label list --repo OWNER/REPO --limit 200
gh api repos/OWNER/REPO/contents/.github -q '.[].path' 2>/dev/null || echo "no .github dir"
gh api repos/OWNER/REPO/contents/.github/workflows -q '.[].name' 2>/dev/null || echo "no workflows"
gh api repos/OWNER/REPO/rulesets -q '.[] | {name:.name, enforcement:.enforcement}' 2>/dev/null || echo "no rulesets"
gh api repos/OWNER/REPO/branches -q '.[].name' 2>/dev/null
for f in README.md CONTRIBUTING.md SECURITY.md LICENSE .gitignore; do
  gh api "repos/OWNER/REPO/contents/$f" -q .name 2>/dev/null || echo "missing: $f"
done

4. Detect test framework (for CI module)

Check for these signals (first match wins):

gh api repos/OWNER/REPO/contents/package.json -q .name 2>/dev/null   # node → templates/ci-node.yml
gh api repos/OWNER/REPO/contents/pyproject.toml -q .name 2>/dev/null # python → templates/ci-python.yml
gh api repos/OWNER/REPO/contents/go.mod -q .name 2>/dev/null         # go → templates/ci-go.yml
gh api repos/OWNER/REPO/contents/Cargo.toml -q .name 2>/dev/null     # rust → templates/ci-rust.yml

No signal → propose the generic CI (or ask the user whether CI is wanted at all).

5. Ask about language (before planning)

6. Ask about automation (decides the Governance labels)

Ask the user whether the repo has any automation bots or AI writers running on it — e.g. dependabot, a Stale bot, ClawSweeper, or an AI coding agent that auto-files PRs / auto-fixes issues.

Workflow

  1. Preflight (above). If auth or access fails, stop with a clear message.
  2. Dry-run plan — show the user a concise table of what will be created/updated/skipped. Get confirmation for: rulesets, branch deletion/protection changes, org-level changes, and anything destructive.
  3. Apply modules (each idempotent; run in this order).
  4. Verify — re-query and print an applied / skipped / failed checklist.

Module A — Labels (design first, then idempotent upsert)

Step 1 — Profile the project (adjust the taxonomy, never copy blindly):

Step 2 — Compose categories. Baseline lives in templates/labels.json (plain names, no emoji); extend or trim per the profile in Step 1.

Emoji policy — rating tiers are the ONLY mandatory-emoji labels. Every rating: / issue-rating: tier MUST carry an emoji with a clear low→high gradient (e.g. rating: 🦞 diamond lobster). All other labels: emoji is the agent's call — add icons where they aid scanning, omit them where they clutter. Consistency rule: within one dimension, either ALL labels carry an emoji or NONE do — never a mixed half-emoji dimension (e.g. don't ship 🐛 bug next to a plain enhancement).

Every dimension is opt-in except Type. Add a dimension only if the repo actually needs it; skip it otherwise. The menu below mirrors OpenClaw's official label taxonomy (the richest open reference) — cover every dimension that applies, but never force one the repo doesn't use.

Priority uses P0–P3 (OpenClaw's convention — P0 = emergency). Examples in the tables below show the optional emoji style — apply them all or none per dimension (baseline ships plain P0–P3):

LabelMeaningColor
🔴 P0Emergency: data loss, security bypass, crash loop, unusable coreb60205
🟠 P1High: blocks planned work, needs attention soond93f0b
🟡 P2Medium: normal priorityfbca04
🟢 P3Low: nice to have1a7f37

Dimension menu (write each label in the user's chosen language):

DimensionLabels (examples)Add when
Type (always)🐛 bug ✨ enhancement 📚 documentation ❓ question 🙋 help wanted 🌱 good first issuealways
Priority🔴 P0 🟠 P1 🟡 P2 🟢 P3recommended
Status🚧 in progress 🧱 blocked ✅ ready to merge 🎉 merged 🚫 wontfixrecommended
Impactimpact: security impact: data-loss impact: availability …recommended; required for security-sensitive repos
Rating (PR quality)rating: 🦞 diamond lobster … themed tiersPR-quality gate exists
Issue ratingissue-rating: 🦞 diamond lobster …issue-quality gate exists (may fold into Rating)
Merge riskmerge-risk: 🚨 security-boundary merge-risk: 🚨 availability …maintainer review process exists
Sizesize: XS size: S size: M size: L size: XLlarge repo / team estimation
Area / modulearea: core area: api area: cli …multi-module project
Bug detailbug: behavior bug: crashcrash-prone / many bug reports
Governance / auto-close rulesr: spam r: support r: no-ci-pr … clawsweeper: triage:automation bot enforces close/lock/review rules
Close reasonclose: duplicate close: superseded close: invalid …close-automation bot exists
Triagetriage: bug triage: blocked triage: needs-review …triage workflow exists
Proofproof: 🎥 video proof: 📸 screenshotreproduction evidence required
Dependencies📦 dependenciesdependabot / dependency PRs
Security🔒 securitysecurity-sensitive repo
Regression↩️ regressionstable project (was-working-now-fails)
Stale🕰️ stale 🚫 no-stalestale automation exists
Teamteam: <group>explicit division of labor
Duplicate / invalid👯 duplicate 🚫 invalidactive public repo with many issues
Channelchannel: discord channel: telegram …multi-channel product (OpenClaw-style)
App / platformapp: ios app: android app: web-ui …multi-platform app
Extensions / pluginsextensions: <name> plugin: <name>plugin/extension ecosystem

Governance rules (r: / bot labels) — gated by Preflight step 6. Only consider this dimension if the user answered "yes" to automation bots / AI writers; skip it entirely otherwise. Auto-close and bot-state labels are signal labels, not categories — a bot (or Actions workflow) reads them and acts (auto-close, auto-lock, auto-fix, auto-merge). They are useless without the matching automation, so skip them unless a governance bot actually runs on the repo. If one does, add only the r: rules matching the project's real off-topic / reject criteria (e.g. r: spam, r: support, r: no-ci-pr) plus the bot's own state labels (clawsweeper:, triage:, close:). Never copy OpenClaw's set verbatim — its rules encode OpenClaw's specific product boundaries.

Impact dimension — the security "blast radius" judgement (generalized from OpenClaw; trim to the repo's actual failure modes):

LabelMeaning
impact: securitysecurity boundary, credentials, authz, sandbox, sensitive data
impact: data-lossloses/corrupts/drops user, session, or config data
impact: availabilitycrash, hang, restart loop, or process outage
impact: auth-providerauth / routing / model choice / secret resolution breaks
impact: session-statesession / memory / state drifts or corrupts (stateful systems)
impact: message-lossmessages/events lost, duplicated, or misrouted (messaging systems)
impact: ux-blockeruser blocked with no terminal/logs/support (GUI products)
impact: ux-frictionconfusing flow / support burden (GUI products)
impact: othermeaningful impact outside the owned taxonomy

Step 3 — Color rules (mandatory):

Step 4 — Rating-label docs (only if rating labels exist). Generate LABELS.md from templates/LABELS.md (or extend an existing docs file): list every rating label with its meaning and the explicit low→high order, plus the rest of the taxonomy. Commit and push it together with the labels.

Step 5 — Idempotent upsert. GitHub has no PUT /labels/{name} endpoint. Upsert = check existence (GET /labels/{name}), then POST /labels (create) or PATCH /labels/{name} (update). Works for both map-form and array-form labels.json:

R="repos/OWNER/REPO"
jq -c 'if type == "array" then .[] else to_entries[] | {name: .key} + .value end' templates/labels.json | while read -r l; do
  name=$(echo "$l" | jq -r .name); color=$(echo "$l" | jq -r .color); desc=$(echo "$l" | jq -r .description)
  enc=$(python3 -c "import urllib.parse,sys;print(urllib.parse.quote(sys.argv[1]))" "$name")
  if gh api "$R/labels/$enc" >/dev/null 2>&1; then
    gh api -X PATCH "$R/labels/$enc" -f name="$name" -f color="$color" -f description="$desc" --silent && echo "label updated: $name"
  else
    gh api -X POST "$R/labels" -f name="$name" -f color="$color" -f description="$desc" --silent && echo "label created: $name"
  fi
done

Module B — Issue forms + config

Create .github/ISSUE_TEMPLATE/ with config.yml plus one YAML form per template (bug / feature / question). Push via a commit:

mkdir -p .github/ISSUE_TEMPLATE
cp templates/issue-form-*.yml templates/config.yml .github/ISSUE_TEMPLATE/
git add .github/ISSUE_TEMPLATE && git commit -m "chore: add issue forms" && git push

Module C — PR template

mkdir -p .github
cp templates/PR_TEMPLATE.md .github/PULL_REQUEST_TEMPLATE.md
git add .github/PULL_REQUEST_TEMPLATE.md && git commit -m "chore: add PR template" && git push

Module D — CI workflow

Pick the workflow from the framework detection (templates/ci-*.yml — they trigger on $default-branch, so they work for any default branch name). Write to .github/workflows/ci.yml, commit, push. Keep existing workflows; only add ci.yml if none exists.

Module E — Branch rules

Prefer rulesets (modern) over legacy branch protection:

# list existing
gh api repos/OWNER/REPO/rulesets -q '.[].name'
# create (example: protect default branch)
gh api -X POST repos/OWNER/REPO/rulesets --input - <<'EOF'
{
  "name": "protect-default-branch",
  "target": "branch",
  "enforcement": "active",
  "conditions": {
    "ref_name": {"include": ["refs/heads/DEFAULT_BRANCH"], "exclude": []}
  },
  "rules": [
    {"type": "pull_request", "parameters": {"required_approving_review_count": 1, "dismiss_stale_reviews_on_push": true, "require_code_owner_review": false, "require_last_push_approval": true, "required_review_thread_resolution": true}},
    {"type": "required_linear_history"},
    {"type": "deletion"},
    {"type": "non_fast_forward"},
    {"type": "required_signatures"}
  ]
}
EOF

Module F — Docs

README (ask about languages FIRST):

Module G — AI assistant guides (CLAUDE.md / AGENTS.md)

Verification

gh label list --repo OWNER/REPO --limit 200 | wc -l
gh api repos/OWNER/REPO/contents/.github/ISSUE_TEMPLATE -q '.[].name' 2>/dev/null
gh api repos/OWNER/REPO/contents/.github/PULL_REQUEST_TEMPLATE.md -q .name 2>/dev/null
gh api repos/OWNER/REPO/contents/.github/workflows/ci.yml -q .name 2>/dev/null
gh api repos/OWNER/REPO/rulesets -q '.[] | {name:.name, enforcement:.enforcement}'

Report a final table: module | status (applied/skipped/failed) | note.

Template placeholders (replace on copy)

Templates stay generic — OWNER/REPO, OWNER_USERNAME, PROJECT_NAME, YYYY-MM-DD are placeholders the agent fills in when copying a template into the target repo. Unreplaced placeholders ship broken links (badges, clone URL, discussions, security advisory, CODEOWNERS handle) into the user's repo.

PlaceholderReplace with
OWNERtarget repo owner login (user or org)
REPOtarget repo name
OWNER_USERNAMEowner's default reviewer / team handle
PROJECT_NAMEproject display name
YYYY-MM-DDcurrent date

Resolve the values once up front, then substitute in every copied file (config.yml, README*.md, SECURITY.md, CODEOWNERS, AGENTS.md / CLAUDE.md, VISION.md, …):

O=OWNER R=REPO N=PROJECT_NAME D=$(date +%F)
sed -i "s|OWNER_USERNAME|$O|g; s|OWNER/REPO|$O/$R|g; s|PROJECT_NAME|$N|g; s|YYYY-MM-DD|$D|g" \
  .github/ISSUE_TEMPLATE/config.yml README.md SECURITY.md .github/CODEOWNERS AGENTS.md

Rules of thumb

Templates

All templates live in templates/: labels.json, LABELS.md, config.yml, issue-form-bug.yml, issue-form-feature.yml, issue-form-question.yml, PR_TEMPLATE.md, ci-node.yml, ci-python.yml, ci-go.yml, ci-rust.yml, CODEOWNERS, CONTRIBUTING.md, SECURITY.md, CODE_OF_CONDUCT.md, CLAUDE.md, AGENTS.md, VISION.md, CHANGELOG.md, templates/README.md, templates/README.zh.md.

同类技能
acreadiness-assessacreadiness-generate-instructionsacreadiness-policyad-campaign-analyzeradd-educational-commentsai-readyai-research-exploreai-research-reproduction
本页内容来自开源项目 github, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。