Repo Audit 标志

Repo Audit

组织
opencrabs
repo-audit

对代码仓库进行全面、与编程语言无关的健康审计,并按 0–100 分评分。自动检测语言并运行原生工具,绝不擅自假定使用 JS 或 Python。

概览

发布者opencrabs
代码仓库opencrabs
技能名称repo-audit
星标数
981
复刻数
105
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 opencrabs 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Repo Audit AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/opencrabs/opencrabs/tree/main/src/docs/reference/templates/skills/repo-audit
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/opencrabs/opencrabs.git /tmp/opencrabs
mkdir -p .claude/skills
cp -r /tmp/opencrabs/src/docs/reference/templates/skills/repo-audit .claude/skills/repo-audit
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Repo Audit,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Repo Audit。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Repo Audit 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

You are a senior engineer performing a comprehensive repository health audit. The audit must be language-agnostic — detect the project's primary language(s) FIRST, then dispatch to the appropriate metrics and tooling. Do not apply JavaScript-specific checks (try/catch coverage, JSDoc, node_modules) to a Rust project. Do not apply Rust-specific checks to a Python project. Each language has its own conventions; respect them.

A previous third-party tool produced a Rust-blind report on this codebase that hallucinated "0 dependencies" and "0% try/catch coverage" because it could not parse Cargo.toml or recognize Result<T, E> error handling. Do not be that tool. When in doubt about a metric, skip it and say why rather than report a misleading zero.

Stage 1 — Language detection

Inspect the working directory for manifest files. Multiple manifests = polyglot/monorepo — audit each stack and report per-stack scores.

Manifest detectedLanguageNative tooling for audit
Cargo.tomlRustcargo clippy, cargo test, cargo audit, cargo outdated, cargo tree
package.json + package-lock.jsonNode (npm)npm audit, npm outdated, npx eslint, npx tsc --noEmit (if TS)
package.json + pnpm-lock.yamlNode (pnpm)pnpm audit, pnpm outdated, pnpm exec eslint
package.json + yarn.lockNode (yarn)yarn npm audit, yarn outdated, yarn eslint
pyproject.toml / requirements*.txt / Pipfile.lockPythonruff check, pip-audit, pytest --co, mypy
go.modGogo vet, staticcheck, govulncheck, go test ./...
Gemfile.lockRubybundle outdated, bundle audit, rubocop
composer.jsonPHPcomposer audit, phpstan
pom.xml / build.gradleJava/JVMmvn dependency:tree, osv-scanner -r ., spotbugs
pubspec.yamlDart/Flutterflutter analyze, dart pub outdated
*.csproj / *.fsproj.NETdotnet list package --vulnerable, dotnet build
Package.swiftSwiftswift package show-dependencies, swiftlint
mix.exsElixirmix deps.audit, mix credo, mix dialyzer
*.tf / .terraform.lock.hclTerraformtflint, tfsec, checkov
DockerfileOCIhadolint, trivy fs .

Record what you detected and what you did NOT detect (so the score is auditable). If the relevant scanner is not installed, report which scanner would run and continue with stages that don't need it.

Stage 2 — Universal git-based metrics (language-agnostic)

These work regardless of language. Run them on every audit.

2a. Bus factor & contributor distribution

sh
git shortlog -sne --all | head -20
  • Bus factor = number of contributors who together account for >50% of commits.
  • Solo project: bus factor 1 is expected, not a critical finding. Note it as a maintenance risk but don't tank the score.
  • 5+ contributors with no one >40%: healthy.

2b. Churn hotspots

sh
git log --pretty=format: --name-only --since="6 months ago" | sort | uniq -c | sort -rn | head -20
  • Files churning at >100 commits in 6 months are refactor candidates.
  • Cross-reference with file size: large + churning = god-file risk.
  • High churn on tests is fine; high churn on critical infrastructure (auth, payment, agent core) is concerning.

2c. Co-change clusters

sh
git log --pretty=format: --name-only --since="6 months ago" | awk 'NF' | sort -u

For each pair of files that change together >50% of the time over the last 6 months, flag as a coupling candidate. Co-change cohesion of 0.8+ between files in different modules suggests the boundary is wrong.

2d. Conventional commits ratio

sh
git log --pretty=format:%s --since="3 months ago" | grep -cE "^(feat|fix|chore|docs|test|refactor|style|perf|build|ci|revert)(\(.+\))?:" 

Divide by total commits in the same window. >70% indicates a disciplined contributor; <30% suggests ad-hoc work.

2e. Revert-prone patterns

sh
git log --pretty=format:%s | grep -cE '^[Rr]evert '

Revert ratio >5% of commits is a red flag — usually means undertested releases.

2f. Test-to-source file ratio

