[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77KB3GDHFNDHEYQXJ79XEXB":3,"skill-same:01M77KB3GDHFNDHEYQXJ79XEXB":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M77KB3GDHFNDHEYQXJ79XEXB","gh-repo-scrub-history",null,"Rewrite a repo's entire git history to substitute one string with another across every commit via git-filter-repo --replace-text, then force-push. Purges leaked secrets\u002Fnames\u002Fstrings from history. Warns loudly (but does not refuse) on public repos. Prompts for the from\u002Fto strings when not passed, using any passed values as editable defaults.","TheVoskamps\u002Fclaude-plugins-marketplace","TheVoskamps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235012489?v=4","01M77K5ZCP12QCJPQ85WVJSHTS","Irene and Edwin Voskamp","01M77K5ZDS7DB0PA1W8FM7G2QD",0,"GPL-3.0","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgithub-setup\u002Fskills\u002Fgh-repo-scrub-history\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: gh-repo-scrub-history\ndescription: \"Rewrite a repo's entire git history to substitute one string with another across every commit via git-filter-repo --replace-text, then force-push. Purges leaked secrets\u002Fnames\u002Fstrings from history. Warns loudly (but does not refuse) on public repos. Prompts for the from\u002Fto strings when not passed, using any passed values as editable defaults.\"\n---\n\nYou are running the `\u002Fgh-repo-scrub-history` skill. Your job is to\nrewrite the **entire git history** of the **current repo** (the repo\n`cd`-ed into when this skill was invoked) so that one string is\nsubstituted with another across **every commit** in history, then\nforce-push the rewritten history to the remote.\n\nThis is the tool for purging a leaked secret, a name, or any string\nthat should not live in the repo's history. It is deliberately a\n**history rewrite**, not a working-tree edit: a working-tree\nsubstitution leaves the old value sitting in every prior commit, which\nis useless for the leaked-secret case this skill exists to serve. The\nwhole point is that `git log -p`, `git show \u003Cold-sha>`, and a fresh\nclone all stop containing the value.\n\nThe mechanism is `git filter-repo --replace-text`, which rewrites blob\ncontent across all commits. Rewriting blobs changes every commit SHA\nfrom the first rewritten commit onward, so the local history diverges\nfrom the remote and the push is necessarily a **force-push**.\n\nThis skill is the pre-flip gate that `gh-repo-setup-public` (a separate\nskill, tracked in issue #92) points at: scrub the history clean\n*before* a private repo is ever made public. Normal use is therefore on\na **private** repo. Running it on a public repo is the break-glass case\n— see \"Posture\" below.\n\nFollow the steps in order. There are two explicit **halts** where you\nwait for the user. Do not skip them.\n\n---\n\n## Inputs (both optional)\n\n- **`from`** — the string to replace (the leaked\u002Funwanted value).\n- **`to`** — the replacement string. When the intent is redaction\n  rather than substitution, a sentinel like `***REMOVED***` is the\n  conventional `to` value (it matches `git-filter-repo`'s own default\n  replacement text).\n\nResolution:\n\n- If **both** are passed, use them as the **defaults** in the Halt #1\n  prompt — the user confirms or edits them before anything runs. Passed\n  values are never used unconfirmed.\n- If **either** is omitted, **prompt** the user for the missing\n  value(s) at Halt #1. Any value that *was* passed pre-fills its field\n  as the editable default.\n- `from` must be non-empty after confirmation. `to` may be empty\n  **only if the user explicitly intends deletion** (replace the string\n  with nothing); otherwise default an empty\u002Fblank `to` to the\n  `***REMOVED***` sentinel and show that in the Halt #1 confirmation so\n  the user sees what will be written.\n\nDo not echo a `from` value that is itself a live secret more than\nnecessary; it has to appear in the Halt #1 confirmation (the user must\nconfirm exactly what is being scrubbed), but do not repeat it\ngratuitously elsewhere in the conversation.\n\n---\n\n## Step 1: Pre-flight — repo root\n\nVerify you are inside a git working tree:\n\n```bash\ngit rev-parse --show-toplevel\n```\n\nTreat the path printed by this command as the **repo root** for the\nrest of the skill. The skill operates on the repo the user invoked it\nfrom. Do **not** assume `~\u002F.claude` or any other path.\n\nIf the command fails (non-zero exit, \"not a git repository\"), abort\nwith:\n\n> `\u002Fgh-repo-scrub-history` must be run from inside a git repository.\n> The current directory is not a git working tree.\n\n## Step 2: Pre-flight — local tooling\n\nVerify `git-filter-repo` is installed locally:\n\n```bash\ncommand -v git-filter-repo\n```\n\nIf it returns nothing (exit non-zero), abort with:\n\n> `git-filter-repo` is not installed. Install it with\n> `brew install git-filter-repo`, then re-run `\u002Fgh-repo-scrub-history`.\n\nDo **not** attempt to install it yourself — the user runs\n`brew install git-filter-repo` (host-integrity rule: no on-initiative\nhost-wide installs).\n\nAlso verify `gh` is authenticated (needed both to read the repo's\nvisibility in Step 3 and to push later):\n\n```bash\ngh auth status\n```\n\nIf `gh` reports the user is not authenticated, abort and tell them to\nrun `gh auth login` first.\n\n## Step 3: Pre-flight — repo visibility (posture branch)\n\nRead the repo's visibility:\n\n```bash\ngh repo view --json visibility -q .visibility\n```\n\n- If the value is `PRIVATE`: this is the normal, intended use. Note it\n  and continue.\n- If the value is anything else (`PUBLIC`, `INTERNAL`): this is the\n  **break-glass case**. Emit the loud warning below and continue — do\n  **not** refuse. Warn, then let the user decide.\n\n### Public-repo warning (break-glass)\n\nPrint this verbatim when visibility is not `PRIVATE`, before Halt #1:\n\n```text\n⚠️  WARNING: this repo is \u003Cvisibility>, not private.\n\nRewriting history on a public repo is a break-glass action. If a secret\nor sensitive string has been public, rewriting history helps but does\nNOT fully un-leak it:\n\n  - It may already be cached by GitHub, search engines, or the GitHub\n    Archive \u002F GH Archive datasets.\n  - It may have been forked; forks keep the old history independently.\n  - It may have been cloned, crawled, or scraped by third parties.\n  - Old commit SHAs may still be reachable via the GitHub API for a\n    while, and via anyone's existing clone indefinitely.\n\nIf a credential leaked publicly, ROTATE THE CREDENTIAL — that is the\nonly real remediation. This rewrite reduces casual exposure but is not\na substitute for rotation.\n\nThis skill will still proceed if you want it to.\n```\n\nThen continue to Halt #1. The warning informs; it does not block.\n\n## Step 4: Halt #1 — confirm strings, posture, and the exact invocation\n\nResolve the `from` \u002F `to` values per \"Inputs\" above (prompt for any\nnot passed; use passed values as editable defaults). Then build the\n**exact** `git filter-repo` invocation and show it to the user for\nexplicit approval before anything runs.\n\nThe skill writes a single-rule replacement file in the sandbox and\npoints `git filter-repo` at it with `--replace-text`. The replacement\nfile format is one rule per line, `\u003Cfrom>==>\u003Cto>`:\n\n- A **literal** substitution is the default: `\u003Cfrom>==>\u003Cto>`.\n- When `to` is the redaction sentinel and the user did not give an\n  explicit replacement, the rule is `\u003Cfrom>==>***REMOVED***`.\n- When the user explicitly intends deletion (replace with nothing),\n  the rule is `\u003Cfrom>==>` (empty right side).\n\n> **Critical — never hand-write `#` comment lines into this file, and\n> never strip-by-deny-list.** `git filter-repo --replace-text` does\n> **not** skip `#` lines: a bare `#` line is parsed as the literal\n> rule `# ==> ***REMOVED***`, which would corrupt every `#` in every\n> file (shebangs, comments, Markdown headings). This is a known\n> `git-filter-repo` behavior — the `--replace-text` parser treats every\n> non-empty line as a rule and does not recognize `#` as a comment\n> marker. This skill therefore writes a replacement file containing\n> **only the single real rule line and nothing else** — no header, no\n> comments, no blank lines. Do not add explanatory comments to the\n> generated file.\n\nPresent this halt verbatim (filling in the resolved values):\n\n```text\nAbout to REWRITE THIS REPO'S ENTIRE GIT HISTORY.\n\n  Repo:         \u003Cowner>\u002F\u003Cshort>   (\u003Cvisibility>)\n  Replace:      \u003Cfrom>\n  With:         \u003Cto>              (or \"(deleted)\" when the rule is \u003Cfrom>==> )\n  Rule written: \u003Cfrom>==>\u003Cto>     (in a sandbox replacements file)\n\nExact command that will run, against a fresh mirror clone in the\nsandbox:\n\n  git filter-repo --replace-text \u003Csandbox>\u002Freplacements.txt\n\nThis rewrites EVERY commit SHA from the first match onward. After the\nrewrite I will show you the diff\u002Fstat, then ask SEPARATELY before\nforce-pushing. Consequences, accepted by design:\n\n  - All commit SHAs change. Existing clones and forks are broken;\n    collaborators must re-clone or hard-reset.\n  - Open PRs built on the old SHAs will need to be recreated\u002Frebased.\n  - The force-push overwrites remote history and cannot be cleanly\n    undone once others have fetched it.\n\nProceed with the rewrite? (y to continue, or tell me what to change)\n```\n\nWait for explicit approval (`y`, `yes`, `go`, `do it`). If the user\nwants to change `from`, `to`, or cancel, update and re-display this\nhalt — do not proceed without confirmation. This halt approves the\n**rewrite**, not the push (the push has its own approval at Halt #2).\n\n## Step 5: Perform the rewrite in a sandbox clone\n\nDo the rewrite against a **fresh mirror clone in the sandbox**, never\nagainst the user's working clone directly. Mirroring first means the\nuser's working repo is untouched until the explicit force-push at\nHalt #2 — if anything looks wrong, the working clone and the remote\nare both still intact.\n\nAll scratch work goes under `\u003Crepo-root>\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\u002F`\n— never `\u002Ftmp\u002F`, never the home directory, never outside the repo.\n\n```bash\n# Capture the absolute repo root BEFORE building paths.\nREPO_ROOT=\"$(git rev-parse --show-toplevel)\"\nSANDBOX=\"$REPO_ROOT\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\"\nmkdir -p \"$SANDBOX\"\nWORK=\"$SANDBOX\u002Fscrub.git\"\nrm -rf \"$WORK\"\n# A mirror clone carries all refs (branches + tags) so the rewrite\n# covers the whole history, not just the current branch.\ngit clone --mirror \"$REPO_ROOT\" \"$WORK\"\n```\n\nWrite the single-rule replacement file (exactly one line, no comments\n— see the `#`-comment warning in Step 4). Use the `Write` tool to write\n`\u003CSANDBOX>\u002Freplacements.txt` containing only:\n\n```text\n\u003Cfrom>==>\u003Cto>\n```\n\nAlso use the `Write` tool to write a one-line needle file\n`\u003CSANDBOX>\u002Fneedle.txt` containing exactly the `from` value (no trailing\nrule syntax, no `==>`). Step 6's verification grep reads this file with\n`git grep -F -f` so the leak-shaped `from` string is never interpolated\nonto a shell command line:\n\n```text\n\u003Cfrom>\n```\n\nThen run the filter against the mirror clone. `--replace-text` defaults\nto operating on all refs in the mirror, so every branch and tag is\nrewritten.\n\nRun this as **two separate steps** — a bare `cd` into the sandbox\nmirror, then the bare `git filter-repo` command. Do **not** combine\nthem as `cd \"$WORK\" && git ...` (the `cd \u003Cpath> && git` form trips the\nharness's CVE-2025-59536 gate) or as a `( cd … ; … )` subshell:\n\n```bash\ncd \"$WORK\"\n```\n\n```bash\ngit filter-repo --replace-text \"$SANDBOX\u002Freplacements.txt\" --force\n```\n\n`--force` is required here: `git filter-repo` refuses to rewrite a repo\nthat is not a fresh, single-purpose clone, and the mirror clone in the\nsandbox is exactly such a throwaway, so `--force` is the correct flag.\n(It forces filter-repo to run against the already-cloned mirror; it is\nunrelated to the later `git push --force`.)\n\n## Step 6: Show what changed; report whether the string was found\n\nShow the user the effect of the rewrite before any push. You are still\n`cd`-ed into the sandbox mirror (`$WORK`) from Step 5, so these run as\nbare commands; if a prior Bash call reset the cwd, re-run `cd \"$WORK\"`\nfirst (its own Bash call, never `cd \"$WORK\" && git …`):\n\n```bash\ngit log --oneline -n 20\n```\n\nVerify the string is actually gone from the rewritten history. Pass the\n`from` value through a file and use `git grep -F -f` so the\nleak-shaped string is never interpolated into the shell command line\n(no quoting\u002Fescaping hazard, and the value stays off `ps` listings).\nFeed the refs to `git grep` via `xargs` reading\n`git rev-list --all` on stdin, so a repo with many refs cannot blow\n`ARG_MAX`:\n\n```bash\n# Write the search needle to a sandbox file (Write tool, not echo) so\n# the raw `from` value is never placed on a command line:\n#   \u003CSANDBOX>\u002Fneedle.txt  ->  a single line containing exactly \u003Cfrom>\n#\n# Then search every ref. Prints NOTHING if the scrub worked. Any output\n# means the string still survives somewhere (e.g. it appears in a\n# path\u002Ffilename, which --replace-text does not rewrite — only blob\n# CONTENT).\ngit rev-list --all | xargs git grep -I -n -F -f \"$SANDBOX\u002Fneedle.txt\" -- 2>\u002Fdev\u002Fnull | head\n```\n\nReport to the user:\n\n- Whether the string was found and replaced at all. If\n  `git filter-repo` reports **no replacements made**, tell the user\n  plainly: the string did not appear in any blob content. Possible\n  reasons — it never existed in history, it was already scrubbed, or it\n  exists only in a **filename\u002Fpath** or a **commit message** (neither\n  of which `--replace-text` rewrites; `--replace-text` is blob content\n  only). Ask whether they want to stop or proceed anyway.\n- The number of commits whose SHAs changed (the divergence point).\n\nThis step is read-only reporting. The next step is the destructive one.\n\n## Step 7: Halt #2 — confirm the force-push\n\nThe mirror clone in the sandbox now has the rewritten history, but\n**nothing has been pushed and the working clone is untouched.** Ask\nexplicitly before the force-push:\n\n```text\nThe rewrite is done in the sandbox and the string is no longer in the\nrewritten history. Nothing has been pushed yet.\n\nForce-pushing will OVERWRITE the remote's history on all rewritten\nbranches and tags. This is destructive and breaks existing clones,\nforks, and open PRs. It cannot be cleanly undone once others fetch it.\n\nForce-push the rewritten history to origin now? (y to push, or no to\nstop and leave the sandbox for inspection)\n```\n\nWait for explicit `y`\u002F`yes`\u002F`push`. If the user declines, stop and\ntell them the rewritten mirror is preserved at `\u003CWORK>` for inspection;\ndo not delete the sandbox.\n\nOn approval, force-push all rewritten refs from the mirror clone to the\n**real GitHub remote**.\n\n`git clone --mirror \"$REPO_ROOT\"` set the sandbox's `origin` to the\nuser's *local working clone path*, not to GitHub. The push must\ntherefore be re-pointed at the true remote **before** any force-push —\notherwise it rewrites the local working clone instead of GitHub. Do\nthis in order, each as its own Bash call (never `cd \"$WORK\" && git …`,\nnever `git -C \u003Cpath> …`):\n\nFirst, read the real remote URL from the working clone:\n\n```bash\ncd \"$REPO_ROOT\"\n```\n\n```bash\nREMOTE_URL=\"$(git remote get-url origin)\"\n```\n\nThen enter the sandbox mirror and re-point its `origin` at that URL:\n\n```bash\ncd \"$WORK\"\n```\n\n```bash\ngit remote set-url origin \"$REMOTE_URL\"\n```\n\nConfirm the re-point landed on GitHub (not the local path) before\npushing — this guards against an empty\u002Funset `REMOTE_URL`:\n\n```bash\ngit remote get-url origin\n```\n\nOnly once that prints the real GitHub URL, force-push all rewritten\nrefs to that explicit remote URL:\n\n```bash\ngit push --force --mirror \"$REMOTE_URL\"\n```\n\nPushing to the resolved `\"$REMOTE_URL\"` (rather than the bare name\n`origin`) makes the target unambiguous even if the re-point above were\nsomehow skipped. `--mirror` pushes all rewritten branches and tags so\nthe remote matches the scrubbed history exactly.\n\n## Step 8: Tell the user to refresh their working clone\n\nAfter the force-push, the user's **working clone still has the old,\npre-rewrite history** (the rewrite happened in the sandbox mirror, not\nthe working clone). They must reconcile it:\n\n```text\nForce-push complete. The remote now has the scrubbed history.\n\nYour working clone at \u003Crepo-root> still has the OLD history. Reconcile\nit with:\n\n    git fetch origin\n    git reset --hard origin\u002F\u003Ccurrent-branch>\n\nTell any collaborators to do the same (or re-clone). Their old clones\nand any forks still contain the old value until they do.\n\nIf a real credential leaked, ROTATE IT — the rewrite is not a\nsubstitute for rotation.\n```\n\nThen clean up the sandbox **only if every step succeeded**:\n\n```bash\nrm -rf \"$REPO_ROOT\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\"\n```\n\nLeave the sandbox in place if any step from 5 onward failed (or if the\nuser declined the push at Halt #2), so it can be inspected.\n\n---\n\n## Halts and approval gates (summary)\n\nThe skill **must** halt and wait for explicit user confirmation at:\n\n- **Halt #1 (Step 4)** — confirm the `from`\u002F`to` strings, the posture\n  (public-repo warning if applicable), and the exact `git filter-repo`\n  invocation. Approves the rewrite.\n- **Halt #2 (Step 7)** — confirm the force-push. Approves the\n  destructive remote overwrite. This is a separate approval from\n  Halt #1; \"yes\" at Halt #1 never implies the push.\n\n---\n\n## Hard constraints\n\n- **It is a history rewrite, not a working-tree edit.** A working-tree\n  substitution leaves the old value in every prior commit and does not\n  serve the leaked-secret purpose. Always use\n  `git filter-repo --replace-text` across all history.\n- **Warn, do not refuse, on a public repo.** Step 3 prints the\n  break-glass warning when visibility is not `PRIVATE`, then continues.\n  The user decides; the skill does not block.\n- **Show the exact command before running it; get approval before the\n  rewrite (Halt #1) AND before the force-push (Halt #2).** Two separate\n  approvals.\n- **Never hand-write `#` comments into the replacement file**, and\n  never feed filter-repo a file with comment\u002Fblank lines — `git\n  filter-repo --replace-text` does not treat `#` as a comment marker,\n  so bare `#` lines are parsed as literal rules and corrupt every `#`\n  in the repo. Write exactly one rule line.\n- **Do the rewrite in a sandbox mirror clone, never against the user's\n  working clone.** The working clone stays intact until the explicit\n  force-push, and is reconciled afterward (Step 8) with\n  `git fetch && git reset --hard`.\n- **SHA rewrite \u002F force-push \u002F broken clones & forks are accepted by\n  design.** Call them out at both halts; do not block on them.\n- **All scratch work goes under\n  `\u003Crepo-root>\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\u002F`** — never `\u002Ftmp\u002F`,\n  never the home directory, never outside the repo. Clean up on\n  success; leave in place on failure or on a declined push.\n- **Never install `git-filter-repo` yourself.** Step 2 aborts with the\n  `brew install git-filter-repo` instruction; the user installs it.\n\n---\n\n## Out of scope\n\n- **`git-filter-repo` installation.** The user installs it out-of-band\n  (`brew install git-filter-repo`); Step 2 aborts if it is missing.\n- **Filename \u002F path scrubbing.** `--replace-text` rewrites blob\n  *content* only. A secret that appears in a filename or directory name\n  is not removed by this skill; Step 6 reports when the string survives\n  for this reason. Path-based filtering (`--path`, `--invert-paths`) is\n  a different operation, out of scope here.\n- **Commit-message scrubbing.** `--replace-text` does not touch commit\n  messages (`--replace-message` is a separate pass). Out of scope for\n  this skill, which targets blob content.\n- **Credential rotation.** The skill reminds the user to rotate a\n  leaked credential, but rotating it is the user's responsibility and\n  outside this skill.\n- **Coordinating collaborators' re-clones.** The skill tells the user\n  what to communicate (Step 8) but cannot force others to refresh their\n  clones or forks.\n- **Making the repo public.** That is `gh-repo-setup-public` (issue\n  #92), which points at this skill as its pre-flip gate. This skill\n  only scrubs; it does not change visibility.\n","You are running the `\u002Fgh-repo-scrub-history` skill. Your job is to\nrewrite the **entire git history** of the **current repo** (the repo\n`cd`-ed into when this skill was invoked) so that one string is\nsubstituted with another across **every commit** in history, then\nforce-push the rewritten history to the remote.\n\nThis is the tool for purging a leaked secret, a name, or any string\nthat should not live in the repo's history. It is deliberately a\n**history rewrite**, not a working-tree edit: a working-tree\nsubstitution leaves the old value sitting in every prior commit, which\nis useless for the leaked-secret case this skill exists to serve. The\nwhole point is that `git log -p`, `git show \u003Cold-sha>`, and a fresh\nclone all stop containing the value.\n\nThe mechanism is `git filter-repo --replace-text`, which rewrites blob\ncontent across all commits. Rewriting blobs changes every commit SHA\nfrom the first rewritten commit onward, so the local history diverges\nfrom the remote and the push is necessarily a **force-push**.\n\nThis skill is the pre-flip gate that `gh-repo-setup-public` (a separate\nskill, tracked in issue #92) points at: scrub the history clean\n*before* a private repo is ever made public. Normal use is therefore on\na **private** repo. Running it on a public repo is the break-glass case\n— see \"Posture\" below.\n\nFollow the steps in order. There are two explicit **halts** where you\nwait for the user. Do not skip them.\n\n---\n\n## Inputs (both optional)\n\n- **`from`** — the string to replace (the leaked\u002Funwanted value).\n- **`to`** — the replacement string. When the intent is redaction\n  rather than substitution, a sentinel like `***REMOVED***` is the\n  conventional `to` value (it matches `git-filter-repo`'s own default\n  replacement text).\n\nResolution:\n\n- If **both** are passed, use them as the **defaults** in the Halt #1\n  prompt — the user confirms or edits them before anything runs. Passed\n  values are never used unconfirmed.\n- If **either** is omitted, **prompt** the user for the missing\n  value(s) at Halt #1. Any value that *was* passed pre-fills its field\n  as the editable default.\n- `from` must be non-empty after confirmation. `to` may be empty\n  **only if the user explicitly intends deletion** (replace the string\n  with nothing); otherwise default an empty\u002Fblank `to` to the\n  `***REMOVED***` sentinel and show that in the Halt #1 confirmation so\n  the user sees what will be written.\n\nDo not echo a `from` value that is itself a live secret more than\nnecessary; it has to appear in the Halt #1 confirmation (the user must\nconfirm exactly what is being scrubbed), but do not repeat it\ngratuitously elsewhere in the conversation.\n\n---\n\n## Step 1: Pre-flight — repo root\n\nVerify you are inside a git working tree:\n\n```bash\ngit rev-parse --show-toplevel\n```\n\nTreat the path printed by this command as the **repo root** for the\nrest of the skill. The skill operates on the repo the user invoked it\nfrom. Do **not** assume `~\u002F.claude` or any other path.\n\nIf the command fails (non-zero exit, \"not a git repository\"), abort\nwith:\n\n> `\u002Fgh-repo-scrub-history` must be run from inside a git repository.\n> The current directory is not a git working tree.\n\n## Step 2: Pre-flight — local tooling\n\nVerify `git-filter-repo` is installed locally:\n\n```bash\ncommand -v git-filter-repo\n```\n\nIf it returns nothing (exit non-zero), abort with:\n\n> `git-filter-repo` is not installed. Install it with\n> `brew install git-filter-repo`, then re-run `\u002Fgh-repo-scrub-history`.\n\nDo **not** attempt to install it yourself — the user runs\n`brew install git-filter-repo` (host-integrity rule: no on-initiative\nhost-wide installs).\n\nAlso verify `gh` is authenticated (needed both to read the repo's\nvisibility in Step 3 and to push later):\n\n```bash\ngh auth status\n```\n\nIf `gh` reports the user is not authenticated, abort and tell them to\nrun `gh auth login` first.\n\n## Step 3: Pre-flight — repo visibility (posture branch)\n\nRead the repo's visibility:\n\n```bash\ngh repo view --json visibility -q .visibility\n```\n\n- If the value is `PRIVATE`: this is the normal, intended use. Note it\n  and continue.\n- If the value is anything else (`PUBLIC`, `INTERNAL`): this is the\n  **break-glass case**. Emit the loud warning below and continue — do\n  **not** refuse. Warn, then let the user decide.\n\n### Public-repo warning (break-glass)\n\nPrint this verbatim when visibility is not `PRIVATE`, before Halt #1:\n\n```text\n⚠️  WARNING: this repo is \u003Cvisibility>, not private.\n\nRewriting history on a public repo is a break-glass action. If a secret\nor sensitive string has been public, rewriting history helps but does\nNOT fully un-leak it:\n\n  - It may already be cached by GitHub, search engines, or the GitHub\n    Archive \u002F GH Archive datasets.\n  - It may have been forked; forks keep the old history independently.\n  - It may have been cloned, crawled, or scraped by third parties.\n  - Old commit SHAs may still be reachable via the GitHub API for a\n    while, and via anyone's existing clone indefinitely.\n\nIf a credential leaked publicly, ROTATE THE CREDENTIAL — that is the\nonly real remediation. This rewrite reduces casual exposure but is not\na substitute for rotation.\n\nThis skill will still proceed if you want it to.\n```\n\nThen continue to Halt #1. The warning informs; it does not block.\n\n## Step 4: Halt #1 — confirm strings, posture, and the exact invocation\n\nResolve the `from` \u002F `to` values per \"Inputs\" above (prompt for any\nnot passed; use passed values as editable defaults). Then build the\n**exact** `git filter-repo` invocation and show it to the user for\nexplicit approval before anything runs.\n\nThe skill writes a single-rule replacement file in the sandbox and\npoints `git filter-repo` at it with `--replace-text`. The replacement\nfile format is one rule per line, `\u003Cfrom>==>\u003Cto>`:\n\n- A **literal** substitution is the default: `\u003Cfrom>==>\u003Cto>`.\n- When `to` is the redaction sentinel and the user did not give an\n  explicit replacement, the rule is `\u003Cfrom>==>***REMOVED***`.\n- When the user explicitly intends deletion (replace with nothing),\n  the rule is `\u003Cfrom>==>` (empty right side).\n\n> **Critical — never hand-write `#` comment lines into this file, and\n> never strip-by-deny-list.** `git filter-repo --replace-text` does\n> **not** skip `#` lines: a bare `#` line is parsed as the literal\n> rule `# ==> ***REMOVED***`, which would corrupt every `#` in every\n> file (shebangs, comments, Markdown headings). This is a known\n> `git-filter-repo` behavior — the `--replace-text` parser treats every\n> non-empty line as a rule and does not recognize `#` as a comment\n> marker. This skill therefore writes a replacement file containing\n> **only the single real rule line and nothing else** — no header, no\n> comments, no blank lines. Do not add explanatory comments to the\n> generated file.\n\nPresent this halt verbatim (filling in the resolved values):\n\n```text\nAbout to REWRITE THIS REPO'S ENTIRE GIT HISTORY.\n\n  Repo:         \u003Cowner>\u002F\u003Cshort>   (\u003Cvisibility>)\n  Replace:      \u003Cfrom>\n  With:         \u003Cto>              (or \"(deleted)\" when the rule is \u003Cfrom>==> )\n  Rule written: \u003Cfrom>==>\u003Cto>     (in a sandbox replacements file)\n\nExact command that will run, against a fresh mirror clone in the\nsandbox:\n\n  git filter-repo --replace-text \u003Csandbox>\u002Freplacements.txt\n\nThis rewrites EVERY commit SHA from the first match onward. After the\nrewrite I will show you the diff\u002Fstat, then ask SEPARATELY before\nforce-pushing. Consequences, accepted by design:\n\n  - All commit SHAs change. Existing clones and forks are broken;\n    collaborators must re-clone or hard-reset.\n  - Open PRs built on the old SHAs will need to be recreated\u002Frebased.\n  - The force-push overwrites remote history and cannot be cleanly\n    undone once others have fetched it.\n\nProceed with the rewrite? (y to continue, or tell me what to change)\n```\n\nWait for explicit approval (`y`, `yes`, `go`, `do it`). If the user\nwants to change `from`, `to`, or cancel, update and re-display this\nhalt — do not proceed without confirmation. This halt approves the\n**rewrite**, not the push (the push has its own approval at Halt #2).\n\n## Step 5: Perform the rewrite in a sandbox clone\n\nDo the rewrite against a **fresh mirror clone in the sandbox**, never\nagainst the user's working clone directly. Mirroring first means the\nuser's working repo is untouched until the explicit force-push at\nHalt #2 — if anything looks wrong, the working clone and the remote\nare both still intact.\n\nAll scratch work goes under `\u003Crepo-root>\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\u002F`\n— never `\u002Ftmp\u002F`, never the home directory, never outside the repo.\n\n```bash\n# Capture the absolute repo root BEFORE building paths.\nREPO_ROOT=\"$(git rev-parse --show-toplevel)\"\nSANDBOX=\"$REPO_ROOT\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\"\nmkdir -p \"$SANDBOX\"\nWORK=\"$SANDBOX\u002Fscrub.git\"\nrm -rf \"$WORK\"\n# A mirror clone carries all refs (branches + tags) so the rewrite\n# covers the whole history, not just the current branch.\ngit clone --mirror \"$REPO_ROOT\" \"$WORK\"\n```\n\nWrite the single-rule replacement file (exactly one line, no comments\n— see the `#`-comment warning in Step 4). Use the `Write` tool to write\n`\u003CSANDBOX>\u002Freplacements.txt` containing only:\n\n```text\n\u003Cfrom>==>\u003Cto>\n```\n\nAlso use the `Write` tool to write a one-line needle file\n`\u003CSANDBOX>\u002Fneedle.txt` containing exactly the `from` value (no trailing\nrule syntax, no `==>`). Step 6's verification grep reads this file with\n`git grep -F -f` so the leak-shaped `from` string is never interpolated\nonto a shell command line:\n\n```text\n\u003Cfrom>\n```\n\nThen run the filter against the mirror clone. `--replace-text` defaults\nto operating on all refs in the mirror, so every branch and tag is\nrewritten.\n\nRun this as **two separate steps** — a bare `cd` into the sandbox\nmirror, then the bare `git filter-repo` command. Do **not** combine\nthem as `cd \"$WORK\" && git ...` (the `cd \u003Cpath> && git` form trips the\nharness's CVE-2025-59536 gate) or as a `( cd … ; … )` subshell:\n\n```bash\ncd \"$WORK\"\n```\n\n```bash\ngit filter-repo --replace-text \"$SANDBOX\u002Freplacements.txt\" --force\n```\n\n`--force` is required here: `git filter-repo` refuses to rewrite a repo\nthat is not a fresh, single-purpose clone, and the mirror clone in the\nsandbox is exactly such a throwaway, so `--force` is the correct flag.\n(It forces filter-repo to run against the already-cloned mirror; it is\nunrelated to the later `git push --force`.)\n\n## Step 6: Show what changed; report whether the string was found\n\nShow the user the effect of the rewrite before any push. You are still\n`cd`-ed into the sandbox mirror (`$WORK`) from Step 5, so these run as\nbare commands; if a prior Bash call reset the cwd, re-run `cd \"$WORK\"`\nfirst (its own Bash call, never `cd \"$WORK\" && git …`):\n\n```bash\ngit log --oneline -n 20\n```\n\nVerify the string is actually gone from the rewritten history. Pass the\n`from` value through a file and use `git grep -F -f` so the\nleak-shaped string is never interpolated into the shell command line\n(no quoting\u002Fescaping hazard, and the value stays off `ps` listings).\nFeed the refs to `git grep` via `xargs` reading\n`git rev-list --all` on stdin, so a repo with many refs cannot blow\n`ARG_MAX`:\n\n```bash\n# Write the search needle to a sandbox file (Write tool, not echo) so\n# the raw `from` value is never placed on a command line:\n#   \u003CSANDBOX>\u002Fneedle.txt  ->  a single line containing exactly \u003Cfrom>\n#\n# Then search every ref. Prints NOTHING if the scrub worked. Any output\n# means the string still survives somewhere (e.g. it appears in a\n# path\u002Ffilename, which --replace-text does not rewrite — only blob\n# CONTENT).\ngit rev-list --all | xargs git grep -I -n -F -f \"$SANDBOX\u002Fneedle.txt\" -- 2>\u002Fdev\u002Fnull | head\n```\n\nReport to the user:\n\n- Whether the string was found and replaced at all. If\n  `git filter-repo` reports **no replacements made**, tell the user\n  plainly: the string did not appear in any blob content. Possible\n  reasons — it never existed in history, it was already scrubbed, or it\n  exists only in a **filename\u002Fpath** or a **commit message** (neither\n  of which `--replace-text` rewrites; `--replace-text` is blob content\n  only). Ask whether they want to stop or proceed anyway.\n- The number of commits whose SHAs changed (the divergence point).\n\nThis step is read-only reporting. The next step is the destructive one.\n\n## Step 7: Halt #2 — confirm the force-push\n\nThe mirror clone in the sandbox now has the rewritten history, but\n**nothing has been pushed and the working clone is untouched.** Ask\nexplicitly before the force-push:\n\n```text\nThe rewrite is done in the sandbox and the string is no longer in the\nrewritten history. Nothing has been pushed yet.\n\nForce-pushing will OVERWRITE the remote's history on all rewritten\nbranches and tags. This is destructive and breaks existing clones,\nforks, and open PRs. It cannot be cleanly undone once others fetch it.\n\nForce-push the rewritten history to origin now? (y to push, or no to\nstop and leave the sandbox for inspection)\n```\n\nWait for explicit `y`\u002F`yes`\u002F`push`. If the user declines, stop and\ntell them the rewritten mirror is preserved at `\u003CWORK>` for inspection;\ndo not delete the sandbox.\n\nOn approval, force-push all rewritten refs from the mirror clone to the\n**real GitHub remote**.\n\n`git clone --mirror \"$REPO_ROOT\"` set the sandbox's `origin` to the\nuser's *local working clone path*, not to GitHub. The push must\ntherefore be re-pointed at the true remote **before** any force-push —\notherwise it rewrites the local working clone instead of GitHub. Do\nthis in order, each as its own Bash call (never `cd \"$WORK\" && git …`,\nnever `git -C \u003Cpath> …`):\n\nFirst, read the real remote URL from the working clone:\n\n```bash\ncd \"$REPO_ROOT\"\n```\n\n```bash\nREMOTE_URL=\"$(git remote get-url origin)\"\n```\n\nThen enter the sandbox mirror and re-point its `origin` at that URL:\n\n```bash\ncd \"$WORK\"\n```\n\n```bash\ngit remote set-url origin \"$REMOTE_URL\"\n```\n\nConfirm the re-point landed on GitHub (not the local path) before\npushing — this guards against an empty\u002Funset `REMOTE_URL`:\n\n```bash\ngit remote get-url origin\n```\n\nOnly once that prints the real GitHub URL, force-push all rewritten\nrefs to that explicit remote URL:\n\n```bash\ngit push --force --mirror \"$REMOTE_URL\"\n```\n\nPushing to the resolved `\"$REMOTE_URL\"` (rather than the bare name\n`origin`) makes the target unambiguous even if the re-point above were\nsomehow skipped. `--mirror` pushes all rewritten branches and tags so\nthe remote matches the scrubbed history exactly.\n\n## Step 8: Tell the user to refresh their working clone\n\nAfter the force-push, the user's **working clone still has the old,\npre-rewrite history** (the rewrite happened in the sandbox mirror, not\nthe working clone). They must reconcile it:\n\n```text\nForce-push complete. The remote now has the scrubbed history.\n\nYour working clone at \u003Crepo-root> still has the OLD history. Reconcile\nit with:\n\n    git fetch origin\n    git reset --hard origin\u002F\u003Ccurrent-branch>\n\nTell any collaborators to do the same (or re-clone). Their old clones\nand any forks still contain the old value until they do.\n\nIf a real credential leaked, ROTATE IT — the rewrite is not a\nsubstitute for rotation.\n```\n\nThen clean up the sandbox **only if every step succeeded**:\n\n```bash\nrm -rf \"$REPO_ROOT\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\"\n```\n\nLeave the sandbox in place if any step from 5 onward failed (or if the\nuser declined the push at Halt #2), so it can be inspected.\n\n---\n\n## Halts and approval gates (summary)\n\nThe skill **must** halt and wait for explicit user confirmation at:\n\n- **Halt #1 (Step 4)** — confirm the `from`\u002F`to` strings, the posture\n  (public-repo warning if applicable), and the exact `git filter-repo`\n  invocation. Approves the rewrite.\n- **Halt #2 (Step 7)** — confirm the force-push. Approves the\n  destructive remote overwrite. This is a separate approval from\n  Halt #1; \"yes\" at Halt #1 never implies the push.\n\n---\n\n## Hard constraints\n\n- **It is a history rewrite, not a working-tree edit.** A working-tree\n  substitution leaves the old value in every prior commit and does not\n  serve the leaked-secret purpose. Always use\n  `git filter-repo --replace-text` across all history.\n- **Warn, do not refuse, on a public repo.** Step 3 prints the\n  break-glass warning when visibility is not `PRIVATE`, then continues.\n  The user decides; the skill does not block.\n- **Show the exact command before running it; get approval before the\n  rewrite (Halt #1) AND before the force-push (Halt #2).** Two separate\n  approvals.\n- **Never hand-write `#` comments into the replacement file**, and\n  never feed filter-repo a file with comment\u002Fblank lines — `git\n  filter-repo --replace-text` does not treat `#` as a comment marker,\n  so bare `#` lines are parsed as literal rules and corrupt every `#`\n  in the repo. Write exactly one rule line.\n- **Do the rewrite in a sandbox mirror clone, never against the user's\n  working clone.** The working clone stays intact until the explicit\n  force-push, and is reconciled afterward (Step 8) with\n  `git fetch && git reset --hard`.\n- **SHA rewrite \u002F force-push \u002F broken clones & forks are accepted by\n  design.** Call them out at both halts; do not block on them.\n- **All scratch work goes under\n  `\u003Crepo-root>\u002F.claude\u002Ftmp\u002Fgh-repo-scrub-history\u002F`** — never `\u002Ftmp\u002F`,\n  never the home directory, never outside the repo. Clean up on\n  success; leave in place on failure or on a declined push.\n- **Never install `git-filter-repo` yourself.** Step 2 aborts with the\n  `brew install git-filter-repo` instruction; the user installs it.\n\n---\n\n## Out of scope\n\n- **`git-filter-repo` installation.** The user installs it out-of-band\n  (`brew install git-filter-repo`); Step 2 aborts if it is missing.\n- **Filename \u002F path scrubbing.** `--replace-text` rewrites blob\n  *content* only. A secret that appears in a filename or directory name\n  is not removed by this skill; Step 6 reports when the string survives\n  for this reason. Path-based filtering (`--path`, `--invert-paths`) is\n  a different operation, out of scope here.\n- **Commit-message scrubbing.** `--replace-text` does not touch commit\n  messages (`--replace-message` is a separate pass). Out of scope for\n  this skill, which targets blob content.\n- **Credential rotation.** The skill reminds the user to rotate a\n  leaked credential, but rotating it is the user's responsibility and\n  outside this skill.\n- **Coordinating collaborators' re-clones.** The skill tells the user\n  what to communicate (Step 8) but cannot force others to refresh their\n  clones or forks.\n- **Making the repo public.** That is `gh-repo-setup-public` (issue\n  #92), which points at this skill as its pre-flip gate. This skill\n  only scrubs; it does not change visibility.\n",{"name":5,"description":7},"main","4b187366f06afb374243166f6a0f5fc1514fa579","plugins\u002Fgithub-setup\u002Fskills\u002Fgh-repo-scrub-history","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace","https:\u002F\u002Fgithub.com\u002FTheVoskamps","2026-11-14 13:16:57",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add TheVoskamps\u002Fclaude-plugins-marketplace --skill gh-repo-scrub-history",{"tool":36,"command":37},"bunx","bunx skills add TheVoskamps\u002Fclaude-plugins-marketplace --skill gh-repo-scrub-history",{"tool":39,"command":40},"pnpm","pnpm dlx skills add TheVoskamps\u002Fclaude-plugins-marketplace --skill gh-repo-scrub-history","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fgithub-setup\u002Fskills\u002Fgh-repo-scrub-history\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M77KH3GAXPPXNQS96KDEEZBS","mask-inappropriate-language","Replace inappropriate language (profanity, slurs, strong insults) in provided text or a file with asterisks, character-for-character, preserving everything else.","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwriting-tools\u002Fskills\u002Fmask-inappropriate-language\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M77KGY5TZDQT8QR23Y0R8P7A","theorem-agents-interface","The interface between the sdlc reviewer and the theorem agents it spawns — what each double-dash brief parameter means, and what each consequence class means. Preloaded into every theorem agent (sdlc:theorem-generator, the disprover, and the verifier) via its skills frontmatter, and read by name by the sdlc:theorem-based-pr-reviewer agent for what its briefs' parameters mean; not invoked from the user's slash menu.","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Ftheorem-agents-interface\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M77KGT5HW0XAE500WSSM0PZY","sdlc-config-user","Interactively create or merge-update the repo user sdlc config, `\u003Crepo-root>\u002F.sdlc\u002Fuser-config.yml` (tier 3 — this user, this repo, never committed), and add it to the repo's tracked `.gitignore`.","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsdlc-config-user\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M77KGQGQVB0NYZX0WJRJPDEK","sdlc-config-repo","Interactively create or merge-update the shared repo sdlc config, `\u003Crepo-root>\u002F.sdlc\u002Frepo-config.yml` (tier 2 — tracked, every user of this repo).","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsdlc-config-repo\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M77KGKPEN7C5RCEDSEP3Z1XB","sdlc-config-global","Interactively create or merge-update the global user sdlc config, `$XDG_CONFIG_HOME\u002Fsdlc\u002Fuser-config.yml` (tier 1 — this user, every repo on this machine).","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fsdlc-config-global\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M77KGFX95J2XEQBBD49QHTXK","pr-read-cli-interface","The contract for sdlc's PR-read CLIs — sdlc-pr-round, sdlc-pr-adjustments, sdlc-fixer-brief and sdlc-records-chain — their arguments, exit codes and output grammar. Preloaded into sdlc:theorem-based-pr-reviewer, sdlc:issue-fixer, sdlc:docs-writer and sdlc:pr-finalizer via their skills frontmatter; not invoked from the user's slash menu.","https:\u002F\u002Fgithub.com\u002FTheVoskamps\u002Fclaude-plugins-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fpr-read-cli-interface\u002FSKILL.md",[],[]]