mcpField
G
gemini-qa

gemini-qa

github.com/funnelenvyAgent 工作流137 次安装41 周前更新
代码仓库

关于 gemini-qa

gemini-qa 是一项通过 Google's Gemini CLI 查询代码库并返回回答的技能,适用于需要代码解释、架构信息或第二意见的 Agent 和开发者。

主要功能

  1. 01通过 Gemini CLI 查询代码库
  2. 02以无交互模式运行查询
  3. 03用 @ 引用文件或目录
  4. 04通过管道传入内容
  5. 05请求 JSON 输出

适用场景

  1. 01解释函数或模块
  2. 02询问数据库层的结构
  3. 03查找错误处理模式
  4. 04检查文件中的潜在问题

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/funnelenvy/agents_webinar_demos --skill gemini-qa

安装后在 Claude Code 中输入/gemini-qa确认已加载。

详细介绍

Gemini 问答

使用 Google 的 Gemini CLI 回答有关代码库的问题。

前提条件

必须安装 Gemini CLI:

npm install -g @anthropic-ai/gemini-cli
# or follow installation at https://github.com/google-gemini/gemini-cli

必须完成身份验证配置(Google API 密钥或应用默认凭据)。

用法

生成 gemini-qa 子 Agent 来处理问题:

Use the Task tool to spawn the gemini-qa agent with the user's question.

子 Agent 将:

  1. 为 Gemini 编写清晰的提示词
  2. 在无头模式下运行 gemini -p "question"
  3. 返回 Gemini 的回答

直接使用(不使用子 Agent)

如果你更愿意直接运行 Gemini:

gemini -p "your question here"
# or
gemini "your question here"
命令选项
  • 基本查询:gemini -p "question"
  • 位置参数:gemini "question"
  • 管道输入:cat file.txt | gemini -p "summarize this"
  • JSON 输出:gemini -p "question" --output-format json
  • 文件引用:gemini -p "@src/file.ts explain this"
使用 @ 引用文件

Gemini 支持使用 @ 语法来包含文件上下文:

# Reference a specific file
gemini -p "@src/auth.ts Explain this module"

# Reference a directory
gemini -p "@src/ Summarize all code here"

常见用例

  • 代码说明:“这个函数的作用是什么?”
  • 架构问题:“数据库层的结构是怎样的?”
  • 查找模式:“错误处理在哪里实现?”
  • 代码审查:“审查此文件,找出潜在问题”
  • 比较:针对代码问题获取第二种意见

备注

  • 使用 -p 标志以无头(非交互)模式运行
  • Gemini 能识别 Git,并会在引用目录时遵循 .gitignore
  • 对于复杂问题,使用子 Agent 可更好地隔离上下文

评论

支持 Markdown