plugins/autonomous-dev/skills/security-patterns/SKILL.md
Security best practices covering API key management, input validation, injection prevention, and OWASP patterns. Use when handling secrets, user input, or security-sensitive code. TRIGGER when: security, API key, secret, input validation, injection, OWASP. DO NOT TRIGGER when: non-security code, styling, documentation, test scaffolding.
npx skillsauth add akaszubski/autonomous-dev security-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Security best practices and patterns for secure development.
See: code-examples.md for Python implementations See: templates.md for checklists and config templates
Rule: Never hardcode secrets. Always use environment variables via .env files.
# ✅ CORRECT
api_key = os.getenv("ANTHROPIC_API_KEY")
# ❌ WRONG
api_key = "sk-ant-1234567890abcdef" # NEVER!
See: code-examples.md#api-keys--secrets for full validation code
Rule: Always validate paths are within allowed directories.
# Use is_relative_to() to prevent ../ attacks
if not file_path.is_relative_to(base_dir):
raise ValueError("Path traversal detected")
Rule: Never use shell=True. Pass arguments as lists.
# ✅ CORRECT
subprocess.run([command] + args, shell=False)
# ❌ WRONG
subprocess.run(f"ls {user_input}", shell=True) # Injection risk!
Rule: Always use parameterized queries.
# ✅ CORRECT
cursor.execute("SELECT * FROM users WHERE username = ?", (username,))
# ❌ WRONG
cursor.execute(f"SELECT * FROM users WHERE username = '{username}'")
See: code-examples.md#input-validation for complete examples
| Use Case | Permission | Octal |
|----------|------------|-------|
| Sensitive files | rw------- | 0o600 |
| Sensitive dirs | rwx------ | 0o700 |
| Public files | rw-r--r-- | 0o644 |
See: code-examples.md#file-operations-security
Rule: Use secrets module for security-sensitive random values.
# ✅ CORRECT
token = secrets.token_hex(32)
# ❌ WRONG
token = str(random.randint(0, 999999)) # Not cryptographically secure!
See: code-examples.md#cryptographic-operations for password hashing
Rule: Never log full secrets. Mask sensitive values.
# ✅ CORRECT
masked_key = api_key[:7] + "***" + api_key[-4:]
logging.info(f"Using key {masked_key}")
# ❌ WRONG
logging.info(f"Using key {api_key}") # Exposes full key!
# Check for vulnerabilities
pip install safety && safety check
# OR
pip install pip-audit && pip-audit
is_relative_to()secrets moduleSee: templates.md#owasp-top-10-quick-reference
development
GenAI-first testing with structural assertions, congruence validation, and tier-based test structure. Use when writing tests, setting up test infrastructure, or validating coverage. TRIGGER when: test, pytest, coverage, TDD, test patterns, congruence, validation. DO NOT TRIGGER when: production code implementation, documentation, config-only changes.
development
One topic, one home. Routes content to its canonical store (CLAUDE.md, PROJECT.md, MEMORY.md, docs/, memory/) and audits for duplication. TRIGGER when: auditing CLAUDE.md/PROJECT.md/MEMORY.md sizes, deduplicating docs, applying the content-allocation pattern to a new repo, running /align --content. DO NOT TRIGGER when: implementing features, writing tests, routine code edits, debugging.
testing
Prompt engineering patterns for writing agent prompts and skill files — constraint budgets, register shifting, HARD GATE patterns, anti-personas. Use when writing or reviewing agents/*.md or skills/*/SKILL.md. TRIGGER when: agent prompt, skill file, prompt engineering, model-tier compensation, HARD GATE, prompt quality. DO NOT TRIGGER when: user-facing docs, README, CHANGELOG, config files.
testing
JSON persistence, atomic writes, file locking, crash recovery, and state versioning patterns. Use when implementing stateful libraries or features requiring persistent state. TRIGGER when: state persistence, atomic write, file locking, crash recovery, checkpoint. DO NOT TRIGGER when: stateless utilities, pure functions, config reads, documentation.