Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

repo-hygiene回购卫生

Agent Skill

repo-hygiene 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

259

周安装

11

GitHub Stars

4

下载量

91
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:repo-hygiene(回购卫生)
来源仓库:https://github.com/marcfargas/skills
仓库路径:skills/repo-hygiene
安装命令:
npx skills add https://github.com/marcfargas/skills --skill repo-hygiene
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/marcfargas/skills --skill repo-hygiene

简介

repo-hygiene 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 它通过分析仓库结构和内容,帮助 Agent 理解项目上下文并提取关键信息。
  • 可通过 npx skills add 命令从指定 GitHub 仓库安装,具体用法请参考原始 README。
  • 安装前建议确认权限范围和维护状态,注意是否触发联网或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

repo-hygiene — Repository Health Check

A structured, periodic health check for repositories. Run anytime to detect drift, accumulation of tech debt, and configuration issues before they become problems.

Not a release gate. For pre-release checks, use the pre-release skill instead. This skill is for ongoing maintenance — run it weekly, after major refactors, when onboarding to a repo, or whenever things feel "off".

When to Use

  • Onboarding to a new (or forgotten) repo — "what shape is this in?"
  • Weekly/monthly maintenance sweep
  • After a large refactor or dependency upgrade
  • Before starting a new feature sprint
  • When CI starts failing mysteriously
  • After a team member leaves and you inherit their repo

Supported Stacks

StackPackage managerDetected by
Node.js / TypeScriptnpmpackage.json + package-lock.json
Pythonuv / pippyproject.toml or requirements.txt
Gogo modulesgo.mod

Detect the stack from the project root. Multiple stacks in one repo is fine — run applicable checks for each. If the stack isn't listed, skip stack-specific checks and run the universal ones (git, CI, docs, security).

The Workflow

Step 0: Detect Project

# What are we working with?
ls package.json pyproject.toml go.mod 2>/dev/null
git rev-parse --show-toplevel

Determine: stack(s), git remote, default branch, CI system (GitHub Actions, GitLab CI, etc.).

Step 1: Dependency Health

Node.js / npm

#CheckCommandSeverity
D1Known vulnerabilitiesnpm audit --json🔴 critical/high = Fix Now, moderate = Fix Soon
D2Outdated dependenciesnpm outdated --json🟡 major bumps = Fix Soon, minor/patch = Info
D3Unused dependenciesnpx depcheck --json🟡 Fix Soon
D4Phantom dependencies (used but undeclared)npx depcheck --jsonmissing🔴 Fix Now
D5Lockfile freshnessSee below🟡 Fix Soon
D6Duplicate dependencies`npm ls --all --json 2>/dev/null \grep -c '"deduped"'`ℹ️ Info

D5 — Lockfile freshness check:

# package.json changed more recently than lockfile?
LOCK_DATE=$(git log -1 --format=%ct -- package-lock.json 2>/dev/null || echo 0)
PKG_DATE=$(git log -1 --format=%ct -- package.json 2>/dev/null || echo 0)
if [ "$PKG_DATE" -gt "$LOCK_DATE" ]; then
  echo "⚠️ package.json modified after lockfile — run npm install"
fi

How to fix:

  • D1: npm audit fix for compatible fixes; npm audit fix --force for breaking (review changes). For stubborn advisories: check if the vuln is reachable, or override in package.json overrides.
  • D2: npm update for minor/patch; npm install <pkg>@latest for major (check changelogs).
  • D3: npm uninstall <pkg> for each unused dep.
  • D4: npm install <pkg> for each missing dep.
  • D5: npm install to regenerate lockfile, commit it.
  • D6: npm dedupe then verify tests pass.

Python (uv / pip)

#CheckCommandSeverity
D1Known vulnerabilitiespip-audit --format=json🔴 Fix Now
D2Outdated dependenciesuv pip list --outdated or pip list --outdated --format=json🟡 Fix Soon
D3Unused dependenciesdeptry. --json (if available)🟡 Fix Soon
D5Lockfile freshnessCompare uv.lock vs pyproject.toml timestamps🟡 Fix Soon

