Communitygithub.com

repo-scan

引导性指针,用于安装来自固定可审查提交的外部 repo-scan 技能。在需要安装 repo-scan 以运行其跨栈源代码资产审计时使用;此 ECC 指针本身不执行审计。

repo-scan 是什么?

repo-scan 是一款跨堆栈源代码分析工具,能够在 C++、Android、iOS 和 Web 项目中统一识别代码归属——区分项目自有代码、第三方嵌入代码和构建产物。它支持 50 多种常用库的自动检测与版本提取,并为每个模块提供四种级别的判定建议(核心资产/提取合并/重新构建/弃用),帮助大型代码库接管、重构前评估和第三方依赖审计。安装通过固定提交的 git 克隆与可审查流程完成,确保安全性,之后用户可运行不同深度级别(快速/标准/深度/全量)的分析并生成交互式 HTML 报告。该技能已集成到 Claude Code、Cursor 等主流 AI 代理平台,适用于 monorepo 架构和多语言混合项目的资产盘点。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/repo-scan

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

repo-scan 是做什么的?

每个生态系统都有自己的依赖管理器,但没有任何工具能够跨 C++、Android、iOS 和 Web 告诉你:真正属于你的代码有多少,哪些是第三方的,哪些是多余的负担。

何时使用

  • 接手大型遗留代码库,需要结构概览
  • 在进行重大重构之前——识别核心代码、重复代码和无用代码
  • 审计直接嵌入在源码中的第三方依赖(而非在包管理器中声明)
  • 为单体仓库重组准备架构决策记录

安装

# 先克隆,以便在安装前审查固定的提交
set -euo pipefail

REPO_SCAN_COMMIT=2742664ebcad1450c208eda0ae45d3c17fad5dd8
REPO_SCAN_INSTALL_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills/repo-scan"
REPO_SCAN_INSTALL_PARENT="$(dirname "$REPO_SCAN_INSTALL_DIR")"
mkdir -p "$REPO_SCAN_INSTALL_PARENT"
REPO_SCAN_TMP="$(mktemp -d "$REPO_SCAN_INSTALL_PARENT/.repo-scan-install.XXXXXX")"
REPO_SCAN_TOKEN="${REPO_SCAN_TMP##*.}"
REPO_SCAN_STAGE="$REPO_SCAN_TMP/stage-$REPO_SCAN_TOKEN"
REPO_SCAN_BACKUP="$REPO_SCAN_TMP/backup-$REPO_SCAN_TOKEN"
REPO_SCAN_LOCK="$REPO_SCAN_INSTALL_PARENT/.repo-scan-install.lock"
REPO_SCAN_KEEP_TMP=0
REPO_SCAN_LOCK_HELD=0
REPO_SCAN_MV_HAS_NO_TARGET=0
cleanup_repo_scan_install() {
  if [ "$REPO_SCAN_KEEP_TMP" -eq 0 ]; then
    rm -rf -- "$REPO_SCAN_TMP"
  fi
  if [ "$REPO_SCAN_LOCK_HELD" -eq 1 ] && ! rmdir -- "$REPO_SCAN_LOCK"; then
    printf '无法释放安装锁 %s\n' "$REPO_SCAN_LOCK" >&2
  fi
}
trap cleanup_repo_scan_install EXIT
mkdir "$REPO_SCAN_TMP/mv-probe-source"
if mv -T -- "$REPO_SCAN_TMP/mv-probe-source" \
  "$REPO_SCAN_TMP/mv-probe-destination" 2>/dev/null; then
  REPO_SCAN_MV_HAS_NO_TARGET=1
  rmdir "$REPO_SCAN_TMP/mv-probe-destination"
else
  rmdir "$REPO_SCAN_TMP/mv-probe-source"
