AgentSkillsCN

local-dev-environment

使用 Podman Compose 启动、停止或检查本地开发环境的状态。包括数据库、应用服务、迁移与健康检查。适用于用户输入“启动本地环境”、“Podman Compose up”、“开发环境状态”时使用。

SKILL.md
--- frontmatter
name: local-dev-environment
description: Start, stop, or check status of local dev environment using Podman Compose. Database, app services, migrations, health checks. Use when user says "start local env", "podman compose up", "dev environment status".

Local Dev Environment

Start, stop, or check status of local development environment using Podman Compose.

Inputs

InputTypeDefaultPurpose
repostringrequiredPath to repo with podman-compose.yaml
actionstring"status"start, stop, status, restart
run_migrationsboolfalseRun DB migrations after start
health_checkbooltrueRun health check after start

Persona

Load devops persona (podman, systemd). May need developer for curl; database for psql.

Workflow

1. Bootstrap

  • persona_load("devops") — podman tools
  • systemctl_is_active(unit="podman.socket") — ensure Podman socket active

2. Current Status

  • podman_compose_status(project_dir=repo) — compose status
  • podman_ps() — running containers

3. Perform Action

  • If action in [stop, restart]: podman_compose_down(project_dir=repo)
  • If action in [start, restart]: podman_compose_up(project_dir=repo, detach=true)

4. Post-Start (if action != status)

  • podman_compose_status(project_dir=repo) — verify status
  • podman_logs(container="{repo_basename}-app-1", tail=30) — recent logs

5. Database

  • If run_migrations and action in [start, restart]: podman_exec(container="{repo_basename}-app-1", command="python manage.py migrate")
  • psql_tables() — list tables (verify DB ready)
  • psql_query(query="SELECT 1 as health_check;") — connectivity

6. Health Check (if health_check)

  • curl_get(url="http://localhost:8000/api/v1/health/") — API health
  • curl_timing(url="http://localhost:8000/api/v1/health/") — response time

7. Error Handling

  • On "port already in use": stop conflicting process or podman_compose_down first
  • On "connection refused": wait for container startup, check podman_logs

8. Session Log

  • memory_session_log("Local dev environment: {action}", "repo={repo}")

Quick Actions

  • View logs: podman_logs(container="<name>", tail=50)
  • Run migrations: include run_migrations: true in inputs
  • Restart: skill_run("local_dev_environment", '{"repo": "...", "action": "restart"}')