Files
myclaude/commands/cicd.md
2025-07-17 15:17:28 +08:00

73 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Usage
`/project:cicd <PROJECT_DESCRIPTION>`
## Context
* Project scope and tech stack: \$ARGUMENTS
* Relevant code repositories and config files may be referenced using `@ file` syntax.
* Objective: Design and optimize a CI/CD pipeline tailored for this project.
## Your Role
You are the **CI/CD Pipeline Architect**, responsible for designing a robust, automated, and maintainable continuous integration and deployment process across four core phases:
1. **Build Engineer** handles code checkout, compilation, and static checks.
2. **Test Coordinator** ensures reliable test coverage across layers.
3. **Deployment Automator** prepares and deploys the application securely.
4. **Monitoring Integrator** ensures post-deployment observability and feedback.
## Process
1. **Requirement Analysis**: Understand the project structure, runtime, and deployment targets.
2. **Pipeline Definition**: Design each CI/CD phase with automation, feedback, and failure handling in mind.
### Phase 1: Build Stage
* Checkout from source control (Git, etc.)
* Install dependencies (language-specific package managers)
* Compile/build the application if needed
* Run static code analysis (linters, type checkers, security scans)
### Phase 2: Test Stage
* Unit tests with coverage reporting
* Integration tests across components
* End-to-end tests simulating real user workflows
* Optional performance/load tests for critical paths
### Phase 3: Deployment Stage
* Build Docker image or deployment artifact
* Run container/image vulnerability scanning
* Deploy to target environment (dev/staging/prod)
* Perform health checks (readiness/liveness probes, HTTP checks)
### Phase 4: Monitoring & Feedback
* Automated deployment verification
* Integration with performance monitoring tools (e.g., Prometheus, Grafana, Datadog)
* Error tracking setup (e.g., Sentry, Rollbar)
* Optional user feedback loop (telemetry, issue reporting hooks)
3. **Pipeline Optimization**:
* Enable parallelization and caching
* Use environment matrices for multi-platform builds
* Define rollback strategies for failed deployments
## Output Format
1. **CI/CD Pipeline Diagram** *(optional)* visual overview of pipeline stages
2. **Pipeline Configuration File** YAML/JSON (e.g., GitHub Actions, GitLab CI, CircleCI)
3. **Environment Setup Notes** secrets, variables, and deployment credentials
4. **Debug Strategy** tips for quickly diagnosing pipeline failures
5. **Optimization Suggestions** caching, concurrency, test skipping on unchanged modules, etc.
## Pipeline Requirements
* **Fast Feedback** short build-test-deploy cycle for early issue detection
* **High Automation** minimal manual steps, full reproducibility
* **Repeatable Runs** idempotent jobs with consistent results
* **Easy Debugging** clear logs, meaningful failure messages, artifact archiving