ghost-repo-context by ghostsecurity/skills
npx skills add https://github.com/ghostsecurity/skills --skill ghost-repo-context您通过检测项目、总结其架构并将结果写入 repo.md 来收集仓库上下文。所有工作请自行完成——不要创建子代理或委派任务。
从 $ARGUMENTS(键值对)中解析以下内容:
~/.ghost/repos/<repo_id>/cache)$ARGUMENTS
如果未提供 cache_dir,则按如下方式计算:
repo_name=$(basename "$(pwd)") && remote_url=$(git remote get-url origin 2>/dev/null || pwd) && short_hash=$(printf '%s' "$remote_url" | git hash-object --stdin | cut -c1-8) && repo_id="${repo_name}-${short_hash}" && cache_dir="$HOME/.ghost/repos/${repo_id}/cache" && echo "cache_dir=$cache_dir"
请勿使用 WebFetch 或 WebSearch。所有工作必须仅使用仓库中的本地文件。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
发现此技能自身的目录,以便您可以引用代理文件:
skill_dir=$(find . -path '*/skills/repo-context/SKILL.md' 2>/dev/null | head -1 | xargs dirname)
echo "skill_dir=$skill_dir"
检查 <cache_dir>/repo.md 是否已存在。如果存在,则跳过所有步骤并返回:
Repository context is at: <cache_dir>/repo.md
如果不存在,则运行 mkdir -p <cache_dir> 并继续。
检测项目 — 读取 <skill_dir>/detector.md 并按照其说明对 <repo_path> 进行操作。保存完整的检测输出(步骤 2 所需的项目详细信息)。如果检测未发现任何项目,则写入一个最小的 repo.md,注明“未检测到项目”,并跳转到步骤 4。
总结每个项目 — 读取 <skill_dir>/summarizer.md。对于步骤 1 中检测到的每个项目,使用该项目的详细信息(id、type、base_path、languages、frameworks、dependency_files、extensions、evidence)按照总结器的说明进行操作。收集每个项目的总结。如果某个项目的总结失败,请将其标记为“总结不可用”并继续处理剩余项目。
写入 repo.md — 使用 <skill_dir>/template-repo.md 中的格式,将检测和总结结果合并到 <cache_dir>/repo.md 中。对于每个项目,请包含:
验证 — 重新读取 <cache_dir>/repo.md 并验证其包含 <skill_dir>/template-repo.md 中预期的部分(例如,包含检测和总结字段的项目条目)。如果文件缺失或格式错误,请在报告错误前重试写入一次。
输出 — 返回:Repository context is at: <cache_dir>/repo.md
每周安装次数
547
仓库
GitHub 星标数
368
首次出现
2026年2月20日
安全审计
安装于
claude-code479
gemini-cli92
amp92
github-copilot92
codex92
kimi-cli92
You gather repository context by detecting projects, summarizing their architecture, and writing the results to repo.md. Do all work yourself — do not spawn subagents or delegate.
Parse these from $ARGUMENTS (key=value pairs):
~/.ghost/repos/<repo_id>/cache)$ARGUMENTS
If cache_dir is not provided, compute it:
repo_name=$(basename "$(pwd)") && remote_url=$(git remote get-url origin 2>/dev/null || pwd) && short_hash=$(printf '%s' "$remote_url" | git hash-object --stdin | cut -c1-8) && repo_id="${repo_name}-${short_hash}" && cache_dir="$HOME/.ghost/repos/${repo_id}/cache" && echo "cache_dir=$cache_dir"
Do NOT use WebFetch or WebSearch. All work must use only local files in the repository.
Discover this skill's own directory so you can reference agent files:
skill_dir=$(find . -path '*/skills/repo-context/SKILL.md' 2>/dev/null | head -1 | xargs dirname)
echo "skill_dir=$skill_dir"
Check if <cache_dir>/repo.md already exists. If it does, skip everything and return:
Repository context is at: <cache_dir>/repo.md
If it does not exist, run mkdir -p <cache_dir> and continue.
Detect Projects — Read <skill_dir>/detector.md and follow its instructions against <repo_path>. Save the full detection output (project details needed for step 2). If detection finds no projects, write a minimal repo.md noting "No projects detected" and skip to step 4.
Summarize Each Project — Read <skill_dir>/summarizer.md. For EACH project detected in step 1, follow the summarizer instructions using that project's details (id, type, base_path, languages, frameworks, dependency_files, extensions, evidence). Collect the summary for each project. If summarization fails for a project, note it as "summary unavailable" and continue with remaining projects.
Write repo.md — Combine detection and summary results into <cache_dir>/repo.md using the format in <skill_dir>/template-repo.md. For each project include:
Weekly Installs
547
Repository
GitHub Stars
368
First Seen
Feb 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code479
gemini-cli92
amp92
github-copilot92
codex92
kimi-cli92
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
136,300 周安装
OpenAPI 转 TypeScript 工具 - 自动生成 API 接口与类型守卫
563 周安装
数据库模式设计器 - 内置最佳实践,自动生成生产级SQL/NoSQL数据库架构
564 周安装
Rust Unsafe代码检查器 - 安全使用Unsafe Rust的完整指南与最佳实践
564 周安装
.NET并发编程模式指南:async/await、Channels、Akka.NET选择决策树
565 周安装
韩语语法检查器 - 基于国立国语院标准的拼写、空格、语法、标点错误检测与纠正
565 周安装
技能安全扫描器 - 检测Claude技能安全漏洞,防范提示注入与恶意代码
565 周安装
Validate — Read <cache_dir>/repo.md back and verify it contains the expected sections from <skill_dir>/template-repo.md (e.g., project entries with Detection and Summary fields). If the file is missing or malformed, retry the write once before reporting an error.
Output — Return: Repository context is at: <cache_dir>/repo.md