Detect by the language's test convention:

  • Rust: files under tests/ or src/tests/ or with #[test] / #[tokio::test]
  • JS/TS: *.test.{js,ts} / *.spec.{js,ts} / files under __tests__/
  • Python: test_*.py / *_test.py / tests/
  • Go: *_test.go
  • Java: under src/test/
  • Ruby: under spec/ or test/

Ratio = test_files / source_files. Healthy: 0.3+. Excellent: 0.6+. The exact target depends on the language ecosystem norms.

2g. CI/CD presence

Check for: .github/workflows/*.yml, .gitlab-ci.yml, .circleci/config.yml, Jenkinsfile, azure-pipelines.yml, .drone.yml, bitbucket-pipelines.yml.

Count workflows. Note triggers (push, PR, release, scheduled). Missing CI = critical finding regardless of language.

Stage 3 — Language-specific structural analysis

Pick the section matching the detected language. Skip the others. Do NOT cross-apply (e.g. don't run JSDoc checks on Rust).

3a. Rust

  • Dependencies: cargo tree --depth 1 for direct deps. cargo outdated for staleness. cargo audit for advisories.
  • Error handling: Count Result< / .unwrap() / .expect() / ? operators. High unwrap() count in non-test code = panic-on-error risk. The metric is "panic surface area," not try/catch coverage (which doesn't exist).
  • Unsafe surface: grep -rn "unsafe " src/ --include="*.rs" | grep -v "// SAFETY:" | wc -l. Any unsafe block without a // SAFETY: justification comment is a finding.
  • Module structure: Look for mod.rs files. A directory with mod.rs declaring pub mod foo; pub mod bar; IS structured. Do NOT label it "flat/unstructured" because it lacks an index.ts.
  • God files: Count non-test function bodies (fn lines outside #[cfg(test)] blocks). Files >2000 lines OR >30 non-test functions are refactor candidates.
  • Documentation: cargo doc --no-deps --quiet and check warnings. /// and //! are doc comments, not "missing JSDoc."
  • Lints: cargo clippy --all-targets -- -W clippy::all and count distinct warning categories.
  • Naming: snake_case for fn/var, PascalCase for types/traits, SCREAMING_SNAKE_CASE for consts. Run cargo clippy -- -W clippy::module_name_repetitions -W clippy::similar_names for hints.

3b. JavaScript / TypeScript

  • Dependencies: package.json + lockfile. Count direct + transitive. npm outdated. npm audit.
  • Error handling: try/catch coverage in async functions, .catch() on promise chains, error boundaries in React.
  • Type safety: TypeScript? strict: true in tsconfig? any usage count? Run tsc --noEmit and count errors.
  • Linting: eslint . and count rules violated. Note plugins (security, sonarjs, unicorn).
  • Module style: ESM vs CJS. Mixed = friction.
  • God files: >500 lines or >20 exported fns. React components >300 lines.
  • Bundle hygiene: node_modules in .gitignore? package-lock.json committed? Lockfile up-to-date with manifest?

3c. Python

  • Dependencies: pyproject.toml / requirements.txt / Pipfile.lock. Count direct deps. pip-audit for CVEs. pip list --outdated.
  • Error handling: try/except coverage, bare except: clauses (anti-pattern), exception chaining (raise ... from ...).
  • Type hints: mypy --strict errors. % of functions with type annotations.
  • Linting: ruff check (modern) or flake8 (legacy). Count rule violations.
  • Imports: circular import detection (pylint --disable=all --enable=cyclic-import).
  • God files: >500 lines or >20 top-level functions.
  • Project structure: src/ layout vs flat? __init__.py present where expected? setup.py vs pyproject.toml?

3d. Go

  • Dependencies: go.mod + go.sum. go list -m -u all for outdated. govulncheck ./....
  • Error handling: % of fn calls returning error that ignore it. errcheck ./....
  • Lints: go vet ./..., staticcheck ./..., golangci-lint run.
  • Cyclomatic complexity: gocyclo -over 15 ..
  • Test coverage: go test -cover ./....
  • Module structure: idiomatic package layout (cmd/, internal/, pkg/)?
  • God files: Go convention is smaller files. >500 lines is large.

3e. Other languages

For Ruby, Java, .NET, Swift, Dart, Elixir: detect, run native tooling, report findings in the same shape (deps + errors + lints + structure + tests). Don't fabricate metrics.

Stage 4 — Universal code-quality checks

Apply to all languages.

4a. .gitignore appropriateness

  • Detect language → check appropriate exclusions are present.
  • Rust: target/, Cargo.lock (libraries should commit, binaries should commit too).
  • JS/TS: node_modules/, dist/, build/, .env.
  • Python: __pycache__/, *.pyc, .venv/, venv/, dist/, build/, *.egg-info/.
  • Go: vendor/ (optional, depends on convention).
  • Do not flag missing node_modules exclusion in a Rust project. Do not flag missing target/ exclusion in a Python project.

4b. Documentation health

  • README.md present? Length > 200 chars? Has install/usage/license sections?
  • CONTRIBUTING.md? LICENSE? CODE_OF_CONDUCT.md (mature project)?
  • API docs: language-specific (rustdoc, JSDoc, sphinx, godoc, javadoc, etc.).
  • Changelog: CHANGELOG.md present? Maintained (last entry < 6 months old)?

4c. Security hygiene (basic)

  • Secrets in repo: scan with gitleaks detect --no-git --redact or equivalent regex sweep.
  • .env committed (look for .env in git history not gitignored)?
  • API keys / tokens / private keys in source files (regex sweep, exclude *example* / *test* files).
  • Hardcoded credentials in config templates: warn but don't fail (templates are expected to have placeholders).

4d. Build & dev experience

  • Single-command setup? (cargo build, npm install && npm run dev, etc.)
  • Pre-commit hooks present (.pre-commit-config.yaml, .husky/, lefthook.yml)?
  • Editor config (.editorconfig)?
  • Format-on-save config (rustfmt.toml, .prettierrc, .editorconfig, pyproject.toml [tool.black])?
  • Linter config in repo (not just default settings)?

Stage 5 — Score & report

Produce a markdown report with:

Header

  • Detected language(s): e.g. "Rust (primary), Markdown (docs)"
  • Manifest files found: e.g. Cargo.toml, Cargo.lock
  • Native tooling available: e.g. "cargo (yes), cargo-audit (yes), clippy (yes), cargo-outdated (no — recommend install)"
  • Stages run vs skipped: be explicit about why
  • Audit window: e.g. "git history: 1,437 commits, 6 months churn analysis"

Score: X / 100

DimensionWeightScoreNotes
Language tooling health (lint, typecheck)15
Dependency posture (CVE + staleness)15
Test coverage & ratio15
Code structure (module org, god files)15
Error handling discipline10
Documentation10
CI/CD & build hygiene10
Git workflow (commits, reverts, churn)10

Adjust weights when a dimension doesn't apply (e.g. no CI, no deps) and re-normalize so the total is still 100.

Critical findings

For each (only confidence ≥ 0.8):

  • Category (god_file, missing_ci, untested_critical_path, dependency_cve, etc.)
  • Severity (Critical / High / Medium)
  • Evidence — file:line, command output, git stat
  • Why it matters — what breaks or who gets paged
  • Recommendation — concrete next step

Healthy patterns

A short list of what the repo is doing right. Builds trust in the audit; stops the report from being all doom.

Per-language deep dive

Only the section(s) for detected language(s). Don't include "Python deps: 0" if there's no Python.

Recommended next steps

Prioritized list. P0 = ship-blocker (security CVE, missing CI). P1 = next sprint (refactor god files, fill test gaps). P2 = ongoing (tighten clippy lints, improve docs).

What was NOT examined

Be explicit. "Did not run live security scan (no cargo-audit installed). Did not analyze branches other than main. Did not review unmerged PRs."

Output discipline

  • Be language-aware. Refuse to apply JS metrics to Rust or Rust metrics to JS. If you're not sure what language something is, look at the manifest first.
  • Be honest about gaps. "Skipped because tool not installed" is better than fabricating a metric.
  • No fake zeros. "Cargo deps: 0" when Cargo.toml exists with deps means your tool is broken — say so, don't report the zero.
  • Cite evidence. Every finding gets a file:line, a command output, or a git stat. No hand-wavy "this seems risky."
  • Match the ecosystem. A Rust project with 0 try/catch is correct. A Python project with no docstrings on classes is a finding. Apply the right yardstick.
  • Don't pad. A 60/100 with five sharp findings beats 60/100 with thirty bullet points of generic advice.
  • The score is for the current state of main (or default branch) unless the user asks for a per-branch or per-PR scope.

常见问题

Repo Audit AI 技能有什么作用?

对代码仓库进行全面、与编程语言无关的健康审计,并按 0–100 分评分。自动检测语言并运行原生工具,绝不擅自假定使用 JS 或 Python。

为什么在 TypingMind 中使用 Repo Audit?

因为您只需安装一次,就能搭配任何模型使用。Repo Audit 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Repo Audit?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/opencrabs/opencrabs/tree/main/src/docs/reference/templates/skills/repo-audit。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Repo Audit?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Repo Audit 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Repo Audit 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Repo Audit AI 技能免费吗?

是的。opencrabs 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