AgentSkillsCN

development

开发环境、测试、CI/CD 与部署流程。在处理月度指令、数据库生命周期、GitHub Actions,或部署工作流时,可优先使用此技能。

SKILL.md
--- frontmatter
name: development
description: Development environment, testing, CI/CD, and deployment procedures. Use this skill when working with moon commands, database lifecycle, GitHub Actions, or deployment workflows.

Development Environment

Core Definition: Local development, testing, CI, and deployment.

Moon Commands (Primary Interface)

bash
# Development
moon run backend:dev        # FastAPI on :8000
moon run frontend:dev       # Next.js on :3000

# Testing
moon run :test              # All tests
moon run backend:test       # Backend tests (auto-manages DB)
moon run :smoke             # Smoke tests

# Code Quality
moon run :lint              # Lint all
moon run backend:format     # Format Python

# Build
moon run :build             # Build all

Database Lifecycle

Reference Counting

code
Terminal 1: moon run backend:test  → refcount=1 (start container)
Terminal 2: moon run backend:test  → refcount=2
Terminal 2 exits                   → refcount=1
Terminal 1 exits                   → refcount=0 (stop container)

Local Test Isolation

  • Set BRANCH_NAME=<branch_name> to namespace test resources
  • Use WORKSPACE_ID=<id> to isolate multiple working copies
  • Test DB container name includes the branch suffix

Six Scenarios

#ScenarioTriggerTestsGoal
1Local DevManualNoneIteration speed
2Local Testmoon run backend:testUnit+Integration<30s feedback
3Remote CIPR / PushUnit+IntegrationQuality gate
4PR TestPR openedHealth CheckDeployment validation
5StagingPush to mainSmoke + PerfFull validation
6ProductionManual dispatchHealth CheckMinimal validation

Coverage Gate

  • Backend line coverage must be >= 95% (--cov-fail-under=95)

Environment Variable Lifecycle

  1. Frontend (Next.js): NEXT_PUBLIC_ prefix, must be in Dockerfile ARG
  2. Backend (FastAPI): Must have type and default in config.py
  3. Production (Vault): Secrets in secrets.ctmpl, validated by CI

Source Files

FilePurpose
moon.ymlRoot workspace tasks
apps/*/moon.ymlPer-project tasks
scripts/test_backend.shDatabase lifecycle
docker-compose.ymlDevelopment containers
.github/workflows/ci.ymlGitHub Actions CI