Env setup

From tinh2/skills-hub-registry · View interactive version

Env setup is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Bootstrap a project from zero to working dev environment. Detects runtime versions, installs dependencies, creates .env from templates, starts Docker services, runs database migrations, and verifies build plus tests pass. Use when cloning a new repo, onboarding to a project, setting up local develop

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Do NOT pause for confirmation.

Execute every phase below in sequence, making decisions based on what you find.

============================================================

PHASE 0 — INPUT

============================================================

$ARGUMENTS may contain:

If no arguments, run the full setup: detect, install, configure, verify.

============================================================

PHASE 1 — DETECT REQUIRED TOOLS

============================================================

Scan project files to build a requirements list:

Runtime Detection:

Tool Detection:

Package Manager Detection:

Build the full requirements list with expected versions.

============================================================

PHASE 2 — CHECK INSTALLED VERSIONS

============================================================

For each required tool, check if it is installed and the version matches:

node --version        → compare against required
npm --version         → verify package manager
python3 --version     → compare against required
go version            → compare against required
rustc --version       → verify installed
flutter --version     → compare against required
docker --version      → verify installed
docker compose version → verify installed

Produce a status table:

| Tool | Required | Installed | Status |

|------|----------|-----------|--------|

| node | 20.x | 20.11.0 | OK |

| pnpm | 9.x | not found | MISSING|

For MISSING tools:

For VERSION MISMATCH:

If --check-only, stop here and report the status table. Do not proceed to install.

============================================================

PHASE 3 — INSTALL DEPENDENCIES

============================================================

Install project dependencies using the detected package manager:

Node.js:

Python:

Go: go mod download

Rust: cargo fetch

Flutter: flutter pub get

Ruby: bundle install

For monorepos, run install from the root. If workspace installs are needed, detect and run those too.

Verify install succeeded (exit code 0). If it fails, read the error and attempt to resolve:

============================================================

PHASE 4 — CONFIGURE ENVIRONMENT

============================================================

4.1 — Environment Variables

If .env.example or .env.template exists and .env does not:

  1. Copy: cp .env.example .env
  2. Scan the template for variables that need values:
  1. Write the populated .env file

If no .env.example exists but the project clearly needs env vars (detected from code scanning for process.env, os.environ, os.Getenv), create a .env.example with discovered variables and sensible defaults.

4.2 — Database Setup

Skip if --skip-db.

If docker-compose.yml exists with database services:

  1. Start services: docker compose up -d
  2. Wait for database to be ready (poll with connection check, max 30 seconds)
  3. Run migrations:
  1. Run seed if available:

If no docker-compose.yml but database is needed:

4.3 — Additional Setup

============================================================

PHASE 5 — VERIFY BUILD AND TESTS

============================================================

Run verification checks to confirm the project is ready for development:

5.1 — Build Check:

5.2 — Test Check (skip if --skip-tests):

5.3 — Dev Server Check (non-blocking):

Report results for each check: PASS / FAIL with error details.

============================================================

SELF-HEALING VALIDATION (max 2 iterations)

============================================================

After completing, validate the output was produced correctly:

  1. Verify generated files exist and are syntactically valid.
  2. Run any available validation (lint, type-check, dry-run).
  3. If the skill produces configuration, verify it parses without errors.

IF VALIDATION FAILS:

============================================================

OUTPUT

============================================================

Print the setup summary:

## Environment Setup Complete

### System Requirements
| Tool   | Required | Installed | Status  |
|--------|----------|-----------|---------|
| node   | 20.x     | 20.11.0   | OK      |
| docker | any      | 27.1.1    | OK      |
| ...

### Dependencies
- {package manager}: {N} packages installed

### Environment
- .env: created from .env.example with {N} variables populated
- Database: {PostgreSQL 16 running on localhost:5432}
- Migrations: {applied N migrations}
- Seed data: {loaded / not available}

### Verification
- Build: PASS
- Tests: PASS ({N} tests, {N} passed)
- Dev server: PASS (responding on localhost:{port})

### Manual Steps Required
- {any tools that need manual install}
- {any API keys that need manual configuration}

============================================================

NEXT STEPS

============================================================

  1. Start developing: npm run dev / python manage.py runserver / go run .
  2. Run /git-hooks to set up pre-commit hooks
  3. Run /devcontainer to containerize this setup for team consistency
  4. Share .env.example with the team (never commit .env)

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /env-setup — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

============================================================

DO NOT

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.