Skills: Deployment & CI/CD Skills
Last updated: 2026-08-31
Deployment is the operation that least tolerates errors — Skills codify every step into a process, making deployment as reliable as breathing.
1. Deployment Skill Architecture
(1) Deployment Process Breakdown
TEXT
📖 Display only
Deployment Process
├── Pre-check
│ ├── Is code committed?
│ ├── Are tests passing?
│ └── Are environment variables ready?
├── Build Stage
│ ├── Install dependencies
│ ├── Compile/package
│ └── Generate build artifacts
├── Deploy Stage
│ ├── Backup current version
│ ├── Deploy new version
│ └── Health check
└── Post-verification
├── Functional smoke test
├── Monitoring metrics check
└── Notify team
(2) Environment Management
| Environment | Purpose | Risk Level | Deploy Strategy |
|---|---|---|---|
| development | Local development | 🟢 | Manual deploy |
| staging | Pre-release verification | 🟡 | Auto deploy + manual verification |
| production | Live service | 🔴 | Auto deploy + approval + rollback |
2. CI/CD Integration
(1) Configuration File Detection
MARKDOWN
## Auto-detect CI/CD Platform
- Detect .github/workflows/ → GitHub Actions
- Detect .gitlab-ci.yml → GitLab CI
- Detect Jenkinsfile → Jenkins
- Detect .circleci/ → CircleCI
(2) Pipeline Design
YAML
# GitHub Actions example
name: Deploy
on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
deploy:
needs: test
steps:
- run: npm run build
- run: npm run deploy
(3) Skill Integration Points
TEXT
📖 Display only
Skill's role in CI/CD:
├── During local dev: Pre-check, build verification
├── On PR creation: Auto-review, test execution
├── Before merge: Full test suite, security scan
└── After deploy: Health check, monitoring verification
3. Rollback Strategy
(1) Auto-Rollback Conditions
MARKDOWN
## Auto-Rollback Trigger Conditions
- Health check fails 3 consecutive times
- Error rate exceeds 5%
- Response time exceeds 2s (P99)
- Memory usage exceeds 90%
(2) Rollback Process
TEXT
📖 Display only
Rollback Process
1. Detect abnormal metrics
2. Notify team
3. Bash to execute rollback command
4. Verify health check after rollback
5. Output rollback report
(3) Version Management
BASH
# Deploy version record
git tag -a v1.2.3 -m "Deploy to production"
git push origin v1.2.3
# Rollback to previous version
git tag -a v1.2.2-rollback -m "Rollback from v1.2.3"
4. Deployment Skill Practice
▶ Example: Safe Deploy Skill
Alice created a deployment Skill with approval and rollback:
YAML
---
name: safe-deploy
description: "Safe deploy: pre-check + approval + deploy + verify + rollback"
triggers:
- keyword: "deploy"
tools:
- Read
- Bash
- Grep
---
MARKDOWN
## Deployment Process
1. Pre-check
- Bash: git status (confirm committed)
- Bash: npm test (confirm tests pass)
- Grep: Check for TODO/FIXME
2. Build & Deploy
- Bash: npm run build
- Bash: npm run deploy:staging
3. Health Check
- Bash: curl -f http://staging.example.com/health
4. Ask whether to deploy to production
5. Production deploy + health check
Bob commented: "The biggest fear in deployment isn't failure — it's not knowing how to roll back when it fails. Skills write rollback into the process so every deployment has an exit plan."
❓ FAQ
Q Should a deploy Skill have Bash write access?
A With caution. We recommend only allowing specific deploy commands; prohibit dangerous operations like
rm, curl | bash. Restrict with command allowlists.Q How to handle multi-environment configurations?
A Use variables to differentiate environments; put configs in
.env.staging/.env.production; the Skill selects configuration based on environment variables.Q How to troubleshoot CI/CD pipeline failures?
A The Skill reads error logs first, locates the failing step, and analyzes the error cause. Common causes: dependency install failure, test timeout, insufficient permissions.
📖 Summary
- Four deployment stages: pre-check → build → deploy → post-verification
- Environment tiers: development → staging → production, increasing risk
- CI/CD integration: Skills contribute at local/PR/merge/deploy stages
- Rollback strategy: auto-detect anomalies → notify → rollback → verify
📝 Exercises
- Basic (⭐): Create a deployment pre-check Skill that checks if code is committed and tests pass.
- Intermediate (⭐⭐): Create a complete safe deploy Skill with pre-check, build, deploy, and health check steps.
- Advanced (⭐⭐⭐): Create a CI/CD assistant Skill that can auto-detect the project CI platform, analyze pipeline configuration, and diagnose failure causes.