From private-repo
Separate directories from a public repo into private or public GitHub repos using git submodules. Controls visibility (public/private) per directory while keeping the monorepo structure intact. Responds to natural language like "make this private", "split into private repo", "separate as submodule".
How this skill is triggered — by the user, by Claude, or both
Slash command
/private-repo:private-repoThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Separates directories from the current repository into independent GitHub repositories using git submodules, with explicit **public/private visibility control** per directory.
Separates directories from the current repository into independent GitHub repositories using git submodules, with explicit public/private visibility control per directory.
Core concept: A public monorepo can contain a mix of public and private submodules. Other users who clone the public repo will see the full project structure, but private submodule directories appear as empty folders — the private code is only accessible to authorized users.
my-project/ (public repo)
├── core/ (inline — visible to everyone)
├── docs/ (inline — visible to everyone)
├── feature-a/ (submodule → public repo — visible to everyone)
├── feature-b/ (submodule → private repo — empty folder for others)
└── my-ideas/ (submodule → private repo — empty folder for others)
/private-repo — list eligible directories and choose/private-repo my-service — extract my-service/ immediately/private-repo dir1 dir2 — batch extract multiple directoriesgh CLI authenticated (gh auth status).gitmodules).git, .github, .claude, node_modules, build, dist, out, .gradle, .venv, venv| # | Directory | Git History | Status |
|---|---------------|---------------|----------------|
| 1 | my-service/ | 12 commits | Extractable |
| 2 | my-idea/ | untracked | Extractable |
| 3 | lib-internal/ | 5 commits | Extractable |
Use AskUserQuestion to let the user select.
Before proceeding, display and confirm:
gh api user --jq '.login'{current-repo-name}-{directory}, customizableVisibility selection — Use AskUserQuestion:
Use AskUserQuestion for repo name:
{repo-name}-{directory} (Recommended)# --private or --public based on user's visibility choice
gh repo create {owner}/{repo-name} --{visibility} \
--description "{directory} — submodule extracted from {current-repo}"
If git history exists (directory has commits in git log):
# Extract directory history into a temporary branch
git subtree split -P {directory} -b split-{directory}
# Push to new repo from temp location
cd /tmp && mkdir {repo-name} && cd {repo-name}
git init && git pull {original-repo-path} split-{directory}
git remote add origin https://github.com/{owner}/{repo-name}.git
git branch -M main && git push -u origin main
# Cleanup
cd {original-repo-path}
git branch -D split-{directory}
rm -rf /tmp/{repo-name}
If no git history (untracked or gitignored):
cd /tmp && mkdir {repo-name} && cd {repo-name}
git init
cp -r {original-repo-path}/{directory}/* .
cp -r {original-repo-path}/{directory}/.* . 2>/dev/null
git add -A && git commit -m "initial: extract {directory}"
git remote add origin https://github.com/{owner}/{repo-name}.git
git branch -M main && git push -u origin main
cd {original-repo-path}
rm -rf /tmp/{repo-name}
# Remove from git tracking and filesystem
git rm -r --cached {directory} 2>/dev/null
rm -rf {directory}
# Remove from .gitignore if present (use Edit tool)
# Add as submodule
git submodule add https://github.com/{owner}/{repo-name}.git {directory}
git add .gitignore .gitmodules {directory}
git commit -m "chore: extract {directory} as private submodule → {owner}/{repo-name}"
Report to user:
git submodule status)git clone --recurse-submodules required for full checkoutWhen multiple directories are given (/private-repo dir1 dir2 dir3):
If the user wants to reverse the extraction:
# Remove submodule
git submodule deinit -f {directory}
git rm -f {directory}
rm -rf .git/modules/{directory}
# Restore as regular directory
git clone https://github.com/{owner}/{repo-name}.git {directory}
rm -rf {directory}/.git
git add {directory}
git commit -m "chore: inline {directory} back from submodule"
| Scenario | Action |
|---|---|
gh auth status fails | Prompt gh auth login |
| Repo name already exists | Ask to use existing or pick new name |
subtree split fails | Fall back to no-history extraction |
submodule add fails (residual files) | Clean .git/modules/{dir} and retry |
| No directories eligible | Inform user all dirs are already submodules or excluded |
| Push fails (auth) | Run gh auth setup-git and retry |
npx claudepluginhub 1989v/ai --plugin private-repoPushes monorepo subdirectories to standalone GitHub repos via git subtree. Detects changes, registers new projects, and automates incremental pushes after commits.
Copies patterns, setup, or structure from another project into the current session. Also supports fix-and-PR mode to submit bug fixes to referenced projects.
Creates and manages multi-repo workspaces for AI coding assistants (Claude Code, Codex) by unifying configs from sibling git repos and supporting worktree-based feature branches.