Skip to content
Back to skills

Repo Config

ASecurity

Cross-cutting contract for the test-readiness pipeline. Specifies the GitHub repository configuration that makes "tests pass" structurally meaningful instead of advisory — branch protection requiring CI to pass, required secrets, environments, deploy hooks, and PR templates. Referenced by `test-design` (Phase 2 emits the repo-config plan) and `test-roadmap` (Phase 4 auto-pairs workflow tasks with branch-protection tasks). Without these, the verification commands in each task body are honor-sy...

  • 16 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 2, 2026
ai-agentsgogitapi

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned December 4, 2026

npx -y skills add app-vitals/shipwright --skill repo-config --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Repo Config?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Repo Config
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/app-vitals-repo-config/badge)](https://www.skillsdirectory.com/skills/app-vitals-repo-config)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: repo-config
description: >
  Cross-cutting contract for the test-readiness pipeline. Specifies the GitHub repository configuration that makes "tests pass" structurally meaningful instead of advisory — branch protection requiring CI to pass, required secrets, environments, deploy hooks, and PR templates. Referenced by `test-design` (Phase 2 emits the repo-config plan) and `test-roadmap` (Phase 4 auto-pairs workflow tasks with branch-protection tasks). Without these, the verification commands in each task body are honor-system; with them, the workflow is the gate.
---

# repo-config skill

## Purpose

Capture the repository-level configuration that turns CI into an actual gate. The audit's verification commands are only meaningful if `main` cannot be merged unless they pass.

## When invoked

- By `test-design` (Phase 2) — emits the **Repo Configuration** section of the blueprint
- By `test-roadmap` (Phase 4) — applies the **pairing rule** (a human-only settings task when a repo first sets up, or switches to, the required `CI` check)
- By `test-fix` (Phase 5) — the task's `acceptanceCriteria` array is the task-store equivalent of a Closing Checklist

## The repo-config plan

A complete repo-config plan covers four concerns:

### 1. Branch protection

For each protected branch (default: `main`):

This is the standard recommendation for every shipwright repo — one flat default, not a
choice between options. Shipwright repos are moving toward `shipwright-merge` (agent
merges via `gh pr merge --squash`, deferring to native branch protection with the merging
account configured as a ruleset `bypass_actor`) across the board, so recommend the settings
below regardless of where a given repo currently is in that rollout.

- **Required PR** — no direct pushes.
- **Required status checks** — a single check named `CI`, the aggregate job of `test.yml` (see "One required check: `CI`" below). This is the real gate: CI must be green on the branch that lands. `merge.md` now defers to this natively rather than bypassing it outright, so it's a live merge-gate for the merge phase too, not just a signal for merges that skip `merge.md` (e.g. a human merging via the GitHub UI) — though a `bypass_actor` merging account can still push past it if a status check regresses after the pre-flight check ran.
- **Require conversation resolution before merging** — **no.** Not worth recommending: `check-patch.ts`'s `hasUnaddressedFindings()` only checks for unresolved threads when a qualifying review exists at the *current* HEAD commit — if a later commit lands without a fresh qualifying review at that commit (e.g. a CI-only fix), stale unresolved threads from an earlier review are never revisited, and nothing in the pipeline resolves them. The merging account is configured as a ruleset `bypass_actor`, which bypasses this setting regardless of whether `merge.md` force-merges or defers natively, so the theoretical "free safety net for manual merges" benefit doesn't hold up against the risk of a PR getting stuck with orphaned unresolved threads no automated process will ever clean up. Not worth the effort to fix the gap for a benefit this narrow.
- **Require branches to be up to date before merging** — **no.** The merging account's `bypass_actor` status on the ruleset bypasses this regardless of whether `merge.md`'s merge step goes through natively or hits the branch-protection-block backstop. It also has a concrete, independent cost: GitHub's strict status checks go stale whenever the base branch moves, and with multiple agents merging PRs in parallel, every merge into main invalidates the "up to date" status of every other open PR — forcing a rebase and a full CI re-run on each sibling PR just to become mergeable again. Real Action-minutes burned for no benefit, on top of being redundant with the required-status-check gate above.
- **Required approving reviews** — **0.** GitHub rejects self-APPROVE via the API, so `review.md` Step 10 force-downgrades an agent's review of its own PR to `COMMENT` with a `Verdict: APPROVE` marker — a required-review count can never be satisfied by the pipeline itself. `merge.md` now defers to this setting natively for identities that are not a ruleset `bypass_actor`, treating a missing required review as a branch-protection-block: the PR is marked `blocked` rather than force-merged, and a human must add a real approval or configure the identity as a `bypass_actor`.
- **Enforce on admins** — **no.** The merging account still relies on being a ruleset `bypass_actor` to merge self-reviewed PRs — `merge.md` no longer force-bypasses branch protection outright, but the merge model still depends on that bypass existing for the common case. `enforce_admins: true` would either block every automated merge for accounts without a real second approval, or require the merging account to be a permanent `bypass_actor` anyway, which is enforcement in name only.
- **Canary status check is NOT included** — canary runs post-merge; gates promotion staging → prod, not merge to main

#### One required check: `CI`

Recommend exactly one required check, named `CI`. Other checks (e.g. secret scanning) may stay separate only if they report on every PR. Later test jobs join `CI` by being added to its `needs`, so adding a job never needs a branch-protection settings change.

**Safe skips.** The workflow starts on every PR and on every default-branch push, with no workflow-level path filter. A change-detection job decides which tests are affected; optional jobs use a job-level `if:`. The `CI` job uses `if: always()`, `needs` change detection and every test and coverage job, and fails when change detection does not succeed or does not give valid choices, or when any needed job fails or is cancelled. Only intentional skips pass. Require `CI`, not the optional jobs: a job skipped because an earlier job failed reports as skipped (which counts as passing), so requiring the optional job itself would let a PR through.

```yaml
on:
  push:
    branches: [main]   # the default branch
  pull_request:        # no workflow-level paths filter

jobs:
  changes:
    runs-on: ubuntu-latest
    outputs:
      run_tests: ${{ steps.detect.outputs.run_tests }}
    steps:
      - uses: actions/checkout@v4
      - id: detect
        run: echo "run_tests=true" >> "$GITHUB_OUTPUT"   # replace with real change detection; emit true or false

  test:
    needs: changes
    if: needs.changes.outputs.run_tests == 'true'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # ... unit, integration and smoke tests ...

  coverage-check:
    needs: [changes, test]
    if: always() && needs.changes.outputs.run_tests == 'true'
    runs-on: ubuntu-latest
    steps:
      - run: echo "publish shipwright-coverage, then check the rising minimum on the combined all-layer report; a missing or failed report fails this job"

  CI:
    needs: [changes, test, coverage-check]
    if: always()
    runs-on: ubuntu-latest
    steps:
      - name: Fail unless every needed job passed or was intentionally skipped
        env:
          CHANGES: ${{ needs.changes.result }}
          RUN_TESTS: ${{ needs.changes.outputs.run_tests }}
          RESULTS: ${{ join(needs.*.result, ' ') }}
        run: |
          [ "$CHANGES" = success ] || { echo "change detection did not succeed"; exit 1; }
          case "$RUN_TESTS" in true|false) ;; *) echo "invalid change-detection output"; exit 1;; esac
          case " $RESULTS " in *" failure "*|*" cancelled "*) echo "a needed job failed or was cancelled"; exit 1;; esac
          if [ "$RUN_TESTS" = true ]; then
            case " $RESULTS " in *" skipped "*) echo "a job that should have run was skipped"; exit 1;; esac
          fi
```

Rules that follow from this:

- **Never require a workflow that may not start.** If a workflow can be filtered out entirely (workflow-level `paths:` / `branches:` filters), its required check stays pending forever and blocks the PR. This is why `CI` lives in a workflow that starts on every PR.
- **Prefer running all tests.** Path rules can skip tests that a change still affects (shared code, dependencies, build settings). Run the tests when unsure.
- **`CI` reports after the jobs it needs.** Custom automation that watches checks and merges with `--admin` must wait for the whole workflow run to finish first, not act on the first green check (`scripts/platform-bump-gate.sh` is an example).

### 2. Required secrets and environments

For each external integration named in the inventory, list the GitHub secret needed to authenticate against it in CI and canary mode. For each deployment target, list the GitHub Environment.

Tests exercise third-party HTTP APIs through recorded fixture doubles (msw / nock / hand-authored JSON), so the test run itself needs no third-party credential. Secrets listed here are only for checks that hit a live service.

Minimum set for the test pipeline:
- `TEST_CANARY_API_KEY` — scoped canary auth token
- `TEST_TARGET_URL` per environment (often set in the workflow, not as a secret)
- Per-external: `<SERVICE>_API_KEY` (only where a live integration needs a credential)
- Per-environment GitHub Environments (`staging`, `production`) with required reviewers if promotion is gated

### 3. Deploy hooks

- Post-deploy workflow trigger — typically `workflow_run` on the deploy workflow's `completed` event filtered to success
- Canary workflow uses the deployed env's `TEST_TARGET_URL`
- Promotion workflow gated on canary success

See [`references/deploy-canary-promote.md`](./references/deploy-canary-promote.md) for a full reference contract covering the three critical wiring details: non-empty-tag guard, skipped-job-counts-as-success hole, and staging-vs-prod `TEST_TARGET_URL`.

### 4. PR conventions

- **Closing PR must reference the issue** via `Closes #N` or `Fixes #N` in the body
- **Verification output** — the PR description must include the output of the issue's `Verification command` (or a CI run link that shows the same)
- **Acceptance-criteria checkboxes** — all checked before merge

A PR template (`.github/pull_request_template.md`) can enforce the verification-output convention via a checklist.

## The pairing rule (Phase 4 — test-roadmap)

When generating the task list, a repo-settings task is emitted only when a repo first sets up, or switches to, the required `CI` check. Adding later jobs to `CI` (via `needs`) emits no settings task, because the required check does not change.

Pattern:

| Workflow task | Paired branch-protection task |
|---|---|
| Create / update `test.yml` that first sets up, or switches to, the required `CI` check | Enable branch protection on `main` requiring the single `CI` check (see below) |
| Add later test jobs to `CI` | None — no settings change |
| Add canary workflow | Wire as deploy-gate (NOT as merge-gate) |
| Add deploy workflow | Add `staging` / `production` GitHub Environments with required reviewers |

**Branch-protection settings task shape.** It is a human-only dev task: `hitl: true`, `status: pending`, no coding. Its description has a `## Human steps` section: (1) confirm `CI` passed on `main`, then (2) change the required checks in the repo's branch protection or ruleset to require `CI`. It `depends_on` the task that adds `CI`. Only work that needs the new rule depends on it; unrelated tasks do not.

Why `hitl: true` and not blocked: a blocked review task is unblocked into the agent queue, where an agent that may lack permission to read or change branch protection would pick it up. A human-only task is never handed to an agent. Land the workflow first, confirm green on main, then the human enables protection, which avoids the chicken-and-egg block.

## Coverage minimum (rising, checked inside `CI`)

The coverage check is not a separate branch-protection setting. It runs as a job that `CI` already needs, so it is enforced by the one required `CI` check and emits no settings task, no never-decrease task and no promotion task.

**Order.** Publish coverage first (the `shipwright-coverage` artifact, per `plugins/shipwright/references/coverage-output.md`), then add tests until line coverage reaches the **90%** target. The check below is added once a complete report exists.

**Rising minimum.** The minimum starts at the repo's current line coverage and the check fails below it. Any task that adds coverage raises the minimum to the new figure in the same PR, until it reaches 90%. The minimum then stays at 90%. Store it in a file in the repo (for example `.shipwright/coverage-minimum`) so raising it is a normal reviewed change.

**Where it is checked.** Check it where all layer reports come together:

- **One test job (the default):** in that job, after the layers have run.
- **Split jobs:** in a `coverage-check` job that downloads every layer's report. It runs on PRs and on the default branch, and `CI` lists it in `needs`.

**What it measures.** Follow `plugins/shipwright/references/coverage-output.md`: every layer, lcov reports combined by `(file, line)` rather than summed, and the same `.shipwright/coverage.json` exclusions as the published figure.

**Never compare partial coverage.**

- On the default branch, always run every coverage layer and publish a complete report.
- On a PR, either run every coverage layer, or skip all layers and the check together for a change that clearly cannot affect them (the change-detection job decides, and `CI` treats that skip as intentional).
- Never compare partial coverage with the full minimum.
- A missing or failed report fails the check.

## The closing checklist (Phase 5 — test-fix)

Every task-store task `test-fix` queues must carry closing-checklist concerns in its
`acceptanceCriteria` array (a flat list of strings — see `test-fix/SKILL.md`'s field-building
section). This converts the verification command from a suggestion into a mergeable gate:

```json
"acceptanceCriteria": [
  "All acceptance-criteria items above are satisfied",
  "Verification command `{verify}` run; output captured in the closing PR description",
  "CI is green on the PR (assuming branch protection is enabled)",
  "No source files outside `Files to touch` were modified, or the deviation is justified in the PR description"
]
```

The third item only becomes a hard gate once branch protection is on. Until then, it's still good hygiene.

## What this skill produces in artifacts

### In `test-system.md` (Phase 2 output)

A `## Repo configuration` section with the four concerns filled in for the target repo:
- Branch protection rule definition
- Required secrets list
- Required environments list
- PR template recommendation

### In `test-readiness-plan.md` (Phase 4 output)

A `## Repo configuration tasks` block listed alongside the test tasks. By default these go in **M1** (infrastructure baseline) with `depends_on` pointing at the corresponding workflow task.

### In each task issue body (Phase 5 output)

A `## Closing checklist` section at the bottom.

## Anti-patterns

- **"Tests pass" without branch protection.** Without enforcement, the audit is a social contract. Engineers WILL bypass it under deadline pressure. Branch protection is the only mechanism that scales beyond one careful reviewer.
- **Required canary checks at merge time.** Canary needs a deployed env; gating merge on canary creates a deadlock. Canary gates *promotion*, not merge.
- **Recommending required-review ≥1 / enforce-admins:true / require-up-to-date / require-conversation-resolution for a shipwright-merge repo.** The merging account's ruleset `bypass_actor` status (see `merge.md`, which now defers to native branch protection rather than force-bypassing with `--admin`) is the merge model's real bypass mechanism, not an emergency exemption, and it bypasses all four of these settings wholesale regardless of whether the merge command itself carries a bypass flag. Requiring ≥1 approval doesn't add a review — self-APPROVE is blocked by GitHub's API — "up to date" burns real CI minutes on every sibling PR each time main advances, and conversation resolution can leave a PR permanently stuck (see `check-patch.ts`'s `hasUnaddressedFindings()` gap above) for a benefit (a "safety net" for manual merges that also get bypassed) not worth the maintenance cost. Stricter-looking, not actually stricter.
- **Secrets baked into workflows.** Use GitHub Secrets + Environments. Workflow YAML references `${{ secrets.X }}`, never literal values.
- **No PR template.** Closing checklists in issue bodies help, but PRs without a template forget the verification-output convention within weeks.

Files in this skill

  • SKILL.content.test.ts6.6 KB
  • SKILL.md17.7 KB
  • references/deploy-canary-promote.md4.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.