secure-coding

A set of guidelines for writing and changing code with security in mind, especially when code handles user input, logins, databases, or outside services.

In plain words
What is it for?
Use it when building or modifying features that accept user data, manage authentication or permissions, query databases, call external APIs, or handle secrets.
Why use it?
It helps prevent common problems such as unsafe input, code injection, exposed secrets, and missing access checks.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/techygarg/lattice/secure-coding
Any agent
npx skills add techygarg/lattice --skill secure-coding
Clone the repo
git clone --depth 1 https://github.com/techygarg/lattice

Made for: Claude Code, Codex.

Per session 137 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,291 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00137 $0.01291
Opus 5 $0.00068 $0.00646
Sonnet 5 $0.00027 $0.00258
Haiku 4.5 $0.00014 $0.00129

Measured 2d ago against content hash fc9d23af9d92, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

secure-coding 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 2d 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.

plugins/lattice/skills/secure-coding/SKILL.md · 68 lines

How it starts

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

Secure Coding

Config Resolution

Projects can customize this skill's standards. Resolution order:

  1. Read .lattice/config.yaml in the repo root.
  2. If found, check paths.secure_coding for a custom document path.
  3. If a custom document exists at that path, read it and check its YAML frontmatter for mode:
    • mode: override: the custom document has full precedence. Use it instead of the embedded defaults. It must be comprehensive -- treat it as the sole reference.
    • mode: overlay (or no mode field): read the embedded ./references/defaults.md first, then apply the custom document's sections on top. A custom section replaces the matching default section (matched by exact heading); new sections append after the defaults.
  4. If a custom path is configured but no document exists at it → tell the user which configured path is missing, then fall back to ./references/defaults.md.
  5. If there is no config file or no paths.secure_coding key, read ./references/defaults.md.
  6. Language adaptation: if paths.language_idioms is set in the config and the document exists, read its "Error Handling" section and adapt §2 (Input Validation Patterns) error-message patterns to the language's idioms. Language idioms take precedence over the pseudocode defaults.

Self-Validation Checklist

STOP after generating each component. Verify ALL checks before proceeding. A check clearly fails → fix the code before presenting. A check is a judgment call with multiple valid approaches (see Ambiguity Signals) → flag it -- present options and reasoning rather than silently choosing.

  1. TRUST BOUNDARIES: Where does trusted code meet untrusted data? Are all boundaries explicitly identified?
  2. INPUT VALIDATION: Is every external input validated at the boundary with an allowlist before it reaches business logic?
  3. QUERY SAFETY: Are all database queries parameterized? Is any string concatenation used in query building?
  4. COMMAND SAFETY: Is there any shell/command execution? If so, is the input strictly allowlisted?
  5. SECRETS: Are there API keys, passwords, tokens, or connection strings in code? If so → move them to environment variables or a secret manager.
  6. OUTPUT ENCODING: Is output encoded appropriately for its render context (HTML, JSON, URL)?
  7. AUTHORIZATION: Is authorization verified at the service layer, not just the controller? Does every endpoint enforce least privilege?
  8. ERROR MESSAGES: Do error messages exposed to users avoid revealing internal detail (stack traces, SQL queries, file paths)?
  9. DEPENDENCIES: Is each new third-party package necessary? Are versions pinned or constrained? Is any known-vulnerable package being added?

Read the full file on GitHub · 68 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 68 lines · 137 tokens per session scan A fc9d23af9d92

Subscribe to this mod's changes

secure-coding is a skill published in the GitHub repository techygarg/lattice (183 stars, last pushed 4d ago), licensed MIT. It adds 137 tokens to every session and 1,291 once invoked, about $0.0007 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.

Related

Other skills, from other repositories

xiaoyaoclaw-workspace-initializer

OpenClaw workspace initialization & standardization. Sets up a proper agent home: standard directory structure (projects/tasks/outputs/knowledge/scripts/ memory/tmp) + WORKSPACE.md rules + multi-agent config safety (config.patch, never config.apply) + memory log. Use when an agent enters a new/empty workspace root, or…

dtsola/xiaoyaoclaw-workspace-initializer · 105 tokens

learn

Search, install, update, and rate AI agent skills from agentskill.sh (100,000+ skills). Use when the user asks to find skills, install extensions or plugins, discover new capabilities, check what skills are available, or says "how do I do X" when a skill might help. Also handles listing installed skills, checking for…

agentskill-sh/ags · 115 tokens

review-skill

Review and improve AI agent skills (SKILL.md files) against best practices from the Agent Skills specification and Anthropic's authoring guidelines. Scores skills on 10 quality dimensions, identifies specific issues, and rewrites problem areas. Use when creating, editing, auditing, or improving agent skills. Triggers…

agentskill-sh/ags · 90 tokens

building-chatgpt-apps

Guides creation of ChatGPT Apps with interactive widgets using OpenAI Apps SDK and MCP servers. Use when building ChatGPT custom apps with visual UI components, embedded widgets, or rich interactive experiences. Covers widget architecture, MCP server setup with FastMCP, response metadata, and Developer Mode…

mjunaidca/mjs-agent-skills · 87 tokens

memory-systems

Design and implement memory architectures for agent systems. Use when building agents that need to persist state across sessions, maintain entity consistency, or reason over structured knowledge.

mjunaidca/mjs-agent-skills · 35 tokens

multi-agent-patterns

Design multi-agent architectures for complex tasks. Use when single-agent context limits are exceeded, when tasks decompose naturally into subtasks, or when specializing agents improves quality.

mjunaidca/mjs-agent-skills · 38 tokens