Skip to main content
rule CX Codex

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

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add WorldFlowAI/everything-claude-code
/plugin install everything-claude-code@everything-claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

.claude/rules/security.md

The paths frontmatter field limits the files

Step 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

Similar IDE rules

All IDE rules for Security →

From the same set29

The whole set →
build-fix build-fix fixes TypeScript and build failures one at a time, rerunning the build after each change. Useful when the error list needs a controlled pass. CX Codex +1 ★ 6,739repo stars refactor-clean refactor-clean identifies unused code across your codebase, categorizes findings by risk level, and removes them with test verification. Runs the full test suite before and after each deletion to catch regressions. CX Codex +1 ★ 6,739repo stars code-review code-review is a Claude Code command that checks uncommitted changes for security flaws and code-quality issues. It reports findings and blocks commits when it detects CRITICAL or HIGH severity problems. CX Codex +1 ★ 6,739repo stars git-workflow The git-workflow rule defines commit formats (feat, fix, docs and five other types), PR steps, and a three-stage flow with planner, TDD-guide and code-reviewer agents. CX Codex +1 ★ 6,739repo stars patterns patterns sets standard TypeScript interfaces for APIs and repositories, provides a useDebounce hook, and defines a workflow for evaluating skeleton repos. CX Codex +1 ★ 6,739repo stars verify The verify command checks the build, types, lint, tests, logs, and Git state. Use it before a commit or pull request. CX Codex +1 ★ 6,739repo stars performance performance — a Claude Code rule that matches model to task and keeps heavy refactors away from the tail of the context window. CX Codex +1 ★ 6,739repo stars coding-style coding-style is a Claude Code rule for code structure and quality checks. It applies while an agent writes or changes code. CX Codex +1 ★ 6,739repo stars

More in the catalog

Project sponsors

Companies that keep this analytics open