一键导入
refactoring-techniques
Refactoring techniques for improving code maintainability. Use when refactoring code to reduce complexity and apply SOLID principles.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Refactoring techniques for improving code maintainability. Use when refactoring code to reduce complexity and apply SOLID principles.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Aspire skill covering the Aspire CLI, AppHost orchestration, service discovery, integrations, MCP server, VS Code extension, Dev Containers, GitHub Codespaces, templates, dashboard, and deployment. Use when the user asks to create, run, debug, configure, deploy, or troubleshoot an Aspire distributed application.
Create ASP.NET Minimal API endpoints with proper OpenAPI documentation
Clean code principles for writing maintainable, readable code. Use when refactoring, code reviews, or writing new code to improve code quality.
Detailed coding standards and best practices including clean code, SOLID, and common patterns. Use when writing or reviewing code.
Containerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project.
Create a README.md file for the project
| name | refactoring-techniques |
| description | Refactoring techniques for improving code maintainability. Use when refactoring code to reduce complexity and apply SOLID principles. |
| license | Apache 2.0 |
// Before: Long method
async function processOrder(order) {
// Validate order (20 lines)
// Calculate total (15 lines)
// Charge payment (10 lines)
// Update inventory (10 lines)
// Send confirmation (5 lines)
}
// After: Extracted methods
async function processOrder(order) {
validateOrder(order);
const total = calculateTotal(order);
const paymentResult = await chargePayment(order, total);
await updateInventory(order);
await sendConfirmation(order);
}
// Before: Feature envy
class Report {
generate(order) {
const total = order.items.reduce((sum, item) =>
sum + (item.price * item.quantity), 0);
}
}
// After: Method moved to data owner
class Order {
getTotal() {
return this.items.reduce((sum, item) =>
sum + (item.price * item.quantity), 0);
}
}
// Before: Primitive obsession
class Order {
constructor(public email: string) {
if (!email.includes('@')) throw new Error('Invalid');
}
}
// After: Value Object
class Email {
constructor(public value: string) {
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) {
throw new Error('Invalid email');
}
}
}