secure-code-guardian
O que ela faz
Ele orienta a IA na criação de funcionalidades seguras, como login, controle de acesso e validação de entradas. É para desenvolvedores que querem um código mais seguro.
Quando usar
- ✓Quando você adiciona um sistema de login ou cadastro a um app web.
- ✓Quando você quer que entradas do usuário sejam verificadas contra ataques como injeção de SQL ou cross-site scripting.
- ✓Quando precisa configurar armazenamento seguro de senhas, tokens ou cabeçalhos CORS.
Link da skill
https://github.com/Jeffallan/claude-skills/blob/main/skills/secure-code-guardian/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Você pode me ajudar a adicionar login seguro e armazenamento de senhas ao meu app web?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
A IA segue uma lista de verificação: planeja os riscos, cria as proteções e depois testa se os ataques comuns são bloqueados, registrando as decisões tomadas.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do GitHub.
Secure Code Guardian
Core Workflow
- Threat model — Identify attack surface and threats
- Design — Plan security controls
- Implement — Write secure code with defense in depth; see code examples below
- Validate — Test security controls with explicit checkpoints (see below)
- Document — Record security decisions
Validation Checkpoints
After each implementation step, verify:
- Authentication: Test brute-force protection (lockout/rate limit triggers), session fixation resistance, token expiration, and invalid-credential error messages (must not leak user existence).
- Authorization: Verify horizontal and vertical privilege escalation paths are blocked; test with tokens belonging to different roles/users.
- Input handling: Confirm SQL injection payloads (
' OR 1=1--) are rejected; confirm XSS payloads (<script>alert(1)</script>) are escaped or rejected. - Headers/CORS: Validate with a security scanner (e.g.,
curl -I, Mozilla Observatory) that security headers are present and CORS origin allowlist is correct.
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| OWASP | references/owasp-prevention.md |
OWASP Top 10 patterns |
| Authentication | references/authentication.md |
Password hashing, JWT |
| Input Validation | references/input-validation.md |
Zod, SQL injection |
| XSS/CSRF | references/xss-csrf.md |
XSS prevention, CSRF |
| Headers | references/security-headers.md |
Helmet, rate limiting |
Constraints
MUST DO
- Hash passwords with bcrypt/argon2 (never MD5/SHA-1/unsalted hashes)
- Use parameterized queries (never string-interpolated SQL)
- Validate and sanitize all user input before use
- Implement rate limiting on auth endpoints
- Set security headers (CSP, HSTS, X-Frame-Options)
- Log security events (failed auth, privilege escalation attempts)
- Store secrets in environment variables or secret managers (never in source code)
MUST NOT DO
- Store passwords in plaintext or reversibly encrypted form
- Trust user input without validation
- Expose sensitive data in logs or error responses
- Use weak or deprecated algorithms (MD5, SHA-1, DES, ECB mode)
- Hardcode secrets or credentials in code
Code Examples
Password Hashing (bcrypt)
import bcrypt from 'bcrypt';
const SALT_ROUNDS = 12; // minimum 10; 12 balances security and performance
export async function hashPassword(plaintext: string): Promise<string> {
return bcrypt.hash(plaintext, SALT_ROUNDS);
}
export async function verifyPassword(plaintext: string, hash: string): Promise<boolean> {
return bcrypt.compare(plaintext, hash);
}
Parameterized SQL Query (Node.js / pg)
// NEVER: `SELECT * FROM users WHERE email = '${email}'`
// ALWAYS: use positional parameters
import { Pool } from 'pg';
const pool = new Pool();
export async function getUserByEmail(email: string) {
const { rows } = await pool.query(
'SELECT id, email, role FROM users WHERE email = $1',
[email] // value passed separately — never interpolated
);
return rows[0] ?? null;
}
Input Validation with Zod
import { z } from 'zod';
const LoginSchema = z.object({
email: z.string().email().max(254),
password: z.string().min(8).max(128),
});
export function validateLoginInput(raw: unknown) {
const result = LoginSchema.safeParse(raw);
if (!result.success) {
// Return generic error — never echo raw input back
throw new Error('Invalid credentials format');
}
return result.data;
}
JWT Validation
import jwt from 'jsonwebtoken';
const JWT_SECRET = process.env.JWT_SECRET!; // never hardcode
export function verifyToken(token: string): jwt.JwtPayload {
// Throws if expired, tampered, or wrong algorithm
const payload = jwt.verify(token, JWT_SECRET, {
algorithms: ['HS256'], // explicitly allowlist algorithm
issuer: 'your-app',
audience: 'your-app',
});
if (typeof payload === 'string') throw new Error('Invalid token payload');
return payload;
}
Securing an Endpoint — Full Flow
import express from 'express';
import rateLimit from 'express-rate-limit';
import helmet from 'helmet';
const app = express();
app.use(helmet()); // sets CSP, HSTS, X-Frame-Options, etc.
app.use(express.json({ limit: '10kb' })); // limit payload size
const authLimiter = rateLimit({
windowMs: 15 * 60 *
Perguntas frequentes
Funciona com qualquer linguagem de programação?
Foca em tecnologias e padrões web comuns, então seus exemplos se encaixam melhor em apps web típicos.
Ele audita o app inteiro em busca de falhas?
Ele verifica os controles que cria, como payloads de ataque bloqueados e limites de login. Uma auditoria completa é coberta pelo skill de revisão de segurança.
Ele cobre armazenamento seguro de senhas?
Sim. Orienta o uso de métodos de hash como bcrypt ou argon2, em vez de guardar senhas em texto puro.
Detalhes
Descrição original do autor
Use when implementing authentication/authorization, securing user input, or preventing OWASP Top 10 vulnerabilities — including custom security implementations such as hashing passwords with bcrypt/argon2, sanitizing SQL queries with parameterized statements, configuring CORS/CSP headers, validating input with Zod, and setting up JWT tokens. Invoke for authentication, authorization, input validation, encryption, OWASP Top 10 prevention, secure session management, and security hardening. For pre-built OAuth/SSO integrations or standalone security audits, consider a more specialized skill.
repo: Jeffallan/claude-skills
Popularidade
- Estrelas no GitHub
- 12 mil
- Posição no ranking
- #11454
- Licença
- MIT
- Atualizada em
- 30/10/2026
Comentários
- …
Mais skills deste repositório
angular-architect
12 milAjuda seu agente a criar apps Angular 17 ou mais novos, com componentes standalone, rotas com carregamento sob demanda, estado NgRx, padrões RxJS e ajuste de desempenho.
api-designer
12 milAjuda seu agente a projetar APIs REST ou GraphQL e a escrever especificações OpenAPI 3.1, com regras para recursos, paginação, formatos de erro e versionamento.
architecture-designer
12 milAjuda seu agente a projetar a arquitetura de sistemas, comparar padrões e tecnologias e escrever Architecture Decision Records que explicam cada escolha.
atlassian-mcp
12 milAjuda seu agente a buscar e atualizar issues do Jira e páginas do Confluence pelo MCP, incluindo consultas JQL e CQL, sprints e sincronização de documentação.
Skills parecidas
reverse-engineer-anything
422 milAjuda seu agente a analisar apps e pacotes já publicados para explicar recursos, comparar versões ou orientar uma reconstrução, usando a ferramenta REA.
1password
394 milAjuda seu agente a configurar a CLI do 1Password, fazer login e ler ou injetar segredos sem imprimir seus valores no chat.
healthcheck
394 milAjuda seu agente a auditar o computador ou servidor que roda o OpenClaw em busca de riscos como SSH, firewall, atualizações e backups, com correções seguras.