$npx -y skills add PaulRBerg/agent-skills --skill repo-renamePreview or rename a GitHub upstream repo and matching local project folder, update origin, and preserve Codex CLI and Claude Code continuity references.
| 1 | # Repo Rename |
| 2 | |
| 3 | Preview the complete GitHub, Git, filesystem, and agent-continuity mutation set before applying a repository rename. |
| 4 | |
| 5 | ## Scope |
| 6 | |
| 7 | - Rename the current GitHub repository, matching local folder, and `origin` URL. |
| 8 | - Update literal old paths in `~/.claude/projects`, `~/claude/projects` when present, `~/.codex/sessions`, and |
| 9 | `~/.codex/config.toml` only when the repository has an active Claude Code or Codex transcript; this continuity update |
| 10 | does not apply to repos with no active transcripts. |
| 11 | - Update constrained literal old-name references inside the repository, excluding VCS, dependencies, and generated build |
| 12 | directories. |
| 13 | - Do not modify other transcript stores, archives, remotes, or repositories. |
| 14 | |
| 15 | ## Workflow |
| 16 | |
| 17 | 1. Check whether the repository has any active AI chat transcript before treating continuity preservation as in scope: |
| 18 | - Claude Code: resolve `${CLAUDE_CONFIG_DIR:-~/.claude}/projects/<absolute-repo-path-with-/-replaced-by-->` and check |
| 19 | it exists and is non-empty. |
| 20 | - Codex: resolve `${CODEX_HOME:-~/.codex}/sessions` and check whether any session file references the exact absolute |
| 21 | repo path. |
| 22 | - If neither exists, state that the transcript-continuity update does not apply; the rename may still proceed for the |
| 23 | GitHub, git, filesystem, and repository-content changes below. |
| 24 | |
| 25 | 2. Resolve the skill directory and run the helper from the repository to produce a read-only preview: |
| 26 | |
| 27 | ```sh |
| 28 | uv run <skill-dir>/scripts/repo-rename.py <new-name> --dry-run |
| 29 | ``` |
| 30 | |
| 31 | The helper requires a clean worktree, matching GitHub repo/folder names, a free target path, and valid GitHub |
| 32 | context. It prints the old/new repo and paths, exact confirmation token, external commands, directory moves, every |
| 33 | replacement file, occurrence counts, and rollback coverage. |
| 34 | |
| 35 | 3. If `--dry-run` was requested, return the preview and stop. A successful dry run must not change the GitHub repo, |
| 36 | remote, folder, config, transcripts, or repository files. |
| 37 | |
| 38 | 4. Otherwise present the complete preview and require explicit confirmation in a subsequent user message. Explain that |
| 39 | the confirmation authorizes the GitHub rename, local folder move, origin update, and every listed |
| 40 | continuity/repository replacement. Lead with `### ⚠️ Rename preview — no changes made`; show GitHub, folder, origin, |
| 41 | replacement counts, and rollback coverage in compact tables, then the exhaustive file/count list. Put the exact |
| 42 | confirmation token alone in code formatting. If any preview fact changes, regenerate it and ask again. |
| 43 | |
| 44 | 5. After confirmation, pass the preview's exact token: |
| 45 | |
| 46 | ```sh |
| 47 | uv run <skill-dir>/scripts/repo-rename.py <new-name> --apply --confirm '<owner/old->owner/new>' |
| 48 | ``` |
| 49 | |
| 50 | The helper re-runs preflight, backs up every replacement file, applies deterministic literal replacements, and |
| 51 | attempts rollback on failure. Never bypass its clean-tree, target-path, or confirmation checks. |
| 52 | |
| 53 | 6. Verify the helper's result with `gh repo view`, `git remote get-url origin`, `pwd -P`, and a search for remaining old |
| 54 | absolute-path/name references in the listed scope. Report intentional remaining matches separately. |
| 55 | |
| 56 | ## Completion |
| 57 | |
| 58 | Dry-run completion is a full mutation preview with zero writes. Apply completion requires the new GitHub identity, |
| 59 | folder, remote, and listed continuity references to agree, plus a clean verification report. If rollback is incomplete, |
| 60 | stop and lead with `### ⛔ Rollback incomplete`, then report every failed rollback action before doing anything else. On |
| 61 | success, use `### ✅ Repository renamed` and a surface/expected/verified table. Keep helper JSON, confirmation tokens, |
| 62 | commands, paths, URLs, and rollback errors exact and undecorated. |