Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

environment-deployment-strategy环境部署策略

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

870

周安装

37

GitHub Stars

公开资料未说明

下载量

305
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:environment-deployment-strategy(环境部署策略)
来源仓库:https://github.com/loxosceles/ai-dev
仓库路径:skills/environment-deployment-strategy
安装命令:
npx skills add https://github.com/loxosceles/ai-dev --skill environment-deployment-strategy
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/loxosceles/ai-dev --skill environment-deployment-strategy

简介

environment-deployment-strategy 提供三环境(本地、开发、生产)的安全部署策略模式参考。

  • 适用于 Codex、Claude、Cursor、Gemini CLI 中需要规划云资源结构或制定发布流程的团队。
  • 明确禁止向本地环境部署,开发环境镜像生产架构,通过 CI/CD 门禁控制生产发布节奏。
  • 使用时应根据实际云服务调整资源命名和权限策略,避免直接复制模板导致配置漂移或权限过度开放。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Environment Deployment Strategy

This is a reference pattern. Learn from the approach, adapt to your context — don't copy verbatim.

Problem: Need safe deployment practices that prevent accidental production deployments while enabling rapid development iteration.

Solution: Three-tier environment strategy with deployment restrictions.


Pattern

Three Environments:

  1. Local (local)

- Runs on developer machine - Uses cloud resources from dev environment - Cannot be deployed (no cloud resources) - Fast iteration, no deployment wait

  1. Development (dev)

- Deployed to cloud - Mirrors production architecture - Can deploy via: Local script OR GitHub Actions (on merge to dev branch) - Used for testing and validation

  1. Production (prod)

- Deployed to cloud - Live customer-facing environment - Can ONLY deploy via: GitHub Actions (on merge to main branch) - Never deployed from local machine


Why This Pattern?

Benefits:

  • Safety: Production protected from accidental local deployments
  • Speed: Local development uses cloud dev resources (no local infrastructure)
  • Consistency: Dev mirrors prod, catches issues before production
  • Audit Trail: All prod deployments tracked in GitHub Actions logs
  • Rollback: Git history enables easy rollback

Prevents:

  • Accidental production deployments from developer machines
  • Untested code reaching production
  • Configuration drift between environments
  • "Works on my machine" issues

Implementation

Environment Configuration:

# .env (local - not committed)
ENVIRONMENT=local
AWS_REGION=eu-central-1
# Uses dev resources
API_ENDPOINT=https://api-dev.example.com

# .env.dev (committed template)
ENVIRONMENT=dev
AWS_REGION=eu-central-1
API_ENDPOINT=https://api-dev.example.com

# .env.prod (committed template, secrets from SSM)
ENVIRONMENT=prod
AWS_REGION=eu-central-1
API_ENDPOINT=https://api.example.com

Deployment Scripts:

// package.json
{
  "scripts": {
    "deploy:dev": "cdk deploy --all --context environment=dev",
    "deploy:prod": "echo 'ERROR: Production can only be deployed via GitHub Actions' && exit 1"
  }
}

GitHub Actions Workflow:

# .github/workflows/deploy.yml
name: Deploy

on:
  pull_request:
    types: [closed]
    branches: [dev, main]

jobs:
  deploy-dev:
    if: github.base_ref == 'dev' && github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to Dev
        run: npm run deploy:dev

  deploy-prod:
    if: github.base_ref == 'main' && github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to Production
        run: cdk deploy --all --context environment=prod

Deployment Flow

Development Cycle:

1. Developer works locally (uses dev resources)
2. Commits to feature branch
3. Opens PR to dev branch
4. PR merged → GitHub Actions deploys to dev
5. Test in dev environment
6. Open PR from dev to main
7. PR merged → GitHub Actions deploys to prod

Local Development:

# Developer runs frontend locally
npm run dev

# Frontend connects to dev API
# No infrastructure deployment needed
# Fast iteration

Dev Deployment (two options):

# Option 1: Local deployment (for quick testing)
npm run deploy:dev

# Option 2: GitHub Actions (on PR merge to dev)
# Automatic, tracked, consistent

Prod Deployment (one option only):

# Only via GitHub Actions (on PR merge to main)
# Attempting local deployment fails with error message

Resource Isolation

Separate Resources Per Environment:

// All resources include environment identifier
const bucket = new s3.Bucket(this, 'Bucket', {
  bucketName: `${PROJECT_ID}-data-${environment}` // dev or prod
});

const table = new dynamodb.Table(this, 'Table', {
  tableName: `${PROJECT_ID}-users-${environment}` // dev or prod
});

Why: Prevents dev and prod from sharing resources, avoiding data corruption and conflicts.


AWS CodePipeline Integration

Alternative: Use AWS CodePipeline instead of GitHub Actions

// Separate pipelines per environment
const devPipeline = new codepipeline.Pipeline(this, 'DevPipeline', {
  pipelineName: `${PROJECT_ID}-pipeline-dev`
});

const prodPipeline = new codepipeline.Pipeline(this, 'ProdPipeline', {
  pipelineName: `${PROJECT_ID}-pipeline-prod`
});

GitHub Actions trigger:

- name: Trigger Dev Pipeline
  run: aws codepipeline start-pipeline-execution --name ${PROJECT_ID}-pipeline-dev

- name: Trigger Prod Pipeline
  run: aws codepipeline start-pipeline-execution --name ${PROJECT_ID}-pipeline-prod

Benefits:

  • Build logs in AWS CloudWatch
  • IAM-based permissions (no GitHub secrets)
  • Integrated with AWS services

Variations

Two-Environment (simpler projects):

  • dev - Development and testing
  • prod - Production only

Four-Environment (enterprise):

  • local - Developer machines
  • dev - Development
  • staging - Pre-production testing
  • prod - Production

Related Patterns


Progressive Improvement

If the developer corrects a behavior that this skill should have prevented, suggest a specific amendment to this skill to prevent the same correction in the future.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.14%
按下载量换算104

Claude

31.73%
按下载量换算97

Cursor

16.41%
按下载量换算50

Gemini CLI

9.51%
按下载量换算29

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills