Sync template

From raffertyuy/repo-of-repos · View interactive version

Sync template is an AI agent skill from the GitHub repository raffertyuy/repo-of-repos. Pull latest repo-of-repos template updates into this workspace

How to use this skill

Skill file

Sync Template

Pull the latest repo-of-repos template changes into this workspace without overwriting project-specific content.

Overview

This workspace was created from the repo-of-repos template. The template evolves — new skills, improved agents, better docs. This skill brings those updates into your workspace while preserving your project-specific configuration.

Arguments

The user may optionally specify:

Order of Operations

  1. Check versions — compare local vs upstream
  2. Fetch upstream — clone template to a temp directory
  3. Read changelog — understand what changed and why
  4. Copy safe files — framework files that have no project-specific content
  5. Smart-merge mixed files — files with both template and project content
  6. Update version — write the new TEMPLATE_VERSION
  7. Report — summarize what changed

Step 1: Check Versions

  1. Read the local TEMPLATE_VERSION file at the project root. If it doesn't exist, assume 0.0.0 (pre-versioned workspace).
  2. Fetch only the upstream TEMPLATE_VERSION file:

```bash

gh api repos/<upstream>/contents/TEMPLATE_VERSION --jq '.content' | base64 -d

```

  1. Compare versions. If already up to date, inform the user and stop.
  2. If the upstream is newer, continue.

Step 2: Fetch Upstream

Clone the upstream template to a temporary directory:

git clone --depth 1 --branch <branch> https://github.com/<upstream>.git /tmp/repo-of-repos-upstream

Clean up this directory when done (in the final step).

Step 3: Read Changelog

Read TEMPLATE_CHANGELOG.md from the upstream clone. Identify all versions between the local version and the upstream version. This tells you:

Present a summary to the user before proceeding: which versions will be applied and what the key changes are.

Step 4: Copy Safe Files

These are framework files with no project-specific content. Copy them directly from the upstream clone, overwriting local versions:

| Path | What |

|------|------|

| .agents/skills/*/SKILL.md | All skill definitions (canonical) |

| .claude/skills/*/SKILL.md | Skill stubs (frontmatter + @ pointer to canonical) |

