Clone a Git or GitHub repository into the current workspace or local folder after checking and confirming the active Git user, verify the cloned contents, and inspect initial project files. Use whenever the user asks to clone a repository, import a repo from GitHub/GitLab, or fetch a remote codebase locally.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Clone Github Repo?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/henryhyunwookim-clone-github-repo-7a46d080)
---
name: clone-github-repo
description: Clone a Git or GitHub repository into the current workspace or local folder after checking and confirming the active Git user, verify the cloned contents, and inspect initial project files. Use whenever the user asks to clone a repository, import a repo from GitHub/GitLab, or fetch a remote codebase locally.
---
# Clone GitHub Repository Skill
Use this skill when the user requests to clone a Git or GitHub repository into the current local directory or a specified folder.
## Workflow
### 1. Identify Target Directory and Repository URL
- **Repository URL**:
- Accept standard GitHub/GitLab/Bitbucket URLs (e.g., `https://github.com/<owner>/<repo>`, `https://github.com/<owner>/<repo>.git`, or SSH `git@github.com:<owner>/<repo>.git`).
- If the user provides a shorthand like `<owner>/<repo>`, resolve it to `https://github.com/<owner>/<repo>.git`.
- Extract the repository name (e.g., `AI-news-aggregator-KRJP` from `https://github.com/henryhyunwookim/AI-news-aggregator-KRJP`).
- **Target Folder**:
- By default, clone into the current working directory / active workspace folder.
- If the user specified a custom directory or subfolder name, resolve the path accordingly.
- **Important**: Never use the `cd` command. Instead, pass the absolute path to the target folder in the `Cwd` parameter of `run_in_terminal`.
### 2. Pre-Check Destination
- Before cloning, check if a folder with the repository's name already exists in the target directory using `list_dir`.
- If the directory already exists and contains files:
- Warn the user or ask how to proceed (e.g., clone into a different directory name, pull updates, or overwrite/clean up).
- Do not blindly run `git clone` into an existing non-empty directory as Git will abort with an error.
### 3. Check & Confirm Active Git User (Mandatory Gate)
- **Before running `git clone` or any Git action**, inspect the current active Git user and GitHub authentication state (read-only) using `run_in_terminal`:
```powershell
git config --show-origin --get user.name
git config --show-origin --get user.email
if (Get-Command gh -ErrorAction SilentlyContinue) { gh auth status }
```
*(On POSIX shells, check `gh` with `command -v gh >/dev/null && gh auth status`. Never print or expose raw tokens or credentials.)*
- Present the detected identity clearly to the user:
- **Active Git `user.name`** and **`user.email`** (including config source/scope, or a warning if unset).
- **Active GitHub CLI account** (if `gh` is installed, highlighting any other logged-in accounts or potential mismatch with the target repository owner/organization).
- **Target repository URL** and destination folder.
- **Stop and ask the user for explicit confirmation** before executing `git clone`:
- Ask whether to proceed with this active Git user/account, or whether to switch accounts first (e.g., `gh auth switch --user <account>`) or configure a repository-local `user.name`/`user.email` immediately after cloning.
- **Do NOT execute `git clone`** until the user explicitly confirms.
### 4. Execute the Clone Command
- Once the user confirms the active Git user:
- If the user requested switching the active GitHub account first, run `gh auth switch --user <account>` and re-verify before cloning.
- Use `run_in_terminal` with:
- `CommandLine`: `git clone <repository_url>` (or `git clone <repository_url> <custom_dir_name>` if a custom name is desired).
- If user asks for shallow clone or specific branch: add `--depth 1` or `-b <branch_name>`.
- `Cwd`: Target folder where the cloned repo directory will be created.
- `WaitMsBeforeAsync`: Set to a reasonable timeout (e.g., `10000` to `20000` ms) to allow the clone process to complete synchronously.
- If the user requested a specific repository-local Git identity for the cloned repo, configure it immediately after cloning and verify:
```powershell
git -C "<cloned_dir>" config --local user.name "<name>"
git -C "<cloned_dir>" config --local user.email "<email>"
```
### 5. Verify Cloned Content
- Once the command succeeds, list the cloned directory using `list_dir` to confirm the folder structure and verify that files exist.
- Identify key landmark files:
- `README.md` / `README`
- Dependencies/package files: `requirements.txt`, `pyproject.toml`, `package.json`, `pom.xml`, `go.mod`, `Cargo.toml`, etc.
- Environment/configuration templates: `.env.example`, `config.yaml`, `Dockerfile`, etc.
### 6. Report to User
- Provide a concise summary of the clone result including:
- Repository name, full local path, and confirmed active Git user (plus repo-local override if configured).
- Clickable markdown links (`file:///...`) to the cloned directory and key landmark files (README, config, package files).
- A brief note on detected project type (e.g., Python, Node.js, Go) and recommended next setup steps (e.g., virtual environment creation, dependency installation) if relevant.