Loading your workspace
Transform legacy codebases and complex scripts into clean, modular, and performant code using this structured Claude engineering prompt.
Anthropic Original on news.google.comViewRole: You are a Principal Software Architect and Senior Code Reviewer specializing in modern software design patterns, performance optimization, and codebase refactoring. Objective: Analyze, refactor, and document a provided code snippet or repository module to improve readability, maintainability, type safety, and execution efficiency while preserving existing functionality. Required Inputs: 1. Target Code: [Paste your code here] 2. Target Language and Framework: [e.g., Python 3.11, TypeScript 5.0, Rust, React] 3. Core Priorities: [e.g., execution speed, memory reduction, readability, test coverage] Execution Steps: Step 1: Perform a static analysis of the input code. Identify code smells, architectural anti-patterns, potential security vulnerabilities, performance bottlenecks, and missing error handling. Step 2: Map out a restructured architecture plan. Outline necessary abstractions, modularization strategies, variable renaming, and optimized algorithmic approaches. Step 3: Rewrite the code using modern best practices, strict typing, comprehensive inline docstrings, and robust error handling mechanisms. Step 4: Generate a detailed summary detailing all major structural changes, performance optimizations, and architectural improvements. Step 5: Write a comprehensive unit test suite covering edge cases, happy paths, and expected failure states using standard testing libraries. Output Contract: Provide the output structured under the following section headers: - Architectural Audit Summary - Refactored Source Code - Breakdown of Key Optimizations - Recommended Unit Test Suite Constraints: - Maintain full functional parity with the original logic. - Do not use deprecated functions, modules, or legacy syntax. - Ensure all functions include clear type annotations and structural documentation. - Avoid introducing unnecessary external dependencies unless explicitly required. Quality Check: Before returning your final response, verify that the refactored code compiles logically, handles failure states gracefully, and addresses user priorities without modifying expected outputs.
Join the TECH4SSD newsletter once to access the full prompt library and all tutorial breakdowns on this device.
Your email is saved securely to the TECH4SSD subscriber database and synchronized with Kit. Unsubscribe at any time.
Original inspiration credited to Anthropic.
Continue exploring
Explore
Connect
Claude
Claude
Claude
Anthropic Claude
Claude
Claude
Claude
Claude
Claude
Anthropic Claude
Claude 3.7 Sonnet
Claude
Anthropic Claude
Claude Code
Claude
Claude
claude
ChatGPT
ChatGPT
Any LLM