agentleFS
DeadlymindDeadlymind/nanolama/skills/ci-cd/SKILL.md

ci-cd

Skill1 starsChanged 5 months agoMITView on GitHub

Builds a GitHub Actions merge gate for the app stack — parallel backend/frontend jobs that run manage.py check, makemigrations --check --dry-run (fail on model drift), pytest, ruff lint, tsc typecheck, and pnpm build, with cached deps and required status checks blocking red PRs. Use when adding or fixing a workflow under .github/workflows, wiring CI for Django/DRF plus Next.js, catching migration drift or unformatted code before merge, running a dependency-audit gate, or asking how the pipeline blocks a broken branch. Not for deploying the built app to Beanstalk/Amplify (see deploy-aws) or authoring the tests themselves (see write-tests).

  • Reads credentials
  • Installs packages

25 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use caching, shell-scripting and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • zebbernSkill

    caching

    Caching strategies — invalidation, TTL guidelines, cache keys, cache layers, and when not to cache. Use when implementing or reviewing caching logic.

    Also in 3 projects that use this

  • mylee04Skill

    shell-scripting

    Shell scripting best practices for cross-platform CLI tools

    Also in 3 projects that use this

  • MicrosoftSkill

    error-handling

    统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。

    Also in 5 projects that use this

  • diego-tobalinaSkill

    logging

    Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.

    Also in 3 projects that use this

  • pproencaSkill

    refactoring

    Code refactoring best practices based on Martin Fowler's catalog and Clean Code principles. This skill should be used when refactoring existing code, improving code structure, reducing complexity, eliminating code smells, or reviewing code for maintainability. Triggers on tasks involving extract method, rename, decompose conditional, reduce coupling, or improve readability.

    Also in 4 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 9 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 16 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Add security checks as their own required jobs (GitHub Actions), each failing the build on high severity so a vuln can't merge:

    line 77
  2. Very specific:

    SAST: Run bandit -r . -ll for Python, plus semgrep (or CodeQL) with the Django/DRF and React rulesets for injection, XSS, and …

    line 79
  3. Very specific:

    Secret scan: Run gitleaks detect over both the diff and history — a secret in an old commit is still leaked.

    line 81
  4. Very specific:

    Deploy sanity: Run python manage.py check --deploy to catch insecure settings (DEBUG, weak SECRET_KEY, missing HSTS/cookie flags) before …

    line 83

“Common” is measured: kept by at least 6 in 10 of the 16 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

CI/CD (GitHub Actions merge gate)

When to use

Setting up or repairing the pipeline that must go green before any branch merges to main. On this stack the gate has one job: refuse to merge a branch that fails a static check, drifts from its migrations, breaks a test, or won't build.

Pattern

Fail closed at the PR boundary. Split backend and frontend into parallel jobs, cache their dependency stores, and make each check a distinct step so a red run points at the exact failure. The migration-drift check (makemigrations --check --dry-run) is the one people forget — it catches models edited without a migration, which passes locally but breaks deploy. Mark every job a required status check in branch protection so a red pipeline blocks merge instead of merely warning.

