Agent skill

refactoring-assistant

Assists with code refactoring by detecting code smells, suggesting improvements, and providing refactoring patterns. Activates when writing/editing code, explicitly requested refactoring, or when code quality issues are detected. Maintains awareness of core principles while providing detailed patterns and examples.

Stars 1
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/fubira/claude-code-settings/tree/main/skills/refactoring-assistant

SKILL.md

Refactoring Assistant Skill

Detect code smells and assist refactoring during development. Proactively suggest improvements without waiting for explicit requests.

Activation Triggers

  • Threshold violations detected during code editing (automatic)
  • "refactor", "code smell" (manual)

Code Smell Thresholds

Code Smell Threshold Action
Long Method > 50 lines Extract functions
Duplicate Code 3+ occurrences Extract to shared function/constant
Deep Nesting > 3 levels Early return, extract conditions
Long Parameter List > 5 params Structured params (TS: RORO, Go: struct)
Large Module > 300 lines Split into smaller modules
Complex Conditional > 3 conditions Extract to named function/variable

Workflow

  1. Detect: Read code, match against thresholds. Prioritize by severity (security > readability > style)
  2. Analyze: Check tech-stack rules (patterns/typescript-react.md, patterns/go.md). Consider context (one-off vs recurring, business justification for complexity)
  3. Suggest: Show location (file:line), present before/after with trade-offs. Execute after user approval (partial approval OK)
  4. Implement: Make small incremental changes. Run tests/linter to verify. Record new patterns via knowledge-manager

Guardrails

  • Do not refactor without test coverage (add tests first)
  • Do not change behavior (refactoring ≠ feature change)
  • Prefer incremental improvement over large-scale rewrites

Supporting Files

  • rules/code-smells.md: Detection criteria and pattern details
  • patterns/typescript-react.md: TS/React-specific patterns
  • patterns/go.md: Go-specific patterns

Expand your agent's capabilities with these related and highly-rated skills.

fubira/claude-code-settings

code-reviewer

Assists with code review by analyzing code changes for quality, best practices, security, and potential issues. Activates after implementing code features, bug fixes, or refactorings. Provides structured feedback with critical issues, suggestions, and positive highlights.

1 0
Explore
fubira/claude-code-settings

context-compactor

Analyzes and compacts context-affecting documents (project memory, CLAUDE.md, skill files) to reduce token usage and compaction frequency. Manual trigger only. Always requires user approval before making changes.

1 0
Explore
fubira/claude-code-settings

test-executor

Executes tests, analyzes test results, checks test coverage, and provides comprehensive testing status overview. Primarily for Go projects. Activates after implementing/modifying code to verify correctness, or when explicitly requested to assess test suite health.

1 0
Explore
fubira/claude-code-settings

knowledge-manager

Manages a structured knowledge base of patterns, troubleshooting guides, best practices, and workflows. Activates when discovering reusable insights, solving technical problems, or establishing new standards. Records knowledge in categorized files for future reference without bloating global CLAUDE.md.

1 0
Explore
fubira/claude-code-settings

release-assistant

Automates and ensures reliable release workflows with automatic version bump based on commit history, mandatory lint/build/test execution before release, and safe tag creation and push.

1 0
Explore
fubira/claude-code-settings

git-commit-assistant

Assists with careful Git commits in any repository. Activates when committing changes, checking .gitignore, or generating commit messages. Ensures proper file exclusion (credentials, MCP configs, personal settings), identifies untracked files, and generates Conventional Commits messages with Japanese explanations.

1 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results