Skip to content
Skills Library
Security · Building & coding

secure-code

/secure-code

Use when writing or changing code that takes input from outside, handles authentication, authorization, secrets, files, network requests, database queries or the output of a language model.

Repository
14All ↗
Licence
MIT
Last repository change
05.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use when writing or changing code that takes input from outside, handles authentication, authorization, secrets, files, network requests, database queries or the output of a language model.

Original author description

Use when writing or changing code that takes input from outside, handles authentication, authorization, secrets, files, network requests, database queries or the output of a language model.

How it works

  1. Threat model first
  2. Always, ask first, never
  3. The usual holes
  4. A language model in the code
  5. Reporting
Original SKILL.md headings · 47 lines, 407 words
SKILL.md preview
---
name: secure-code
description: Use when writing or changing code that takes input from outside, handles authentication, authorization, secrets, files, network requests, database queries or the output of a language model.
---

# Secure Code

Security problems come from what an outsider can send, not from what the code is meant to do. Start from the outsider.

## Threat model first

Before you write the code, write five lines (in your notes, not in the code):

1. What is worth protecting (data, money, accounts, the machine).
2. Where the trust boundaries are: what comes from outside, what is inside.
3. The entry points: each route, form, file, message, command-line argument and environment variable.
4. Who can send what to each entry point, with what permission.
5. Two or three abuse cases: "someone sends X to get Y".

## Always, ask first, never

**Always**
- Validate input at the boundary, by what is allowed, not by what is forbidden.
- Use parameterized queries and argument lists. Check authorization on every request and on every object, not only at login.
- Hash passwords with a slow, salted hash. Keep secrets in the environment or a secret store.
- Treat the data inside the boundary as trusted only after it has passed the boundary.

**Ask first**
- A new dependency, a change to authentication or permissions, a new request to an address the user can choose, storing personal data, a new way to run user-supplied code.

**Never**
- Build a query, a command or a path from raw input.
- Disable a check, or catch and ignore its error, to make a test pass.
- Commit a secret, or log a password, a token or a full card number.
- Trust a client-side check as the only check.

## The usual holes

Injection (query, command, template); path traversal; server-side request forgery; a missing authorization check; unsafe deserialization; weak randomness or hashing; open redirects; cross-site scripting and request forgery; outdated dependencies; error messages that reveal internals.

## A language model in the code

- Its output is untrusted input: validate it, and never run it as code or as a command without a check.
- Give each tool the least permission the task needs.
- Keep secrets and other users' data out of its prompts.
- A person confirms an irreversible action.

## Reporting

For each problem say where (`file:line`), who sends what to get what, the fix, and how you know: `read` (in the code), `inferred` (reasoned, not run) or `unverified`. For a dedicated pass over a diff or a directory use the `security-auditor` agent; `code-review` covers the rest of a review.
Files in this package (2)
  • SKILL.md 3 KB
  • meta.yaml 1 KB

Versions

The database has no other skills named secure-code.

Database snapshot: 13.11.2026 · package version 8a1a5e8a4513 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 90secure-code-generation
    Plan, generate, and review application code with security checks. Use when implementing or changing software.
  • 100secure-code-review
    Perform a security-focused code review of a change or codebase — authentication, authorization (object/function level), input handling and injection, output encoding, cryptography, secrets, deserialization, SSRF, file handling, logging — with language-specific sinks and a…
  • 100secure-coding
    Secure-by-default rules for writing or editing ANY code. Use whenever you create, modify, or generate code that touches user input, HTTP/APIs, databases/SQL, files, shell commands, auth/login/sessions, secrets/API keys/config, crypto/hashing/tokens, payments, uploads, C/C++…
  • 100secure-change
    Build or review code that handles login, permissions, user input, files, secrets, payments or personal data. Use this whenever a change adds an endpoint, a form, an upload, a query built from input, a webhook, a token or an admin action, even if security was not mentioned.
  • 96ditz-secure
    Use when adding auth, secrets, or handling user input.
  • 100secure-code-review
    Review a focused code change for exploitable security defects using the feature's trust boundaries and data flow. Use for authentication, authorization, input handling, file access, payments, secrets, or other sensitive changes.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.