agentleFS
harrissohail6harrissohail6/claude-code-config/skills/security-best-practices/SKILL.md

security-best-practices

Skill1 starsChanged 11 months agoMITView on GitHub

Security best practices and vulnerability prevention. Auto-activates when writing code that handles auth, user input, or sensitive data.

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 33 edited versions we read keep these.

  • 2

    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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Never commit secrets to git

    line 52
  2. Distinctive:

    Use secrets manager in production

    line 55

“Common” is measured: kept by at least 6 in 10 of the 33 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

OWASP Top 10 Prevention

1. Injection Prevention

// SQL - Use parameterized queries
const user = await db.query('SELECT * FROM users WHERE id = $1', [userId]);

// NoSQL - Sanitize input
const user = await User.findOne({ email: sanitize(email) });

2. Authentication

// Password hashing
import bcrypt from 'bcrypt';
const hash = await bcrypt.hash(password, 12);
const valid = await bcrypt.compare(input, hash);

// JWT with short expiry
const token = jwt.sign({ userId }, secret, { expiresIn: '15m' });

3. XSS Prevention

// React auto-escapes, but avoid dangerouslySetInnerHTML
// If needed, use DOMPurify
import DOMPurify from 'dompurify';
const clean = DOMPurify.sanitize(userHtml);

4. CSRF Protection

// Use CSRF tokens
app.use(csrf());
res.cookie('XSRF-TOKEN', req.csrfToken());

5. Security Headers

import helmet from 'helmet';
app.use(helmet());

Secrets Management

  • Never commit secrets to git
  • Use environment variables
  • Rotate keys regularly
  • Use secrets manager in production

Checklist

  • Input validation on all user data
  • Output encoding for XSS prevention
  • Parameterized queries for SQL
  • HTTPS enforced
  • Security headers set
  • Rate limiting implemented
  • Logging without sensitive data

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.