security — Claude Code rule: what it does, how to install
security is a Claude Code rule that checks changes for exposed secrets, input validation, and protection against web attacks before commit.
MIT ★ 6,739 updated 2026-01-23
/plugin marketplace add WorldFlowAI/everything-claude-code
/plugin install everything-claude-code@everything-claude-codeWhat security does
This instruction set enforces mandatory checks before any commit reaches version control. It directs the assistant to scan changes for plain-text credentials, confirm input validation, and ensure defense against SQL injection, XSS, and CSRF vulnerabilities.
Secret handling follows a strict pattern: values must come from environment variables such as process.env.OPENAI_API_KEY, failing explicitly if unset. When an exploit or leak is detected, the protocol dictates halting edits immediately, deploying the security-reviewer subagent, rotating exposed credentials, and resolving critical findings before continuing.
What it helps with
- spot hardcoded passwords and API tokens prior to commit
- verify parameterized database queries and sanitized HTML output
- ensure endpoint rate limiting and authorization checks are active
- prevent error responses from disclosing sensitive system internals
Example prompts for the agent
- Audit my staged changes against the pre-commit security checklist
- Check this API route for missing input validation and unhandled error leaks
- Replace all hardcoded credentials in this file with environment variables
How to install security
1Plugin marketplace
/plugin marketplace add WorldFlowAI/everything-claude-code/plugin install everything-claude-code@everything-claude-code2Manually: put the files in place
.claude/rules/security.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/security.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/security.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/security.mdManually: put the files in place
.clinerules/security.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about security
How to install security in Claude Code?
Run /plugin marketplace add WorldFlowAI/everything-claude-code first, then run /plugin install everything-claude-code@everything-claude-code. Alternatively, place the file directly at .claude/rules/security.md.
What does the security rule do?
It commands Claude Code to verify safety requirements before every commit, focusing on secrets, SQL injection, XSS, and authorization.
What is the response protocol when an issue is found?
You stop work immediately, invoke the security-reviewer agent, patch critical flaws, rotate leaked credentials, and inspect the rest of the codebase.
Source text
security.md · MIT
# Security Guidelines
## Mandatory Security Checks
Before ANY commit:
- [ ] No hardcoded secrets (API keys, passwords, tokens)
- [ ] All user inputs validated
- [ ] SQL injection prevention (parameterized queries)
- [ ] XSS prevention (sanitized HTML)
- [ ] CSRF protection enabled
- [ ] Authentication/authorization verified
- [ ] Rate limiting on all endpoints
- [ ] Error messages don't leak sensitive data
## Secret Management
```typescript
// NEVER: Hardcoded secrets
const apiKey = "sk-proj-xxxxx"
// ALWAYS: Environment variables
const apiKey = process.env.OPENAI_API_KEY
if (!apiKey) {
throw new Error('OPENAI_API_KEY not configured')
}
```
## Security Response Protocol
If security issue found:
1. STOP immediately
2. Use **security-reviewer** agent
3. Fix CRITICAL issues before continuing
4. Rotate any exposed secrets
5. Review entire codebase for similar issues
© Affaan Mustafa · MIT · WorldFlowAI/everything-claude-code