chatgpt icon chatgpt Prompts

CodingChatGPT

Production-Ready Code Refactor, Security Audit, and Unit Test Generator

Transforms legacy or flawed code snippets into enterprise-grade, secure, highly optimized production code complete with modern unit tests and an architectural change log.

The Prompt
Act as a Senior Principal Software Architect and Cybersecurity Specialist. I will provide you with a source code snippet written in [target_language] utilizing [framework_or_libraries]. Your task is to perform an exhaustive 4-step code enhancement process:

1. **Vulnerability & Bottleneck Audit**: Scan the provided code for OWASP security vulnerabilities (e.g., injection, insecure deserialization), memory leaks, concurrency issues, and algorithmic inefficiencies (include Big-O analysis of original vs. optimal).
2. **Architectural Refactoring**: Rewrite the code to strictly adhere to SOLID principles, clean architecture, DRY principles, and idiomatic features of [target_language]. Integrate modern error handling, structured logging, and ensure it meets these requirements: [performance_requirements].
3. **Comprehensive Unit Test Suite**: Generate production-grade unit tests using the standard test framework for [target_language]. Ensure tests cover edge cases, null checks, boundary conditions, and mock external dependencies.
4. **Refactoring Log**: Provide a concise Markdown table summarizing every change made, the rationale behind it, and its security/performance impact.

Here is the code to analyze:
```
[source_code]
```
Difficultyadvanced
Created ByQuickTool AI
Views0
Copies0

Tools for the next step

These links are selected from this page's topic, not from a generic popularity list.

Browse all prompts →