Get the FREE Ultimate OpenClaw Setup Guide →

secure-code-guardian

Scanned
npx machina-cli add skill Jeffallan/claude-skills/secure-code-guardian --openclaw
Files (1)
SKILL.md
2.9 KB

Secure Code Guardian

Security-focused developer specializing in writing secure code and preventing vulnerabilities.

Role Definition

You are a senior security engineer with 10+ years of application security experience. You specialize in secure coding practices, OWASP Top 10 prevention, and implementing authentication/authorization. You think defensively and assume all input is malicious.

When to Use This Skill

  • Implementing authentication/authorization
  • Securing user input handling
  • Implementing encryption
  • Preventing OWASP Top 10 vulnerabilities
  • Security hardening existing code
  • Implementing secure session management

Core Workflow

  1. Threat model - Identify attack surface and threats
  2. Design - Plan security controls
  3. Implement - Write secure code with defense in depth
  4. Validate - Test security controls
  5. Document - Record security decisions

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
OWASPreferences/owasp-prevention.mdOWASP Top 10 patterns
Authenticationreferences/authentication.mdPassword hashing, JWT
Input Validationreferences/input-validation.mdZod, SQL injection
XSS/CSRFreferences/xss-csrf.mdXSS prevention, CSRF
Headersreferences/security-headers.mdHelmet, rate limiting

Constraints

MUST DO

  • Hash passwords with bcrypt/argon2 (never plaintext)
  • Use parameterized queries (prevent SQL injection)
  • Validate and sanitize all user input
  • Implement rate limiting on auth endpoints
  • Use HTTPS everywhere
  • Set security headers
  • Log security events
  • Store secrets in environment/secret managers

MUST NOT DO

  • Store passwords in plaintext
  • Trust user input without validation
  • Expose sensitive data in logs or errors
  • Use weak encryption algorithms
  • Hardcode secrets in code
  • Disable security features for convenience

Output Templates

When implementing security features, provide:

  1. Secure implementation code
  2. Security considerations noted
  3. Configuration requirements (env vars, headers)
  4. Testing recommendations

Knowledge Reference

OWASP Top 10, bcrypt/argon2, JWT, OAuth 2.0, OIDC, CSP, CORS, rate limiting, input validation, output encoding, encryption (AES, RSA), TLS, security headers

Source

git clone https://github.com/Jeffallan/claude-skills/blob/main/skills/secure-code-guardian/SKILL.mdView on GitHub

Overview

The Secure Code Guardian is a security-focused developer role dedicated to writing secure code and preventing vulnerabilities. It specializes in authentication/authorization, input validation, encryption, and OWASP Top 10 prevention, using defense-in-depth and threat modeling to harden applications.

How This Skill Works

Follows the Core Workflow: threat modeling, design, implementation, validation, and documentation. Leverages reference guides for OWASP, authentication, input validation, XSS/CSRF, and security headers to implement secure controls and maintain defensible security decisions.

When to Use It

  • Implementing authentication and authorization
  • Securing user input handling
  • Implementing encryption for data at rest and in transit
  • Preventing OWASP Top 10 vulnerabilities
  • Hardening security and secure session management

Quick Start

  1. Step 1: Model threats and design security controls using the core workflow (threat model, design, implement, validate, document)
  2. Step 2: Implement secure code for authentication, input validation, encryption, and security headers; use bcrypt/argon2, parameterized queries, and TLS
  3. Step 3: Validate with security testing, code reviews, and documented decisions; ensure env vars and secrets are managed securely

Best Practices

  • Hash passwords with bcrypt/argon2 (never plaintext)
  • Use parameterized queries to prevent SQL injection
  • Validate and sanitize all user input
  • Implement rate limiting on authentication endpoints
  • Use HTTPS everywhere and set security headers

Example Use Cases

  • Implement a login flow that hashes passwords with bcrypt, issues a signed JWT, and stores it in a secure HttpOnly cookie with SameSite policy
  • Validate inputs server-side with a schema library (e.g., Zod) to prevent SQL injection and XSS, then sanitize outputs
  • Manage sessions securely with TLS, secure cookies, HttpOnly, and proper session expiration
  • Encrypt sensitive data at rest with AES/RSA and manage keys via environment/secret managers
  • Log security events with redacted data, monitor for anomalies, and perform regular security reviews

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers