security-hardener

security-hardener is a skill for Claude Code, Codex from khalilbenaz/claude-skills-collection. It costs 86 tokens per session (2,426 once invoked), scanned A, original, MIT.

A guide for securing AI agents against malicious instructions, misuse, and data leaks. It examines threats such as prompt injection, tool abuse, social engineering, and uncontrolled API costs.

In plain words
What is it for?
Use it for threat modelling, security reviews before deployment, and agents that can write, delete, send, or publish content. It also covers production and compliance concerns.
Why use it?
It helps identify how untrusted user input or external data could alter an agent's behaviour, expose sensitive information, or trigger harmful actions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for threat modelling, security reviews before deployment, and agents that can write, delete, send, or publish content. It also covers production and compliance concerns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/khalilbenaz/claude-skills-collection/security-hardener
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add khalilbenaz/claude-skills-collection --skill security-hardener
Clone the repo
git clone --depth 1 https://github.com/khalilbenaz/claude-skills-collection

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for security-hardener

README.md
[![agentmods](https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/security-hardener/github.svg)](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/security-hardener)
Your own site
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/security-hardener"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/security-hardener/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for security-hardener

Your own site · 80×15
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/security-hardener"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/security-hardener.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,426 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. ✓ AI security review Sonnet 5 · 7 Sept 2026 📄 Read the review
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00086 $0.02426
Opus 5 $0.00043 $0.01213
Sonnet 5 $0.00017 $0.00485
Haiku 4.5 $0.00009 $0.00243

Measured 11d ago against content hash 689ec1752d67, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

security-hardener scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agent-skills/security-hardener/SKILL.md · 256 lines

How it starts

The opening of the file, as written. The whole thing — 256 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Security Hardener

Quand utiliser ce skill

Agent exposé à des inputs utilisateurs non fiables, déployé en production, ou soumis à des exigences réglementaires (GDPR, SOC2, HIPAA, PCI-DSS). S'applique aussi lors d'une revue sécurité pré-déploiement ou après un incident.


Workflow en 10 étapes

1. Threat modeling — cartographier avant de mitiger

Commence toujours par identifier la surface d'attaque réelle :

Menace Vecteur Impact
Prompt injection directe Input utilisateur malveillant Contournement des instructions
Prompt injection indirecte Données externes (web, fichiers, BDD) Prise de contrôle via contenu tiers
Data exfiltration Manipulation du contexte Fuite du system prompt ou données sensibles
Tool abuse Instruction de supprimer/envoyer/publier Actions destructrices irréversibles
Cost attack (DoS éco.) Requêtes token-maximisantes Facture API hors de contrôle
Social engineering Dérive progressive du contexte Contournement progressif des guardrails

Critère de décision : si l'agent a accès à des outils avec effets de bord (write, delete, send), le niveau de sécurité est automatiquement "HIGH" — appliquer toutes les étapes.


2. Input sanitization

import re

INJECTION_PATTERNS = [
    r"ignore\s+(all\s+)?previous\s+instructions",
    r"system\s+prompt",
    r"jailbreak",
    r"DAN\b",
    r"<\s*(INST|SYS|system|prompt)\s*>",
    r"forget\s+(everything|your\s+rules)",
]

def is_safe_input(text: str, max_len: int = 4000) -> tuple[bool, str]:
    if len(text) > max_len:
        return False, "INPUT_TOO_LONG"
    for pattern in INJECTION_PATTERNS:
        if re.search(pattern, text, re.IGNORECASE):
            return False, f"INJECTION_DETECTED:{pattern}"
    return True, "OK"
  • Valider les inputs structurés avec Pydantic (schéma strict, pas de champs extra="allow").
  • Échapper les délimiteurs de prompt (---, ###, <user>) provenant de l'utilisateur.
  • Piège : l'encodage Base64 ou les caractères Unicode homoglyphes contournent les regex naïves. Normaliser le texte (unicode NFKC) avant de filtrer.

Read the full file on GitHub · 256 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 256 lines · 86 tokens per session scan E 689ec1752d67

Subscribe to this mod's changes

security-hardener is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (22 stars, last pushed 17d ago), licensed MIT. It adds 86 tokens to every session and 2,426 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.