Automated summary
Analyzes code to identify refactoring opportunities with blast radius and risk assessment, outputting recommendations without executing changes.
Strengths
- Identifies multiple code smells with precise locations
- Includes blast radius and risk assessment per suggestion
- Recommends order of operations based on dependencies and risk
- Provides test coverage awareness
Limitations
- Analysis-only; does not perform the actual refactoring
- May miss context-specific nuances like business logic intent
- Relies on static analysis patterns, not runtime behavior
When planning a refactoring sprint, assessing technical debt, or evaluating the impact of potential changes before modifying code.
When you need immediate automated refactoring execution, or for trivial single-file changes where a quick edit suffices.
Security analysis
SafeThis skill is read-only analysis with Read, Glob, Grep tools. It does not execute any code, modify files, or access external resources. No destructive actions or data exfiltration risks.
No concerns found
How this analysis is madeExamples
Analyze pkg/auth/handler.go for refactoring opportunities, focusing on complexity and duplication.Review the utils/ directory and identify all code smells, blast radius, and suggest a refactoring plan with risk levels.Find refactoring opportunities in the UserProfile component, particularly around state management and render logic.name: refactor description: Analyze code and suggest refactoring opportunities with blast radius assessment, risk evaluation, and recommended order of operations license: MIT compatibility:
- runtime:any allowed-tools:
- Read
- Glob
- Grep metadata: author: thoreinstein version: 1.0.0
Refactor
Analyze code and suggest refactoring opportunities with rationale. This is an analysis-only skill - it identifies and documents refactoring opportunities but does not execute them.
When to Use
- Reviewing code for improvement opportunities
- Planning a refactoring initiative
- Assessing technical debt in a codebase area
- Evaluating complexity, duplication, or coupling concerns
- Understanding blast radius before making changes
Input
- Target: file path, directory/package, or function/component name
- Optional: specific concern (duplication, complexity, coupling, testability, etc.)
Investigation Strategy
Track 1: Codebase Exploration
- Map dependencies and call sites for target code
- Identify blast radius of potential changes
- Find related code with similar patterns
- Assess test coverage of affected areas
Track 2: Code Analysis
- Deep analysis of code smells and patterns
- Identify refactoring opportunities
- Assess complexity metrics
- Evaluate maintainability concerns
Refactoring Patterns
Universal Patterns
| Pattern | Description | |---------|-------------| | Extract function/method | Pull out reusable logic | | Inline function/variable | Remove unnecessary indirection | | Rename | Improve clarity (with blast radius assessment) | | Move | Relocate to better home (file, package, module) | | Replace conditional with polymorphism | Simplify branching | | Introduce parameter object | Group related parameters | | Dependency inversion | Decouple via interfaces/abstractions |
Go-Specific Patterns
| Pattern | Description | |---------|-------------| | Extract interface | Define behavior contracts | | Consolidate error handling | Reduce repetitive error checks | | Replace concrete with interface | Improve testability | | Extract middleware | Separate cross-cutting concerns | | Table-driven refactor | Convert repetitive code to data-driven |
Frontend-Specific Patterns
| Pattern | Description | |---------|-------------| | Extract component | Break down large components | | Extract custom hook | Reuse stateful logic | | Lift state up | Move state to common ancestor | | Push state down | Colocate state with usage | | Extract render function | Simplify complex JSX | | Memoization | Optimize re-renders |
Output
Document the analysis using the template at references/templates/refactor-analysis.md.
The analysis should include:
- Code smells identified with locations
- Suggested refactorings with risk assessment
- Blast radius for each change
- Recommended order of operations
- Test coverage assessment
Constraints
- Analysis only: Do not execute refactorings - document recommendations
- Blast radius required: Every suggestion must include affected files/functions
- Risk assessment required: Every suggestion must be rated Low/Medium/High
- Order matters: Recommend sequence based on risk and dependencies
- Test awareness: Note test coverage and impact for each suggestion
Example
Refactoring Analysis: pkg/auth/handler.go
Target:
- Path: pkg/auth/handler.go
- Scope: file
- Concern: complexity
Summary:
The auth handler has grown to 450 lines with 3 code smells identified.
Recommend extracting token validation and session management into
separate services. Low-risk changes that improve testability.
Code Smells Identified:
1. Long Function (validateAndCreateSession)
- Location: handler.go:145-280
- Description: 135-line function handling validation, session
creation, and response formatting
- Impact: Hard to test, multiple responsibilities
2. Feature Envy (token validation)
- Location: handler.go:156-198
- Description: Handler reaches into token package internals
- Impact: Tight coupling, changes ripple across packages
Suggested Refactorings:
1. Extract TokenValidator service
- Type: Extract
- Target: handler.go:156-198
- Rationale: Encapsulates token validation logic
- Blast Radius: handler.go, handler_test.go
- Risk: Low — isolated logic, good test coverage
- Test Impact: Add TokenValidator unit tests
2. Extract SessionManager service
- Type: Extract
- Target: handler.go:200-250
- Rationale: Separates session concerns from HTTP handling
- Blast Radius: handler.go, session.go, handler_test.go
- Risk: Medium — touches session storage
- Test Impact: Update integration tests
Recommended Order:
1. TokenValidator first (lowest risk, no dependencies)
2. SessionManager second (depends on cleaner handler)
Begin by identifying the target code and any specific concerns to focus on.
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/code-refactoring-analysis-mm8o51p2' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/code-refactoring-analysis-mm8o51p2/download' --output '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md.part' && mv '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md.part' '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md' && test -s '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/refactor' && cp -R '.skill-downloads/code-refactoring-analysis-mm8o51p2' '.claude/skills/refactor'Cursor
test -f '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md' && test -s '.skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/refactor' && cp -R '.skill-downloads/code-refactoring-analysis-mm8o51p2' '.cursor/skills/refactor'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/code-refactoring-analysis-mm8o51p2'openskills read 'code-refactoring-analysis-mm8o51p2'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/code-refactoring-analysis-mm8o51p2/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.