Agent skill

Secure Coding

by techygarg in techygarg/lattice

Apply security-conscious thinking when generating or modifying code.

MITAuto-check passedSecurity

Install Secure Coding

skills CLI
$ npx skills add techygarg/lattice --skill secure-coding -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install techygarg/lattice secure-coding --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/techygarg/lattice.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/secure-coding .claude/skills/secure-coding && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
secure-coding
GitHub stars
198
Token cost
~1.5k tokens
SKILL.md length
730 words
Files
2 (incl. references)
Skills in repo
33
Repo updated
First seen
Licence
MIT

At a glance

Apply security-conscious thinking when generating or modifying code.

  • Works in 6 steps: Read .lattice/config.yaml in the repo… → If found, check paths.secure_coding for… → If a custom document exists at that… → …
  • Generating code that handles user input
  • SKILL.md covers Config Resolution, Self-Validation Checklist, Active Anti-Pattern Scan and Ambiguity Signals, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Secure Coding is an agent skill from techygarg/lattice. Apply security-conscious thinking when generating or modifying code. Enforces trust boundary awareness, input validation, injection prevention, secrets management, and defense-in-depth authorization. Use when generating code that handles user input, authentication, authorization, database queries, external APIs, or file operations, or when the user mentions 'security review', 'secure this', 'check for vulnerabilities', 'trust boundary', 'input validation', or 'OWASP'. Loaded automatically by the code-generating…

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/defaults.md`).

It sits in Security, covering Secure coding, Debugging and Code quality. The repository describes itself as: Install engineering discipline into any AI coding assistant. Composable skills for design, implementation, review, and team standards. Better process, not just better prompts. The licence is MIT.

When your agent uses it

  • Generating code that handles user input
  • Database queries
  • File operations
  • The user mentions security review

Example prompts

  • “security review”
  • “secure this”
  • “check for vulnerabilities”
  • “/secure-coding”

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

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

What it can do on your machine

Read from SKILL.md and the folder at commit 4d6c35f. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Secure Coding loads about 1.5k tokens when it runs, and up to ~5.2k if it reads all its reference files. Until then it costs about 179 tokens; SKILL.md has 730 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~179
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from techygarg/lattice at commit 4d6c35f, republished under its MIT licence (© techygarg). 730 words, ~1,502 tokens.

Download SKILL.mdSave it as .claude/skills/secure-coding/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
secure-coding
description
Apply security-conscious thinking when generating or modifying code. Enforces trust boundary awareness, input validation, injection prevention, secrets management, and defense-in-depth authorization. Use when generating code that handles user input, authentication, authorization, database queries, external APIs, or file operations, or when the user mentions 'security review', 'secure this', 'check for vulnerabilities', 'trust boundary', 'input validation', or 'OWASP'. Loaded automatically by the code-generating molecules (code-forge, refactor-safely, bug-fix). This skill governs the security posture of generated code -- not architecture (see architecture) and not code craft (see clean-code).

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?

All checks pass → state "Passes secure-coding. [next step]."

Show full SKILL.md (331 more words)Show less

Active Anti-Pattern Scan

STOP: After verifying the checklist above, scan the output for each anti-pattern below. Any box you can check → fix before presenting the code.

  • Trust All Input: no validation on request parameters; data flows straight into business logic → validate at the boundary with an allowlist.
  • SQL String Concatenation: user input interpolated into a SQL query → use a parameterized query or ORM query builder.
  • Hardcoded Secrets: API key, password, or token in source code → use an env var or secret manager.
  • Missing Authorization: auth checked at login but not re-verified at the service or resource level → check at every layer.
  • Overly Broad Permissions: admin access granted where read-only suffices → apply least privilege.
  • Unvalidated Redirects: a user-controlled URL used in a redirect → allowlist permitted destinations.
  • Verbose Error Messages: stack trace or SQL in an API response → return a generic message; log details server-side.
  • Logging Sensitive Data: passwords, tokens, or PII in log files → log the event, not the value; mask sensitive fields.

Ambiguity Signals

Checks here often have multiple valid outcomes. When you encounter one, present the options rather than silently choosing. If framework:collaborative-judgment is loaded, use its presentation format.

  • Trust Boundary Scope: an internal API behind a trusted gateway may or may not need full boundary validation.
  • Error Message Detail: how much detail is "actionable but safe" depends on whether the consumer is a human user, a frontend client, or an internal service.
  • Validation Depth: whether to re-validate at inner layers (defense-in-depth) or trust boundary validation alone.
  • Auth vs Authz Failure Response: whether to return 401 (not authenticated) or 403 (not authorized) depends on whether the identity is known.

Core Principle

Govern the security posture of generated code -- trust boundaries, input validation, injection prevention, secrets, authorization.

Boundary with clean-code: clean-code governs error-message craft; this skill governs what error messages must not reveal (internal detail).

Boundary with architecture: architecture defines where checks live (service layer, not controller); this skill defines what to check (identity confirmed, permission granted, resource owned).

See ./references/defaults.md.

© techygarg, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/secure-coding of techygarg/lattice.

  • SKILL.md
  • references/defaults.md

Open the folder on GitHubat commit 4d6c35f

Compare with similar skills

Secure Coding next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Secure Coding compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Secure Coding this skilltechygarg/lattice198—~1.5kAutomated safety check: PassMIT
Security Reviewgithub/awesome-copilot40k1 repos~2.3kAutomated safety check: NotesMIT
Security Scanericrisco/rsc-harness156—~2.8kAutomated safety check: NotesMIT
Security Baselinerampstackco/claude-skills935—~3kAutomated safety check: PassMIT
Discover Securityrand/cc-polymath181—~1.9kAutomated safety check: PassMIT
Security Hardeningrohitg00/awesome-claude-code-toolkit2.7k—~1.5kAutomated safety check: NotesApache-2.0

Similar skills

  • Security Review

    github/awesome-copilot

    Official

    AI-powered codebase security scanner that reasons about code like a security researcher — tracing data flows, understanding component interactions, and catching vulnerabilities that pattern-matching…

    40k GitHub starsUsed in 1 repo~2.3k tokens
    SecurityAuto-check: notes
  • Security Scan

    ericrisco/rsc-harness

    A skill your agent uses when automated scanners drive a security sweep of a repo or app — SAST, dependency/lockfile CVEs, secrets in the tree or git history, IaC misconfig — and the raw output has…

    156 GitHub stars~2.8k tokensUpdated today
    SecurityAuto-check: notes
  • Security Baseline

    rampstackco/claude-skills

    Establish a security baseline for a website or web app. An agent skill from rampstackco/claude-skills.

    935 GitHub stars~3k tokensUpdated today
    SecurityAuto-check passed
  • Discover Security

    rand/cc-polymath

    Automatically discover security skills when working with authentication, authorization, input validation, security headers, vulnerability assessment, or secrets management.

    181 GitHub stars~1.9k tokensUpdated 7 mo ago
    SecurityAuto-check passed
  • Security Hardening

    rohitg00/awesome-claude-code-toolkit

    Application security covering input validation, auth, headers, secrets management, and dependency auditing

    2.7k GitHub stars~1.5k tokensUpdated 4 mo ago
    DevOps & CloudAuto-check: notes
  • Runs claude-flow CLI security scans for input validation, path traversal, SQL injection, XSS, hardcoded secrets and known CVEs, and writes an audit report.

    74k GitHub starsUsed in 2 repos~823 tokens
    SecurityAuto-check passed

More from techygarg/lattice

All 33 skills in this repo
  • Architecture Compass

    techygarg/lattice

    Architectural thinking partner for an existing repository — scans the codebase, conducts a structured interview, agrees on current architectural state and recommended direction, and produces a…

    198 GitHub stars~4.4k tokensUpdated yesterday
    Auto-check passed
  • Lattice Init

    techygarg/lattice

    Guided setup and upgrade-check experience for Lattice projects -- scans the repository, detects existing configuration and outdated conventions, suggests refiners and available upgrades in priority…

    198 GitHub stars~3.3k tokensUpdated yesterday
    Auto-check passed
  • Skill Align

    techygarg/lattice

    Audit and fix all Lattice documentation, README, docs/, PROJECT.md, GitHub issue templates, and CLAUDE.md to ensure they are fully aligned with the current skill inventory.

    198 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Skill Validate

    techygarg/lattice

    Validate any Lattice SKILL.md against all tier conventions — atoms, molecules, and refiners.

    198 GitHub stars~1.5k tokensUpdated yesterday
    Auto-check passed
  • Architecture Refiner

    techygarg/lattice

    Facilitate a structured conversation to define architecture principles for a repository.

    198 GitHub stars~3.7k tokensUpdated yesterday
    Auto-check passed
  • Clean Code Refiner

    techygarg/lattice

    Facilitate a structured conversation to define clean code principles for a repository.

    198 GitHub stars~3k tokensUpdated yesterday
    Auto-check passed

Questions about Secure Coding

What does Secure Coding do?

Apply security-conscious thinking when generating or modifying code. Secure Coding is an agent skill from techygarg/lattice. Apply security-conscious thinking when generating or modifying code.

When should I use Secure Coding?

Secure Coding fits situations like: generating code that handles user input; database queries; file operations; the user mentions security review.

How do I install Secure Coding in Claude Code?

Run `npx skills add techygarg/lattice --skill secure-coding -a claude-code`. Or copy the skill folder (skills/secure-coding in techygarg/lattice) into .claude/skills/secure-coding in your project. Claude Code loads it when a task matches its description.

How do I install Secure Coding in Codex?

Run `npx skills add techygarg/lattice --skill secure-coding -a codex`. Or copy the skill folder (skills/secure-coding in techygarg/lattice) into .agents/skills/secure-coding in your project. Codex loads it when a task matches its description.

Can I use Secure Coding in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add techygarg/lattice --skill secure-coding -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/secure-coding, .gemini/skills/secure-coding, .github/skills/secure-coding and .opencode/skills/secure-coding in your project.

What does Secure Coding need to run?

SKILL.md names no scripts, command-line tools or credentials: Secure Coding is instructions for the agent only.

Does Secure Coding access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Secure Coding safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Secure Coding use?

Secure Coding is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Secure Coding use?

About 1.5k tokens (SKILL.md is roughly 6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.7k tokens, read only when the agent opens those files.

What are the alternatives to Secure Coding?

Skills that share tags, products or a category with Secure Coding: Security Review (github/awesome-copilot, 40k stars), Security Scan (ericrisco/rsc-harness, 156 stars), Security Baseline (rampstackco/claude-skills, 935 stars) and Discover Security (rand/cc-polymath, 181 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Secure Coding?

techygarg (a GitHub user) maintains it in techygarg/lattice, which has 198 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on October 6, 2026.

Source: techygarg/lattice on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.