一键导入
create-repo
Create a new GitHub repository, scaffold a project, and push it. Use when the user describes a new project they want to build.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new GitHub repository, scaffold a project, and push it. Use when the user describes a new project they want to build.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| 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. |
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.
GITHUB_PAT environment variable must be set (validated by SessionStart hook)GITHUB_USER environment variable is set by the SessionStart hookExtract:
private unless user says otherwiseHTTP_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
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
}'
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
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"
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-appropriateCLAUDE.md — coding standards, build commands, architecture notesLanguage-specific scaffolding:
Use your knowledge to create appropriate project structure. Some examples:
package.json, tsconfig.json, src/index.tsGemfile, lib/ directory, .ruby-versionCMakeLists.txt or Makefile, src/, include/pyproject.toml, src/ package, requirements.txtgit add -A
git commit -m "Initial scaffold: <short description>"
git push "https://$GITHUB_PAT@github.com/$GITHUB_USER/<repo-name>.git" main
Remove the cloned directory to avoid leaking the PAT (it's in .git/config):
cd /
rm -rf "/tmp/<repo-name>"
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.
GITHUB_PAT in their environment settings-2, date suffix, etc.)echo $GITHUB_PAT or write it to committed files.git/config of the cloned repo — always rm -rf after push.git/config or any file containing the PAT