agentleFS
Jonathan0823Jonathan0823/opencode-config/skills/security-best-practices/SKILL.md

security-best-practices

Skill8 starsChanged 10 months agoMITView on GitHub

Security best practices, OWASP guidelines, secure coding patterns, and vulnerability prevention. Use when implementing authentication, handling user input, securing APIs, managing secrets, or reviewing code for security vulnerabilities.

25 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use supabase-postgres-best-practices, api-design and 7 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • JetBrainsSkill

    supabase-postgres-best-practices

    Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

    Also in 3 projects that use this

  • MicrosoftSkill

    api-design

    Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.

    Also in 3 projects that use this

  • VercelSkill

    vercel-react-best-practices

    React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

    Also in 4 projects that use this

  • VercelSkill

    agent-browser

    Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

    Also in 4 projects that use this

  • StrayDragonSkill

    ui-ux-pro-max

    UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

    Also in 3 projects that use this

  • MicrosoftSkill

    mcp-builder

    Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 24 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Injection: - Use parameterized queries, never concatenate user input into SQL/commands

    line 16
  2. Distinctive:

    Insecure Deserialization: - Use JSON instead of pickle, validate data

    line 23
  3. Distinctive:

    Always include these headers:

    line 100
  4. Distinctive:

    Use this skill when:

    line 113

“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Best Practices Skill

Overview

This skill provides security guidelines following OWASP Top 10, secure coding patterns, authentication/authorization best practices, secrets management, and vulnerability prevention across multiple languages.

OWASP Top 10 Summary

  1. Injection - Use parameterized queries, never concatenate user input into SQL/commands
  2. Broken Authentication - Implement strong passwords, secure sessions, rate limiting
  3. Sensitive Data Exposure - Encrypt data at rest, use HTTPS, hash passwords
  4. XML External Entities (XXE) - Disable external entities in XML parsers
  5. Broken Access Control - Enforce authorization checks, implement resource-level controls
  6. Security Misconfiguration - Secure defaults, minimal privileges, regular updates
  7. Cross-Site Scripting (XSS) - Escape output, sanitize input, use CSP headers
  8. Insecure Deserialization - Use JSON instead of pickle, validate data
  9. Known Vulnerabilities - Regular dependency scanning, keep components updated
  10. Insufficient Logging - Log security events, monitor for anomalies

Quick Security Checklist

Input Validation

  • Validate all user input on server side
  • Use allowlists, not denylists
  • Sanitize data before display (prevent XSS)
  • Validate file uploads (type, size, extension)

Authentication

  • Use strong password requirements (12+ chars, complexity)
  • Hash passwords with bcrypt/Argon2 (not MD5/SHA1)
  • Implement rate limiting on login endpoints
  • Use secure session management (HttpOnly, Secure, SameSite)

Authorization

  • Check permissions on every request
  • Implement principle of least privilege
  • Use resource-level access controls
  • Never rely on client-side checks

Data Protection

  • Encrypt sensitive data at rest
  • Use TLS 1.2+ for all connections
  • Set security headers (HSTS, CSP, X-Frame-Options)
  • Never log sensitive data (passwords, tokens, PII)

Secrets Management

  • Use environment variables or secret managers
  • Never commit secrets to version control
  • Rotate secrets regularly
  • Use different secrets per environment

Common Vulnerabilities Prevention

SQL Injection

# ✅ SAFE: Parameterized query
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))

# ❌ UNSAFE: String concatenation
query = f"SELECT * FROM users WHERE id = '{user_id}'"

XSS Prevention

# ✅ SAFE: Template auto-escaping
return render_template('profile.html', username=username)

# ❌ UNSAFE: Raw HTML
return f"<div>{user_input}</div>"

Command Injection

# ✅ SAFE: Use list, not shell
subprocess.run(["ls", "-la", directory], shell=False)

# ❌ UNSAFE: Shell with user input
os.system(f"ls -la {directory}")

Language-Specific Patterns

See detailed guides in references/:

  • OWASP Top 10 Details - Comprehensive prevention for all 10 categories
  • Secure Coding - Python - Python-specific security patterns
  • Secure Coding - JavaScript - Node.js/Frontend security
  • Secure Coding - Go - Go security patterns
  • Secrets Management - AWS, Vault, GCP secret management

Security Headers

Always include these headers:

Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Content-Security-Policy: default-src 'self'
Referrer-Policy: strict-origin-when-cross-origin

When to Use This Skill

Use this skill when:

  • Implementing authentication and authorization systems
  • Handling user input and data validation
  • Setting up HTTPS and security headers
  • Managing secrets and credentials
  • Configuring CORS and CSP policies
  • Reviewing code for security vulnerabilities
  • Setting up logging and monitoring
  • Configuring Docker and deployment security

Related Skills

  • @docker-patterns - Container security hardening
  • @ci-cd-pipelines - Security scanning in CI/CD
  • @api-rest-design - API security patterns
  • @postgresql-patterns - Database security
  • @feature-development - Secure development workflow

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.