Repo Hardening
Overview
Use this skill to run a deterministic repo inventory, write reusable hardening artifacts into the target repo, and then drive a concrete remediation pass with evidence-backed verification.
This skill's default artifact location is .repo-hardening/, with an optional override when the repo already has a preferred location.
When To Use
Use this skill when:
- auditing a repo for supply-chain risk
- hardening GitHub Actions or GitLab CI
- checking lockfile and package-manager discipline
- investigating mutable refs, broad workflow permissions, raw bootstrap/download paths, or bot workflows
- creating a reusable audit packet for a repo that does not already have one
- responding to a new package incident and checking whether a repo is exposed
Principles
- Deterministic first: run the inventory script before making claims.
- Repo-local artifacts: write findings into the target repo so future work has a durable trail.
- Minimum viable hardening: prefer the smallest safe change set that materially improves posture.
- Verification before closure: rerun the repo's native checks before claiming the repo is hardened.
- Do not assume house style: default to
.repo-hardening/ unless the repo already has an established security artifact location.
Artifact Model
Default output directory in the target repo:
.repo-hardening/
Default generated files:
inventory.json
audit.md
hardening-plan.md
If the repo already uses a canonical location such as security/, you may override the output path explicitly. See references/artifact-layout.md.
Audit Workflow
- Run the deterministic inventory:
python3 <skill-dir>/scripts/repo_inventory.py <repo-path>
Optional incident-package checks:
python3 <skill-dir>/scripts/repo_inventory.py <repo-path> --package axios --package litellm
Optional output override:
python3 <skill-dir>/scripts/repo_inventory.py <repo-path> --out-dir security
- Read the generated artifacts in the target repo:
inventory.json for raw evidence
audit.md for findings
hardening-plan.md for prioritized work
Load references/hardening-matrix.md for stack-specific remediation choices.
Explain the findings in this order:
current exposure
highest-value fixes
residual risk
Hardening Workflow
- Run the inventory first if current artifacts do not exist or are stale.
- Apply the minimum safe hardening changes for the repo's stack:
- Node:
pnpm install --frozen-lockfile or npm ci, pinned packageManager, pinned GitHub Action SHAs
- Python:
uv sync --frozen or hash-verified requirements installs
- GitHub Actions: explicit top-level
permissions:, no mutable uses: refs
- GitLab CI: reduce fresh installs, pin reusable includes when practical
- Bot workflows: reduce write scopes and remove install-capable tool grants unless justified
- Remote bootstrap/downloads: replace
latest and curl | sh style flows with pinned or verified retrieval
- Run the repo's own checks and tests.
- Refresh the generated artifacts so they reflect post-change state.
- Report exactly what changed, what was verified, and what remains.
Output Requirements
When returning results to the user:
- lead with the highest-risk findings or the highest-value fixes
- include concrete file references when discussing changes
- state what verification actually ran
- state what remains local-only, uncommitted, or unpushed
When updating the repo-local artifacts:
- keep findings concise and evidence-backed
- separate current state from planned work
- distinguish completed fixes from residual backlog
Verification
- Run the target repo's native lint, build, and test commands before calling the hardening pass complete.
- Re-run
python3 <skill-dir>/scripts/repo_inventory.py <repo-path> after changes so the repo-local artifacts reflect the post-change state.
- If workflow files changed, confirm there are no mutable
uses: refs and no missing top-level permissions: blocks.
- If install paths changed, confirm the repo now uses a frozen or hash-verified form in CI.
Boundaries
- Do not assume every repo should adopt the same package manager or CI shape.
- Do not rewrite repo history or revert unrelated local work.
- Do not claim a repo is hardened without rerunning native verification.
- Do not create or delete repo-local security directories unless the user asked; use
.repo-hardening/ by default.
- Do not silently remove bot workflows; that is a product decision unless the user asked for removal.
Commands
References
references/hardening-matrix.md
references/artifact-layout.md
Sibling skills
Two security skills, distinguished by scope.
secure-code — semgrep-based static scan of application code for vulnerabilities (injection, auth, secrets). This skill is broader (supply-chain, CI/CD, repo posture); pair them on high-stakes audits.
audit-skill — security audit specifically for agent skills (prompt injection, exfiltration). Different artifact; use that one before installing third-party skills.
1---2name: repo-hardening3description: Audit and harden a software repo against supply-chain and workflow risks. Use when a user asks to audit a repo, harden CI, pin GitHub Actions, freeze installs, reduce bot workflow risk, review lockfile/package-manager discipline, or create repo-local security investigation artifacts. Supports Node, Python, GitHub Actions, GitLab CI, and mixed-stack repos. On-demand via /repo-audit and /repo-harden.4---56# Repo Hardening78## Overview910Use this skill to run a deterministic repo inventory, write reusable hardening artifacts into the target repo, and then drive a concrete remediation pass with evidence-backed verification.1112This skill's default artifact location is `.repo-hardening/`, with an optional override when the repo already has a preferred location.1314## When To Use1516Use this skill when:17- auditing a repo for supply-chain risk18- hardening GitHub Actions or GitLab CI19- checking lockfile and package-manager discipline20- investigating mutable refs, broad workflow permissions, raw bootstrap/download paths, or bot workflows21- creating a reusable audit packet for a repo that does not already have one22- responding to a new package incident and checking whether a repo is exposed2324## Principles2526- **Deterministic first**: run the inventory script before making claims.27- **Repo-local artifacts**: write findings into the target repo so future work has a durable trail.28- **Minimum viable hardening**: prefer the smallest safe change set that materially improves posture.29- **Verification before closure**: rerun the repo's native checks before claiming the repo is hardened.30- **Do not assume house style**: default to `.repo-hardening/` unless the repo already has an established security artifact location.3132## Artifact Model3334Default output directory in the target repo:3536```text37.repo-hardening/38```3940Default generated files:4142- `inventory.json`43- `audit.md`44- `hardening-plan.md`4546If the repo already uses a canonical location such as `security/`, you may override the output path explicitly. See `references/artifact-layout.md`.4748## Audit Workflow49501. Run the deterministic inventory:5152```bash53python3 <skill-dir>/scripts/repo_inventory.py <repo-path>54```5556Optional incident-package checks:5758```bash59python3 <skill-dir>/scripts/repo_inventory.py <repo-path> --package axios --package litellm60```6162Optional output override:6364```bash65python3 <skill-dir>/scripts/repo_inventory.py <repo-path> --out-dir security66```67682. Read the generated artifacts in the target repo:69- `inventory.json` for raw evidence70- `audit.md` for findings71- `hardening-plan.md` for prioritized work72733. Load `references/hardening-matrix.md` for stack-specific remediation choices.74754. Explain the findings in this order:761. current exposure772. highest-value fixes783. residual risk7980## Hardening Workflow81821. Run the inventory first if current artifacts do not exist or are stale.832. Apply the minimum safe hardening changes for the repo's stack:84- Node: `pnpm install --frozen-lockfile` or `npm ci`, pinned `packageManager`, pinned GitHub Action SHAs85- Python: `uv sync --frozen` or hash-verified requirements installs86- GitHub Actions: explicit top-level `permissions:`, no mutable `uses:` refs87- GitLab CI: reduce fresh installs, pin reusable includes when practical88- Bot workflows: reduce write scopes and remove install-capable tool grants unless justified89- Remote bootstrap/downloads: replace `latest` and `curl | sh` style flows with pinned or verified retrieval90913. Run the repo's own checks and tests.924. Refresh the generated artifacts so they reflect post-change state.935. Report exactly what changed, what was verified, and what remains.9495## Output Requirements9697When returning results to the user:9899- lead with the highest-risk findings or the highest-value fixes100- include concrete file references when discussing changes101- state what verification actually ran102- state what remains local-only, uncommitted, or unpushed103104When updating the repo-local artifacts:105106- keep findings concise and evidence-backed107- separate current state from planned work108- distinguish completed fixes from residual backlog109110## Verification111112- Run the target repo's native lint, build, and test commands before calling the hardening pass complete.113- Re-run `python3 <skill-dir>/scripts/repo_inventory.py <repo-path>` after changes so the repo-local artifacts reflect the post-change state.114- If workflow files changed, confirm there are no mutable `uses:` refs and no missing top-level `permissions:` blocks.115- If install paths changed, confirm the repo now uses a frozen or hash-verified form in CI.116117## Boundaries118119- Do not assume every repo should adopt the same package manager or CI shape.120- Do not rewrite repo history or revert unrelated local work.121- Do not claim a repo is hardened without rerunning native verification.122- Do not create or delete repo-local security directories unless the user asked; use `.repo-hardening/` by default.123- Do not silently remove bot workflows; that is a product decision unless the user asked for removal.124125## Commands126127- `/repo-audit`128- `/repo-harden`129130## References131132- `references/hardening-matrix.md`133- `references/artifact-layout.md`134135## Sibling skills136137Two security skills, distinguished by *scope*.138139- `secure-code` — semgrep-based static scan of *application code* for vulnerabilities (injection, auth, secrets). This skill is broader (supply-chain, CI/CD, repo posture); pair them on high-stakes audits.140- `audit-skill` — security audit specifically for *agent skills* (prompt injection, exfiltration). Different artifact; use that one before installing third-party skills.