How to fix:

  • D1: uv pip install --upgrade <pkg> for each vulnerable package. Check advisories for minimum safe version.
  • D2: uv pip install --upgrade <pkg> per package, or uv lock --upgrade for all.
  • D3: Remove from [project.dependencies] in pyproject.toml, then uv sync.
  • D5: uv lock && uv sync.

Go

#CheckCommandSeverity
D1Known vulnerabilitiesgovulncheck./...🔴 Fix Now
D2Outdated dependenciesgo list -m -u all🟡 Fix Soon
D3Unused dependenciesgo mod tidy -v (reports removed)🟡 Fix Soon

How to fix:

  • D1: go get <module>@latest for vulnerable deps, then go mod tidy.
  • D2: go get -u./... for all, or go get <module>@latest selectively.
  • D3: go mod tidy removes unused; commit go.mod and go.sum.

Step 2: Git Hygiene

#CheckCommandSeverity
G1Stale local branches (merged)`git branch --merged main \grep -v '^\*\main\develop'`🟡 Fix Soon
G2Stale remote branches (merged)`git branch -r --merged origin/main \grep -v 'HEAD\main\develop'`🟡 Fix Soon
G3Large files in repoSee below🟡 Fix Soon (🔴 if >10MB)
G4.gitignore completenessSee below🟡 Fix Soon
G5Untracked files that should be ignored`git status --porcelain \grep '^??'` — look for build artifacts, IDE files, env filesℹ️ Info
G6Uncommitted changesgit status --porcelainℹ️ Info

G3 — Large files check:

# Top 10 largest tracked files
git ls-files -z | xargs -0 -I{} git log --diff-filter=A --format='%H' -1 -- '{}' | head -20
# Simpler: just check current tree
git ls-files -z | xargs -0 du -sh 2>/dev/null | sort -rh | head -10

G4 —.gitignore completeness:

Must include (per stack):

  • Universal: .env, .env.*, *.local, .DS_Store, Thumbs.db, *.swp, .idea/, .vscode/ (or be deliberate about tracking it)
  • Node: node_modules/, dist/, build/, coverage/, .turbo/, .next/
  • Python: __pycache__/, *.pyc, .venv/, venv/, .mypy_cache/, .pytest_cache/, *.egg-info/
  • Go: binary name (check go build -o), vendor/ (if not vendoring)

How to fix:

  • G1: git branch -d <branch> for each merged local branch.
  • G2: git push origin --delete <branch> for each merged remote branch. Be careful — confirm with team.
  • G3: For files that shouldn't be tracked: add to .gitignore, git rm --cached <file>. For files already in history: git filter-repo or BFG Repo-Cleaner (destructive — confirm first).
  • G4: Add missing patterns to .gitignore. Use a generator like gitignore.io as a starting point.
  • G5: Either add to .gitignore or git add if they should be tracked.

Step 3: CI/CD Health

Skip if no CI configuration found.

