Skip to main content
command CX Codex

repo-init — Claude Code command: what it does, how to install

repo-init turns an empty folder into a pushed GitHub repository in one go: directory, git init, gh repo create, README, first commit and push.

MIT ★ 763 updated 2026-03-31

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/commands/repo-init.md
Open on GitHub

What repo-init does

Hand it a repository name and it runs the whole chain. mkdir and git init come first, then gh repo create <repository-name> --private, a README.md headed with the project name, git add and the initial commit. The origin remote is then built over SSH from gh api user, the branch is renamed to main, and git push -u origin main closes it out.

Private is the default. Ask for a public repo in the same request if that is what you need. Work happens on your machine through Bash and Write, so gh must be installed and logged in, and the GitHub account needs the SSH key the remote points at. Without an authenticated gh, step three stops dead.

Seven steps, each written out. A missing prerequisite surfaces early rather than after a half-built repository, which is the useful part. Check gh access and your SSH key before you start.

What it helps with

  • create a private GitHub repo without leaving the terminal
  • land the initial commit right after the repo exists
  • wire an SSH origin to your own account
  • start a project with a README and a main branch already there

Example prompts for the agent

  • Run /repo-init billing-service and show me what the first commit contains
  • /repo-init docs-site — make this one public
  • Use /repo-init internal-api and push it to main

How to install repo-init

Manually: put the files in place

.claude/commands/repo-init.md

Call it with /repo-init. For all projects use ~/.claude/commands/

Questions about repo-init

How do I install repo-init in Claude Code?

Put the command file at .claude/commands/repo-init.md in your project. It then runs as /repo-init <repository-name>.

What does repo-init do?

It creates the directory, initialises git, makes the GitHub repo with gh, writes a README.md, commits and pushes to main.

What has to be set up beforehand?

A logged-in gh CLI and an SSH key on the GitHub account. The origin remote is added over SSH, so HTTPS credentials alone will not do.

Source text

repo-init.md · MIT
---
allowed-tools: Bash, Write, TodoWrite
description: Create a new GitHub repository with proper setup including directory creation, git initialization, and remote configuration
category: workflow
argument-hint: "<repository-name>"
---

# GitHub Repository Setup

Create a new GitHub repository named "$ARGUMENTS" with proper directory structure and git setup.

**Note:** The repository will be created as **private** by default for security. If you need a public repository, please specify "public" in your request.

## Steps to execute:

1. Create a new directory named "$ARGUMENTS"
2. Initialize a git repository in that directory
3. Create the GitHub repository using gh CLI
4. Create a basic README.md file
5. Make an initial commit
6. Set up the remote origin
7. Push to GitHub

## Commands:

```bash
# Create the directory
mkdir "$ARGUMENTS"
cd "$ARGUMENTS"

# Initialize git repository
git init

# Create GitHub repository using gh CLI (private by default)
gh repo create "$ARGUMENTS" --private

# Create README.md
echo "# $ARGUMENTS" > README.md
echo "" >> README.md
echo "A new repository created with GitHub CLI." >> README.md

# Initial commit
git add README.md
git commit -m "Initial commit"

# Add remote origin (using SSH)
git remote add origin "[email protected]:$(gh api user --jq .login)/$ARGUMENTS.git"

# Push to GitHub
git branch -M main
git push -u origin main
```

Execute these commands to create the repository.

© carlrannaberg · MIT · carlrannaberg/claudekit

Similar slash commands

All slash commands for Git and GitHub →

From the same set54

The whole set →

Project sponsors

Companies that keep this analytics open