agentleFS
nainishshafinainishshafi/developer-productivity-skills/.github/skills/sync-github-forks/SKILL.md

sync-github-forks

Skill1 starsChanged 8 months agoMITView on GitHub

This skill should be used when the user asks to "sync github forks", "sync forks", "pull all my forks", or wants to create a bash script that clones or pulls all their GitHub forked repositories.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run gh auth status — confirm you are logged in.

    line 59
  2. Distinctive:

    Run the appropriate script for your OS (see Usage above).

    line 60

≈ “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

IMPORTANT: Both scripts are already bundled with this skill. Do NOT create new files. Detect the OS and run the appropriate existing script:

  • Windows → scripts/sync-forks.ps1
  • Linux / macOS → scripts/sync-forks.sh

The bundled scripts sync all GitHub forks by cloning missing repos and pulling existing ones. They use the gh CLI for API calls — no token needed.

Prerequisites

  • gh CLI installed and authenticated (gh auth login)
  • git on PATH
  • Linux/macOS only: jq on PATH
  • SSH key added to GitHub (for clone/pull via SSH)

Usage

Both scripts already exist — detect the OS and run the correct one. Do not create any new files.

Windows (PowerShell):

# Optional: override clone location (default: ~\git-repos)
$env:BASE_DIR = "$env:USERPROFILE\code"

pwsh scripts/sync-forks.ps1

Linux / macOS (bash):

# Optional: override clone location (default: ~/git-repos)
export BASE_DIR=~/code

bash scripts/sync-forks.sh

What the Script Does

  1. Checks that gh, jq, and git are on PATH.
  2. Derives your GitHub username automatically via gh api user.
  3. Paginates GET /user/repos?type=forks&per_page=100&page=N via gh api until all forks are fetched.
  4. For each fork:
    • Local dir exists → git pull origin <current-branch> (fast-forward).
    • Local dir missing → git clone <ssh_url> $BASE_DIR/<name>.
  5. Prints a final summary: Done — cloned N, pulled N, failed N.

Key Decisions

  • gh CLI handles authentication — no GITHUB_TOKEN env var required.
  • Username is derived at runtime from gh api user — no hardcoded config.
  • SSH clone URLs are used so no token is embedded in the remote URL.
  • Pagination ensures all forks are fetched beyond the 100-repo API limit.

Verification

  1. Run gh auth status — confirm you are logged in.
  2. Run the appropriate script for your OS (see Usage above).
  3. Confirm repos are cloned or pulled in BASE_DIR.

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.