| .claude/agents/*.md | Agent definitions (read by Claude Code and Copilot) |

| .claude/prompt-snippets/*.md | Shared prompt snippets |

| .claude/rules/*.md | Auto-applied rules (read by Claude Code and VS Code Copilot) |

| CLAUDE.md | One-line @AGENTS.md pointer (template-owned, copy as-is) |

| _plans/README.md | Plan system docs |

| docs/*.md | Reference documentation |

New files: If the upstream has new skills, agents, rules, or prompt snippets that don't exist locally, create them (including any new directories). When creating skill or agent files, ensure the origin: template frontmatter field is present (copy it from upstream as-is).

Removed template files: Some skills or agents may have been removed from the template (e.g., /create-task and /list-tasks were removed in v0.5.0). To detect these:

  1. Scan local .agents/skills/*/SKILL.md and .claude/agents/*.md for files that have origin: template in their frontmatter
  2. For each such file, check if the corresponding path exists in the upstream clone
  3. If a local origin: template file is NOT present in upstream → it was intentionally removed from the template
  4. Show the user a list of these orphaned template files and ask for confirmation before deleting:

```

The following template-owned skills/agents no longer exist in the upstream template:

Delete these? [y/N]

```

  1. If confirmed, delete the files and their parent directories (only if the directory contains no other files). When removing a skill, delete BOTH the canonical .agents/skills/<name>/ directory AND its stub .claude/skills/<name>/ directory
  2. Local skills/agents without origin: template are project-custom — never touch them

Step 5: Smart-Merge Mixed Files

These files contain both template content and project-specific content. You (the agent) are the merge tool. For each file:

  1. Read the upstream version (from temp clone)
  2. Read the local version (from workspace)
  3. Read the relevant changelog entries for context on what changed and why
  4. Intelligently merge — apply the template updates while preserving project-specific content

AGENTS.md

AGENTS.md (the canonical instruction file — CLAUDE.md is just a one-line @AGENTS.md pointer) is the most complex merge target. Live projects customize it heavily — different persona, project-specific architecture, custom coding standards, additional sections. The template evolves its framework sections independently.

Pre-0.6.0 workspaces: if the local workspace still has full instructions in CLAUDE.md and no AGENTS.md, migrate first — treat the local CLAUDE.md content as the local AGENTS.md for merging purposes, write the merged result to AGENTS.md, and replace CLAUDE.md with the one-line pointer.

Classify every section as one of:

| Classification | What it means | Merge strategy |

|----------------|---------------|----------------|

| Template-owned | Section exists in both template and local, content is purely framework | Replace with upstream version |

| Template-seeded, project-customized | Section originated from template but the project has modified it | Three-way merge (see below) |

| Project-only | Section exists only in the local file | Preserve as-is, keep in its current position |

Template-owned sections (replace with upstream):

Template-seeded sections that projects commonly customize (three-way merge):

Three-way merge procedure:

  1. Read the upstream section
  2. Read the local section
  3. Identify what the local version added, removed, or changed relative to what the template would have had
  4. Apply the upstream update as the new base
  5. Re-apply the local modifications on top
  6. If a local modification conflicts with an upstream change (both changed the same content), prefer the local version and add a comment: <!-- sync-template: upstream also changed this section — review manually -->

Project-only sections — Anything in the local AGENTS.md that has no counterpart in the upstream template. Common examples:

These must be preserved in their current position in the file. If an upstream update adds a new template section, insert it in the correct position relative to other template sections, but never displace project-only sections.

Section ordering: Follow the upstream's section order for template sections. Project-only sections stay where the user placed them. If a project-only section is between two template sections, keep it between them (or at the end if the surrounding template sections were reordered).

First-line / title: The local AGENTS.md may have a different title or opening line (e.g., # aws-mk0 instead of # AGENTS.md). Preserve the local title.

README.md

README.md is the public face of the project. Live projects replace the template description, customize the project tree, add project-specific sections, and may remove template sections that don't apply.

Classify every section as one of:

| Classification | What it means | Merge strategy |

|----------------|---------------|----------------|

| Template-owned | Pure framework documentation | Replace with upstream version |

| Template-seeded, project-customized | Originated from template, modified by project | Three-way merge |

| Project-only | Exists only in the local file | Preserve as-is |

| Template-removed | Exists in template but project intentionally deleted it | Do NOT re-add |

Template-owned sections (replace with upstream):

Template-seeded sections that projects commonly customize (three-way merge):

Detecting intentionally removed sections:

If a template section exists in the upstream but NOT in the local README, the project likely removed it intentionally. Do NOT re-add it. Instead, note it in the sync report:

| Further Reading | Skipped (not present locally — likely intentionally removed) |

If unsure whether removal was intentional, ask the user before re-adding.

Three-way merge procedure: Same as AGENTS.md (see above).

Section ordering: Follow the local file's ordering. If upstream introduces a new section, insert it in a logical position relative to existing sections.

.gitignore

repos/repos.yaml

TEMPLATE_CHANGELOG.md

Step 6: Update Version

Write the upstream version string to the local TEMPLATE_VERSION file.

Step 7: Cleanup and Report

  1. Remove the temp clone directory: rm -rf /tmp/repo-of-repos-upstream
  2. Report a summary:
## Template Sync: v0.2.0 → v0.3.0

### Files updated
| File | Action |
|------|--------|
| `.agents/skills/pull-all-repos/SKILL.md` | Copied from upstream |
| `AGENTS.md` | Merged (added "Git vs Local Entries" section) |
| `.gitignore` | Merged (switched to per-repo entries) |
| ... | ... |

### New files
- `.agents/skills/sync-template/SKILL.md` (+ stub in `.claude/skills/sync-template/`)

### Removed files
- `.agents/skills/create-task/` *(template skill removed in v0.5.0)*
- `.agents/skills/list-tasks/` *(template skill removed in v0.5.0)*

### Key changes
- Local source folder support (see TEMPLATE_CHANGELOG.md for details)

### Next steps
- Review the changes with `git diff`
- Commit when satisfied: `/commit`

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.