#CheckCommandSeverity
C1Workflow files existls.github/workflows/*.yml 2>/dev/nullℹ️ Info
C2Actions pinned by SHAgrep -rE 'uses: [^@]+@v[0-9]'.github/workflows/ — should return nothing🟡 Fix Soon
C3Least-privilege permissionsScan for permissions: blocks; flag write-all or missing job-level perms🟡 Fix Soon
C4No secret leaks in workflowsCheck for echo ${{secrets.*}}, secret in $GITHUB_OUTPUT/$GITHUB_ENV🔴 Fix Now
C5Deprecated actionsCheck for known deprecated: actions/create-release@v1, set-output commands, ::set-env🟡 Fix Soon
C6Node/Python version matches projectCompare workflow matrix with engines, .nvmrc, pyproject.toml [requires-python]🟡 Fix Soon

How to fix:

  • C2: Replace uses: actions/checkout@v4 with uses: actions/checkout@<full-sha>. Find SHA: gh api repos/actions/checkout/git/ref/tags/v4 --jq.object.sha or check the releases page.
  • C3: Add explicit permissions: at job level. Start with contents: read and add only what's needed.
  • C4: Remove secret interpolation. Use environment: blocks or write to files with masking.
  • C5: Replace deprecated actions with current equivalents. set-output$GITHUB_OUTPUT file.
  • C6: Align versions. Use .nvmrc or engines as the source of truth.

Step 4: Code Quality Drift

#CheckCommandSeverity
Q1TODO/FIXME/HACK count`git grep -ciE '(TODO\FIXME\HACK)' -- '*.ts' '*.js' '*.py' '*.go' ':!node_modules' ':!vendor' ':!.venv'`ℹ️ Info (🟡 if >20)
Q2console.log in src (JS/TS)git grep -c 'console\.log' -- 'src/**/*.ts' 'src/**/*.js' ':!*.test.*' ':!*.spec.*'🟡 Fix Soon
Q3Disabled/skipped tests`git grep -cE '(it\.skip\test\.skip\describe\.skip\xit\xdescribe\@pytest\.mark\.skip\t\.Skip)' -- '*.test.*' '*.spec.*' '*_test.*' '*_test.go'`🟡 Fix Soon
Q4Lint passesnpm run lint / ruff check. / golangci-lint run🟡 Fix Soon
Q5Tests passnpm test / pytest / go test./...🔴 Fix Now
Q6Build succeedsnpm run build / uv build / go build./...🔴 Fix Now
Q7Type errors (TS)npx tsc --noEmit🟡 Fix Soon
Q8Dead exports (TS)`npx ts-prune 2>/dev/null \grep -v '(used in module)'`ℹ️ Info

How to fix:

  • Q1: Triage each TODO — either do it, create an issue/task for it, or remove it if obsolete.
  • Q2: Replace with a proper logger, or remove debug logging. grep -rn 'console.log' src/ to find them.
  • Q3: Either fix the underlying issue and un-skip, or delete the test if the feature was removed.
  • Q4–Q7: Fix the errors. Run the tool, address each issue.
  • Q8: Remove unused exports, or add // ts-prune-ignore-next if they're part of the public API.

Step 5: Documentation Freshness

#CheckCommandSeverity
F1README.md existsFile check🔴 Fix Now
F2README freshness vs. sourceCompare git log -1 --format=%cr -- README.md vs git log -1 --format=%cr -- src/🟡 if src is >30 days newer
F3CHANGELOG existsFile check🟡 Fix Soon (for published packages)
F4Broken internal linksSee below🟡 Fix Soon
F5LICENSE file presentFile check🔴 Fix Now
F6LICENSE matches package metadataCompare LICENSE text with package.json license / pyproject.toml license🟡 Fix Soon
F7AGENTS.md references valid pathsIf .pi/AGENTS.md exists, check that referenced files/dirs exist🟡 Fix Soon

F4 — Broken link check:

# Find markdown links and verify targets exist
grep -roE '\[([^]]+)\]\(([^)]+)\)' *.md docs/**/*.md 2>/dev/null | \
  grep -v 'http' | \
  while IFS= read -r line; do
    # Extract path from markdown link
    path=$(echo "$line" | sed 's/.*](\([^)]*\)).*/\1/' | sed 's/#.*//')
    if [ -n "$path" ] && [ ! -e "$path" ]; then
      echo "BROKEN: $line"
    fi
  done

How to fix:

  • F1: Write a README with: what it does, how to install, how to use, prerequisites, license.
  • F2: Review README against current code — update examples, API docs, feature lists.
  • F3: Add a CHANGELOG.md. Consider @changesets/cli for automated generation (see pre-release skill).
  • F4: Update or remove broken links.
  • F5: Add a LICENSE file. Use choosealicense.com if unsure.
  • F6: Make LICENSE file and metadata agree.
  • F7: Update AGENTS.md to reflect current project structure.

Step 6: Configuration Consistency

#CheckHowSeverity
X1EditorConfig present.editorconfig existsℹ️ Info
X2Strict mode (TS)tsconfig.json"strict": true🟡 Fix Soon
X3Formatter configured.prettierrc / ruff.toml / gofmt (built-in)🟡 Fix Soon
X4Linter configured.eslintrc* or eslint.config.* / ruff.toml / golangci-lint config🟡 Fix Soon
X5Engine constraints match CIpackage.json engines vs CI matrix; pyproject.toml requires-python vs CI🟡 Fix Soon
X6.nvmrc / .python-version matchesCompare with engines / requires-python / CI configℹ️ Info

