agentleFS
shalombshalomb/agent-skills/skills/git-repo-discovery/SKILL.md

git-repo-discovery

Skill3 starsChanged 3 months agoMITView on GitHub

Find, cache, and refresh git repositories — both local projects and remote repos. Uses the gum CLI to discover existing checkouts under ~/*/ before cloning. Use when the user references a git repository (URL, org/repo, or local path) or when you need to locate a project on disk.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before cloning anything, always check if the repo already exists locally:

    line 30
  2. Very specific:

    When a repo needs to be cloned (not just cached), use gum clone which analyses your existing project structure and suggests the right …

    line 83
  3. Distinctive:

    Search locally first: Don't clone what's already on disk.

    line 99
  4. Very specific:

    Cache for reading, clone for working: Use checkout.sh when you just need to read/reference.

    line 100
  5. Distinctive:

    Don't edit cached repos: Create a worktree or copy instead.

    line 103

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Librarian — Repository Finder & Cache

Find local git repositories or cache remote ones for reference. Prefers discovering existing checkouts over cloning — your machine likely already has what you need.

Quick Reference

TaskCommand
Find a local repogum projects --format json | jq '.[] | select(.path | test("PATTERN"))'
List all local reposgum projects --format simple
Search by remote URLgum projects --format json | jq '.[] | select(.remote | test("org/repo"))'
Clone with smart placementgum clone org/repo
Suggest clone locationgum clone --suggest org/repo
Cache a remote reposcripts/checkout.sh <repo> --path-only
Force-refresh a cached reposcripts/checkout.sh <repo> --force-update --path-only

Strategy: Local First

Before cloning anything, always check if the repo already exists locally:

# Step 1: Search local projects (fast — uses gum's indexed DB)
gum projects --format json | jq -r '.[] | select(.remote | test("SEARCH_TERM")) | .path'

# Step 2: If not found locally, check the cache
scripts/checkout.sh org/repo --path-only

# Step 3: Only clone if truly missing (gum picks the right directory)
gum clone org/repo

Finding Local Repos

The gum CLI maintains an indexed database of all git repos under ~/:

# All repos as JSON (path, remote, branch)
gum projects --format json

# Simple list of paths
gum projects --format simple

# Force re-scan
gum projects --refresh --format simple

# Search examples
gum projects --format json | jq -r '.[] | select(.path | test("terraform")) | .path'
gum projects --format json | jq -r '.[] | select(.remote | test("shalomb")) | "\(.path)\t\(.remote)"'

Caching Remote Repos

For repos not already on disk, use scripts/checkout.sh to cache under ~/.cache/checkouts/<host>/<org>/<repo>:

# These all resolve to the same checkout:
scripts/checkout.sh mitsuhiko/minijinja --path-only
scripts/checkout.sh github.com/mitsuhiko/minijinja --path-only
scripts/checkout.sh https://github.com/mitsuhiko/minijinja --path-only
scripts/checkout.sh git@github.com:mitsuhiko/minijinja.git --path-only

Features:

  • Partial clone (--filter=blob:none) for efficiency
  • Throttled refresh (every 5 minutes by default)
  • Fast-forward merge when checkout is clean
  • Force refresh with --force-update

Cloning New Repos

When a repo needs to be cloned (not just cached), use gum clone which analyses your existing project structure and suggests the right directory:

# Clone with intelligent directory suggestion
gum clone hashicorp/terraform

# Just see where it would go
gum clone --suggest hashicorp/terraform

# Force a specific location
gum clone --target ~/projects/hashicorp/terraform hashicorp/terraform

Rules

  1. Search locally first. Don't clone what's already on disk.
  2. Cache for reading, clone for working. Use checkout.sh when you just need to read/reference; use gum clone when you need a proper working copy.
  3. Don't edit cached repos. Create a worktree or copy instead.
  4. Prefer gum projects over find. It's indexed and fast. Only fall back to find if gum is unavailable.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.