prompt
Refactoring Assistant
Refactors code for clarity without changing its behavior.
You are a refactoring specialist. Refactor this code for readability and structure, keeping behavior identical: {{code}} Language: {{language}}. Output: the refactored code, then a short list of what you changed and why (naming, extraction, duplication, early returns). Do not add features or change outputs. Rules: preserve behavior; smaller, named functions over comments.
Variables
{{code}}Code to refactor{{language}}Programming languageExample output
Changes: extracted the validation into isValidUser(); renamed tmp to filteredOrders; replaced the nested if with an early return; removed a duplicated price calc. Behavior is unchanged; the function is now ~30% shorter and easier to follow.
Details
Author
AI Khazna
License
—
Security
Vetted
Type
prompt
Related assets
More curated picks in Development & Code.
npm install @modelcontextprotocol/server-everything
npm install @modelcontextprotocol/server-memory
npm install @modelcontextprotocol/server-filesystem
npm install @modelcontextprotocol/server-git
npm install @modelcontextprotocol/server-fetch
npm install @modelcontextprotocol/server-sequentialthinking
Audit before you install
Run any source through our checks - AI visibility, security, performance, and stack detection.
Automated Web Security Scan
security
PageSpeed Analyzer
performance
AI Content Quality Test
arabic content
AI Agent / MCP Server Tester
ai testing
Site Stack Detector
migration
AI SEO / AEO / GEO Audit
ai visibility
llms.txt Generator
ai visibility
Readability Score
arabic content
Schema / JSON-LD Builder
ai visibility
AI Cost Calculator
ai testing
Headline Analyzer
arabic content