dotfiles
bugabingas dorkfiles
owned by bugabinga
opencode/skills/ci-cd/SKILL.md
Raw
name: ci-cd
description: Set up CI/CD pipelines — GitHub Actions, GitLab CI, deployment automation, artifact publishing, test parallelization, caching strategies, environment promotion.
license: MIT
What I do
Guide CI/CD pipeline design and deployment.
Pipeline Stages
- Lint: Format, type check, secret scan
- Test: Unit → Integration → E2E, coverage
- Build: Compile, create artifacts, version
- Security Scan: Dependencies, containers, SAST
- Deploy: Environment, smoke tests, health checks
Environment Promotion
dev → staging → production
Best practices:
- Build once, promote same artifact
- Auto-promote if tests pass
- Manual approval for production
- Always able to rollback
Artifact Management
Versioning
- Semantic versioning
- Include commit SHA
Storage
- Artifact repository (Nexus, GitHub Packages)
- Clean old artifacts, sign for security
Secrets
- Never hardcode
- Use CI secrets (GitHub Secrets)
- Inject at runtime, not build time
- Rotate regularly, audit access
Deployment Strategies
Blue-Green
Two identical environments, switch traffic at once, fast rollback.
Canary
Deploy to 1-5% first, monitor errors, gradually increase, quick rollback.
Rolling
Deploy one instance at a time, no extra infrastructure.
Feature Flags
Deploy code behind flags, toggle without deployment.
Optimization
Caching
- Dependencies (npm, pip, cargo)
- Docker layers
- Cache based on lock file hash
Parallel Jobs
- Independent test suites
- Multiple test files
Monitoring
Health Checks
- Endpoint returns 200
- Check dependencies
- Response time within threshold
Smoke Tests
- Run after deployment
- Test critical paths
- Fail if smoke tests fail
Rollback Triggers
- Error rate increase
- Latency increase
Best Practices
- Fail fast: Lint and fast tests first
- Idempotent: Same input → same output
- Isolated: Jobs don't share state
- Logged: Clear logs for debugging
Checklist
Pre-Deploy
- Tests passing
- Security scan clean
- Artifacts built
- Rollback plan ready
Post-Deploy
- Smoke tests passing
- Error rates normal
- Team notified
Use this skill when setting up or improving CI/CD pipelines.
Markdown source
File outline
---
name: ci-cd
description: Set up CI/CD pipelines — GitHub Actions, GitLab CI, deployment automation, artifact publishing, test parallelization, caching strategies, environment promotion.
license: MIT
---
## What I do
Guide CI/CD pipeline design and deployment.
## Pipeline Stages
1. **Lint**: Format, type check, secret scan
2. **Test**: Unit → Integration → E2E, coverage
3. **Build**: Compile, create artifacts, version
4. **Security Scan**: Dependencies, containers, SAST
5. **Deploy**: Environment, smoke tests, health checks
---
## Environment Promotion
```
dev → staging → production
```
**Best practices**:
- Build once, promote same artifact
- Auto-promote if tests pass
- Manual approval for production
- Always able to rollback
---
## Artifact Management
### Versioning
- Semantic versioning
- Include commit SHA
### Storage
- Artifact repository (Nexus, GitHub Packages)
- Clean old artifacts, sign for security
---
## Secrets
- Never hardcode
- Use CI secrets (GitHub Secrets)
- Inject at runtime, not build time
- Rotate regularly, audit access
---
## Deployment Strategies
### Blue-Green
Two identical environments, switch traffic at once, fast rollback.
### Canary
Deploy to 1-5% first, monitor errors, gradually increase, quick rollback.
### Rolling
Deploy one instance at a time, no extra infrastructure.
### Feature Flags
Deploy code behind flags, toggle without deployment.
---
## Optimization
### Caching
- Dependencies (npm, pip, cargo)
- Docker layers
- Cache based on lock file hash
### Parallel Jobs
- Independent test suites
- Multiple test files
---
## Monitoring
### Health Checks
- Endpoint returns 200
- Check dependencies
- Response time within threshold
### Smoke Tests
- Run after deployment
- Test critical paths
- Fail if smoke tests fail
### Rollback Triggers
- Error rate increase
- Latency increase
---
## Best Practices
- **Fail fast**: Lint and fast tests first
- **Idempotent**: Same input → same output
- **Isolated**: Jobs don't share state
- **Logged**: Clear logs for debugging
---
## Checklist
### Pre-Deploy
- [ ] Tests passing
- [ ] Security scan clean
- [ ] Artifacts built
- [ ] Rollback plan ready
### Post-Deploy
- [ ] Smoke tests passing
- [ ] Error rates normal
- [ ] Team notified
---
Use this skill when setting up or improving CI/CD pipelines.