Repo cache

From archibate/dotfiles-claude · View interactive version

Repo cache is an AI agent skill from the GitHub repository archibate/dotfiles-claude. Clone or reuse a cached local checkout of a remote git repo (GitHub/GitLab/Bitbucket). Use when the user gives a repo URL or `owner/repo` identifier (e.g. "facebook/react"), says "clone this repo" / "read the source", or needs to browse a remote codebase.

How to use this skill

Skill file

Use this skill when the user points you to a remote git repository (GitHub/GitLab/Bitbucket URLs, git@..., or owner/repo shorthand).

The goal is to keep a reusable local checkout that is:

Cache location

Repositories are stored at:

~/.cache/checkouts/<host>/<org>/<repo>

Example:

github.com/facebook/react → ~/.cache/checkouts/github.com/facebook/react

Command

scripts/checkout.sh <repo> --path-only

Examples:

scripts/checkout.sh facebook/react --path-only
scripts/checkout.sh github.com/facebook/react --path-only
scripts/checkout.sh https://github.com/facebook/react --path-only

The script will:

  1. Parse the repo reference into host/org/repo.
  2. Clone if missing.
  3. Reuse existing checkout if present.
  4. Fetch from origin when stale (default interval: 300s).
  5. Attempt a fast-forward merge if the checkout is clean and has an upstream.

Update strategy

scripts/checkout.sh <repo> --force-update --path-only

Recommended workflow

  1. Resolve repository path via checkout.sh --path-only.
  2. Use that path for searching, reading, and analysis.
  3. On later references to the same repo, call checkout.sh again; it will find and update the cached checkout.

If edits are needed

Prefer not to edit directly in the shared cache. Create a separate worktree or copy from the cached checkout for task-specific modifications.

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.