Skip to content

secure-refactoring

“Security by Design.”

Read ONLY files that need refactoring!

FileDescriptionWhen to Read
*.py, *.js, *.tsSource code filesIdentify refactoring targets
tests/Unit and integration testsVerify changes don’t break functionality

SkillUse For
@[skills/code-auditing]Identifying code to refactor
@[skills/testing-patterns]Ensuring no regression

“Rewrite with security in mind.”

  • Prefer parameterized queries over string concatenation for SQL
  • Use secure libraries for cryptography and hashing
  • Implement proper input validation and output encoding
  • Avoid using deprecated or vulnerable functions

Before finalizing changes:

  • Replaced unsafe SQL queries with parameterized queries
  • Validated input against strict allow-lists
  • Escaped output based on context (HTML, JS, CSS)
  • Replaced weak cryptographic algorithms with strong ones
  • Verified that refactoring did not break existing functionality

Always identify gaps and suggest next steps to users. In case there is no gaps anymore, then AI should clearly state that there is no gap left.