refactor
Analyze code and suggest refactoring opportunities with blast radius assessment, risk evaluation, and recommended order of operations
Skill by thoreinstein
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.
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.
About
Reviews
Write a reviewNo 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: ExtractFrom thoreinstein/agents, MIT.
More from thoreinstein/agents
- 0.454score
core-web-vitals
addyosmani
Optimize Core Web Vitals (LCP, INP, CLS) for better page experience and search ranking.
SkillDFreshness: D★ 3Claude Code +9 - 0.449score
performance
addyosmani
Optimize web performance for faster loading and better user experience.
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
code-review
thoreinstein
Comprehensive code review with security, performance, and maintainability focus.
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
debug
thoreinstein
Guide systematic debugging through hypothesis generation, evidence collection, and verification.
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
bugfix
thoreinstein
Diagnose and fix bugs using hypothesis-driven debugging, diagnostic instrumentation, architecture-aware analysis, and evidence-based root cause identification
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
analyze
thoreinstein
Deep analysis mode - thorough multi-phase investigation with expert consultation for complex problems requiring careful examination
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
content-writer
thoreinstein
Research-driven content writing with citations, iterative outlines, and real-time feedback.
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
deploy-checklist
thoreinstein
Generate deployment checklists with pre-flight checks, rollout strategy, and verification steps.
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
runbook
thoreinstein
Generate operational runbooks for services, procedures, or incident response with step-by-step procedures, troubleshooting guides, and escalation paths
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
implement
thoreinstein
Full implementation mode - end-to-end feature implementation with phased execution, parallel work streams, verification gates, and atomic commits per phase
SkillDFreshness: D★ 3Claude Code +9 - 0.443score
research
thoreinstein
Research the codebase to find and explain specific topics, answering questions about architecture, configuration, data flows, and implementation details
SkillDFreshness: D★ 3Claude Code +9 - 0.442score
figma-design
thoreinstein
Interact with Figma design files via the web browser using the Figma Plugin API.
SkillDFreshness: D★ 3Claude Code +9
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
- Repository
- github.com/thoreinstein/agents
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from thoreinstein
- 0.776score
journal
thoreinstein
Use when the user wants to work with their daily note — view today's entry, add a log, do a daily review, or capture quick thoughts.
SkillAFreshness: A★ 102Claude Code +9 - 0.649score
vault
thoreinstein
Use when the user wants to set, change, or create their Obsidian vault, or says "vault", "set vault", "change vault", "create vault", or "new vault".
SkillAFreshness: A★ 102Claude Code +9 - 0.597score
vault-lint
thoreinstein
Use when the user wants a health audit of the vault — stale content, provenance drift, frontmatter compliance, or MOC coverage gaps.
SkillDFreshness: D★ 102Claude Code +9 - 0.597score
moc-update
thoreinstein
Use after creating a new Engineering/ note to suggest which Maps of Content (MOCs) it belongs in.
SkillDFreshness: D★ 102Claude Code +9 - 0.597score
research
thoreinstein
Use when the user asks a question about their vault, wants to explore a topic across notes, or says "research", "find out", "what do I know about", or…
SkillDFreshness: D★ 102Claude Code +9 - 0.597score
wiki-ingest
thoreinstein
Use when the user wants to ingest external sources into the vault — PDFs, markdown files, transcripts, Readwise exports, or any document.
SkillDFreshness: D★ 102Claude Code +9
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.
Cite this page
refactor skill. Agent Mart. https://agentmart.dev/skills/thoreinstein-refactor (last updated 2026-10-24)