Harden Skill: Audit & Rewrite

VerifiedCaution

Audits and rewrites a single Claude skill file applying three principles: correct visibility flags, deterministic steps, and self-verification. Produces a hardened rewrite with a changelog.

Sby Skills Guide Bot
DevelopmentIntermediate
8/10/2026
Claude Code
#skill-audit#agent-skills#determinism#self-verification#composability

Recommended for

Automated summary

Audits a single Claude skill file across visibility flags, deterministic steps, composability, and self-verification, then returns a hardened rewrite with a changelog.

Strengths

  • Gives a per-axis checklist and a pattern-to-script replacement table for deterministic steps.
  • Produces a rewritten skill plus a changelog explaining every change.
  • Checks existing scripts via capability-map.sh before recommending replacements.
  • Covers trigger metadata, duplication, input/output declarations, and pre-output self-checks.

Limitations

  • Assumes a specific `.claude/commands/[skill-name].md` layout and a `backend/scripts/capability-map.sh` script.
  • Audits only one skill at a time and does not test the rewritten skill's runtime behavior.
  • Some classifications (side effects vs. background knowledge) still depend on the model's judgment.
When to use it

Use it when an existing skill needs a focused quality pass before being committed or reused.

When not to use it

Do not use it for creating a new skill from scratch, auditing many skills at once, or validating runtime behavior.

Security analysis

Caution
Quality score88/100

The skill uses bash commands to read capability maps and run verification scripts, which is a powerful capability but for legitimate auditing purposes. It does not instruct destructive, exfiltrating, or obfuscated actions, and it explicitly forbids inventing script calls. The main risk is the undeclared tool usage and reliance on local scripts whose contents are not audited here.

Findings
  • •Skill instructs running bash scripts (e.g., backend/scripts/capability-map.sh, ship-gate.sh) but does not declare any allowed tools, creating ambiguity about execution permissions.
  • •Although the scripts appear to be legitimate repo utilities, the skill relies on unverified local script names that may not exist or could be altered, and it does not enforce path validation.
How this analysis is made

Examples

Harden an existing skill
Harden skill researcher. Audit its visibility flags, replace deterministic steps with scripts where possible, add self-verification, and output the rewritten skill plus a changelog.
Audit a custom command
Apply the audit to /my-custom-skill and rewrite it with visibility flags, deterministic script calls, and a self-check block.
Improve a planning skill
Improve skill plan using the three-axis audit: fix frontmatter visibility, remove duplicated logic, and add a changelog of changes.

name: harden-skill description: Audits and rewrites a single Claude skill file applying three principles — correct visibility flags (disable-model-invocation, user-invocable), deterministic steps (replace AI-interpretable fixed ops with scripts), and self-verification (generate AND verify output). Trigger when the user says "harden skill X", "apply audit to X", "rewrite X with visibility flags", or "improve skill X". Outputs the rewritten skill with a changelog.

/harden-skill — Single-Skill Audit & Rewrite

Takes one skill, applies the three-axis audit, and produces a hardened rewrite with a changelog of every change and why.

Composability

  • Input: A skill name (e.g. researcher, plan, /my-custom-skill)
  • Output: Rewritten skill file + changelog — ready to commit
  • Uses: backend/scripts/capability-map.sh for checking if a deterministic script already exists
  • Part of: A periodic skill maintenance cycle — run on any skill added before these principles existed

STEP 1 — Read the Skill

Read the full .claude/commands/[skill-name].md file.

Then read:

bash backend/scripts/capability-map.sh

This shows what scripts already exist as Level 3 resources.


STEP 2 — Axis 1: Visibility Audit

Check: disable-model-invocation

Does this skill have side effects that should only be user-triggered?

Side effects that require disable-model-invocation: true:

  • Commits, pushes, or merges
  • Deploys or infrastructure changes
  • Sending messages or notifications
  • Any action that's hard to reverse

If yes and the flag is missing → add it.

Check: user-invocable

Is this skill pure background knowledge that users would never /run directly?

Background knowledge that requires user-invocable: false:

  • Architecture reference sheets (file maps, env vars, stack descriptions)
  • Constraint lookup tables
  • Context injected into Claude automatically when relevant

