$npx -y skills add neuromechanist/research-skills --skill ci-scaffoldingThis skill should be used when the user says \"set up CI\", \"create GitHub Actions\", \"scaffold CI pipeline\", \"add CI/CD\", \"configure continuous integration\", \"create test workflow\", \"create release workflow\", \"add pre-commit hooks\", \"set up linting pipeline\", \"co
| 1 | # CI/CD Scaffolding |
| 2 | |
| 3 | Generate and configure CI/CD pipelines following project conventions. Supports Python (ruff + pytest + coverage) and TypeScript/JavaScript (biome + bun test) stacks, with templates for testing, documentation, and release workflows. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - Adding CI/CD to a new project |
| 8 | - Updating existing GitHub Actions workflows |
| 9 | - Setting up pre-commit hooks for linting |
| 10 | - Configuring coverage reporting |
| 11 | - Adding release automation (tag-based) |
| 12 | |
| 13 | ## Pipeline Templates |
| 14 | |
| 15 | ### Python Project Pipeline |
| 16 | |
| 17 | Standard Python CI pipeline: |
| 18 | |
| 19 | ```yaml |
| 20 | # .github/workflows/test.yml |
| 21 | name: Tests |
| 22 | on: [push, pull_request] |
| 23 | jobs: |
| 24 | test: |
| 25 | runs-on: ubuntu-latest |
| 26 | steps: |
| 27 | - uses: actions/checkout@v4 |
| 28 | - uses: astral-sh/setup-uv@v5 |
| 29 | - run: uv sync --dev |
| 30 | - run: uv run ruff check . |
| 31 | - run: uv run ruff format --check . |
| 32 | - run: uv run pytest --cov --cov-report=xml |
| 33 | ``` |
| 34 | |
| 35 | Key conventions: |
| 36 | - Use `astral-sh/setup-uv` (not pip) |
| 37 | - Ruff for both linting and formatting |
| 38 | - pytest with coverage (XML report for CI integration) |
| 39 | - No mocks in test configuration |
| 40 | |
| 41 | ### TypeScript/JavaScript Project Pipeline |
| 42 | |
| 43 | ```yaml |
| 44 | # .github/workflows/test.yml |
| 45 | name: Tests |
| 46 | on: [push, pull_request] |
| 47 | jobs: |
| 48 | test: |
| 49 | runs-on: ubuntu-latest |
| 50 | steps: |
| 51 | - uses: actions/checkout@v4 |
| 52 | - uses: oven-sh/setup-bun@v2 |
| 53 | - run: bun install |
| 54 | - run: bun run biome check . |
| 55 | - run: bun test |
| 56 | ``` |
| 57 | |
| 58 | Key conventions: |
| 59 | - Use `oven-sh/setup-bun` (not npm/node) |
| 60 | - Biome for linting and formatting |
| 61 | - bun test for testing |
| 62 | |
| 63 | ### Release Workflow |
| 64 | |
| 65 | Tag-based release automation: |
| 66 | |
| 67 | ```yaml |
| 68 | # .github/workflows/release.yml |
| 69 | name: Release |
| 70 | on: |
| 71 | push: |
| 72 | tags: ['v*'] |
| 73 | jobs: |
| 74 | release: |
| 75 | runs-on: ubuntu-latest |
| 76 | permissions: |
| 77 | contents: write |
| 78 | steps: |
| 79 | - uses: actions/checkout@v4 |
| 80 | - uses: softprops/action-gh-release@v2 |
| 81 | with: |
| 82 | generate_release_notes: true |
| 83 | ``` |
| 84 | |
| 85 | ### Documentation Workflow |
| 86 | |
| 87 | MkDocs deployment to GitHub Pages: |
| 88 | |
| 89 | ```yaml |
| 90 | # .github/workflows/docs.yml |
| 91 | name: Docs |
| 92 | on: |
| 93 | push: |
| 94 | branches: [main] |
| 95 | permissions: |
| 96 | contents: write |
| 97 | jobs: |
| 98 | deploy: |
| 99 | runs-on: ubuntu-latest |
| 100 | steps: |
| 101 | - uses: actions/checkout@v4 |
| 102 | - uses: astral-sh/setup-uv@v5 |
| 103 | - run: uv sync --group docs |
| 104 | - run: uv run mkdocs gh-deploy --force |
| 105 | ``` |
| 106 | |
| 107 | ### Typo Checking |
| 108 | |
| 109 | Add typo checking to any project: |
| 110 | |
| 111 | ```yaml |
| 112 | # In existing test.yml or standalone |
| 113 | - uses: crate-ci/typos@master |
| 114 | ``` |
| 115 | |
| 116 | ## Pre-commit Hook Setup |
| 117 | |
| 118 | ### Python (ruff) |
| 119 | |
| 120 | ```bash |
| 121 | #!/bin/sh |
| 122 | # .git/hooks/pre-commit |
| 123 | STAGED=$(git diff --cached --name-only --diff-filter=d -- '*.py') |
| 124 | [ -z "$STAGED" ] && exit 0 |
| 125 | echo "$STAGED" | xargs uv run ruff check --fix --unsafe-fixes |
| 126 | echo "$STAGED" | xargs uv run ruff format |
| 127 | git add $STAGED |
| 128 | ``` |
| 129 | |
| 130 | ### TypeScript (biome) |
| 131 | |
| 132 | ```bash |
| 133 | #!/bin/sh |
| 134 | # .git/hooks/pre-commit |
| 135 | STAGED=$(git diff --cached --name-only --diff-filter=d -- '*.ts' '*.tsx' '*.js' '*.jsx') |
| 136 | [ -z "$STAGED" ] && exit 0 |
| 137 | echo "$STAGED" | xargs bunx biome check --write |
| 138 | git add $STAGED |
| 139 | ``` |
| 140 | |
| 141 | ## Scaffolding Workflow |
| 142 | |
| 143 | ### Step 1: Detect project type |
| 144 | |
| 145 | Scan for language markers (`pyproject.toml`, `package.json`, `Cargo.toml`, `go.mod`) and existing CI configuration. |
| 146 | |
| 147 | ### Step 2: Select pipelines |
| 148 | |
| 149 | Based on detection: |
| 150 | - Always: test workflow |
| 151 | - If Python with docs: docs workflow |
| 152 | - If releases needed: release workflow |
| 153 | - If no pre-commit hook: install one |
| 154 | |
| 155 | ### Step 3: Generate files |
| 156 | |
| 157 | Create `.github/workflows/` directory and write workflow files. Never overwrite existing workflows without asking. |
| 158 | |
| 159 | ### Step 4: Verify |
| 160 | |
| 161 | Run `act` locally if available to validate workflows, or do a dry-run check of YAML syntax. |
| 162 | |
| 163 | ## Additional Resources |
| 164 | |
| 165 | - Reference: [references/workflow-templates.md](references/workflow-templates.md) - Full workflow file templates with all options |
| 166 | - Reference: [references/ci-best-practices.md](references/ci-best-practices.md) - Caching, matrix builds, secrets management |