Skip to content
Agentmart
Submit a tool

refactor

Analyze code and suggest refactoring opportunities with blast radius assessment, risk evaluation, and recommended order of operations

Skill by thoreinstein

IndexedMIT★ 3
Write a review

Chalk Labs

Need help deploying refactor?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/thoreinstein-refactor

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Analyze code and suggest refactoring opportunities with blast radius assessment, risk evaluation, and recommended order of operations

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/refactor

What's inside

Skill name
refactor
Description
Analyze code and suggest refactoring opportunities with blast radius assessment, risk evaluation, and recommended order of operations
License
MIT
Metadata
author: thoreinstein · version: 1.0.0
Instructions
141 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • compatibility: must be text of at most 500 characters
  • allowed-tools: must be a space-separated string

Files (2)

  • SKILL.md
  • refactor-analysis.md · references/templates/

SKILL.md (first lines)

# 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

From thoreinstein/agents, MIT.

More from thoreinstein/agents

Signals

Stars
3
Forks
0
Open issues
0
Last commit (this folder)
Jan 20, 2026 (9 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from thoreinstein

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get refactor running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying refactor?

CallGet help
Cite this page

refactor skill. Agent Mart. https://agentmart.dev/skills/thoreinstein-refactor (last updated 2026-10-24)