mcpbeat Sign in

Secure Coding Agent Skill

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, file operations, or when the user mentions 'security review', 'secure this', 'check for vulnerabilities', 'trust boundary', 'input validation', or 'OWASP'. This skill governs the security posture of generated code -- not architecture (see architecture) and not code craft (see clean-code).

5k tokens
context cost
the whole folder, loaded on every use
2
files
instructions only
0
copies elsewhere
how many repositories repackaged it
169
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/techygarg/lattice --skill secure-coding

The instruction itself

6 sections, as written by the author

Secure Coding

Config Resolution

Skill support project-custom. Order:

  • Look .lattice/config.yaml in repo root
  • If found, check paths.secure_coding for custom doc path
  • If custom path exist, read doc, check YAML frontmatter for mode:
  • mode: override (or no mode): Custom doc take full precedence.

Use instead embed default. Must be comprehensive -- sole reference.

  • mode: overlay: Read embed ./references/defaults.md first, then apply

custom doc sections on top. Custom sections replace matching

sections in default (match by heading). New sections append after default.

  • If no config, no path, or path not found, read ./references/defaults.md
  • Language adaptation: If paths.language_idioms exist in config, read "Error Handling" section and adapt §1 (Trust Boundary Identification) error message patterns to language idioms. Language idioms take precedence over pseudocode defaults.

Self-Validation Checklist

STOP after gen each component. Verify ALL before proceed. If check clearly fail, fix code before present. If check judgment call with multiple valid approach (see Ambiguity Signals), flag — present options and reasoning rather than silent choose.

  • TRUST BOUNDARIES: Where trusted code meet untrusted data? All boundaries explicit identified?
  • INPUT VALIDATION: Every external input validated at boundary with allowlist before reach business logic?
  • QUERY SAFETY: All database query parameterized? Any string concat in query build?
  • COMMAND SAFETY: Any shell/command execution? If so, input strict allowlisted?
  • SECRETS: Any API key, password, token, connection string in code? If so → move to env var or secret manager.
  • OUTPUT ENCODING: Output encoded appropriate for render context (HTML, JSON, URL)?
  • AUTHORIZATION: Authorization verified at service layer, not just controller? Each endpoint enforce least privilege?
  • ERROR MESSAGES: Error message exposed to user avoid reveal internal detail (stack trace, SQL query, file path)?
  • DEPENDENCIES: New third-party package necessary? Version pinned or constrained? Any known-vulnerable package added?

Active Anti-Pattern Scan

STOP: After verify checklist above, scan output for specific anti-pattern. If find any, fix before present code.

  • [ ] Trust All Input: No validation on request param; data flow direct to business logic → validate at boundary with allowlist
  • [ ] SQL String Concatenation: User input interpolated into SQL query → use parameterized query or ORM query builder
  • [ ] Hardcoded Secrets: API key, password, token in source code → use env var or secret manager
  • [ ] Missing Authorization: Auth checked at login but not re-verified at service or resource level → check at every layer
  • [ ] Overly Broad Permissions: Admin access granted where read-only suffice → apply least privilege
  • [ ] Unvalidated Redirects: User-controlled URL used in redirect → allowlist permitted destination
  • [ ] Verbose Error Messages: Stack trace or SQL in API response → return generic message, log detail server-side
  • [ ] Logging Sensitive Data: Password, token, PII in log file → log event, not value; mask sensitive field

Ambiguity Signals

Check often have multiple valid outcome. When encounter, present option rather than silent choose.

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

Core Principle

Govern 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.

Other skills for the same job

different authors, same section of the catalogue
Backend Security Coder
by ComeOnOliver
×2

Expert in secure backend coding practices specializing in input validation, authentication, and API security. Use PROACTIVELY for backend security implementations or security code reviews.

5k tokens
Cloud Penetration Testing
by ComeOnOliver
×2

This skill should be used when the user asks to "perform cloud penetration testing", "assess Azure or AWS or GCP security", "enumerate cloud resources", "exploit cloud misconfigurations", "test O365 security", "extract secrets from cloud environments", or "audit cloud infrastructure". It provides comprehensive techniques for security assessment across major cloud platforms.

16k tokens
Codebase Cleanup Deps Audit
by ComeOnOliver
×2

You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.

10k tokens
Flow Nexus Platform
by ComeOnOliver
×2

Comprehensive Flow Nexus platform management - authentication, sandboxes, app deployment, payments, and challenges

14k tokens
Linux Privilege Escalation
by ComeOnOliver
×2

This skill should be used when the user asks to "escalate privileges on Linux", "find privesc vectors on Linux systems", "exploit sudo misconfigurations", "abuse SUID binaries", "exploit cron jobs for root access", "enumerate Linux systems for privilege escalation", or "gain root access from low-privilege shell". It provides comprehensive techniques for identifying and exploiting privilege escalation paths on Linux systems.

8k tokens
Malware Analyst
by ComeOnOliver
×2

Expert malware analyst specializing in defensive malware research, threat intelligence, and incident response. Masters sandbox analysis, behavioral analysis, and malware family identification. Handles static/dynamic analysis, unpacking, and IOC extraction. Use PROACTIVELY for malware triage, threat hunting, incident response, or security research.

4k tokens
Metasploit Framework
by ComeOnOliver
×2

This skill should be used when the user asks to "use Metasploit for penetration testing", "exploit vulnerabilities with msfconsole", "create payloads with msfvenom", "perform post-exploitation", "use auxiliary modules for scanning", or "develop custom exploits". It provides comprehensive guidance for leveraging the Metasploit Framework in security assessments.

7k tokens
Mobile Security Coder
by ComeOnOliver
×2

Expert in secure mobile coding practices specializing in input validation, WebView security, and mobile-specific security patterns. Use PROACTIVELY for mobile security implementations or mobile security code reviews.

6k tokens

How to use it

Copy the folder

Take techygarg/secure-coding from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.