fi
move_repo_scan_dir() {
  REPO_SCAN_MOVE_SOURCE=$1
  REPO_SCAN_MOVE_DESTINATION=$2
  REPO_SCAN_MOVE_NAME=${REPO_SCAN_MOVE_SOURCE##*/}
  if [ -e "$REPO_SCAN_MOVE_DESTINATION" ] || [ -L "$REPO_SCAN_MOVE_DESTINATION" ]; then
    return 1
  fi
  if [ "$REPO_SCAN_MV_HAS_NO_TARGET" -eq 1 ]; then
    mv -T -- "$REPO_SCAN_MOVE_SOURCE" "$REPO_SCAN_MOVE_DESTINATION"
    return
  fi
  if ! mv -- "$REPO_SCAN_MOVE_SOURCE" "$REPO_SCAN_MOVE_DESTINATION"; then
    return 1
  fi
  if [ -e "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" ] || \
    [ -L "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" ]; then
    if ! mv -- "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" \
      "$REPO_SCAN_MOVE_SOURCE"; then
      REPO_SCAN_KEEP_TMP=1
      printf '移动冲突恢复失败;暂存数据仍保留在 %s\n' \
        "$REPO_SCAN_MOVE_DESTINATION/$REPO_SCAN_MOVE_NAME" >&2
    fi
    return 1
  fi
}

git clone --filter=blob:none --no-checkout \
  https://github.com/haibindev/repo-scan.git "$REPO_SCAN_TMP/source"
git -C "$REPO_SCAN_TMP/source" checkout --detach "$REPO_SCAN_COMMIT"
mkdir -p "$REPO_SCAN_STAGE"
git -C "$REPO_SCAN_TMP/source" archive "$REPO_SCAN_COMMIT" | \
  tar -xf - -C "$REPO_SCAN_STAGE"

# 在批准安装前审查 "$REPO_SCAN_TMP/source"。
printf '输入 install 以在审查固定源后替换 %s:' \
  "$REPO_SCAN_INSTALL_DIR" >&2
read -r REPO_SCAN_CONFIRM
if [ "$REPO_SCAN_CONFIRM" != install ]; then
  printf '安装已取消。\n' >&2
  exit 1
fi
if ! mkdir -- "$REPO_SCAN_LOCK" 2>/dev/null; then
  printf '另一个 repo-scan 安装持有锁 %s\n' \
    "$REPO_SCAN_LOCK" >&2
  exit 1
fi
REPO_SCAN_LOCK_HELD=1

if [ -e "$REPO_SCAN_INSTALL_DIR" ] || [ -L "$REPO_SCAN_INSTALL_DIR" ]; then
  move_repo_scan_dir "$REPO_SCAN_INSTALL_DIR" "$REPO_SCAN_BACKUP"
fi
if ! move_repo_scan_dir "$REPO_SCAN_STAGE" "$REPO_SCAN_INSTALL_DIR"; then
  if [ -e "$REPO_SCAN_BACKUP" ] || [ -L "$REPO_SCAN_BACKUP" ]; then
    if [ -e "$REPO_SCAN_INSTALL_DIR" ] || [ -L "$REPO_SCAN_INSTALL_DIR" ]; then
      REPO_SCAN_KEEP_TMP=1
      printf '替换失败且目标已重新创建;之前的安装保留在 %s\n' \
        "$REPO_SCAN_BACKUP" >&2
    elif ! move_repo_scan_dir "$REPO_SCAN_BACKUP" "$REPO_SCAN_INSTALL_DIR"; then
      REPO_SCAN_KEEP_TMP=1
      printf '替换和回滚均失败;之前的安装保留在 %s\n' \
        "$REPO_SCAN_BACKUP" >&2
    fi
  fi
  exit 1
fi

在安装任何代理技能之前,请审查源代码。

安装仅完成引导。重新加载您的代理框架,然后再次调用 repo-scan。此 ECC 指针安装外部技能,但本身不执行扫描。

核心能力

能力描述
跨栈扫描单次扫描支持 C/C++、Java/Android、iOS(OC/Swift)、Web(TS/JS/Vue)
文件分类每个文件标记为项目代码、第三方代码或构建产物
库检测检测 50 多种已知库(FFmpeg、Boost、OpenSSL…)并提取版本
四级判定核心资产 / 提取合并 / 重新构建 / 弃用
HTML 报告交互式深色主题页面,支持钻取导航
单体仓库支持分层扫描,提供摘要 + 子项目报告

分析深度级别

级别读取文件数用例
fast每个模块 1-2 个大型目录的快速盘点
standard每个模块 2-5 个默认审计,包含完整的依赖和架构检查
deep每个模块 5-10 个增加线程安全、内存管理、API 一致性检查
full所有文件合并前的全面审查

工作原理

  1. 分类代码库表面:枚举文件,然后将每个文件标记为项目代码、嵌入的第三方代码或构建产物。
  2. 检测嵌入的库:检查目录名称、头文件、许可证文件和版本标记,以识别捆绑的依赖项及其可能版本。
  3. 为每个模块评分:将文件按模块或子系统分组,然后根据所有权、重复和维护成本分配四种判定之一。
  4. 突出结构风险:指出无用的构建产物、重复的包装器、过时的供应商代码以及应提取、重建或弃用的模块。
  5. 生成报告:返回简洁的摘要以及交互式 HTML 输出,支持每个模块的钻取,以便异步审查审计结果。

示例

在一个包含 50,000 个文件的 C++ 单体仓库上:

  • 发现仍处于生产环境的 FFmpeg 2.x(2015 年版本)
  • 发现同一个 SDK 包装器重复了 3 次
  • 识别出 636 MB 已提交的 Debug/ipch/obj 构建产物
  • 分类:3 MB 项目代码 vs 596 MB 第三方代码

最佳实践

  • 首次审计从 standard 深度开始
  • 对于超过 100 个模块的单体仓库,使用 fast 进行快速盘点
  • 对标记为重构的模块增量运行 deep
  • 审查跨模块分析,以检测子项目间的重复

链接

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能