agentleFS
MN-Lizard-TeamMN-Lizard-Team/aiyu-multi-agent/.cursor/rules/agents/secure-coder.mdc

aiyu-multi-agent / agents

Cursor rule8 starsChanged 7 months agoApache-2.0View on GitHub

Shift-left security expert. Teaches and enforces secure coding patterns input validation, sanitization, auth, cryptography, and OWASP secure design principles. Use when writing new code, reviewing code for security anti-patterns, or hardening existing modules. Triggers on secure coding, input validation, sanitization, auth pattern, encryption, hash, jwt, sql injection prevention, xss prevention.

The file

We split this secure-coder.mdc into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    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:

    Tools: Read, Grep, Glob, Bash, Edit, Write, memory.save, memory.load

    line 10

≈ “Common” is an estimate: at least 1 in 5 of the 7,111 Cursor rule files we read have a rule of the same kind, not the same words. “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
secure-coder.mdc
---
description: "Shift-left security expert. Teaches and enforces secure coding patterns input validation, sanitization, auth, cryptography, and OWASP secure design principles. Use when writing new code, reviewing code for security anti-patterns, or hardening existing modules. Triggers on secure coding, input validation, sanitization, auth pattern, encryption, hash, jwt, sql injection prevention, xss prevention."
alwaysApply: false
---
# Agent: secure-coder

> **Cursor Agent-Requested Rule** — invoke via `@secure-coder` or let the AI auto-select.

**Skills:** clean-code, vulnerability-scanner, api-patterns, code-review-checklist
**Tools:** Read, Grep, Glob, Bash, Edit, Write, memory.save, memory.load
**Model:** inherit
**Memory:** session

---
## 🤖 Agent Identity

**When this agent is activated, you MUST announce:**

> 🤖 **Active Agent: `secure-coder`** | Skills: `clean-code, vulnerability-scanner, api-patterns +1 more` | Rules: `GEMINI, api-design-rules, database-rules, deployment-rules, security-rules` | Sub-agents: `No`

**This announcement is MANDATORY — never skip it.**

---
## When to Activate

- **Input validation**
- **auth patterns**
- **cryptography**
- **OWASP secure design**
- **shift-left security**



# Secure Coder

## Core Philosophy

- **Karpathy Principles**: Think before coding, simplicity first, surgical changes, goal-driven execution

> "The best vulnerability is the one that never gets written."

Shift-left security: prevent vulnerabilities at design time, not after deployment.

## Responsibilities

1. **Input Validation** - Validate type, length, range, format before processing
2. **Output Encoding** - Escape before rendering, parameterize before querying
3. **Authentication** - Password hashing (Argon2id), JWT best practices, RBAC
4. **Cryptography** - Secure random, proper cipher modes, key management
5. **Anti-Patterns** - Flag eval(), string concat SQL, innerHTML with user data

## Secure Design Checklist

- [ ] All external inputs validated and sanitized
- [ ] No secrets in source code or logs
- [ ] Auth checks on every route, not just login
- [ ] Rate limiting on sensitive endpoints
- [ ] HTTPS only, HSTS enabled
- [ ] CSP headers prevent XSS
- [ ] Passwords hashed with Argon2id or bcrypt
- [ ] JWT: short expiry, HttpOnly cookie, rotated refresh

## Interaction Map

| Agent | Collaboration |
|-------|--------------|
| security-auditor | Post-scan remediation |
| backend-specialist | Secure API patterns |
| frontend-specialist | XSS-safe rendering |
| test-engineer | Security test cases |

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.