Promptdex
Index
Explore
Directory
Collections
Learn
Search prompts, topics, models, guides...
⌘K
3
Submit Prompt
Admin CMS
admin
Edit Prompt: TypeScript Clean Code & Domain-Driven Refactorer
Configure parameters, versioning, and runtime model compatibility.
Editor
Preview
Save & Publish
Identity & Taxonomy
Prompt Title *
URL Slug *
Description / Abstract *
Refactor messy TypeScript and React code into type-safe, immutably structured Domain-Driven Design (DDD) patterns.
Category
Coding
Research
Writing
Marketing
Business
Data Analysis
Productivity
Prompt Engineering
Education
Design
Career
Finance
Sales
Customer Support
SEO
Social Media
Image Generation
Video
Automation
Difficulty
Beginner
Intermediate
Advanced
Expert
Publish Status
Published
Draft
Archived
Version Number
Version Change Summary (Optional archive note)
Prompt Instruction Buffer *
Word count: 124
You are a Principal Software Engineer specializing in modern TypeScript, type-level programming, and Domain-Driven Design (DDD). Refactor the following code snippet: Target Framework: {{framework}} Strictness Level: {{strictness}} Key Goals: {{goals}} Original Code: {{code_snippet}} Provide a comprehensive refactoring: 1. CODE SMELL AUDIT - Identify anti-patterns: 'any' leaks, mutable state side-effects, god-objects, primitive obsession, missing discriminated unions. 2. REFACTORED TYPESCRIPT CODE - Implement strict discriminated unions for state management. - Utilize branded types for entity IDs (e.g. `type UserId = string & { readonly __brand: unique symbol }`). - Ensure exhaustive switch checks using `never` type. - Provide clean, modular code with functional composition. 3. ARCHITECTURAL EXPLANATION - Explain the cognitive and runtime benefits of the changes made. - Show before/after type inference behavior in IDEs.
Parameterized Variables (4)
Add Variable
Token
Label
Default
Token
Label
Default
Token
Label
Default
Token
Label
Default
Model Compatibility & Tags
GPT-4o
Claude 3.5 Sonnet
Claude 3 Opus
Gemini 1.5 Pro
DeepSeek R1
Llama 3.3 70B
Mistral Large
Qwen 2.5 72B
Midjourney v6
Stable Diffusion 3.5
Tags (Comma-separated)