How to fix:

  • X1: Add .editorconfig. Minimal: root = true, [*] block with indent_style, indent_size, end_of_line, insert_final_newline.
  • X2: Set "strict": true in tsconfig.json. Fix resulting type errors (usually worth it).
  • X3–X4: Add config files. Use the project's existing style as a baseline.
  • X5–X6: Pick one source of truth (recommend engines / requires-python) and align everything else.

Step 7: Security Posture

Lightweight security checks for ongoing hygiene. For the full pre-release security audit (gitleaks, trufflehog, workflow audit), use the pre-release skill.

#CheckCommandSeverity
S1No tracked .env or .local filesgit ls-files '*.env' '*.env.*' '*.local' '*.local.*' '.env' '.env.local'🔴 Fix Now
S2.env.example exists (if .env in .gitignore)File check🟡 Fix Soon
S3No hardcoded secrets in source`git grep -iE '(api[_-]?key\secret\password\token)\s*[:=]\s*["\x27][^"\x27]{8,}' -- ':!*.lock' ':!node_modules' ':!*.example' ':!*.sample'`🔴 Fix Now
S4Secrets scanning config present.gitleaks.toml or pre-commit hooksℹ️ Info
S5No broad file permissionsCheck for chmod 777 or 0777 in scripts🔴 Fix Now

How to fix:

  • S1: git rm --cached <file>, add to .gitignore, commit. If the file contained real secrets, rotate them immediately — they're in git history.
  • S2: Create .env.example with placeholder values (<REPLACE_ME>) for every var in .env.
  • S3: Move secrets to env vars or a secrets manager. Replace in code with process.env.VAR / os.environ["VAR"].
  • S4: Add .gitleaks.toml (even a minimal one enables CI scanning). Or add gitleaks to pre-commit hooks.
  • S5: Use least-privilege permissions (644 for files, 755 for executables).

Step 8: Project Metadata

#CheckHowSeverity
M1Required package fieldsname, version, description, license in package.json / pyproject.toml🟡 Fix Soon
M2Repository URL setrepository field in package metadata🟡 Fix Soon
M3Keywords presentkeywords arrayℹ️ Info
M4FUNDING.yml (public repos).github/FUNDING.yml existsℹ️ Info
M5Pi package complianceIf ships skills/extensions: pi-package keyword, pi manifest, files includes skill dirs🟡 Fix Soon (if applicable)

How to fix:

  • M1–M3: Add the missing fields to package.json or pyproject.toml.
  • M4: Create .github/FUNDING.yml with github: <username>.
  • M5: See pi package docs for required fields.

Baseline Tracking

Save a baseline after each run to detect drift over time. Store at .pi/hygiene-baseline.json:

{
  "timestamp": "2026-02-14T23:00:00Z",
  "stack": ["node"],
  "scores": {
    "dependencies": { "status": "healthy", "vulns": 0, "outdated": 3, "unused": 0 },
    "git": { "status": "healthy", "stale_branches": 0, "large_files": 0 },
    "ci": { "status": "warning", "unpinned_actions": 2, "permission_issues": 0 },
    "quality": { "status": "healthy", "todos": 5, "skipped_tests": 0, "lint_clean": true },
    "docs": { "status": "warning", "readme_stale_days": 45, "broken_links": 1 },
    "config": { "status": "healthy", "strict_ts": true, "formatter": true, "linter": true },
    "security": { "status": "healthy", "tracked_env": 0, "hardcoded_secrets": 0 },
    "metadata": { "status": "healthy", "complete": true }
  },
  "overall": "7/10"
}

On subsequent runs, compare with baseline and flag regressions:

📉 Dependencies: 0 → 3 vulnerabilities (regression since last check)
📈 Quality: 15 → 5 TODOs (improvement!)
→  CI: unchanged — 2 unpinned actions remain

When the user approves the report, offer to update the baseline.


Report Format

Present the final report as a health scorecard:

# Repo Health: <project-name>
## Score: 7/10 — GOOD
## Stack: Node.js + TypeScript
## Last check: 2026-01-15 (30 days ago) | Baseline: 6/10 📈

