project-references
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseProject References
项目参考
This skill manages a local mirror of your own GitHub repositories under
and lets you look up conventions and implementation
patterns without guessing or reading all repos blindly.
~/projects/referenzen/All operations are read-only on the reference projects themselves. Only
and write into that directory — never edits.
git clonegit pull此技能用于管理目录下自有GitHub仓库的本地镜像,让你无需猜测或盲目阅读所有仓库即可查找规范和实现模式。
~/projects/referenzen/所有针对参考项目的操作均为只读。只有和会向该目录写入内容——绝不允许编辑。
git clonegit pullInstructions
操作步骤
Step 1: Check whether the relevant repo is already cloned
步骤1:检查相关仓库是否已克隆
bash
ls ~/projects/referenzen/If the needed repo is missing, run to clone it first.
scripts/clone-or-update.sh owner/repobash
ls ~/projects/referenzen/如果所需仓库缺失,先运行进行克隆。
scripts/clone-or-update.sh owner/repoStep 2: Ask the user which reference project is most relevant
步骤2:询问用户哪个参考项目最相关
Do not scan all repos blindly — that fills context. Ask: "Which of your sibling projects uses this pattern?" or list the available repos and let the user pick.
不要盲目扫描所有仓库——这会占用上下文资源。可以问:“你的哪个兄弟项目使用了这种模式?”或者列出可用仓库让用户选择。
Step 3: Search targeted — file first, then grep
步骤3:针对性搜索——先找文件,再用grep
Use to locate a file by name, then or to read only the relevant section. For search commands and patterns, consult .
findcatgrepreferences/search-patterns.md使用按名称定位文件,然后用或仅读取相关部分。如需搜索命令和模式,请参考。
findcatgrepreferences/search-patterns.mdStep 4: Cite the source when adopting a pattern
步骤4:采用模式时注明来源
Always state which project and file path a pattern came from before applying it:
Pattern adopted from→your-serviceline 4helm-charts/Chart.yaml
在应用模式之前,务必说明该模式来自哪个项目和文件路径:
模式源自→your-service第4行helm-charts/Chart.yaml
Step 5: Sync only when explicitly requested
步骤5:仅在明确请求时同步
Run only when the user says "sync all" or "update all references". For a single repo, prefer .
scripts/sync-all.shscripts/clone-or-update.sh仅当用户说“同步所有”或“更新所有参考仓库”时,才运行。对于单个仓库,优先使用。
scripts/sync-all.shscripts/clone-or-update.shExamples
示例
Example 1: Looking up a Helm chart convention
示例1:查找Helm chart规范
User says: "How should I structure the Helm chart for this project?"
Actions:
- Run to see available repos
ls ~/projects/referenzen/ - Ask: "Which sibling project should I use as reference?" — user says
your-service - Run to locate it
find ~/projects/referenzen/your-service -name "Chart.yaml" - Read the file, note the structure (apiVersion, dependencies, version pattern)
- Apply the same structure; cite: "adopted from "
your-service/helm-charts/Chart.yaml
Result: Helm chart consistent with sibling projects, traceable source cited.
用户说:“我应该如何为这个项目构建Helm chart结构?”
操作:
- 运行查看可用仓库
ls ~/projects/referenzen/ - 询问:“我应该以哪个兄弟项目为参考?”——用户回答
your-service - 运行定位文件
find ~/projects/referenzen/your-service -name "Chart.yaml" - 读取文件,记录结构(apiVersion、依赖、版本模式)
- 应用相同结构,并注明:“源自”
your-service/helm-charts/Chart.yaml
结果:Helm chart与兄弟项目保持一致,且来源可追溯。
Example 2: Checking out a new reference repo
示例2:检出新的参考仓库
User says: "Clone my other-service project as a reference"
Actions:
- Run
bash scripts/clone-or-update.sh owner/other-service - Stream output so user sees CLONE/PULL/SKIP progress
- Confirm with
ls ~/projects/referenzen/other-service/
Result: Repo available locally for pattern lookups; no edits made.
用户说:“克隆我的other-service项目作为参考”
操作:
- 运行
bash scripts/clone-or-update.sh owner/other-service - 输出流信息,让用户看到CLONE/PULL/SKIP的进度
- 通过确认结果
ls ~/projects/referenzen/other-service/
结果:仓库已在本地可用,可用于模式查找;未进行任何编辑。
Example 3: Finding a configuration pattern
示例3:查找配置模式
User says: "How do I configure the database pool like in the other projects?"
Actions:
- — pick a relevant sibling project
ls ~/projects/referenzen/ grep -rn "database.pool" ~/projects/referenzen/your-service/src/main/resources/- Read the relevant config section
- Cite: "pattern from line 42"
your-service/src/main/resources/application.yaml
Result: Exact config from a proven sibling project, not guessed.
用户说:“我应该如何像其他项目那样配置数据库连接池?”
操作:
- ——选择一个相关的兄弟项目
ls ~/projects/referenzen/ grep -rn "database.pool" ~/projects/referenzen/your-service/src/main/resources/- 读取相关配置部分
- 注明:“模式源自第42行”
your-service/src/main/resources/application.yaml
结果:直接采用已验证的兄弟项目中的准确配置,而非猜测。
Repository source
仓库来源
Two sources are supported — prefer the manual list when it exists:
- Manual list (): one GitHub repo URL or
~/claude-shared/projekte.txtslug per line, blank lines andowner/namecomments ignored.# - Automatic discovery: when the file is absent or the user explicitly asks for a full sync.
gh repo list --limit 200 --json nameWithOwner
支持两种来源——当手动列表存在时优先使用:
- 手动列表():每行一个GitHub仓库URL或
~/claude-shared/projekte.txt格式的仓库标识,空行和owner/name注释将被忽略。# - 自动发现:当文件不存在或用户明确要求完全同步时,使用。
gh repo list --limit 200 --json nameWithOwner
Scripts
脚本
Two ready-made scripts live in — use them instead of writing
inline Bash. Both accept as an env override (default:
).
scripts/REFERENZEN_DIR~/projects/referenzenscripts/REFERENZEN_DIR~/projects/referenzenscripts/clone-or-update.sh <owner/repo>
scripts/clone-or-update.sh <owner/repo>scripts/clone-or-update.sh <owner/repo>
scripts/clone-or-update.sh <owner/repo>Clones a single repository or pulls if it already exists locally. Refuses
to pull when local changes are present (exit code 2) — never stashes or
resets.
bash
bash scripts/clone-or-update.sh owner/your-repoExit codes: = ok, = skipped (local changes), = clone/pull failed.
023克隆单个仓库,若本地已存在则拉取更新。当本地存在更改时拒绝拉取(退出码2)——绝不进行暂存或重置操作。
bash
bash scripts/clone-or-update.sh owner/your-repo退出码:=成功,=跳过(存在本地更改),=克隆/拉取失败。
023scripts/sync-all.sh [--list <file>] [--limit <n>]
scripts/sync-all.sh [--list <file>] [--limit <n>]scripts/sync-all.sh [--list <file>] [--limit <n>]
scripts/sync-all.sh [--list <file>] [--limit <n>]Iterates over all repositories and calls the clone-or-update logic for each.
Prefers as source; falls back to
when the file is absent. Prints a summary line at the end.
~/claude-shared/projekte.txtgh repo listbash
undefined遍历所有仓库,并为每个仓库调用克隆或更新逻辑。优先使用作为来源;当文件不存在时回退到。最后打印汇总信息。
~/claude-shared/projekte.txtgh repo listbash
undefinedSync everything (auto-detect source)
同步所有仓库(自动检测来源)
bash scripts/sync-all.sh
bash scripts/sync-all.sh
Use a specific list file
使用指定的列表文件
bash scripts/sync-all.sh --list ~/claude-shared/projekte.txt
bash scripts/sync-all.sh --list ~/claude-shared/projekte.txt
Limit gh repo list to 50 repos
将gh repo list限制为50个仓库
bash scripts/sync-all.sh --limit 50
**Do not** run sync-all blindly — use it only when the user explicitly says
"sync all" or "update all references". For a single repo prefer
`clone-or-update.sh`.
---bash scripts/sync-all.sh --limit 50
**请勿**盲目运行sync-all——仅当用户明确说“同步所有”或“更新所有参考仓库”时使用。对于单个仓库,优先使用`clone-or-update.sh`。
---Workflows
工作流程
1. Check out or update repositories
1. 检出或更新仓库
Run the appropriate script and stream output so the user sees every
CLONE / PULL / SKIP action as it happens.
运行相应脚本并输出流信息,让用户实时看到每个CLONE/PULL/SKIP操作。
2. Search within reference projects
2. 在参考仓库中搜索
Scope the search to what the user actually needs. Prefer targeted lookups
over broad recursive greps. For ready-made search commands and citing patterns,
consult .
references/search-patterns.md将搜索范围限定在用户实际需要的内容上。优先进行针对性查找,而非广泛的递归grep。如需现成的搜索命令和引用模式,请参考。
references/search-patterns.md3. Discover available reference projects
3. 发现可用的参考仓库
bash
ls ~/projects/referenzen/If exists, show its contents alongside to
explain which repos are tracked vs. which are locally present.
~/claude-shared/projekte.txtbash
ls ~/projects/referenzen/如果存在,同时显示其内容,以说明哪些仓库是被跟踪的,哪些是本地已存在的。
~/claude-shared/projekte.txtWhen to suggest this skill proactively
何时主动推荐此技能
Suggest looking up a reference project when:
- The user asks how something is structured and the answer may vary by project convention (Helm chart layout, Flyway migration naming, Dockerfile patterns, Maven plugin ordering, etc.)
- There is more than one reasonable approach and consistency with sibling projects matters
- The user says "like the other projects" or "same as before" without specifying which project
Ask the user which reference project is most relevant rather than scanning
all of them — scanning is expensive in context.
当出现以下情况时,建议查找参考项目:
- 用户询问某项内容的结构,且答案可能因项目规范而异(如Helm chart布局、Flyway迁移命名、Dockerfile模式、Maven插件顺序等)
- 存在多种合理实现方式,且与兄弟项目保持一致性至关重要
- 用户说“像其他项目那样”或“和之前一样”但未指定具体项目
询问用户哪个参考项目最相关,而非扫描所有仓库——扫描会消耗大量上下文资源。
Safety rules
安全规则
- Never edit, stage, commit, or delete files inside .
~/projects/referenzen/ - If would fail due to local changes, report the conflict clearly and stop — do not stash, reset, or force.
git pull - Do not expose repository contents that contain secrets (, credential files) in the response — read and cite structure only.
.env
- 绝不允许编辑、暂存、提交或删除目录内的文件。
~/projects/referenzen/ - 如果因本地更改导致失败,需清晰报告冲突并停止操作——不得进行暂存、重置或强制拉取。
git pull - 响应中不得暴露包含机密信息的仓库内容(如、凭证文件)——仅读取和引用结构。
.env