Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计未展示

understand-codebase了解代码库

Agent Skill

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

总安装

315

周安装

13

GitHub Stars

113

下载量

103
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/vinta/hal-9000 --skill understand-codebase

简介

用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。

  • 支持基于关键词、任务场景或来源线索进行信息筛选与组织,提升研究效率。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 安装前需确认权限范围、维护状态及是否涉及联网或文件操作。
  • understand-codebase 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Understand Codebase

Use when navigating code, tracing how functions/classes connect, finding where symbols are defined or called, or answering "how does this work" questions about a codebase.

Tool Selection

NeedTool
Structural patterns (functions, classes, syntax, call flows)sg (ast-grep)
Text patterns (strings, comments, names)rg (ripgrep)
File discovery by name/extensionfd

Choose ripgrep (rg) for:

  • Text-based searches (strings, comments, variable names)
  • Fast, simple pattern matching across many files
  • When exact code structure doesn't matter
  • Regex searches with context lines
  • Searching binary files or non-code text

Choose ast-grep (sg) for:

  • Structural code searches (function signatures, class definitions)
  • Syntax-aware matching that understands code semantics
  • Finding patterns that span multiple lines naturally
  • Refactoring analysis (matching specific AST node types)
  • When you need to match code regardless of formatting/whitespace

Choose fd for:

  • Finding files by name, extension, or path pattern
  • Filtering by modification time or file size
  • Building file lists to pipe into rg or sg
  • Batch operations on matched files

Decision Flow

  1. Need to find files first? → fd, then pipe to rg or sg
  2. Need syntax-aware matching (functions, classes, imports)? → sg
  3. Need fast text/regex search? → rg
  4. Uncertain? Start with rg (faster), escalate to sg if structure matters

Quick Start

ast-grep (structural search)

# Find pattern with metavariables
sg -p 'console.log($MSG)' -l js

# Find function definitions
sg -p 'function $NAME($$$ARGS) { $$$ }' -l js

# Find async functions containing await
sg -p 'async function $NAME($$$) { $$$ }' --has 'await $EXPR' -l js

ripgrep (text search)

# Basic search
rg 'TODO' --type js

# Case-insensitive with context
rg -i 'error' -C 2

# Fixed string (no regex)
rg -F 'user.email' src/

fd (file finding)

# Find by extension
fd -e ts -e tsx src/

# Find files, then search content
fd -e py | xargs rg 'import numpy'

Common Patterns

Codebase Exploration

# Find entry points
sg -p 'export default $COMPONENT' -l tsx
rg 'if __name__.*main' --type py

# Find class definitions
sg -p 'class $NAME { $$$ }' -l ts
rg '^class \w+' --type py

# Find all imports of a module
sg -p 'import $$$IMPORTS from "react"' -l tsx
rg '^import.*from ["\x27]lodash' --type ts

Pre-Refactoring Analysis

# Find all usages of a function
sg -p '$FUNC($$$)' -l js   # where $FUNC matches your function name
rg 'myFunction\(' --type js

# Find method calls on objects
sg -p '$OBJ.methodName($$$)' -l js

# Find variable assignments
sg -p 'const $VAR = $VALUE' -l ts

Security Audits

# Hardcoded secrets
rg '(password|secret|api_key)\s*[:=]\s*["\x27][^"\x27]+["\x27]' -i

# SQL injection risks
sg -p 'query($SQL)' -l js
rg 'execute\(.*\+.*\)' --type py

# Eval usage
sg -p 'eval($CODE)' -l js
rg '\beval\s*\(' --type py

# Console statements (for cleanup)
sg -p 'console.$METHOD($$$)' -l js

Error Handling Analysis

# Find try-catch blocks
sg -p 'try { $$$ } catch ($E) { $$$ }' -l js

# Find empty catch blocks
sg -p 'try { $$$ } catch ($E) { }' -l js

# Find functions without error handling
sg -p 'async function $NAME($$$) { $$$ }' --not-has 'try' -l js

Dependency Analysis

# Find all imports from a package
rg '^import.*from ["\x27]@company/' --type ts

# Find require statements
sg -p 'require($PATH)' -l js

# Find dynamic imports
sg -p 'import($PATH)' -l js

Performance Tips

  1. Limit scope first: Use fd to narrow files, then search content fd -e py src/ | xargs rg 'class.*Test'
  2. Use file type filters: Both rg and sg are faster with type hints rg 'pattern' --type rust # vs searching all files sg -p 'pattern' -l rs # language-specific parsing
  3. Exclude build artifacts: rg 'pattern' -g '!node_modules' -g '!dist' -g '!build' fd -e js -E node_modules -E dist

References

Read these for advanced usage:

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

Claude Code

26.47%
按下载量换算27

OpenCode

22.72%
按下载量换算23

Antigravity

17.87%
按下载量换算18

Codex

12.76%
按下载量换算13

Gemini CLI

7.29%
按下载量换算8

Cursor

3.67%
按下载量换算4

安全审计

# Hardcoded secrets rg '(password|secret|api_key)\s*[:=]\s*["\x27][^"\x27]+["\x27]' -i # SQL injection risks sg -p 'query($SQL)' -l js rg 'execute\(.*\+.*\)' --type py # Eval usage sg -p 'eval($CODE)' -l js rg '\beval\s*\(' --type py # Console statements (for cleanup) sg -p 'console.$METHOD($$$)' -l js Error Handling Analysis # Find try-catch blocks sg -p 'try { $$$ } catch ($E) { $$$ }' -l js # Find empty catch blocks sg -p 'try { $$$ } catch ($E) { }' -l js # Find functions without error handling sg -p 'async function $NAME($$$) { $$$ }' --not-has 'try' -l js Dependency Analysis # Find all imports from a package rg '^import.*from ["\x27]@company/' --type ts # Find require statements sg -p 'require($PATH)' -l js # Find dynamic imports sg -p 'import($PATH)' -l js Performance Tips Limit scope first : Use fd to narrow files, then search content fd -e py src/ | xargs rg 'class.*Test' Use file type filters : Both rg and sg are faster with type hints rg 'pattern' --type rust # vs searching all files sg -p 'pattern' -l rs # language-specific parsing Exclude build artifacts : rg 'pattern' -g '!node_modules' -g '!dist' -g '!build' fd -e js -E node_modules -E dist References Read these for advanced usage: references/ast-grep.md - Metavariables, relational rules, composite patterns references/ripgrep.md - Regex syntax, filtering, replacements references/fd.md - Type filters, execution, time-based search Weekly Installs 13 Repository vinta/hal-9000 GitHub Stars 113 First Seen Jan 21, 2026

未展示

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills