| name | create-repo |
| description | Create a new GitHub repository, scaffold a project, and push it. Use when the user describes a new project they want to build. |
Skill: Create Repository & Scaffold Project
Overview
This skill creates a new GitHub repo, scaffolds initial project files based on the user's description, pushes everything, and provides the user with next steps. All operations use the GITHUB_PAT environment variable for authentication.
Prerequisites
GITHUB_PAT environment variable must be set (validated by SessionStart hook)
GITHUB_USER environment variable is set by the SessionStart hook
- Network access must be "Full internet" in the Claude Code Web environment
Procedure
1. Parse the User's Request
Extract:
- Project name → sanitize to a valid GitHub repo name (lowercase, hyphens, no spaces)
- Language / framework → determines scaffold template
- Description → one-line for the GitHub repo description
- Visibility → default to
private unless user says otherwise
2. Check if Repo Already Exists
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $GITHUB_PAT" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$GITHUB_USER/<repo-name>")
if [ "$HTTP_CODE" = "200" ]; then
echo "Repository already exists!"
fi
3. Create the Repository
Option A: Bare repo with auto_init
curl -sf -X POST \
-H "Authorization: Bearer $GITHUB_PAT" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/user/repos \
-d '{
"name": "<repo-name>",
"description": "<description>",
"private": true,
"auto_init": true
}'
Option B: From a template repo (if templates exist)
curl -sf -X POST \
-H "Authorization: Bearer $GITHUB_PAT" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$GITHUB_USER/<template-repo>/generate" \
-d '{
"owner": "'$GITHUB_USER'",
"name": "<repo-name>",
"description": "<description>",
"private": true
}'
4. Wait for Repo Initialization
GitHub needs a moment after creation. Poll until the repo has at least one commit:
for i in $(seq 1 10); do
COMMIT_COUNT=$(curl -sf \
-H "Authorization: Bearer $GITHUB_PAT" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/$GITHUB_USER/<repo-name>/commits?per_page=1" \
| jq 'length')
if [ "$COMMIT_COUNT" -gt 0 ]; then
break
fi
sleep 2
done
5. Clone with PAT Auth
CRITICAL: Use PAT in the HTTPS URL. This bypasses the sandbox's scoped git proxy and authenticates directly.
cd /tmp
git clone "https://$GITHUB_PAT@github.com/$GITHUB_USER/<repo-name>.git"
cd <repo-name>
git config user.name "Claude"
git config user.email "noreply@anthropic.com"
6. Scaffold the Project
Generate project files based on the user's description. Common scaffolds:
For any project — always create:
README.md — project name, description, setup instructions
.gitignore — language-appropriate
CLAUDE.md — coding standards, build commands, architecture notes
Language-specific scaffolding:
Use your knowledge to create appropriate project structure. Some examples:
- Swift/iOS: Xcode project structure, Package.swift for SPM, or basic source layout
- TypeScript/Node:
package.json, tsconfig.json, src/index.ts
- Ruby:
Gemfile, lib/ directory, .ruby-version
- C/C++:
CMakeLists.txt or Makefile, src/, include/
- React/Web: Vite or Next.js scaffold
- Python:
pyproject.toml, src/ package, requirements.txt
7. Commit and Push
git add -A
git commit -m "Initial scaffold: <short description>"
git push "https://$GITHUB_PAT@github.com/$GITHUB_USER/<repo-name>.git" main
8. Clean Up
Remove the cloned directory to avoid leaking the PAT (it's in .git/config):
cd /
rm -rf "/tmp/<repo-name>"
9. Report to User
Provide:
✅ Repository created: https://github.com/<user>/<repo-name>
📁 Scaffolded files:
- README.md
- CLAUDE.md
- .gitignore
- <list other files>
🚀 Next steps:
1. Open Claude Code: https://claude.ai/code
2. Select repository: <repo-name>
3. Describe what you want to build — Claude will have the scaffold ready
💡 Or continue here if you want me to add more files before you switch.
Error Handling
- PAT invalid/expired: Tell user to update
GITHUB_PAT in their environment settings
- Repo name taken: Suggest alternatives (append
-2, date suffix, etc.)
- Network unreachable: Verify environment is set to "Full internet access"
- Push rejected: Check if repo was actually initialized (needs at least one commit)
Security Notes
- Never
echo $GITHUB_PAT or write it to committed files
- The PAT appears in
.git/config of the cloned repo — always rm -rf after push
- Never commit
.git/config or any file containing the PAT
- The PAT is scoped to the user's GitHub account — treat it like a password