# Security and hardening

> Security and hardening is an open-source agent skill for security. Guides an AI agent through threat modeling, secure coding controls and dependency audits. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/addyosmani/agent-skills/tree/main/skills/security-and-hardening
- **Repository:** https://github.com/addyosmani/agent-skills
- **GitHub stars:** 122,545
- **License:** MIT
- **Skill name:** security-and-hardening
- **Collection:** https://github.com/addyosmani/agent-skills
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-12-03

## About

This skill steers an agent toward security-first development for web applications. It starts with a threat model: the agent maps trust boundaries, including LLM output and local values that look internal, names the assets at risk, and runs a STRIDE pass over each boundary before adding controls.

The guidance is organized as a three-tier rule set (always do, ask first, never do) and then as topic-by-topic controls covering injection and XSS, sessions and cookies, security headers and CORS, schema validation, file uploads, server-side request forgery, rate limiting and secrets. A separate section covers dependency hygiene, including identifying the package manager and lockfile, gating install scripts, triaging audit findings by reachability and reviewing new packages for typosquatting. Further sections address personal data minimization and retention for GDPR and CCPA, and risks specific to LLM features such as prompt injection and untrusted model output.

The skill points to a references file with concrete code patterns and a security checklist, which the agent opens as needed. It is written for web application code and assumes the agent has access to the project's source, lockfile and command line to run audits.

## When your agent uses it

> Hardens code against vulnerabilities. Use when auditing an input handler for vulnerabilities, when handling user input, authentication, data storage, or external integrations, or when checking a login flow is safe against the OWASP Top Ten. Use when building any feature that accepts untrusted data, manages user sessions or session cookies, or interacts with third-party services. Use when auditing dependencies for known vulnerabilities, triaging package-manager audit findings, or assessing supply-chain risk in a new package. Use when personal data or privacy compliance (GDPR, CCPA) is involved.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/addyosmani/agent-skills/tree/HEAD/skills/security-and-hardening)
- [License: MIT](https://github.com/addyosmani/agent-skills/tree/HEAD/skills/security-and-hardening)

## Features

- **Threat modeling first:** Walks the agent through mapping trust boundaries, naming assets and running a STRIDE pass before hardening.
- **Injection and XSS controls:** Covers parameterized queries, output encoding, authorization on every request and safe handling of raw HTML.
- **Session and auth hardening:** Sets rules for password hashing, secret sourcing and httpOnly, secure, sameSite cookies with bounded lifetimes.
- **Dependency audit triage:** Guides audit runs against the committed lockfile, script gating and checks for typosquatted or malicious packages.
- **SSRF and upload safety:** Describes allowlisting outbound URLs, blocking private addresses and validating uploaded file content.
- **Privacy and LLM risks:** Covers data minimization, retention and deletion paths, plus prompt injection and untrusted model output.

## Good for

- Audit an input handler for injection and validation gaps
- Review a login flow against the OWASP Top Ten
- Triage npm or pnpm audit findings before a release
- Check a new package for supply-chain risk before installing it
- Add rate limiting and secure session cookies to an API
- Review a feature that stores personal data for GDPR or CCPA obligations

## Install

### Claude Code

This skill ships in the `agent-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add chrisalehman/bionic
/plugin install agent-skills@bionic
```

Or copy only this skill to `~/.claude/skills/security-and-hardening`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/security-and-hardening &&
cp -R "$tmp/skills/security-and-hardening" ~/.claude/skills/security-and-hardening &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/security-and-hardening` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/security-and-hardening` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/security-and-hardening &&
cp -R "$tmp/skills/security-and-hardening" ~/.agents/skills/security-and-hardening &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/security-and-hardening` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/security-and-hardening` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/security-and-hardening &&
cp -R "$tmp/skills/security-and-hardening" ~/.cursor/skills/security-and-hardening &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/security-and-hardening` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/addyosmani/agent-skills.git --path skills/security-and-hardening
```

Or copy the folder to `~/.gemini/skills/security-and-hardening` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/security-and-hardening`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/addyosmani/agent-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/security-and-hardening &&
cp -R "$tmp/skills/security-and-hardening" ~/.copilot/skills/security-and-hardening &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/security-and-hardening` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/addyosmani/agent-skills.git
```

Then copy `agent-skills/skills/security-and-hardening` into your agent's skills folder as `security-and-hardening`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Security and hardening trigger?

It triggers when the task involves auditing input handlers, handling user input, authentication, data storage or external integrations, OWASP login checks, dependency vulnerability audits, supply-chain risk in new packages, or personal data and privacy compliance.

### Does Security and hardening need any scripts or tools?

The skill ships no scripts. It relies on the project's own package manager audit, such as npm audit or pnpm audit, and on the agent's access to the repository and its lockfile.

### What does Security and hardening leave to the reference files?

Concrete implementation patterns and a review checklist live in a separate references file that the agent opens when it reaches that code.

### How do I install Security and hardening in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/security-and-hardening to use it in all your projects, or to .claude/skills/security-and-hardening in one project. Or install the agent-skills plugin, which includes it: /plugin marketplace add chrisalehman/bionic, then /plugin install agent-skills@bionic.

### Does Security and hardening run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Security and hardening?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Security and hardening?

The closest alternatives to Security and hardening are Security and hardening, Agent security hardening, Agentic safety audit, Security and Threat model.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Security and hardening](https://ai-powered.com/skills/security-and-hardening-ajyadav013-2): Security and hardening is an open-source agent skill for security.
- [Agent security hardening](https://ai-powered.com/skills/agent-security-hardening): Agent security hardening is an open-source agent skill for security.
- [Agentic safety audit](https://ai-powered.com/skills/agentic-safety-audit): Agentic safety audit is an open-source agent skill for security.
- [Security](https://ai-powered.com/skills/security-sorah): Security is an open-source agent skill for security.
- [Threat model](https://ai-powered.com/skills/threat-model-ajyadav013): Threat model is an open-source agent skill for security.
- [Security review](https://ai-powered.com/skills/security-review-getsentry): Security review is an open-source agent skill for security.
- [Security](https://ai-powered.com/skills/security-jasgujral): Security is an open-source agent skill for security.
- [AI threat testing](https://ai-powered.com/skills/ai-threat-testing): AI threat testing is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/security-and-hardening
