AgentSkillsCN

run-local

自动安装依赖、编排服务并进行健康检查,快速启动本地开发环境。当开发者希望在本地运行、启动开发服务器、上线应用,或快速搭建开发环境时,可使用此功能。

SKILL.md
--- frontmatter
name: run-local
description: Start local development environment with automatic dependency installation, service orchestration, and health checks. Use when developers ask to run locally, start dev server, launch the app, or spin up the development environment.
user-invocable: true
model: haiku
allowed-tools:
  - Bash
  - Read
  - Write
  - Glob
  - Grep
  - AskUserQuestion

Run Local - Development Environment Manager

Automatically detect, configure, and start local development environments for any project.

Commands

  • /run-local - Start local development (creates run script if missing)
  • /run-local status - Check health of all running services
  • /run-local stop - Stop all running services
  • /run-local logs - Show aggregated logs from all services

What It Does

This skill automatically:

  1. Checks for existing .run-local.json config or scripts/run-local.sh
  2. If missing, analyzes the project to detect services and dependencies
  3. Creates a run script tailored to the project
  4. Installs all required dependencies
  5. Starts all services (backend, frontend, databases, etc.)
  6. Runs health checks to confirm everything is working

Discovery Flow

When run in a project without configuration:

code
Analyzing project structure...

Detected Services:
| Service    | Type       | Port  | Start Command           |
|------------|------------|-------|-------------------------|
| api        | Node.js    | 3001  | npm run dev             |
| frontend   | Next.js    | 3000  | npm run dev             |
| postgres   | Database   | 5432  | docker-compose up -d    |
| redis      | Cache      | 6379  | docker-compose up -d    |

Dependencies to install:
- Node.js packages (package.json)
- Python packages (requirements.txt)
- Docker containers (docker-compose.yml)

Proceed with setup? [Yes/No]

Configuration

The skill uses .run-local.json in the project root:

json
{
  "services": [
    {
      "name": "api",
      "type": "nodejs",
      "path": "./apps/api",
      "port": 3001,
      "start": "npm run dev",
      "healthCheck": "http://localhost:3001/health",
      "env": {
        "NODE_ENV": "development"
      }
    },
    {
      "name": "frontend",
      "type": "nextjs",
      "path": "./apps/web",
      "port": 3000,
      "start": "npm run dev",
      "healthCheck": "http://localhost:3000",
      "dependsOn": ["api"]
    },
    {
      "name": "postgres",
      "type": "docker",
      "container": "postgres:15",
      "port": 5432,
      "healthCheck": "pg_isready -h localhost -p 5432"
    }
  ],
  "dependencies": {
    "install": [
      { "path": ".", "command": "pnpm install" },
      { "path": "./apps/api", "command": "pip install -r requirements.txt" }
    ],
    "preStart": [
      "docker-compose up -d postgres redis"
    ]
  },
  "healthCheck": {
    "timeout": 60,
    "interval": 2
  }
}

Config Fields

FieldTypeDescription
servicesarrayList of services to manage
services[].namestringService identifier
services[].typestringnodejs, python, nextjs, docker, go, etc.
services[].pathstringWorking directory for the service
services[].portnumberPort the service runs on
services[].startstringCommand to start the service
services[].healthCheckstringURL or command to verify service health
services[].dependsOnarrayServices that must start first
services[].envobjectEnvironment variables
dependencies.installarrayDependency installation commands
dependencies.preStartarrayCommands to run before starting services
healthCheck.timeoutnumberMax seconds to wait for health checks
healthCheck.intervalnumberSeconds between health check attempts

Project Detection

The skill automatically detects:

Package Managers

  • package.json → npm/yarn/pnpm
  • pnpm-workspace.yaml → pnpm monorepo
  • requirements.txt / pyproject.toml → pip/poetry
  • go.mod → Go modules
  • Cargo.toml → Rust/Cargo

Frameworks

  • next.config.* → Next.js (port 3000)
  • vite.config.* → Vite (port 5173)
  • angular.json → Angular (port 4200)
  • manage.py → Django (port 8000)
  • main.go / cmd/ → Go server
  • Dockerfile / docker-compose.yml → Docker services

Databases

  • docker-compose.yml with postgres/mysql/redis → Docker databases
  • .env with DATABASE_URL → Database connection

Example Output

code
Starting local development environment...

[1/4] Installing dependencies...
  ✓ pnpm install (root)
  ✓ pip install -r requirements.txt (apps/api)

[2/4] Starting infrastructure...
  ✓ docker-compose up -d postgres redis
  • Waiting for postgres... ready (port 5432)
  • Waiting for redis... ready (port 6379)

[3/4] Starting services...
  ✓ api started (http://localhost:3001)
  ✓ frontend started (http://localhost:3000)

[4/4] Health checks...
  ✓ api: healthy (http://localhost:3001/health)
  ✓ frontend: healthy (http://localhost:3000)
  ✓ postgres: healthy (pg_isready)
  ✓ redis: healthy (redis-cli ping)

All services running!

Quick access:
  Frontend: http://localhost:3000
  API:      http://localhost:3001
  API Docs: http://localhost:3001/docs

Stop all: /run-local stop
View logs: /run-local logs

Service Types

TypeDetectionDefault PortHealth Check
nodejspackage.json3000HTTP GET /
nextjsnext.config.*3000HTTP GET /
vitevite.config.*5173HTTP GET /
pythonrequirements.txt8000HTTP GET /health
djangomanage.py8000HTTP GET /admin
fastapimain.py + fastapi8000HTTP GET /docs
gogo.mod + main.go8080HTTP GET /health
dockerdocker-compose.ymlvariescontainer health
postgresdocker/native5432pg_isready
redisdocker/native6379redis-cli ping
mysqldocker/native3306mysqladmin ping

Requirements

  • Must be run from within a project directory
  • Docker (for containerized services)
  • Appropriate runtimes (Node.js, Python, Go, etc.)

Notes

  • Services are started in dependency order
  • Background processes are managed with proper cleanup
  • Logs are aggregated and can be viewed with /run-local logs
  • Config is saved for quick restarts
  • Use /run-local stop to cleanly shut down all services