security-hardening

security-hardening is a skill for Claude Code, Codex from monkilabs/opencastle. It costs 56 tokens per session (541 once invoked), scanned A, original, MIT.

A security design guide for sign-in, user permissions, browser security headers, input checks, APIs, and database row-level security, which controls access to individual database rows.

In plain words
What is it for?
Use it to implement authentication and authorization, configure content security policies, validate inputs, secure APIs, and write row-level security policies.
Why use it?
It helps prevent unauthorized access, unsafe input, cross-site attacks, and mistakes where client-side checks are trusted on their own.

Skill for Claude CodeCodex

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

Good fit Use it to implement authentication and authorization, configure content security policies, validate inputs, secure APIs, and write row-level security policies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/monkilabs/opencastle/security-hardening
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 monkilabs/opencastle --skill security-hardening
Clone the repo
git clone --depth 1 https://github.com/monkilabs/opencastle

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-hardening

README.md
[![agentmods](https://agentmods.dev/badge/skills/monkilabs/opencastle/security-hardening/github.svg)](https://agentmods.dev/skills/monkilabs/opencastle/security-hardening)
Your own site
<a href="https://agentmods.dev/skills/monkilabs/opencastle/security-hardening"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/security-hardening/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-hardening

Your own site · 80×15
<a href="https://agentmods.dev/skills/monkilabs/opencastle/security-hardening"><img src="https://agentmods.dev/badge/skills/monkilabs/opencastle/security-hardening.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 541 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00056 $0.00541
Opus 5.5 $0.00022 $0.00216
Sonnet 5.5 $0.00011 $0.00108
Haiku 4.5 $0.00006 $0.00054

Measured 17d ago against content hash 316684be9bf4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

security-hardening scanned grade A with 1 finding 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 17d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

Least privilege: allow only the origins each directive needs, and nonces or hashes in production instead of `'unsafe-inline'` or `'unsafe-eval'`. Check what actually ships with `curl -I` against a preview URL: CSP, `Stri
src/orchestrator/skills/security-hardening/SKILL.md · 37 lines

How it starts

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

Security Hardening

These hold whatever the stack. The stack's own rules — its auth library, its database's access policies, its framework's middleware — are in the skills bound to the database and framework slots of .opencastle/agents/skill-matrix.json.

Authentication and sessions

  • Sign-in, sign-up and sign-out go through server-side handlers with CSRF protection: POST only, Origin checked.
  • Sessions live in HTTP-only, Secure, SameSite cookies, and are refreshed and checked on the server for every protected route — never only in the client.
  • Roles and permissions are stored server-side, where the client cannot write them.

Authorization and data access

  • Check on the server, for every read and write, who is asking and whether they may touch this record. Hiding a button is not access control.
  • Identity comes from the verified session, never from a request parameter.
  • Where the data layer has policies (row-level security, rules), enable them on every table, deny by default and allow explicitly — and keep a test that proves another user reads nothing.

Input and output

  • Validate every handler's input with a schema before it reaches the database or another service. Client-side validation is feedback, not protection.
  • Parameterized queries only. Sanitize user-supplied HTML (DOMPurify or the equivalent) before rendering it.
  • Errors sent to the client carry no stack trace, query or internal id.

Headers and CSP

Least privilege: allow only the origins each directive needs, and nonces or hashes in production instead of 'unsafe-inline' or 'unsafe-eval'. Check what actually ships with curl -I against a preview URL: CSP, Strict-Transport-Security, X-Content-Type-Options: nosniff, Referrer-Policy.

Secrets and scheduled routes

  • Secrets live in environment variables — never in code, logs or the client bundle. A value the browser needs is public.
  • A cron or webhook route checks a shared secret (authorization: Bearer <secret>, generated with openssl rand -hex 32) or the provider's signature, and answers 401 otherwise.
  • Check a new dependency's audit (npm audit, or the project's equivalent) before adding it.

Read the full file on GitHub · 37 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. 17d ago Changed · +1 lines · +6 tokens per session 316684be9bf4
  2. 19d ago Changed · -12 tokens per session cc7cd18fdc09
  3. 1mo ago First seen · 36 lines · 62 tokens per session scan A 8a85980a2431

Subscribe to this mod's changes

security-hardening is a skill published in the GitHub repository monkilabs/opencastle (80 stars, last pushed 3d ago), licensed MIT. It adds 56 tokens to every session and 541 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

transactional-patterns

Use when defining or debugging Spring Boot 3 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events. For duplicate HTTP commands use idempotency-patterns; for reactive transactions use webflux-reactive-patterns.

rrezartprebreza/spring-boot-skills · 53 tokens

flyway-migrations

Use when creating database migrations, schema changes, seed data, or any SQL that modifies database structure. Covers Flyway naming conventions, versioning, and safe migration patterns.

rrezartprebreza/spring-boot-skills · 39 tokens

spring-data-redis

Use when implementing caching, session storage, rate limiting, or any Redis integration. Covers cache-aside pattern, key naming, TTL strategy, and serialization config.

rrezartprebreza/spring-boot-skills · 37 tokens

spring-data-jpa

Use when generating JPA entities, repositories, queries, or anything touching the persistence layer. Covers entity conventions, N+1 prevention, projections, and query patterns.

rrezartprebreza/spring-boot-skills · 38 tokens

idempotency-patterns

Use when making retried HTTP commands or message processing safe against duplicate effects, including database-backed request keys, payload conflicts and concurrent retries. Do not apply caching as a substitute for business idempotency.

rrezartprebreza/spring-boot-skills · 46 tokens

multi-tenancy

Use when implementing tenant resolution, database or schema isolation, tenant-aware JPA, reactive tenant context, migrations, caching, jobs, or authorization in Spring Boot 3.

rrezartprebreza/spring-boot-skills · 38 tokens