### 🔴 Fix Now (2)
| # | Category | Issue | Fix |
|---|----------|-------|-----|
| S1 | Security | `.env.local` tracked in git | `git rm --cached .env.local` |
| D1 | Deps | 2 high-severity npm audit findings | `npm audit fix` |

### 🟡 Fix Soon (4)
| # | Category | Issue | Fix |
|---|----------|-------|-----|
| D2 | Deps | 8 outdated packages (2 major) | `npm outdated` → upgrade |
| C2 | CI | 3 actions not pinned by SHA | Pin to commit SHA |
| F2 | Docs | README 45 days behind source | Review and update |
| Q3 | Quality | 2 skipped tests | Fix or remove |

### 🟢 Healthy (12)
- ✅ Dependencies: no unused, no phantom, lockfile fresh
- ✅ Git: clean tree, no stale branches, no large files
- ✅ Code: lint clean, build passes, tests pass, strict TS
- ✅ Config: EditorConfig, Prettier, ESLint all configured
- ✅ Security: no tracked secrets, .env.example present
- ✅ Metadata: all fields present, license matches

### 📊 Trends (vs. baseline 2026-01-15)
| Category | Then | Now | Trend |
|----------|------|-----|-------|
| Vulnerabilities | 0 | 2 | 📉 |
| Outdated deps | 5 | 8 | 📉 |
| TODOs | 15 | 8 | 📈 |
| Skipped tests | 0 | 2 | 📉 |

### Recommendations
1. **Immediate**: Fix the 2 security/vulnerability items above
2. **This week**: Pin CI actions and update stale README
3. **Ongoing**: Address skipped tests and outdated deps in next sprint

Use your project's task tracking to schedule these items.

Scoring

Calculate the score from check results:

ResultPoints deducted
Each 🔴 Fix Now−1.5
Each 🟡 Fix Soon−0.5
ℹ️ Info0

Start at 10, apply deductions, floor at 0. Round to nearest integer.

ScoreLabel
9–10🟢 EXCELLENT
7–8🟢 GOOD
5–6🟡 FAIR
3–4🟠 NEEDS WORK
0–2🔴 POOR

Auto-Fix Offers

After presenting the report, offer to fix issues that are safe and mechanical. Always present what will be done and get confirmation before executing.

Safe to offer (low risk, reversible)

  • Delete merged local branches (git branch -d)
  • Run npm audit fix (compatible fixes only, not --force)
  • Run npm dedupe / go mod tidy
  • Add missing .gitignore patterns
  • Add .editorconfig from template
  • Remove console.log from source files
  • Create .env.example from .env (with values replaced by <REPLACE_ME>)
  • Add missing package.json fields (description, repository, keywords)
  • Create .github/FUNDING.yml

Offer with warning (confirm carefully)

  • Delete merged remote branches (git push origin --delete)
  • Run npm audit fix --force (may have breaking changes)
  • Major dependency upgrades
  • Enable TypeScript strict mode (may produce many errors)
  • Update CI action pinning (must verify correct SHAs)

Never auto-fix (explain, let user decide)

  • Removing tracked .env files (may need secret rotation)
  • Rewriting git history (BFG / filter-repo)
  • Changing license files
  • Modifying CI permissions model
  • Removing hardcoded secrets (need to determine replacement strategy)

Tips

  • Run early, run often. A monthly cadence catches drift before it compounds.
  • Don't try to fix everything at once. Focus on 🔴 items first, batch 🟡 items into a maintenance sprint.
  • Baseline tracking is your friend. Even if the score isn't perfect, trending upward means you're winning.
  • Pair with pre-release. Run repo-hygiene for ongoing health, pre-release when you're ready to ship. They complement each other — hygiene keeps the baseline high so pre-release has fewer surprises.
  • New repos start clean. Run this right after git init to establish a perfect baseline. It's easier to maintain 10/10 than to recover from 4/10.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.51%
按下载量换算30

Claude

32.38%
按下载量换算29

Cursor

19.9%
按下载量换算18

Gemini CLI

8.76%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

未通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills