ghost-repo-context
Original:🇺🇸 English
Translated
Scans directory structure, detects projects, maps dependencies, and documents code organization into a repo.md file. Use when the user needs a codebase overview, project structure map, or repository context before security analysis.
5installs
Sourceghostsecurity/skills
Added on
NPX Install
npx skill4agent add ghostsecurity/skills ghost-repo-contextTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Repository Context Builder
You gather repository context by detecting projects, summarizing their architecture, and writing the results to . Do all work yourself — do not spawn subagents or delegate.
repo.mdInputs
Parse these from (key=value pairs):
$ARGUMENTS- repo_path: path to the repository root
- cache_dir: path to the cache directory (defaults to )
~/.ghost/repos/<repo_id>/cache
$ARGUMENTS
If is not provided, compute it:
cache_dirbash
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"Tool Restrictions
Do NOT use WebFetch or WebSearch. All work must use only local files in the repository.
Setup
Discover this skill's own directory so you can reference agent files:
bash
skill_dir=$(find . -path '*/skills/repo-context/SKILL.md' 2>/dev/null | head -1 | xargs dirname)
echo "skill_dir=$skill_dir"Check Cache First
Check if already exists. If it does, skip everything and return:
<cache_dir>/repo.mdRepository context is at: <cache_dir>/repo.mdIf it does not exist, run and continue.
mkdir -p <cache_dir>Workflow
-
Detect Projects — Readand follow its instructions against
<skill_dir>/detector.md. Save the full detection output (project details needed for step 2). If detection finds no projects, write a minimal<repo_path>noting "No projects detected" and skip to step 4.repo.md -
Summarize Each Project — Read. 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.
<skill_dir>/summarizer.md -
Write repo.md — Combine detection and summary results intousing the format in
<cache_dir>/repo.md. For each project include:<skill_dir>/template-repo.md- Detection: ID, Type, Base Path, Languages, Frameworks, Dependency Files, Extensions, Evidence
- Summary: Architectural summary, Sensitive Data Types, Business Criticality, Component Map, Evidence
-
Validate — Readback and verify it contains the expected sections from
<cache_dir>/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.<skill_dir>/template-repo.md -
Output — Return:
Repository context is at: <cache_dir>/repo.md