github-clone

BraelinC 的头像作者 BraelinC

将GitHub仓库克隆到Daytona沙箱环境中并设置开发环境。当Claude需要:(1) 将仓库克隆到沙箱中,(2) 从Git仓库设置开发环境,(3) 在沙箱中拉取代码进行分析或修改,(4) 安装依赖并启动开发服务器。需要CONVEX_SITE_URL环境变量和有效的沙箱ID。

📖 中文导读:将GitHub仓库克隆到Daytona沙箱环境中并设置开发环境。当Claude需要:(1) 将仓库克隆到沙箱中,(2) 从Git仓库设置开发环境,(3) 在沙箱中拉取代码进行分析或修改,(4) 安装依赖并启动开发服务器。需要CONVEX_SITE_URL环境变量和有效的沙箱ID。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: github-clone description: Clone GitHub repositories into Daytona sandbox environments and set up development environments. Use when Claude needs to: (1) Clone a repository into a sandbox, (2) Set up a development environment from a Git repo, (3) Pull code for analysis or modification in sandbox, (4) Install dependencies and start dev servers. Requires CONVEX_SITE_URL environment variable and a valid sandbox ID.

GitHub Clone & Dev Environment Setup

Clone repositories and set up development environments in Daytona sandboxes.

Configuration

export CONVEX_SITE_URL="https://calculating-hummingbird-542.convex.site"

Clone Repository

curl -X POST "$CONVEX_SITE_URL/api/sandbox/git/clone" \
  -H "Content-Type: application/json" \
  -d '{
    "sandboxId": "SANDBOX_ID",
    "repoUrl": "https://github.com/owner/repo.git",
    "branch": "main",
    "targetPath": "/home/user/projects/repo"
  }'

Parameters:

  • sandboxId (required): The Daytona sandbox ID
  • repoUrl (required): Full Git URL (HTTPS)
  • branch (optional): Branch to checkout (default: default branch)
  • targetPath (optional): Clone destination (default: /home/daytona/projects/{repo-name})

Returns: {"success": true, "path": "/home/daytona/projects/repo", "output": "..."}

Complete Development Setup Workflow

1. Clone the Repository

curl -X POST "$CONVEX_SITE_URL/api/sandbox/git/clone" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "repoUrl": "https://github.com/BraelinC/planner"}'

2. Check Repository Structure

curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "command": "ls -la /home/daytona/projects/planner"}'

3. Install Dependencies

For Node.js projects:

curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "command": "cd /home/daytona/projects/planner && npm install", "timeout": 120}'

For Python projects:

curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "command": "cd /home/daytona/projects/planner && pip install -r requirements.txt", "timeout": 120}'

4. Start Development Server

Run in background:

curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "command": "cd /home/daytona/projects/planner && npm run dev &"}'

5. Open Browser to View App

Option A: Use terminal to open browser

curl -X POST "$CONVEX_SITE_URL/api/sandbox/execute" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "command": "firefox http://localhost:3000 &"}'

Option B: Click on browser icon in taskbar First take screenshot to see the desktop, then click on browser icon.

6. Take Screenshot to Verify

curl -X POST "$CONVEX_SITE_URL/api/sandbox/screenshot" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "compressed": true, "quality": 80}'

Common Project Types

Next.js / React

# Install
npm install
# Dev server
npm run dev
# Default port: 3000

Vite

# Install
npm install
# Dev server
npm run dev
# Default port: 5173

Python Flask/Django

# Install
pip install -r requirements.txt
# Flask
flask run
# Django
python manage.py runserver
# Default port: 5000 (Flask) or 8000 (Django)

Editing Code

Read a file

curl -X POST "$CONVEX_SITE_URL/api/sandbox/fs/read" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "path": "/home/daytona/projects/planner/src/App.tsx"}'

Write changes

curl -X POST "$CONVEX_SITE_URL/api/sandbox/fs/write" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId": "abc123", "path": "/home/daytona/projects/planner/src/App.tsx", "content": "..."}'

Hot reload

Most dev servers auto-reload on file changes. Take a screenshot to verify.

Tips

  • Clone timeout is 120 seconds by default for large repos
  • Public repos work without authentication
  • Check package.json or requirements.txt to understand the project
  • Use cat package.json to see available npm scripts
  • Start dev servers with & to run in background
  • Take screenshots after starting server to verify it's running

Known Constraints

⚠️ CONSTRAINT: Default sandbox has only 1GB RAM - large npm/bun installs will be killed (OOM).

  • Monorepos with many dependencies need 2-4GB RAM
  • Install bun via npm: npm install -g bun

⚠️ CONSTRAINT: The sandbox user is daytona, not user.

  • Clone to /home/daytona/projects/ not /home/user/projects/

⚠️ CONSTRAINT: Tier 1-2 sandboxes cannot curl arbitrary URLs.

  • Connection reset errors for non-whitelisted domains
  • npm/pip registries work fine

✅ BEST PRACTICE: For workspace:* dependencies, use bun or pnpm (npm doesn't support workspace protocol).