Security Best Practices
Use this skill when the job is to name one missing security layer and turn it into a bounded hardening brief.
The job is not to dump a giant OWASP list, middleware catalog, or scanner parade.
The job is to:
- frame the surface and risk,
- choose one primary hardening mode,
- recommend the smallest credible first slice,
- name the verification ladder,
- route adjacent work honestly.
Read these support docs first:
- references/modes-and-boundaries.md
- references/mode-packets-and-route-outs.md
- references/hardening-review-checklist.md
- references/verification-ladder.md
When to use this skill
- A team says “make this secure” and the missing security layer is still unclear
- A web app, API, marketing-site flow, admin panel, or game-service surface needs a hardening pass before launch or migration
- You need to decide whether the main problem is CSP/headers, cookies/CSRF, abuse controls, validation/unsafe execution, secret handling, or weak verification
- Scanner findings, OWASP requests, or launch-review notes need to be converted into one prioritized hardening brief
- The current stack has some controls already, but trust is low and the next verification step is unclear
When not to use this skill
- The main job is choosing an auth vendor, session architecture, org/member model, or enterprise SSO path →
authentication-setup
- The main job is API contract/interface design before security controls are slotted in →
api-design
- The main job is schema constraints, token tables, indexes, or migration safety →
database-schema-design
- The main job is backend regression coverage or auth/security test implementation →
backend-testing
- The main job is fixing a specific vulnerability in code or reviewing a concrete diff →
debugging or code-review
- The main job is secret injection mechanics, toolchain bootstrapping, or environment wiring →
system-environment-setup / environment-setup
- The main job is cloud IAM, VPC/network, or broader infrastructure security → use the infrastructure-specific skill instead of this app-hardening anchor
Instructions
Step 1: Frame the hardening job before naming tools
Capture the minimum facts first.
security_intake:
surface: frontend | backend-api | fullstack | edge-worker | marketing-site | game-service-web | mixed | unknown
workflow_type: new-build | hardening-pass | audit-review | launch-readiness | incident-follow-up | migration
auth_session_model: cookie-session | bearer-token | mixed | unknown
current_controls:
- headers-csp
- csrf
- rate-limit
- validation
- secret-store
- scanning
- none
primary_risk: xss-browser-policy | csrf-session | abuse-automation | injection-unsafe-execution | secret-exposure | verification-gap | mixed | unknown
environments: local | preview | staging | prod | multi-env | unknown
ownership: app-team | platform | security | shared | unknown
Rule: do not start with “install Helmet,” “turn on CORS,” or “just add WAF rules.”
First label the missing layer.
Step 2: Choose exactly one primary hardening mode
Use the router in references/mode-packets-and-route-outs.md.
Primary modes:
browser-perimeter-policy
session-cookie-csrf
abuse-controls
validation-unsafe-execution
secrets-runtime-config
review-verification
Pick the highest-risk missing layer as primary.
List everything else as follow-up, not as equal co-owners.
Step 3: Keep the invariants visible
These rules survive every answer:
- CORS, auth, CSRF, rate limiting, validation, and secrets are separate concerns even when they touch the same route
- browser-policy work may need staged rollout or report-only verification
- framework defaults help, but they do not prove full coverage
- secret scanning is detection, not storage/rotation policy
- WAF and rate limiting are compensating/perimeter controls, not full substitutes for app-layer fixes
- every recommendation needs a matching verification step
Step 4: Build the security hardening brief
Return this structure:
# Security Hardening Brief
## Scope
- Surface: ...
- Workflow type: ...
- Primary mode: ...
- Confidence: high | medium | low
## Current control state
- Controls already present: ...
- Missing or untrusted controls: ...
## Highest-risk gaps
1. ...
2. ...
3. ...
## Recommended first slice
1. ...
2. ...
3. ...
## Verification plan
- Manual review: ...
- Static/policy checks: ...
- Dynamic/runtime verification: ...
- Operational evidence: ...
## Ownership and route-outs
- Primary owner: ...
- Adjacent skills / teams: ...
Step 5: Use the mode packet, not a giant checklist
Pull the packet from references/mode-packets-and-route-outs.md.
Mode rules:
browser-perimeter-policy → headers, CSP, framing, secure transport, report-only rollout, proxy/CDN vs app ownership
session-cookie-csrf → cookie flags, state-changing browser routes, origin assumptions, web vs API/mobile differences
abuse-controls → login/reset/form/expensive-endpoint protection, per-route vs global limits, bot carve-outs, monitoring
validation-unsafe-execution → trust boundaries, validation/encoding, uploads, SSRF, command execution, dangerous patterns
secrets-runtime-config → secret-vs-config separation, storage/injection, least privilege, rotation/revocation, client-bundle avoidance
review-verification → classify findings, keep/fix/add/defer decisions, smallest proof ladder, honest ownership
Step 6: Route adjacent work explicitly
Use these route-outs when the problem crosses boundaries:
| If the real job is... |
Route to... |
| auth vendor choice, enterprise SSO, org/member model, hosted-vs-native auth |
authentication-setup |
| API auth/error/webhook contract design |
api-design |
| schema constraints, token tables, migration/data-model safety |
database-schema-design |
| backend security regression tests or CI gates |
backend-testing |
| concrete vulnerability fix or risky diff review |
debugging / code-review |
| environment bootstrap or secret injection wiring |
system-environment-setup / environment-setup |
Output expectations
A strong answer from this skill should:
- identify the primary missing layer,
- recommend one bounded first slice,
- name the verification ladder,
- avoid pretending one library/tool solves everything,
- route adjacent work outward instead of absorbing it.
Examples
Example 1: cookie-based admin app hardening
Input
Our Next.js admin app uses cookie sessions. POST routes lack CSRF protection and staging/prod cookie flags drift.
Output direction
- choose
session-cookie-csrf
- identify which routes need CSRF protection and which cookie flags must be fixed
- include a verification step for staging/prod drift
- avoid reframing the task as auth-vendor selection
Example 2: marketing-site form abuse
Input
Our signup and demo-request forms are getting spammed even after adding a honeypot and CAPTCHA.
Output direction
- choose
abuse-controls
- separate form abuse controls from generic CSP/header work
- recommend route-aware throttles / anti-automation steps plus monitoring
- keep broader infrastructure or vendor-rule authoring outside the core brief
Example 3: game-service secret leakage risk
Input
We have a game companion site plus backend APIs. I’m worried partner keys and admin tokens are drifting into CI logs and maybe client bundles.
Output direction
- choose
secrets-runtime-config
- separate secret detection from storage/rotation/injection policy
- route environment bootstrapping details away when needed
- include revocation/rotation proof requirements
Example 4: scanner report with weak ownership
Input
The scanner says weak CSP and missing headers, but the app already added middleware and no one trusts the result.
Output direction
- choose
review-verification or browser-perimeter-policy
- keep middleware installation distinct from rollout proof
- recommend staged/report-only verification or a scanner/runtime handoff
Best practices
- Choose the missing security layer before naming tools.
- Keep browser policy, session safety, abuse controls, validation, secrets, and verification separate.
- Pair every recommendation with evidence that would prove it worked.
- Treat framework defaults and scanners as inputs, not final answers.
- Prefer one bounded hardening brief over a giant compliance dump.
References
1---2name: security-best-practices3description: >4 Routing-first skill for web/application/API hardening. Use when the main job is5 classifying which security layer is missing — browser/perimeter policy,6 session/cookie/CSRF, abuse controls, validation/unsafe execution,7 secrets/runtime config, or verification — and turning vague OWASP/security asks8 into one concrete hardening brief. Route auth-stack choice to9 `authentication-setup`, schema work to `database-schema-design`, code-level bug10 fixing to `debugging` / `code-review`, and environment wiring to11 `system-environment-setup`.12allowed-tools: Bash Read Write Edit Glob Grep13compatibility: >14 Best for web apps, APIs, backend/fullstack services, marketing-site forms,15 edge/frontend-plus-backend systems, and game-adjacent service/web launch16 surfaces where the team needs a vendor-neutral hardening workflow instead of a17 giant middleware or scanner checklist.18license: MIT19metadata:20 source: https://skillmd.com/skills/akillness/security-best-practices21 version: "2.1.0"22 modernization: 2026-04-1423 hardening: 2026-04-1824 tags: security-best-practices, owasp, appsec, csp, csrf, secrets, rate-limiting, web-security, api-security25 platforms: Claude, ChatGPT, Gemini, Codex26---2728# Security Best Practices2930Use this skill when the job is to **name one missing security layer and turn it into a bounded hardening brief**.3132The job is not to dump a giant OWASP list, middleware catalog, or scanner parade.33The job is to:341. frame the surface and risk,352. choose one primary hardening mode,363. recommend the smallest credible first slice,374. name the verification ladder,385. route adjacent work honestly.3940Read these support docs first:41- [references/modes-and-boundaries.md](references/modes-and-boundaries.md)42- [references/mode-packets-and-route-outs.md](references/mode-packets-and-route-outs.md)43- [references/hardening-review-checklist.md](references/hardening-review-checklist.md)44- [references/verification-ladder.md](references/verification-ladder.md)4546## When to use this skill47- A team says “make this secure” and the missing security layer is still unclear48- A web app, API, marketing-site flow, admin panel, or game-service surface needs a hardening pass before launch or migration49- You need to decide whether the main problem is CSP/headers, cookies/CSRF, abuse controls, validation/unsafe execution, secret handling, or weak verification50- Scanner findings, OWASP requests, or launch-review notes need to be converted into one prioritized hardening brief51- The current stack has some controls already, but trust is low and the next verification step is unclear5253## When not to use this skill54- **The main job is choosing an auth vendor, session architecture, org/member model, or enterprise SSO path** → `authentication-setup`55- **The main job is API contract/interface design before security controls are slotted in** → `api-design`56- **The main job is schema constraints, token tables, indexes, or migration safety** → `database-schema-design`57- **The main job is backend regression coverage or auth/security test implementation** → `backend-testing`58- **The main job is fixing a specific vulnerability in code or reviewing a concrete diff** → `debugging` or `code-review`59- **The main job is secret injection mechanics, toolchain bootstrapping, or environment wiring** → `system-environment-setup` / `environment-setup`60- **The main job is cloud IAM, VPC/network, or broader infrastructure security** → use the infrastructure-specific skill instead of this app-hardening anchor6162## Instructions6364### Step 1: Frame the hardening job before naming tools65Capture the minimum facts first.6667```yaml68security_intake:69 surface: frontend | backend-api | fullstack | edge-worker | marketing-site | game-service-web | mixed | unknown70 workflow_type: new-build | hardening-pass | audit-review | launch-readiness | incident-follow-up | migration71 auth_session_model: cookie-session | bearer-token | mixed | unknown72 current_controls:73 - headers-csp74 - csrf75 - rate-limit76 - validation77 - secret-store78 - scanning79 - none80 primary_risk: xss-browser-policy | csrf-session | abuse-automation | injection-unsafe-execution | secret-exposure | verification-gap | mixed | unknown81 environments: local | preview | staging | prod | multi-env | unknown82 ownership: app-team | platform | security | shared | unknown83```8485Rule: do **not** start with “install Helmet,” “turn on CORS,” or “just add WAF rules.”86First label the missing layer.8788### Step 2: Choose exactly one primary hardening mode89Use the router in [references/mode-packets-and-route-outs.md](references/mode-packets-and-route-outs.md).9091Primary modes:921. `browser-perimeter-policy`932. `session-cookie-csrf`943. `abuse-controls`954. `validation-unsafe-execution`965. `secrets-runtime-config`976. `review-verification`9899Pick the **highest-risk missing layer** as primary.100List everything else as follow-up, not as equal co-owners.101102### Step 3: Keep the invariants visible103These rules survive every answer:104- CORS, auth, CSRF, rate limiting, validation, and secrets are separate concerns even when they touch the same route105- browser-policy work may need staged rollout or report-only verification106- framework defaults help, but they do not prove full coverage107- secret scanning is detection, not storage/rotation policy108- WAF and rate limiting are compensating/perimeter controls, not full substitutes for app-layer fixes109- every recommendation needs a matching verification step110111### Step 4: Build the security hardening brief112Return this structure:113114```markdown115# Security Hardening Brief116117## Scope118- Surface: ...119- Workflow type: ...120- Primary mode: ...121- Confidence: high | medium | low122123## Current control state124- Controls already present: ...125- Missing or untrusted controls: ...126127## Highest-risk gaps1281. ...1292. ...1303. ...131132## Recommended first slice1331. ...1342. ...1353. ...136137## Verification plan138- Manual review: ...139- Static/policy checks: ...140- Dynamic/runtime verification: ...141- Operational evidence: ...142143## Ownership and route-outs144- Primary owner: ...145- Adjacent skills / teams: ...146```147148### Step 5: Use the mode packet, not a giant checklist149Pull the packet from [references/mode-packets-and-route-outs.md](references/mode-packets-and-route-outs.md).150151Mode rules:152- `browser-perimeter-policy` → headers, CSP, framing, secure transport, report-only rollout, proxy/CDN vs app ownership153- `session-cookie-csrf` → cookie flags, state-changing browser routes, origin assumptions, web vs API/mobile differences154- `abuse-controls` → login/reset/form/expensive-endpoint protection, per-route vs global limits, bot carve-outs, monitoring155- `validation-unsafe-execution` → trust boundaries, validation/encoding, uploads, SSRF, command execution, dangerous patterns156- `secrets-runtime-config` → secret-vs-config separation, storage/injection, least privilege, rotation/revocation, client-bundle avoidance157- `review-verification` → classify findings, keep/fix/add/defer decisions, smallest proof ladder, honest ownership158159### Step 6: Route adjacent work explicitly160Use these route-outs when the problem crosses boundaries:161162| If the real job is... | Route to... |163|---|---|164| auth vendor choice, enterprise SSO, org/member model, hosted-vs-native auth | `authentication-setup` |165| API auth/error/webhook contract design | `api-design` |166| schema constraints, token tables, migration/data-model safety | `database-schema-design` |167| backend security regression tests or CI gates | `backend-testing` |168| concrete vulnerability fix or risky diff review | `debugging` / `code-review` |169| environment bootstrap or secret injection wiring | `system-environment-setup` / `environment-setup` |170171## Output expectations172A strong answer from this skill should:1731. identify the **primary missing layer**,1742. recommend one bounded first slice,1753. name the **verification ladder**,1764. avoid pretending one library/tool solves everything,1775. route adjacent work outward instead of absorbing it.178179## Examples180181### Example 1: cookie-based admin app hardening182**Input**183> Our Next.js admin app uses cookie sessions. POST routes lack CSRF protection and staging/prod cookie flags drift.184185**Output direction**186- choose `session-cookie-csrf`187- identify which routes need CSRF protection and which cookie flags must be fixed188- include a verification step for staging/prod drift189- avoid reframing the task as auth-vendor selection190191### Example 2: marketing-site form abuse192**Input**193> Our signup and demo-request forms are getting spammed even after adding a honeypot and CAPTCHA.194195**Output direction**196- choose `abuse-controls`197- separate form abuse controls from generic CSP/header work198- recommend route-aware throttles / anti-automation steps plus monitoring199- keep broader infrastructure or vendor-rule authoring outside the core brief200201### Example 3: game-service secret leakage risk202**Input**203> We have a game companion site plus backend APIs. I’m worried partner keys and admin tokens are drifting into CI logs and maybe client bundles.204205**Output direction**206- choose `secrets-runtime-config`207- separate secret detection from storage/rotation/injection policy208- route environment bootstrapping details away when needed209- include revocation/rotation proof requirements210211### Example 4: scanner report with weak ownership212**Input**213> The scanner says weak CSP and missing headers, but the app already added middleware and no one trusts the result.214215**Output direction**216- choose `review-verification` or `browser-perimeter-policy`217- keep middleware installation distinct from rollout proof218- recommend staged/report-only verification or a scanner/runtime handoff219220## Best practices2211. Choose the missing security layer before naming tools.2222. Keep browser policy, session safety, abuse controls, validation, secrets, and verification separate.2233. Pair every recommendation with evidence that would prove it worked.2244. Treat framework defaults and scanners as inputs, not final answers.2255. Prefer one bounded hardening brief over a giant compliance dump.226227## References228- [OWASP Application Security Verification Standard](https://owasp.org/www-project-application-security-verification-standard/)229- [OWASP Cheat Sheet Series](https://cheatsheetseries.owasp.org/)230- [MDN: Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP)231- [MDN: Set-Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)232- [OWASP ZAP](https://www.zaproxy.org/)233- [GitHub CodeQL code scanning](https://docs.github.com/en/code-security/concepts/code-scanning/codeql/about-code-scanning-with-codeql)