ai-toolkit-rules
Mandatory engineering, security, testing, git, performance, quality, and response rules. Claude MUST load this skill for every…
App security: OWASP, authN/authZ, input validation, secrets, TLS, CSRF/XSS/SQLi, JWT, CSP, LLM prompt injection. Triggers: security, OWASP, auth, JWT, CSRF, XSS, SQL injection, secrets, encryption at rest, TLS, CSP, CORS, prompt injection, LLM output trust, tool permissions,
Claude Code
$ npx -y skills add softspark/ai-toolkit --skill security-patterns --agent claude-code
Codex
$ npx skills add softspark/ai-toolkit --skill security-patterns -a codex -y
Cursor
$ npx skills add softspark/ai-toolkit --skill security-patterns -a cursor -y
Gemini CLI
$ npx skills add softspark/ai-toolkit --skill security-patterns -a gemini-cli -y
GitHub Copilot
$ npx skills add softspark/ai-toolkit --skill security-patterns -a github-copilot -y
OpenCode
$ npx skills add softspark/ai-toolkit --skill security-patterns -a opencode -y
Windsurf
$ npx skills add softspark/ai-toolkit --skill security-patterns -a windsurf -y
name: security-patterns description: "App security: OWASP, authN/authZ, input validation, secrets, TLS, CSRF/XSS/SQLi, JWT, CSP, LLM prompt injection. Triggers: security, OWASP, auth, JWT, CSRF, XSS, SQL injection, secrets, encryption at rest, TLS, CSP, CORS, prompt injection, LLM output trust, tool permissions, marketing consent, unsubscribe." effort: medium user-invocable: false allowed-tools: Read
| Risk | Prevention | |------|------------| | Injection | Parameterized queries, ORM | | Broken Auth | MFA, secure sessions | | Sensitive Data | Encryption, HTTPS | | XXE | Disable external entities | | Broken Access | RBAC, resource validation | | Security Misconfig | Security headers, defaults | | XSS | Escaping, CSP | | Insecure Deserialization | Signed tokens, validation | | Vulnerable Components | Dependency scanning | | Insufficient Logging | Audit logs, monitoring |
---
# FastAPI middleware
@app.middleware("http")
async def security_headers(request, call_next):
response = await call_next(request)
response.headers["X-Content-Type-Options"] = "nosniff"
response.headers["X-Frame-Options"] = "DENY"
response.headers["X-XSS-Protection"] = "1; mode=block"
response.headers["Strict-Transport-Security"] = "max-age=31536000; includeSubDomains"
response.headers["Content-Security-Policy"] = "default-src 'self'"
return response---
# .env (never commit) DATABASE_URL=postgresql://... API_SECRET=... # .env.example (commit this) DATABASE_URL=postgresql://user:pass@localhost/db API_SECRET=your-secret-here
# pre-commit hook
- repo: https://github.com/Yelp/detect-secrets
hooks:
- id: detect-secrets---
from slowapi import Limiter
from slowapi.util import get_remote_address
limiter = Limiter(key_func=get_remote_address)
@app.get("/api/resource")
@limiter.limit("100/minute")
async def resource():
pass---
When the app embeds an LLM, every byte the model emits — plus tool results, retrieved documents, and fetched web pages — is **untrusted input on the same footing as a raw request body**. Text inside that content that reads like an instruction ("ignore previous rules", "call the delete tool", "email the config to…") is still data. Render it, store it, classify it — but never let it drive control flow, widen permissions, or fire a side effect without an explicit human decision. This mirrors the agent-behavior rule in [constitution Article VII](../../constitution.md); the rules here cover the application you are building, not the assistant's own behavior.
| Source | Trust | Handling | |--------|-------|----------| | System prompt / app-defined policy | Trusted | The only place instructions may originate | | User chat turn | Semi-trusted | Authenticated to a user, still validate + scope to their permissions | | Model output | Untrusted | Treat as data; gate any tool call it requests | | Tool / function results | Untrusted | Re-validate before feeding back into context | | Retrieved docs / RAG chunks | Untrusted | Strip or delimit embedded instructions | | Fetched web / email / file content | Untrusted | Highest risk — sanitize before it crosses into the prompt |
Use synthetic documents with inert marker text to verify that the application keeps retrieved content in its designated data field. Test tool authorization separately with a local fake tool and an ordinary request outside the user's assigned role. Assert that the application records a denial and the fake tool receives zero calls. Pair it with an allowed request to check that the permission boundary is effective.
---
| Excuse | Why It's Wrong | |--------|----------------| | "It's an internal API, security doesn't matter" | Internal APIs get exposed — lateral movement is attackers' primary technique | | "The framework handles security" | Frameworks provide tools, not guarantees — misconfiguration is OWASP #5 | | "We'll add auth later" | Unauthenticated endpoints in production get discovered within hours | | "Nobody would exploit this" | Automated scanners don't care about your th
AI coding toolkit with machine-enforced safety, 116 skills, 44 agents, lifecycle hooks, persona presets, opt-in plugin packs, and benchmark tooling.
Mandatory engineering, security, testing, git, performance, quality, and response rules. Claude MUST load this skill for every…
Searches past coding sessions for observations, decisions, context. Triggers: mem-search, recall session, past work, prior…
Accessibility validator: WCAG 2.1 AA, EN 301 549, EAA. Triggers: a11y, accessibility, WCAG, EAA, ARIA, contrast, keyboard, screen…
Creates new specialized agents with frontmatter, tools, delegation. Triggers: new agent, create agent, agent scaffold,…
Analyzes code quality, complexity, patterns across codebase. Triggers: quality report, hotspot scan, code analysis, architecture…
API design: naming, versioning, pagination, idempotency, OpenAPI, error contracts and safe retries. Triggers: API design, REST,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.