zakariaf/flutter-skills/ci-pipeline-and-gates
Claude Code and agent skill by zakariaf/flutter-skills
- community
Checking that the SKILL.md file is still in the repository.
Enforces a lean GitHub Actions Flutter CI where every gate maps to one named release-blocking contract — pinned runner + subosito/flutter-action@v2 toolchain, dart format --set-exit-if-changed, flutter analyze --fatal-infos, build_runner and drift schema freshness (git diff --exit-code), flutter test --test-randomize-ordering-seed random, static import/banned-string greps that catch what runtime can't, coverage-as-report-never-a-gate with the upward-lie fixed, verify-never-bless goldens (no --update-goldens in CI), and an honest statement of what CI cannot prove (audio, real fonts, on-device behaviour). Use when editing .github/workflows/*.yml, adding or removing a job or step, wiring a codegen/schema/format/analyze/coverage gate, writing a grep-based policy test or gate script under test/policy or tool/, pinning action versions, or claiming CI proves something it can't.
Install
npx vskill@latest install zakariaf/flutter-skills/ci-pipeline-and-gatesSKILL.md
The same SKILL.md was published earlier as zakariaf/flutter-skills/ci-pipeline-and-gates.
CI Pipeline & Gates
A CI gate is not a decorative green check — it converts one release-blocking contract into a check a build either passes or fails, without trusting a human. Keep the pipeline lean: one workflow file for most single-package apps, every job pinned, every gate traceable to a named contract, and an honest note wherever CI cannot prove the thing that actually matters.
Read the reference for the task at hand:
references/workflow-skeleton.md— the copy-paste single-fileci.yml: pinned runner + toolchain, freshness gates, format/analyze, randomized tests, host-sqlite, coverage-strip, and the release-build job.references/policy-grep-gate.md— the grep-based invariant gate: the three-criteria bar, strip-comments-first, anchor-to-structure, accumulate-and-fail-once, write-the-reason-for-a-stranger.
Run scripts/ci-gates.sh and scripts/banned-strings.sh before a PR to reproduce the static gates locally.
Non-negotiable rules
- Every gate maps to exactly one named contract — name it. A check that serves no stated contract is not a gate: make it advisory and say so, or don't add it. Never invent a merge-blocker with nothing behind it. This keeps the pipeline auditable and stops gate-sprawl.
- Pin the runner AND the toolchain on every job.
runs-on: ubuntu-24.04(never-latest— image drift moves lcov/toolchain versions with no diff to review) andsubosito/flutter-action@v2with an explicitflutter-versionorflutter-version-file,channel: stable. A floating SDK silently re-renders goldens and perturbs determinism. Bump the version only in a dedicated PR. - Mark unverified action versions inline; never invent a major. A wrong major silently fails or silently changes behaviour. Write
# VERIFY:next to a version you haven't confirmed rather than guessing@v7. - Format and analyze are hard gates.
dart format --output=none --set-exit-if-changed .andflutter analyze --fatal-infos.--fatal-infosis load-bearing: an info left unfixed is a warning that gets ignored next. Seelint-and-style-config. - Codegen and schema are freshness gates, not build steps. Run the generator, then
git diff --exit-codethe outputs; a nonzero diff fails with a message telling the author to regenerate and commit. This is the entire mitigation for committing generated code, and the one gate that catches "changed the schema, forgot to migrate". Seerun-codegen,run-migration. - Randomize test ordering; provision native deps the test host needs.
flutter test --test-randomize-ordering-seed randomis free detection of inter-test state leakage. On Linux,flutter testruns in a plain Dart VM wheresqlite3_flutter_libsdoes nothing — install hostsqlite3before a suite that opens a real DB, or it fails for a reason that looks like a broken repo. - Static greps catch what runtime can't — held to the three-criteria bar. A grep-based gate is legitimate only when the invariant is textually decidable, silent when broken, and one line to break (
references/policy-grep-gate.md). It proves properties of the source graph a passing test never can (an import that isn't reached at runtime, a manifest attribute). Two out of three criteria means code review, not a grep. - Coverage is a published report, never a gate. No percentage threshold, no paid service. A covered line that asserts nothing is worthless. First fix the upward lie:
flutter test --coverageomits files no test imports, so an untested file scores zero denominator lines, not 0% — one tested file can report ~100%. Include untested files, then strip generated code fromlcov.info. Seetesting-strategy. - Gates verify, they never bless or mutate the repo. No
--update-goldens, nodart format --fix, no committing regenerated code from CI — a gate that fixes the thing it checks asserts nothing. Regeneration is a local, human-reviewed act. Goldens run on the pinned runner and CI only compares. Seewidget-golden-and-a11y-testing. - A red gate blocks; be honest about the limits. Never
continue-on-error: trueon a gate, never merge on a skipped gate, never// ignore:a static finding. And state plainly what CI cannot prove — audio output, real-font rendering, true on-device behaviour — so the manual on-device pass is treated as a load-bearing release artifact, not a chore.
The single workflow (single-package default)
One file, .github/workflows/ci.yml, is enough for most apps. Pin everything; keep the fast feedback in one job.
The full skeleton — freshness gates, host-sqlite, coverage strip, and the release-build job — is in references/workflow-skeleton.md.
Freshness gates: run the generator, diff the output
This is why committing *.g.dart / *.freezed.dart / *.drift.dart is safe, and how you catch a schema change with no migration.
Check which suffix your codegen actually emits (.drift.dart modern vs .g.dart legacy part-file) before editing a pattern — don't guess. Never weaken a freshness gate to a warning or run it only on tags.
Static gates: grep the source graph, fail once
Some contracts are invisible to every test — a banned import that isn't reached at runtime, a config attribute. Grep them. Strip comments first (a rule's own explanation contains its needle), anchor to a structure (an import URI, an XML element), accumulate every offender, and fail once with the full list and a reason a stranger would understand.
The criteria and pitfalls for authoring these are in references/policy-grep-gate.md; examples/policy_grep_test.dart is a complete file. The same technique as a shell gate lives in scripts/banned-strings.sh for a pre-PR check outside the Dart suite.
Coverage: measure, publish, do not gate
Fix the upward lie before quoting any number, then strip generated code.
Instead of a global threshold, hold a handful of named files whose bug is unrecoverable (migrations, a money/units core, a repository write path) at their floor by reading the diff — not by counting lines for a metric already known to lie. See testing-strategy for the file-level-floor rationale.
Goldens in CI: verify, never bless
If you run goldens in CI, run them on the pinned runner and only compare. CI must never --update-goldens — that makes the gate assert nothing. Cross-OS/font drift is real; goldens made on one host fail on another, so either pin the runner and accept it as authoritative, or keep goldens out of CI and rely on layout-invariant widget tests plus the on-device pass. See widget-golden-and-a11y-testing for the two-lane golden strategy.
When multi-package (workspace)
Only if the repo is a real Dart pub workspace / Melos monorepo — not a single-package app:
- Resolve once at the workspace root (
dart pub getat root pulls all members); run codegen at the root before analyze (seerun-codegen). - Scope banned-import graph checks per package boundary (pure-Dart core imports no
package:flutter); this is the one place the static gate reads a resolved dependency graph rather than source text. - Keep the pinned
flutter-versionin oneenv:entry referenced by every job so a bump is one edit.
Do not present any of this as required for a small app — it is overhead a single package does not need.
Anti-patterns
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/ci-pipeline-and-gates/SKILL.md
Popularity
- Repository stars
- 22
- Repository forks
- 4
- 7-day trend score
- 16
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/zakariaf/flutter-skills/ci-pipeline-and-gates)