prepare-branch-context
它能做什么
这个技能让你的 AI 阅读当前代码分支上的更改,以及相关的拉取请求和评论。适合希望 AI 在开始任务前先了解情况的开发者。
适用场景
- ✓你回到某个代码分支,希望 AI 了解其中的更改的时候。
- ✓你在审查前让 AI 解释某个分支上有什么的时候。
- ✓你希望 AI 在继续工作前先阅读拉取请求评论的时候。
技能链接
https://github.com/trycompai/crm/blob/release/.agents/skills/prepare-branch-context/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在我们做任何更改之前,请先告诉我这个分支上有什么内容。”
每周 5 个新技能,1 分钟读完。
工作原理
这个技能运行 git 命令,将你的分支与 main 进行比较,阅读提交历史和拉取请求,然后给你一份简短的总结。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Prepare Branch Context
Build a comprehensive understanding of the current branch so you can handle followup requests with full context.
Steps
Identify the current branch and base branch:
git branch --show-current git merge-base HEAD mainGather the diff from main:
git diff main...HEAD --stat git diff main...HEADRead through the full diff carefully. Understand what files were changed, added, or removed, and what the changes do.
Review the commit history on this branch:
git log main..HEAD --onelineRead commit messages to understand the progression of changes.
Check for a related PR:
gh pr list --head "$(git branch --show-current)" --json number,title,body,url,state,comments --jq '.[0]'If a PR exists, read its title, description, and comments for additional context (acceptance criteria, discussion, review feedback).
Summarize your understanding to the user:
- What this branch does (high-level purpose)
- Key files and areas of the codebase affected
- Notable decisions or patterns visible in the changes
- Any open review comments or discussion from the PR
- Current state (clean, uncommitted changes, etc.)
Signal readiness: Tell the user you're ready for followup questions or tasks related to this branch.
Rules
- Do NOT make any changes to files. This skill is read-only.
- Read the actual diff content, not just the stat summary. You need to understand the code changes.
- If there's no PR, that's fine — just skip that step and note it.
- If the diff is very large, focus on understanding the overall structure first, then read key files in detail.
- Keep the summary concise but thorough enough that you could confidently make changes to this branch.
- If the branch is
mainor has no divergence from main, tell the user there's nothing to analyze.
常见问题
这个技能需要 GitHub 命令行工具吗?
需要。它使用 gh 命令查找相关的拉取请求,因此必须安装该工具。
AI 会报告哪些内容?
它总结分支的目的、主要涉及的文件、重要决定、未解决的审查评论以及工作的当前状态。
它会更改代码吗?
列出的步骤只读取分支信息,例如差异、历史记录和拉取请求。
详情
作者的原始描述
Analyze the current branch's diff from main and related PR to build context for followup requests. Triggers on "prepare context", "branch context", "catch me up", "what's on this branch".
repo: trycompai/crm
热度
- GitHub 星标
- 12k
- 排名
- #11525
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
ai-elements
12k帮你的智能体用现成的组件构建 AI 聊天界面,包括对话、消息、工具显示和提示输入框。
ai-sdk
12k帮你的智能体使用 Vercel AI SDK 构建 AI 功能,包括文本生成、流式输出、工具调用和智能体。
better-accessibility
12k帮你的智能体让界面可以通过键盘和屏幕阅读器使用,涵盖焦点、标签、ARIA 和表单。
better-auth-best-practices
12k帮你的智能体按照官方文档步骤,在 TypeScript 应用中设置 Better Auth,实现登录、会话、OAuth 和插件。