$npx -y skills add softspark/ai-toolkit --skill ciDetect/generate/debug CI pipeline config (GitHub Actions, GitLab CI). Triggers: CI setup, build pipeline, GitHub Actions config, debug CI, GitLab CI.
| 1 | # /ci - CI/CD Pipeline Management |
| 2 | |
| 3 | $ARGUMENTS |
| 4 | |
| 5 | ## What This Command Does |
| 6 | |
| 7 | Generate, update, or troubleshoot CI/CD pipeline configuration based on project type. |
| 8 | |
| 9 | ## Project context |
| 10 | |
| 11 | - CI config: !`cat .github/workflows/*.yml 2>/dev/null || cat .gitlab-ci.yml 2>/dev/null || echo "no-ci"` |
| 12 | |
| 13 | ## CI Detection Script |
| 14 | |
| 15 | Detect CI platform and analyze configuration: |
| 16 | ```bash |
| 17 | python3 scripts/ci-detect.py [directory] |
| 18 | ``` |
| 19 | |
| 20 | Returns JSON with: |
| 21 | - `platform` - detected CI platform (github-actions, gitlab-ci, jenkins, bitbucket, circleci) |
| 22 | - `config_files[]` - CI config file paths |
| 23 | - `project_type` - detected project type (python, node, flutter, go, rust, php, docker) |
| 24 | - `jobs_found[]` - job/stage names extracted from config |
| 25 | - `stages_detected[]` - best-practice stages found (lint, test, build, deploy) |
| 26 | - `missing_stages[]` - recommended stages not yet configured |
| 27 | - `suggested_template` - pointer to ci-cd-patterns skill for templates |
| 28 | |
| 29 | ## Auto-Detection |
| 30 | |
| 31 | | File Found | Project Type | Pipeline | |
| 32 | |------------|-------------|----------| |
| 33 | | `package.json` | Node.js/TypeScript | npm ci, lint, test, build | |
| 34 | | `pyproject.toml` / `setup.py` | Python | pip install, ruff, mypy, pytest | |
| 35 | | `pubspec.yaml` | Flutter/Dart | dart analyze, flutter test, build | |
| 36 | | `composer.json` | PHP | composer install, phpstan, phpunit | |
| 37 | | `go.mod` | Go | go vet, go test, go build | |
| 38 | | `Cargo.toml` | Rust | cargo clippy, cargo test, cargo build | |
| 39 | | `Dockerfile` | Docker | Build and push image | |
| 40 | |
| 41 | ## Supported Platforms |
| 42 | |
| 43 | - **GitHub Actions** (default): `.github/workflows/ci.yml` |
| 44 | - **GitLab CI**: `.gitlab-ci.yml` |
| 45 | |
| 46 | ## Pipeline Stages |
| 47 | |
| 48 | 1. **Lint** - Static analysis, formatting checks |
| 49 | 2. **Test** - Unit tests, integration tests with coverage |
| 50 | 3. **Build** - Compile, bundle, Docker image |
| 51 | 4. **Deploy** (optional) - Deploy to staging/production |
| 52 | |
| 53 | ## Usage Examples |
| 54 | |
| 55 | ``` |
| 56 | /ci # Generate CI config for detected project type |
| 57 | /ci github-actions # Explicitly use GitHub Actions |
| 58 | /ci add deploy staging # Add deployment stage for staging |
| 59 | /ci fix # Troubleshoot failing pipeline |
| 60 | /ci add matrix node 18,20,22 # Add matrix testing |
| 61 | ``` |
| 62 | |
| 63 | ## Reference Skill |
| 64 | Use `ci-cd-patterns` skill for pipeline templates and best practices. |
| 65 | |
| 66 | ## Rules |
| 67 | |
| 68 | - **MUST** detect existing CI platform before generating a new config — do not overwrite silently |
| 69 | - **NEVER** commit generated CI configs that embed hardcoded secrets or tokens |
| 70 | - **CRITICAL**: preserve existing job names and triggers unless the user explicitly asks for a restructure |
| 71 | - **MANDATORY**: every generated pipeline must include lint + test stages at minimum |
| 72 | |
| 73 | ## Gotchas |
| 74 | |
| 75 | - GitHub Actions YAML parses `on:` as a reserved word only when unquoted. Writing `"on":` (quoted) produces a valid-looking file whose workflow **never triggers**. YAML anchors in this field also silently break. |
| 76 | - GitLab CI's `rules:` and `only:/except:` are mutually exclusive at the job level. Mixing them fails parse on pipeline run but not at `git push` time — test with `gitlab-ci-lint` before committing. |
| 77 | - `secrets.*` in GitHub Actions is undefined in workflows triggered from **forked** PRs (security boundary). Jobs that need secrets must gate on `github.event.pull_request.head.repo.full_name == github.repository` or use `pull_request_target` carefully. |
| 78 | - `actions/checkout@v6` defaults to `fetch-depth: 1` (shallow). Commands that need history (`git log`, `git describe`, conventional-commit tools) fail with misleading errors — set `fetch-depth: 0` for those jobs. |
| 79 | |
| 80 | ## When NOT to Use |
| 81 | |
| 82 | - For running tests locally — use `/test` |
| 83 | - For general CI/CD patterns and theory — use `/ci-cd-patterns` (knowledge skill) |
| 84 | - For deployment orchestration only — use `/deploy` |
| 85 | - When the project has no VCS-hosted CI platform — generate locally-runnable scripts instead |