repo-create
Creates or connects a GitHub repo for the current project. Use when no remote origin exists, or to change repo visibility. Asks before acting.
repo-create
Set up a GitHub repository for the project. This skill handles three scenarios: the user has no repo yet, the user has an existing repo to connect, or the user wants a new repo created. It never assumes — it asks.
When to use
- User says "create a repo", "init git", "push to GitHub."
- A scaffolded project has no
.git/directory or no remote origin. - User wants to change repo visibility or reconnect to a different remote.
Inputs
| Input | Source | Required |
|---|---|---|
| Project root path | cwd or user prompt | Yes |
| Repo name | User prompt (ask if not given) | Yes |
| Visibility | User prompt (ask every time) | Yes |
| Existing repo URL | User prompt (if connecting) | No |
Instructions
-
Ask before acting. Start with these questions — do not skip any:
- "Do you already have a GitHub repo for this project?"
- If yes: "What's the repo URL?" Then skip to step 5.
- If no: "What should the repo be named?"
- Always ask visibility: "Public or private?" Do not default. The user decides every time because the wrong visibility leaks code or blocks collaboration.
-
Check prerequisites. Verify
gitis installed andghCLI is authenticated (gh auth status). Ifghis not available, fall back togit+ GitHub API via the MCP GitHub tools. Tell the user which path you're taking. -
Initialize local git (if
.git/doesn't exist):cd <project-root> git init -
Create the GitHub repo. Use the
ghCLI:gh repo create <repo-name> --<visibility> --source=. --remote=originIf
ghis unavailable, use the GitHub MCPcreate_repositorytool, then add the remote manually:git remote add origin <repo-url> -
Connect to existing repo (if user provided a URL):
git remote add origin <repo-url> git fetch originIf a remote named
originalready exists and points somewhere else, ask before overwriting. Silently clobbering a remote loses work — always confirm. -
Ensure .gitignore exists. If
project-scaffoldalready ran, it will be there. If not, create a sensible default (node_modules, .env, .DS_Store, artifacts/, pycache). Never commit secrets — the .gitignore is your first line of defense. -
Initial commit and push:
git add . git commit -m "chore: initial project scaffold" git branch -M main git push -u origin mainIf there's already commit history, skip the initial commit — just push.
-
Confirm. Print the repo URL and confirm the push succeeded.
Exit condition
- GitHub repo exists (created or pre-existing).
- Local
.git/is initialized withoriginremote pointing to the repo. - At least one commit is pushed to
main. - User has seen the repo URL.
Examples
User: "Create a repo for this project"
Action: Ask repo name and visibility. Create repo, init git, push initial
commit. Print URL.
User: "I already have a repo at github.com/user/my-project"
Action: Add remote origin, fetch, confirm connection. Do not create a new repo.
User: "Set up git, call it dash-ui, make it private"
Action: Create private repo named dash-ui, init, push. No need to ask
visibility — user already specified.
User: "Push to GitHub"
Action: Check if git is initialized and remote exists. If not, ask the
prerequisite questions. If yes, just push.
Cross-cutting
Before completing, read and follow ../references/cross-cutting-rules.md.