Steps / idioms

  1. One workflow, two jobs. Backend job (Postgres service, manage.py check, drift, pytest, ruff) and frontend job (tsc, pnpm build) run in parallel:

    # .github/workflows/ci.yml
    name: CI
    on:
      pull_request: { branches: [main] }
      push: { branches: [main] }
    jobs:
      backend:
        runs-on: ubuntu-latest
        services:
          postgres:
            image: postgres:17
            env: { POSTGRES_PASSWORD: postgres, POSTGRES_DB: app }
            ports: ["5432:5432"]
            options: >-
              --health-cmd pg_isready --health-interval 10s --health-retries 5
        env:
          DATABASE_URL: postgres://postgres:postgres@localhost:5432/app
        steps:
          - uses: actions/checkout@v4
          - uses: actions/setup-python@v5
            with: { python-version: "3.12", cache: pip }  # cache the wheel dir
          - run: pip install -r requirements.txt
          - run: python manage.py check                     # settings/app sanity
          - run: python manage.py makemigrations --check --dry-run  # fail on drift
          - run: ruff check .                               # lint (non-zero fails job)
          - run: pytest -q                                  # Django/DRF tests
          - run: pip-audit                                  # dependency-audit gate
    
      frontend:
        runs-on: ubuntu-latest
        defaults: { run: { working-directory: web } }
        steps:
          - uses: actions/checkout@v4
          - uses: pnpm/action-setup@v4
            with: { version: 9 }
          - uses: actions/setup-node@v4
            with: { node-version: "20", cache: pnpm, cache-dependency-path: web/pnpm-lock.yaml }
          - run: pnpm install --frozen-lockfile
          - run: pnpm tsc --noEmit                          # typecheck, no output
          - run: pnpm build                                 # Next.js production build
  2. Block merge on red. In repo Settings → Branches → protect main: require the backend and frontend checks to pass and require branches be up to date. A green-only merge button is what actually enforces the gate; the YAML alone does not.
  3. Keep steps granular. Separate ruff check from pytest so the summary names the failure. Add ruff format --check . if you enforce formatting.
  4. Audit dependencies in CI. pip-audit (Python) and pnpm audit --prod (Node) flag known-vuln packages on every PR (see dependency-audit).

Security & hardening gates

Add security checks as their own required jobs (GitHub Actions), each failing the build on high severity so a vuln can't merge:

  • SAST. Run bandit -r . -ll for Python, plus semgrep (or CodeQL) with the Django/DRF and React rulesets for injection, XSS, and unsafe-deserialization patterns.
  • Secret scan. Run gitleaks detect over both the diff and history — a secret in an old commit is still leaked. Fail on any finding, not just new ones.
  • Deploy sanity. Run python manage.py check --deploy to catch insecure settings (DEBUG, weak SECRET_KEY, missing HSTS/cookie flags) before they ship.

Then harden the workflow itself — the pipeline is attackable too:

  • Pin actions to a commit SHA, not a moving tag: uses: actions/checkout@<40-char-sha>. A tag like @v4 can be re-pointed at malicious code; a SHA can't.
  • Least-privilege token. Set permissions: { contents: read } at the workflow level and widen per-job only where needed (e.g. pull-requests: write for a comment step).
  • Bound and dedupe runs. Give each job a timeout-minutes: so a hung step can't run for hours, and add a top-level concurrency: { group: ci-${{ github.ref }}, cancel-in-progress: true } to cancel superseded runs on the same branch.

Mark each security job a required status check in branch protection so it blocks merge — the same gate discipline as the test jobs (see security-review).

Adapt to your repo

Rename the frontend dir (web), the Postgres image tag (16/17/18 all run Django 5.2), and the Python/Node versions to match your project. If you use Poetry or uv, swap the install step and its cache key. Point cache-dependency-path at your real lockfile. Match the required-check names in branch protection to your actual job names, or the gate silently passes. If a job needs secrets (RDS, S3), inject them via repository secrets — never commit them.

Gotchas

  • makemigrations --check --dry-run exits non-zero only when a migration is missing — it is the drift guard; running plain makemigrations in CI would instead write files and hide the problem (see migrations).
  • A cache alone doesn't install — you still run pip install / pnpm install; the cache only skips the download. --frozen-lockfile fails if the lockfile is stale.
  • pnpm build needs any build-time env vars (NEXT_PUBLIC_*) present, or the build errors on missing config — set them as non-secret env in the job.
  • Branch protection is per-branch and per-check-name; a renamed job silently stops being required until you re-add it. Verify a red PR is actually unmergeable.
  • Deploy is a separate workflow triggered after this one is green — keep it here or see deploy-aws; don't couple test steps to deploy credentials.

See also

  • deploy-aws
  • write-tests
  • migrations
  • dependency-audit
  • security-review
  • version-check

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.