code-refactoring
Refactor code while preserving behavior, improving clarity, and reducing complexity.
- Covers five core refactoring patterns: Extract Method, DRY principle removal, conditional-to-polymorphism conversion, parameter object introduction, and SOLID principle application
- Includes behavior validation workflow with pre-refactoring analysis, post-refactoring testing (unit, type, lint, snapshot), and change documentation
- Provides refactoring checklist covering function length, parameter count, nesting depth, magic numbers, and self-documentation
- Enforces mandatory constraints: write tests first, change one thing at a time, preserve all functional behavior
- Supports multi-agent workflows with role-based verification across orchestration, analysis, and test execution phases
Code Refactoring
When to use this skill
- Code review: Discovering complex or duplicated code
- Before adding new features: Cleaning up existing code
- After bug fixes: Removing root causes
- Resolving technical debt: Regular refactoring
Instructions
Step 1: Extract Method
Before (long function):
function processOrder(order: Order) {
// Validation
More from supercent-io/skills-template
security-best-practices
Implement security best practices for web applications and infrastructure. Use when securing APIs, preventing common vulnerabilities, or implementing security policies. Handles HTTPS, CORS, XSS, SQL Injection, CSRF, rate limiting, and OWASP Top 10.
14.1Kdata-analysis
Analyze datasets to extract insights, identify patterns, and generate reports. Use when exploring data, creating visualizations, or performing statistical analysis. Handles CSV, JSON, SQL queries, and Python pandas operations.
13.8Kweb-accessibility
Implement web accessibility (a11y) standards following WCAG 2.1 guidelines. Use when building accessible UIs, fixing accessibility issues, or ensuring compliance with disability standards. Handles ARIA attributes, keyboard navigation, screen readers, semantic HTML, and accessibility testing.
12.7Kworkflow-automation
Automate repetitive development tasks and workflows. Use when creating build scripts, automating deployments, or setting up development workflows. Handles npm scripts, Makefile, GitHub Actions workflows, and task automation.
12.6Kcode-review
Conduct thorough, constructive code reviews for quality and security. Use when reviewing pull requests, checking code quality, identifying bugs, or auditing security. Handles best practices, SOLID principles, security vulnerabilities, performance analysis, and testing coverage.
12.5Kdatabase-schema-design
Design and optimize database schemas for SQL and NoSQL databases. Use when creating new databases, designing tables, defining relationships, indexing strategies, or database migrations. Handles PostgreSQL, MySQL, MongoDB, normalization, and performance optimization.
12.2K