CI/CD and Automation
You create a pipeline that is fast, deterministic, and protective: it runs the right checks automatically, fails loudly, and makes shipping boring.
Hard Rules
- Prefer fast PR checks (minutes) over heavy pipelines that nobody trusts.
- Fail on lint/test/typecheck/build before merge; keep steps deterministic.
- Never store secrets in repo; use platform secret stores and least privilege.
- Make workflows cache-aware and concurrency-safe (cancel superseded runs).
- Add automation only when it has a clear owner and a failure mode plan.
Workflow
Step 1 — Define lifecycle and artifacts
Write:
- Target events: PR, main push, tag, manual dispatch
- Required gates: lint, unit, integration, build, security scan (if available)
- Release artifact: npm package, container, binary, docs site, or “none”
Step 2 — Choose the minimum viable pipeline
Start with:
- PR workflow: checkout → setup runtime → install deps → cache → lint/typecheck → tests → build
- Main workflow: re-run critical checks + publish artifact (optional)
Step 3 — Make it reliable
- Pin runtime versions (Node/Python/etc.)
- Use lockfiles
- Cache dependencies
- Add concurrency cancellation on PR branches
- Split slow suites into separate jobs only when needed
Step 4 — Secrets and permissions
- Use env vars from secret store
- Minimize token permissions (read-only unless publishing)
- Avoid broad “write-all” permissions on default branch workflows
Step 5 — Add automation hooks (only if they pay rent)
Examples:
- Auto-label PRs
- Run formatter on changed files (if you accept auto-fixes)
- Generate changelog on release tag
Step 6 — Verification
- Trigger PR workflow on a small change; ensure duration is acceptable
- Confirm failing checks block merge (branch protection)
- Confirm secrets are not echoed in logs
When NOT to use
- Tiny repos where CI cost exceeds value (prototype stage) unless the user explicitly wants it
- Complex deployment platforms without access (require infra context first)
Gotchas
- “Green CI” that doesn’t match local commands becomes ignored.
- Unpinned runtimes cause flakey builds over time.
- Missing branch protections makes CI advisory-only.
- Long pipelines encourage skipping checks; keep PR path fast.
Common Rationalizations
| Excuse |
Reality |
| "We don’t need CI yet" |
CI is cheapest when the repo is small; add the PR gates early. |
| "Let’s add every check" |
Overbuilt CI becomes slow and ignored; start minimal and expand on evidence. |
| "Caching is premature optimization" |
Without caching, CI becomes slow and gets bypassed. |
| "We’ll add branch protection later" |
CI without enforcement is a suggestion, not a gate. |
| "We can just use a PAT" |
PATs are high-risk; use least-privilege tokens and secret stores. |
Output Format
## CI/CD plan — [repo]
Events: [PR/main/tag/manual]
Jobs: [list]
Runtime pinned: [yes/no]
Caching: [what]
Secrets: [needed + where stored]
Protections: [branch protections summary]
Verification: [how to prove it works]
Examples
Verification
Impact Report
Repo: [name] | Workflows: N | Gates: [list]
Runtime pinned: [yes/no] | Cache: [yes/no]
Protections: [enforced/deferred]
Source: dvy1987/agent-loom — distributed by TomeVault.
1---2name: dvy1987-agent-loom-ci-cd-and-automation3description: CI/CD and Automation4---56# CI/CD and Automation78You create a pipeline that is **fast, deterministic, and protective**: it runs the right checks automatically, fails loudly, and makes shipping boring.910## Hard Rules1112- Prefer **fast PR checks** (minutes) over heavy pipelines that nobody trusts.13- Fail on **lint/test/typecheck/build** before merge; keep steps deterministic.14- Never store secrets in repo; use platform secret stores and least privilege.15- Make workflows **cache-aware** and **concurrency-safe** (cancel superseded runs).16- Add automation only when it has a clear owner and a failure mode plan.1718---1920## Workflow2122### Step 1 — Define lifecycle and artifacts2324Write:25- Target events: PR, main push, tag, manual dispatch26- Required gates: lint, unit, integration, build, security scan (if available)27- Release artifact: npm package, container, binary, docs site, or “none”2829### Step 2 — Choose the minimum viable pipeline3031Start with:32- **PR workflow**: checkout → setup runtime → install deps → cache → lint/typecheck → tests → build33- **Main workflow**: re-run critical checks + publish artifact (optional)3435### Step 3 — Make it reliable3637- Pin runtime versions (Node/Python/etc.)38- Use lockfiles39- Cache dependencies40- Add concurrency cancellation on PR branches41- Split slow suites into separate jobs only when needed4243### Step 4 — Secrets and permissions4445- Use env vars from secret store46- Minimize token permissions (read-only unless publishing)47- Avoid broad “write-all” permissions on default branch workflows4849### Step 5 — Add automation hooks (only if they pay rent)5051Examples:52- Auto-label PRs53- Run formatter on changed files (if you accept auto-fixes)54- Generate changelog on release tag5556### Step 6 — Verification5758- Trigger PR workflow on a small change; ensure duration is acceptable59- Confirm failing checks block merge (branch protection)60- Confirm secrets are not echoed in logs6162---6364## When NOT to use6566- Tiny repos where CI cost exceeds value (prototype stage) unless the user explicitly wants it67- Complex deployment platforms without access (require infra context first)6869---7071## Gotchas7273- “Green CI” that doesn’t match local commands becomes ignored.74- Unpinned runtimes cause flakey builds over time.75- Missing branch protections makes CI advisory-only.76- Long pipelines encourage skipping checks; keep PR path fast.7778---7980## Common Rationalizations8182| Excuse | Reality |83|--------|---------|84| "We don’t need CI yet" | CI is cheapest when the repo is small; add the PR gates early. |85| "Let’s add every check" | Overbuilt CI becomes slow and ignored; start minimal and expand on evidence. |86| "Caching is premature optimization" | Without caching, CI becomes slow and gets bypassed. |87| "We’ll add branch protection later" | CI without enforcement is a suggestion, not a gate. |88| "We can just use a PAT" | PATs are high-risk; use least-privilege tokens and secret stores. |8990---9192## Output Format9394```markdown95## CI/CD plan — [repo]9697Events: [PR/main/tag/manual]98Jobs: [list]99Runtime pinned: [yes/no]100Caching: [what]101Secrets: [needed + where stored]102Protections: [branch protections summary]103Verification: [how to prove it works]104```105106---107108## Examples109110<examples>111 <example>112 <input>“Add CI to a TypeScript repo.”</input>113 <output>114Create `.github/workflows/ci.yml` with node-version pinned, npm cache, `npm ci`, `npm run lint`, `npm test`, `npm run build`, concurrency cancel. Add branch protection requiring the workflow.115 </output>116 </example>117</examples>118119---120121## Verification122123- [ ] PR checks run on a sample PR and complete in an acceptable time124- [ ] Lint/tests/build are deterministic and match documented local commands125- [ ] Caching is enabled where appropriate126- [ ] Secrets are stored in the platform secret store (not repo)127- [ ] Branch protections enforce required checks (or explicitly deferred)128129---130131## Impact Report132133```134Repo: [name] | Workflows: N | Gates: [list]135Runtime pinned: [yes/no] | Cache: [yes/no]136Protections: [enforced/deferred]137```138139---140> Source: [dvy1987/agent-loom](https://github.com/dvy1987/agent-loom) — distributed by [TomeVault](https://tomevault.io).141<!-- tomevault:4.0:skill_md:2026-06-15 -->