Token导航 LogoToken导航TokenDH.com
研究检索权限需确认clawhub未标认证来源可访问clear审计提醒

codebase-intelligence代码库情报

Agent Skill

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

总安装

3,016

周安装

122

GitHub Stars

公开资料未说明

下载量

947
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:codebase-intelligence(代码库情报)
来源仓库:https://github.com/michealxie001/codebase-intelligence
安装命令:
openclaw skills install codebase-intelligence
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

ClawHubOpenClaw
openclaw skills install codebase-intelligence

简介

codebase-intelligence 通过缓存机制智能分析项目结构和依赖关系。

  • 适合在 OpenClaw 中快速理解新项目或回答技术问题时启用。
  • 可自动识别模块并生成结构化分析报告。
  • 安装命令:openclaw skills install codebase-intelligence,需确认本地文件访问权限。
  • 建议结合项目规模评估资源消耗和响应速度。

SKILL.md

name
codebase-intelligence
description
Intelligent codebase analysis and understanding with caching. Automatically explores project structure, identifies modules, analyzes dependencies, and answers questions about the codebase. Use when onboarding to a new project, before refactoring, or when you need to understand code relationships.

Codebase Intelligence

智能代码库分析工具,自动理解项目结构、模块边界和依赖关系。

Version: 1.0 Features: 增量索引缓存、符号搜索、智能问答、架构图生成


Quick Start

1. 首次索引(自动缓存)

cd /path/to/project
python3 /path/to/codebase-intelligence/scripts/main.py analyze .

第一次会创建 .codebase-intelligence/ 目录并缓存索引。后续查询秒开!

2. 智能问答

# 查找代码位置
python3 main.py ask "Where is authentication implemented?"

# 了解工作流程
python3 main.py ask "How does the user login flow work?"

# 查找如何修改
python3 main.py ask "What files need to change to add OAuth?"

3. 符号搜索

# 查找类定义
python3 main.py analyze --symbol "UserManager" --symbol-type class

# 查找函数
python3 main.py analyze --symbol "authenticate" --symbol-type func

4. 依赖分析

# 查看文件依赖什么
python3 main.py deps src/auth.py

# 查看什么依赖这个文件
python3 main.py deps src/utils.py --reverse

5. 生成架构图

# Mermaid 图
python3 main.py diagram --format mermaid

# 流程图
python3 main.py diagram --format mermaid-flow --entry-points main.py app.py

Commands

命令功能示例
analyze分析代码库(带缓存)main.py analyze . --stats
analyze --search搜索文件main.py analyze --search "auth"
analyze --symbol查找符号main.py analyze --symbol "User"
ask智能问答main.py ask "How does X work?"
deps依赖分析main.py deps src/main.py --reverse
diagram生成图表main.py diagram --format mermaid
index更新索引main.py index --export index.json

Features

✅ 增量缓存

  • 首次分析后自动缓存
  • 后续只更新修改过的文件
  • 大型项目也能秒开
# 第一次:建立索引(可能需要几秒)
python3 main.py analyze .

# 第二次:秒开!
python3 main.py analyze .  # 瞬间完成

✅ 符号索引

自动索引:

  • 函数定义
  • 类/接口定义
  • 导入语句
  • 文件元数据(语言、行数)

✅ 智能问答

支持问题类型:

  • Location: "Where is X?" → 定位代码
  • How it works: "How does X work?" → 理解流程
  • Definition: "What is X?" → 查找定义
  • Dependencies: "What depends on X?" → 依赖分析
  • Modification: "How to add X?" → 修改建议

✅ 多语言支持

语言符号解析依赖提取
Python
JavaScript/TypeScript
Go
Java
Rust⚠️
Ruby⚠️⚠️
PHP⚠️⚠️

Examples

场景 1:接手新项目

# 1. 获取整体概览
python3 main.py analyze /path/to/project --stats

# 2. 了解主要模块
python3 main.py analyze --search "module"

# 3. 查找核心类
python3 main.py analyze --symbol "App" --symbol-type class

# 4. 了解工作流程
python3 main.py ask "How does data flow through the system?"

# 5. 生成架构图
python3 main.py diagram --format mermaid-component

场景 2:重构前分析

# 1. 检查谁依赖要重构的模块
python3 main.py deps src/old-module.py --reverse --depth 3

# 2. 了解影响范围
python3 main.py ask "What would break if I refactor the auth module?"

# 3. 查看修改建议
python3 main.py ask "How to migrate from class X to class Y?"

场景 3:代码审查

# 查看变更影响
python3 main.py ask "What depends on src/utils/helpers.py?"

Configuration

忽略文件

.codebase-intelligence.json 中配置:

{
  "ignore": [
    "node_modules",
    ".git",
    "*.test.js",
    "vendor/"
  ],
  "entryPoints": [
    "src/main.py",
    "src/index.js"
  ]
}

缓存位置

默认缓存位置:<project>/.codebase-intelligence/codebase_index.pkl

也可以指定:

python3 main.py analyze . --cache-dir /path/to/cache

Output Formats

Markdown Report

python3 main.py analyze --stats

包含:

  • 项目概览
  • 语言分布表
  • 模块结构树
  • 符号统计

JSON Export

python3 main.py index --export index.json

结构化数据,包含完整索引信息。

Mermaid Diagrams

python3 main.py diagram --format mermaid

可直接在 Markdown/GitHub/GitLab 中渲染。


Performance

项目规模首次索引增量更新
小 (<100文件)<1s<0.1s
中 (100-1000文件)2-5s<0.5s
大 (1000-5000文件)10-30s<2s

Files

skills/codebase-intelligence/
├── SKILL.md                    # 本文件
└── scripts/
    ├── main.py                 # ⭐ 统一入口
    ├── indexer.py              # 索引引擎(带缓存)
    ├── ask_v2.py               # 智能问答
    ├── analyze.py              # 基础分析
    ├── deps.py                 # 依赖分析
    └── diagram.py              # 图表生成

Integration

Git Hooks

# .git/hooks/pre-commit
python3 scripts/main.py index

CI/CD

# .github/workflows/analysis.yml
- name: Analyze Codebase
  run: |
    python3 scripts/main.py analyze --stats
    python3 scripts/main.py diagram --format mermaid > architecture.md

Next Steps / Roadmap

  • [x] 增量缓存
  • [x] 符号索引
  • [x] 智能问答
  • [ ] AST 解析(提高准确性)
  • [ ] 接入 LLM(语义理解)
  • [ ] 实时 watch 模式
  • [ ] Web UI

Production Ready? ✅

当前状态:可用,适合日常使用

  • 缓存机制 ✅
  • 增量更新 ✅
  • 符号索引 ✅
  • 智能问答 ✅
  • 性能优化 ✅

待完善:

  • AST 解析(当前使用正则,有 5-10% 误差)
  • LLM 集成(当前基于关键词匹配)

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

OpenClaw

91.69%
按下载量换算868

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

通过

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

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

来源信息

继续浏览同类 Skills