Harden
Run the toolkit's security commands in order to surface secrets, MCP supply-chain issues, install drift, release provenance gaps, and untrusted-code risks before shipping. Use before opening a PR, after adding a dependency, or whenever the security posture needs a fresh check.
Get the complete skill folder, including its scripts and reference files.
When to use this skill
Use Harden when an AI agent needs a reusable SKILL.md workflow for this job: Run the toolkit's security commands in order to surface secrets, MCP supply-chain issues, install drift, release provenance gaps, and untrusted-code risks before shipping. Use before opening a PR, after adding a dependency, or whenever the security posture needs a fresh check.
When not to use it
Skip Harden when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.
How to install
Where will you use it?
mkdir -p ~/.claude/skills/harden # Save SKILL.md to ~/.claude/skills/harden/SKILL.md
- Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/harden/SKILL.md. For a shared project, commit the folder at .claude/skills/harden/ instead.
- Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
- For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.
Full install guide for Claude, Cursor, and Codex →
Try a starter prompt
After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.
Use the Harden skill for this task: Use Harden when this documented workflow matches the task. Confirm any required inputs or files before making changes.
What supports this recommendation?
69/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.
- Documentation
- 77/100
- Practical detail
- 68/100
- Source evidence
- 54/100
- Source signals
- 70/100
Model compatibility evidence
- claudeinferred
The skill text mentions Claude or a closely associated term. This is keyword-derived compatibility; no hands-on model test is recorded.
- chatgptuntested
No model-specific signal or recorded compatibility test was found.
- geminiuntested
No model-specific signal or recorded compatibility test was found.
- copilotuntested
No model-specific signal or recorded compatibility test was found.
- llamauntested
No model-specific signal or recorded compatibility test was found.
- perplexityuntested
No model-specific signal or recorded compatibility test was found.
- mistraluntested
No model-specific signal or recorded compatibility test was found.
- grokuntested
No model-specific signal or recorded compatibility test was found.
Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.
What this skill does
# Harden — security sweep in five ordered steps
Run each command in sequence. Stop on a non-zero exit and fix the finding before proceeding. All five must pass before the branch is considered hardened.
## Steps
### 1 · Secrets — `compass scan --staged` Scan the staged diff for secrets at the commit boundary.
``` compass scan --staged ```
Exits 0 (clean) or 1 (secrets found). Fix: remove the secret, rotate the credential, then re-stage. Add an `# allowlist secret` comment ONLY for confirmed test fixtures — never real credentials.
### 2 · MCP supply-chain pins — `scripts/check-mcp.sh` Verify every auto-installed MCP server is pinned to an exact version and that no `@latest` float or shell-injection marker has crept in.
``` bash scripts/check-mcp.sh ```
Exits 0 (pinned + clean) or non-zero (floating version or injection marker). Fix: pin the version in `mcp/servers.json` and re-run. (`setup-mcp.sh` runs this same audit as a pre-flight, and `compass doctor` includes it.)
### 3 · Install fidelity — `compass drift` Check that the installed `~/.claude` config still matches this repo's source. Catches hand-edited copies, stale hooks, and non-executable guardrail scripts.
``` compass drift ```
Exits 0 (in sync) or non-zero (drift detected). Fix: re-run `quickstart.sh` or remove the hand-edited file and let the install re-link it.
### 4 · Release provenance — `compass verify` Verify the latest release tarball's keyless SLSA attestation. Requires `gh`.
``` compass verify ```
Exits 0 (attestation valid), 77 (gh lacks attestation support — skip), or non-zero (attestation missing or invalid). A 77 is a safe skip on old gh versions; anything else is a provenance gap to investigate.
### 5 · Untrusted code — `compass sandbox -- <cmd>` Run any untrusted command inside a real OS sandbox (no network, writes confined to cwd/tmp via bwrap/firejail/sandbox-exec). Required before executing code fetched from external sources.
``` compass sandbox -- <cmd> ```
Exits 0 (ran confined), 2 (usage error — supply a command), or non-zero if the sandboxed command itself fails. If no backend is available the CLI refuses to run the command unconfined — install bwrap or firejail first.
## Notes - Run the five steps in order; each one gates the next in severity. - `compass scan --staged` should also be wired as a pre-commit hook (`compass scan --staged` in `.git/hooks/pre-commit`) for continuous coverage. - Security (`compass scan`, `compass verify`) and drift detection (`compass drift`) are also surfaced in `compass dashboard` for a fleet-wide view. - This skill does not replace a full `/security-review` — it gates the mechanical checks. Run `/security-review` on the diff for human-judgment findings.
Intended uses
- Use Harden when this documented workflow matches the task.
Implementation notes
- Review the source instructions and adapt inputs before running the workflow.
Try it, then tell us how it went
A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.