recognize-codebase-branch-flow

识别并记忆项目 git 分支模型

Best use case

recognize-codebase-branch-flow is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

识别并记忆项目 git 分支模型

Teams using recognize-codebase-branch-flow should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/recognize-codebase-branch-flow/SKILL.md --create-dirs "https://raw.githubusercontent.com/Lionad-Morotar/local-tools/main/local-link/skills/recognize-codebase-branch-flow/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/recognize-codebase-branch-flow/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How recognize-codebase-branch-flow Compares

Feature / Agentrecognize-codebase-branch-flowStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

识别并记忆项目 git 分支模型

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

将项目信息持久化到本地 SQLite 数据库,用于后续快速查询和分析。

## 数据库

- 路径:`./db/branches.sqlite3`
- 初始化标记:`./db/inited.lock`

## Workflow

### 1. 初始化(首次使用)

检查 `./db/inited.lock` 是否存在。不存在时:
- 创建 SQLite 数据库
- 执行建表语句:
  ```sql
  CREATE TABLE projects (
    path TEXT PRIMARY KEY,
    name TEXT NOT NULL,
    branch_model TEXT NOT NULL,
    total_commits INTEGER NOT NULL DEFAULT 0,
    last_commit_date TEXT,
    last_commit_user TEXT,
    users TEXT DEFAULT '[]',
    analyzed_at TEXT NOT NULL,
    hash TEXT NOT NULL
  );
  ```
- 写入 `./db/inited.lock`

### 2. 检查缓存

对每个待分析项目(realpath 作为主键):
- 查询 `analyzed_at` 字段
- 若距今 ≤7 天,直接跳过(SKIP),除非用户有强制覆盖意图
- 否则重新分析

### 3. 分析项目

收集以下 git 信息:
- `total_commits`: `git rev-list --count --all`
- `last_commit_date`: 最近提交日期
- `last_commit_user`: 最近提交者
- `users`: 全部提交者去重后的数组
- `hash`: 当前 HEAD 短哈希(7 位)

获取所有本地和远程分支(去重):
```bash
git branch -a | sed 's/^[* ]*//' | sed 's|remotes/[^/]*/||' | sort -u
```

### 4. 分支模型判断(由你推理决定)

根据收集到的分支上下文,结合你对分支模型的理解,做出判断。

可选判定结果:gitflow、github flow、gitlab flow、无显著分支模型、自建模式

### 5. 写入数据库

使用 `INSERT OR REPLACE` 更新项目记录,字段:
`path`, `name`, `branch_model`, `total_commits`, `last_commit_date`, `last_commit_user`, `users`, `analyzed_at`, `hash`

## References

当你需要详细了解分支模型差异,或用户要求提供权威资料时,参考以下资源: 

* [Gitflow](https://git-flow.sh/workflows/gitflow/)
* [Github Flow](https://git-flow.sh/workflows/github-flow/)
* [Gitlab Flow](https://git-flow.sh/workflows/gitlab-flow/)

Related Skills

read-codebase

7
from Lionad-Morotar/local-tools

阅读棕地项目代码库,智能分析代码结构,递归补充其调用链上所有函数的注释。

open-u-dashboard

7
from Lionad-Morotar/local-tools

open understand dashboard for user

sync-template-skill

7
from Lionad-Morotar/local-tools

这是一个技能文件的模板,展示了技能的基本结构和内容组织方式。

talk-humanize

7
from Lionad-Morotar/local-tools

Be direct and informative. No filler, no fluff, but give enough to be useful.

search-web

7
from Lionad-Morotar/local-tools

使用 Evaluator-optimizer 模式进行系统性多轮网络搜索,采用结构化 Ask 流程在搜索前澄清研究目标。基于 YC Office Hours 的提问方法论,确保搜索方向清晰、结果可验证。当用户需要深入调查复杂主题、验证假设或全面收集信息时使用。

save-to-eagle

7
from Lionad-Morotar/local-tools

归档网络内容到 Eagle 素材库。支持:(1) Behance/Pixiv 图片归档,(2) 网页视频录制(页面动画、滚动录制)。使用方式:'归档 [URL]' 归档图片;'录制网页视频 [URL]' 录制页面动画;'滚动录制 [URL]' 自动滚动截图。支持评分如 '归档 [URL], 3/5'。

save-ob-chaos

7
from Lionad-Morotar/local-tools

将对话内容快速存档到 Obsidian Chaos 文件夹。触发词:"存档到 Obsidian"、"保存到 Chaos"、"ob 存档"、"记下这个"、"保存这段内容"、"存到 chaos"。

save-ob-chaos-mermaid

7
from Lionad-Morotar/local-tools

将 Mermaid 图表保存到 Obsidian Chaos 文件夹。触发词:"保存 mermaid 到 chaos"、"mermaid 存档"。

save-ob-chaos-excalidraw

7
from Lionad-Morotar/local-tools

绘制 Excalidraw 图表并存档到 Obsidian Chaos 文件夹。触发词:"画个图存到 Obsidian"、"excalidraw 存档"、"画个流程图保存"、"画图存到 chaos"、"创建图表并存档"、"画架构图到 ob"。

release-project

7
from Lionad-Morotar/local-tools

项目版本发布流程指导,帮助用户完成版本规划、Changelog 管理、版本号升级、Git 标签创建和 npm 首次发布准备。Use when: (1) 用户需要发布新版本 (2) 需要创建版本发布流程 (3) 需要管理版本号和 Changelog (4) 需要自动化版本发布 (5) 需要检查 release 分支同步 (6) 首次 npm 发布准备

rebase-commits

7
from Lionad-Morotar/local-tools

将零散的 commits 整合为清晰的逻辑提交,使 Git 历史更易读。 Use when: (1) 用户说 "rebase commits"、"整理提交历史"、"让历史更干净" (2) 用户想将多个相关 commits 合并为逻辑单元 (3) 完成一个功能后需要清理 commit 历史 (4) 提交历史混乱,需要重新组织

proof-reading

7
from Lionad-Morotar/local-tools

修复语病,使句子更通顺