Skip to content
Productivity
Skill

/refactor-code

Improve code structure and readability

From plugin
cowork-os
421154 skills
Install
$ npx -y skills add CoWork-OS/CoWork-OS --skill refactor-code --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/refactor-code

Context preview

The summary Claude sees to decide when to auto-load this skill.

Improve code structure and readability

SKILL.md

refactor-code.SKILL.md
name: refactor-code
description: "Improve code structure and readability"

Refactor Code

Purpose

Improve code structure and readability

Routing

  • Use when: Use when user asks to improve maintainability, readability, modularity, or error handling in code.
  • Do not use when: Don't use for behavior-only fixes where refactor risk is unnecessary.
  • Outputs: Refactor changes, rationale, and minimal review checklist for behavior-sensitive sections.
  • Success criteria: Preserves behavior while improving structure and readability.

Trigger Examples

Positive

  • Use the refactor-code skill for this request.
  • Help me with refactor code.
  • Use when user asks to improve maintainability, readability, modularity, or error handling in code.
  • Refactor Code: provide an actionable result.

Negative

  • Don't use for behavior-only fixes where refactor risk is unnecessary.
  • Do not use refactor-code for unrelated requests.
  • This request is outside refactor code scope.
  • This is conceptual discussion only; no tool workflow is needed.

Parameters

| Name | Type | Required | Description | |---|---|---|---| | path | string | Yes | Path to the file to refactor | | focus | select | Yes | What to focus on |

Runtime Prompt

  • Current runtime prompt length: 235 characters.
  • Runtime prompt is defined directly in `../refactor-code.json`.
Ships withcowork-os

Local-first personal agentic OS and everything app for coding, knowledge work, web design, automations, and artifacts.

Get the whole plugin