/lstack:devops-pipelinefrom lstack
Configures pre-commit hooks and lean GitHub Actions for shift-left QA. Use when adding, auditing, or speeding up CI/CD or cutting Actions minutes or cost.
Ships in lstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Implement DevOps quality gates adapted to the project, shift-left: run as many checks as possible locally via pre-commit, so feedback is fast and CI is a safety net, not the primary gate.
Core principle: if a check can run on a developer's machine, it runs there. GitHub Actions runs only what a laptop genuinely cannot — matrix version testing, CI-only scans, deployment, the coverage summary — plus one cheap job proving the hooks were not bypassed. Speed comes only from free techniques.
Every check lands in exactly one lane. This table is the single source of truth; steps 2–3, the references, and generated config must agree with it.
| Lane | Time budget | What runs there |
|---|---|---|
pre-commit stage (every commit) | < 10s, changed files only | Format, lint, type-check (fastest free tool), offline security scans, unit tests related to the changed files, compile/import check |
pre-push stage (every push) | < 60s | Affected tests (whole suite and coverage threshold when they fit), CLI E2E, slow lint rulesets |
| GitHub Actions, pull request | As short as the slowest guard leg | Diff-scoped bypass guard |
| GitHub Actions, default branch | Free on public repos, billed per minute on private | Full suite and version matrix (per merge, nightly on a busy private repo), cache seeding, CI-only scans, clean-VM tests, coverage summary, deploy/release |
A check that fits an earlier lane must not be repeated in a later one; the only deliberate overlaps are the bypass guard, the default-branch full run that backstops affected-test selection, and security-setup's full-scan workflow, which that skill owns.
Before creating/updating/deleting files in an existing repository, sync the current branch with remote, stashing a dirty working tree first:
git stash push -u -m "pre-sync" # only if the tree is dirty
branch="$(git rev-parse --abbrev-ref HEAD)"
git fetch origin && git pull --rebase origin "$branch"
git stash pop # only after a stash
If origin is missing, pull is unavailable, or rebase/stash conflicts occur, stop and ask the user before continuing.
This skill writes config into someone else's repository and installs git hooks:
.pre-commit-config.yaml, workflows, .oxlintrc.json, vitest.config.*, scripts, AGENTS.md). If the target file exists, follow this merge procedure:
<file>.bak.rev: values.<file>.bak and the merged content.<file>.bak until the user confirms the written result.pre-commit install moves a foreign hook to <hook>.legacy and runs it in migration mode. Never pass -f/--overwrite, which deletes it silently; deleting it needs the user's explicit confirmation.git commit --no-verify or git push --no-verify on the user's behalf, except security-setup's recorded-override commit. A failing hook is a finding to report, not an obstacle to route around.SKIP or lower a coverage threshold to turn a run green or make it faster, nor relax a lint rule or delete or skip a test without the user's approval of that named finding; a blanket "delete the slow tests" or "make it green" approves nothing. Report the failure and let the user decide.--reruns, jest.retryTimes, Vitest retry, Playwright retries). Existing retry config is a named audit finding, removed only after that finding's approval.pre-commit is absent, or origin is missing — see Step 1 and Edge Cases.Detect project characteristics:
ls -la package.json pyproject.toml Cargo.toml go.mod pom.xml build.gradle ./*.csproj 2>/dev/null
ls -la .eslintrc* .oxlintrc* .prettierrc* tsconfig.json mypy.ini setup.cfg ruff.toml 2>/dev/null
ls -la .pre-commit-config.yaml .github/workflows/*.yml 2>/dev/null
gh repo view --json visibility --jq .visibility # PUBLIC or PRIVATE
Identify:
INTERNAL included (billed per minute, each job rounded up, 2 vCPU). Step 3 generates the workflow for it; if gh cannot read it, ask, and assume private meanwhile. For a private repo, count default-branch commits over 30 days: git rev-list --count --first-parent --since=30.days <default-branch>.If no package manifest matches, ask the user for the language and build system before Step 2. Step 1 is done when the language, build system, existing tooling, existing config files, visibility, and CLI status are recorded.
If pre-commit is absent, show the install command and stop — see Edge Cases.
pip install pre-commit # or brew install pre-commit
When pre-commit is available, write .pre-commit-config.yaml for the detected stack, each check in its routing-table lane, with default_stages: [pre-commit] (a hook with no stages: otherwise also runs on every push). If the file exists, use the Safety Rails merge procedure. See references/precommit-configs.md for tool choice and configs per language, and fast test runs.
error, since its warnings exit 0. Type-check: TypeScript 7's tsc, then bun check only if faster with the same errors (tsrs stays a local benchmark until 1.0). Python: Ruff, mypy as arbiter.pytest -n auto needs pytest-xdist: when the dev extras lack it, add it in the same diff, or pytest fails with unrecognized arguments: -n.pass_filenames and require_serial: true and runs only the tests related to the staged files (vitest related --run, scripts/related-tests.py, changed Go packages), so the guard repeats only the diff's; pre-push runs the whole suite, with always_run: true so a deletion-only change still runs it (not in Multi-language, where the path-filtered matrices catch deletions).pre-push when the whole suite exceeds 60 seconds: scripts/affected-tests.sh, which fails when source changed but no test was selected, and runs the whole suite when the diff deletes code.isolate: false only with the reference's per-file reset hook.Modern stage names only (pre-commit, pre-push); run pre-commit migrate-config on a config still using the deprecated commit or push.
If the project is a CLI tool, create scripts/e2e_test.sh exercising every command/subcommand end-to-end (not just compiling), wired to the pre-push stage. See references/cli-e2e.md for command discovery, the script template, and the hook snippet.
Validate the config, dry-run it, then install the hooks, in this order:
pre-commit validate-config .pre-commit-config.yaml. On a non-zero exit, report the error and install nothing.--all-files sees tracked files only), then dry-run pre-commit run --all-files. Fixers may rewrite files, so report git diff --stat; record each failing hook id as a finding.pre-commit or pre-push exists in the directory git rev-parse --git-path hooks prints (not always .git/hooks) without File generated by pre-commit, tell the user it will move to <hook>.legacy.pre-commit install, then pre-commit install --hook-type pre-push; the first alone installs no pre-push hooks.Nothing local stops --no-verify, so never drop the CI bypass guard when trimming CI.
If no workflow exists, write .github/workflows/ci.yml. If one exists, run the CI Speed Audit first, then use the Safety Rails merge procedure, listing each step that duplicates a hook outside the deliberate overlaps as a proposed removal; remove it only after the user confirms. Templates, for example the guard: references/github-actions.md.
CI runs exactly four kinds of thing:
Make it fast, free techniques only: apply every item of references/github-actions.md → Generated-workflow checklist.
Run it before changing an existing workflow, or alone when the user asks why CI is slow. It is read-only and runs no hooks; follow references/github-actions.md. Done when each job's queue/setup/work split comes from real runs, or the report says why none were measured, and the retry check ran.
When the user wants Actions minutes or cost cut, follow references/ci-minutes.md: audit billed minutes per runner OS and the critical path, then report named findings. Apply only approved findings, on a branch, one atomic commit each, measured before and after; keep a change only when it beats noise with all jobs green, else revert it and log it in .github/CI-BUDGET.md. It ends in a pull request.
Each command below is expected to exit 0:
pre-commit run --all-files.pre-commit run --all-files --hook-stage pre-push; the first command skips push-stage hooks (full suite, E2E).bash scripts/e2e_test.sh.actionlint on each written workflow, or parse its YAML when actionlint is absent.SKIP, or lower a threshold to pass.Step 4 is done when each command has a recorded exit code.
After the last Step Completion Report, print the final report from references/final-report.md: Result: (COMPLETE, PARTIAL — reason, or BLOCKED — reason), Evidence: (only commands that ran, with exit codes), Uncertainty: (always the unrun CI workflow), and Decision:. An audit-only run uses the same report.
After running the skill, the repository contains:
.pre-commit-config.yaml — hooks on both stages, placed per the Check Routing Table..github/workflows/ci.yml — step 3's four responsibilities with its speed techniques, generated for the repo's visibility. No standalone step duplicating a hook.scripts/e2e_test.sh (CLI projects only) — executable script exercising every CLI command/subcommand.scripts/affected-tests.sh (only when the suite exceeds the push budget) — affected-test selection that fails closed.scripts/related-tests.py (Python projects) — the commit hook's selection of the unit tests related to the changed files.scripts/base-hook-gate.py — the guard's base-branch gate.An audit-only run writes nothing.
A run passes when all of the following are true:
.pre-commit-config.yaml exists at the repo root and lists at least one hook for the detected primary language (formatter, linter, or type checker).id from .pre-commit-config.yaml appears in a workflow run: step outside the deliberate overlaps, and no check runnable on a laptop is CI-only.stages: use the modern names (pre-commit, pre-push, manual); no generated config emits the deprecated commit or push.pre-commit install and pre-commit install --hook-type pre-push..github/workflows/*.yml exists and carries only the four CI responsibilities from step 3.security-setup's workflow, CI's sole pull request overlap with pre-commit is the bypass guard, and that guard is diff-scoped (--from-ref/--to-ref) and runs both stages.concurrency cancel, timeout-minutes on every job, a fetch-depth: 0 plus filter: blob:none guard checkout, and caches saved by the template's default-branch job when it has one (private Minimal has none by design); with affected-only tests, a default-branch full run and a selection that fails on zero tests for changed source.pre-commit run --all-files and pre-commit run --all-files --hook-stage pre-push both succeed (or their failures are surfaced explicitly to the user, not auto-suppressed).pre-push stage per the language reference files.files: filters. Local language: system entries must also target the package dir (npm --prefix frontend, pytest backend/tests): files: does not change cwd.origin remote: Stop and ask the user whether a local-only setup with no repo sync is acceptable; do not proceed automatically.pre-push (default-branch full run as backstop) or demote to the next lane; record the measured time in a hook comment.gh auth or run history: Review the workflow statically; say under Uncertainty: that no runs were measured.--no-verify: Local gates cannot stop this. Keep the CI bypass guard, and report the bypass rate rather than adding more hooks.After each major step, print:
◆ [Step Name] ([step N of M] — [context])
··································································
[Check 1]: √ pass
[Check 2]: √ pass (note if relevant)
[Check 3]: × fail — [reason]
[Criteria]: √ N/M met
____________________________
Result: PASS | FAIL | PARTIAL
Adapt the check names per step (check names per phase); Criteria counts the acceptance criteria met.
Optional and propose-only. After the run's result is delivered, run this check:
pre-commit, gh, actionlint, a linter or test runner) or hooks path failed and a workaround worked.references/ (the directory holding this SKILL.md). Bump the patch number of metadata.version. If the skill is an installed copy or tracked in git, say so. Commit nothing unless the user asks.Off — the user opted out.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub luongnv89/skills --plugin lstack20 skills in this plugin
/agent-configCreate, update, or audit AGENTS.md (default) or CLAUDE.md agent instructions: set up, prune, add a rule, or merge CLAUDE.md or .cursorrules into one file Claude Code, Codex, and Cursor all read. Don't use for READMEs, skills, or subagents./auto-pushGenerate a commit message, stage all changes, and push to remote after scanning for secrets, large files, and protected-branch risks. Skip for opening PRs, code review, or cutting releases/tags./cleanup-projectPrepare a git repo before new work: review uncommitted changes, fix .gitignore, delete merged branches, end on clean main, or inspect one branch before deciding. Don't use for dead code, commit-and-push, releases, LICENSE files, or git how-tos./cli-builderBuild production-quality CLIs with language detection and a five-step approval-gated workflow. Use when wrapping an existing module or app. Don't use for GUI/TUI apps, web APIs, or one-off shell scripts./code-analysis-setupPlan, then install on approval, free static analysis (lint, SAST, secrets, deps) across repos, merged into existing hooks and CI. Use when adding code analysis. Don't use for one-repo security stacks (security-setup) or CI/CD (devops-pipeline)./code-reviewReview or improve code in four modes: bug/security review (default), performance, clean-code audit, slop cleanup (mode:review|perf|clean|cleanup). Don't use for features, tests (test-coverage) or a full comment audit (comment-audit).Other plugins' skills for the same job