If yes and the flag is missing → add it.

Check: Level 1 metadata quality

Does the frontmatter description field contain:

  • Precise trigger language — exact phrases that should fire this skill
  • What it produces — one-line output description
  • What it's NOT for — distinguishes from similar skills

If the description is vague → rewrite it to be precise.


STEP 3 — Axis 2: Deterministic Steps Audit

Scan every step in the skill body for AI doing something that is actually a fixed, repeatable operation:

| Pattern to flag | Replace with | |---|---| | "Run the tests and check if they pass" | bash backend/scripts/ship-gate.sh | | "Check for SQL string interpolation" | bash backend/scripts/check-sql-injection.sh | | "Is the server alive?" | bash backend/scripts/health-check.sh | | "What's the next migration number?" | bash backend/scripts/next-migration.sh | | "List all existing routes and services" | bash backend/scripts/capability-map.sh | | "Check how many connections the pool is using" | A script that queries pg_stat_activity | | Any lookup of a static fact from a file | Read the file directly or script it |

For each flagged step:

  • Confirm a script already exists (from capability-map.sh output) or flag that a new one is needed
  • Replace the step with the script call + a note that the AI should interpret the exit code / output

STEP 4 — Axis 3: Composability Audit

Check:

  • Does the skill declare its Input (what it receives) and Output (what it produces)?
  • Does it name the next skill in the chain (what to run after this)?
  • Does it duplicate logic from another skill — checklists, formats, or knowledge already in another .claude/commands/ file?
    • If yes → replace the duplicated section with "see [skill-name]" and a pointer

STEP 5 — Self-Verification Audit

Does the skill have a self-check block that runs before outputting its final result?

A self-check must verify:

  • Every required step was completed (not assumed)
  • Scripts were actually run (not skipped)
  • Output is internally consistent (e.g. verdict matches findings)
  • The recommended next step is concrete (names a skill + input string)

If the self-check is missing → add one, placed immediately before the output format section.


STEP 6 — Produce the Rewrite

Apply all findings from Steps 2–5 to produce the rewritten skill file.

Self-Check (run before outputting rewrite)

  • [ ] Frontmatter has name, description, and correct visibility flags
  • [ ] Every deterministic step identified in Step 3 is replaced with a script call
  • [ ] Composability section declares Input, Output, and next skill in chain
  • [ ] Self-check block exists and covers all required fields
  • [ ] No logic was removed that was legitimately AI judgment
  • [ ] No changes made that weren't flagged in Steps 2–5 (surgical edits only)

Output Format

## Skill Audit: [skill-name]

### Findings
| Axis | Issue | Severity |
|---|---|---|
| Visibility | [e.g. "disable-model-invocation missing — skill orchestrates commits"] | High / Medium / Low |
| Deterministic | [e.g. "Phase 3 asks AI to check if tests pass — should call ship-gate.sh"] | High / Medium / Low |
| Composability | [e.g. "Duplicates security checklist from security-and-hardening.md"] | High / Medium / Low |
| Self-verification | [e.g. "No self-check before verdict output"] | High / Medium / Low |

### Changelog
- **[line/section]:** [what changed] — [why]
- **[line/section]:** [what changed] — [why]

### Rewritten Skill
[Full rewritten .md content]

Ground Rules

  • Surgical edits only. Don't restructure the whole skill if only the frontmatter needs changing.
  • Never remove AI judgment. Only replace steps that are actually deterministic.
  • If a needed script doesn't exist — flag it as a finding but don't invent the script call. Create the script separately first.
  • One skill per run. Multiple skills = multiple runs.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/harden-skill-audit-rewrite-msmr5hav' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/harden-skill-audit-rewrite-msmr5hav/download' --output '.skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md.part' && mv '.skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md.part' '.skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md' && test -s '.skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/harden-skill' && cp -R '.skill-downloads/harden-skill-audit-rewrite-msmr5hav' '.claude/skills/harden-skill'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/harden-skill-audit-rewrite-msmr5hav'

openskills read 'harden-skill-audit-rewrite-msmr5hav'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/harden-skill-audit-rewrite-msmr5hav/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills