Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install vivekkarmarkar-claude-code-os-skills-gitinitgit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-gitinit/SKILL.md# Git Init — Initialize a Git Repo Set up a GitHub repo for the current project in one step. ## Arguments `$ARGUMENTS` — Parse for two optional pieces: 1. **Visibility**: `public` or `private` (case-insensitive). If not provided, ASK the user: "Public or private?" and wait for their answer before proceeding. 2. **Project name**: Any other word that isn't `public`/`private`. Used as the GitHub repo name. If not provided, use the current directory name. Examples: - `/gitinit` — asks public or private, uses current folder name - `/gitinit private` — private repo, current folder name - `/gitinit public` — public repo, current folder name - `/gitinit private my-cool-app` — private repo named "my-cool-app" - `/gitinit my-cool-app public` — public repo named "my-cool-app" (order doesn't matter) ## Workflow ### Step 1: Pre-flight Checks 1. Check if the current directory already has a git repo (`git rev-parse --git-dir`). - If yes, tell the user: "This directory is already a git repo." Then check if it has a GitHub remote — if not, offer to create one. If it does, stop. 2. Check that `gh` CLI is installed and authenticated (`gh auth status`). - If not, tell the user to run `gh auth login` first. ### Step 2: Determine Visibility - If `$ARGUMENTS` contains `public` or `private` (case-insensitive) → use that. - If neither is specified → **ASK the user**: "Public or private?" Do NOT proceed until they answer. ### Step 3: Initialize 1. Run `git init` 2. Create a `.gitignore` appropriate for the project. Scan the directory for clues: - If `package.json` exists → Node.js gitignore (node_modules, dist, .env, etc.) - If `requirements.txt` or `pyproject.toml` exists → Python gitignore (__pycache__, venv, .env, etc.) - If `Cargo.toml` exists → Rust gitignore (target/, etc.) - If `go.mod` exists → Go gitignore - If none of the above, use a minimal universal gitignore (.env, .DS_Store, *.log, tmp/) - Always include: `.env`, `.env.local`, `.DS_Store`, `*.log` 3. Stage everything: `git add -A` 4. Create initial commit: `git commit -m "Initial commit"` ### Step 4: Create GitHub Repo 1. Determine the repo name: - Use the project name from arguments if provided - Otherwise use the current directory name (`basename "$PWD"`) 2. Run: `gh repo create <repo-name> --<visibility> --source=. --push` 3. Confirm to the user: ``` Repo created: https://github.com/<username>/<repo-name> (<visibility>) ``` ## Rules - **Never overwrite an existing .gitignore.** If one already exists, leave it alone. - **Don't commit secrets.** If you spot `.env` files, credentials, or API keys in the directory, make sure they're in `.gitignore` before the initial commit. - **Keep it simple.** No branches, no worktrees, no CI setup. Just init, commit, push. Done.