Index of every page on this site: llms.txt
All skills
joacod avatar

/refactor-design-patterns

@652e752
by joacodjoacod/skills3 stars
Run it yourself

Slash command only. Review existing code or architecture and decide whether a specific design pattern would improve it without overengineering when this command is invoked to judge whether a pattern is justified, compare nearby patterns like Strategy vs State or Adapter vs Facade vs Proxy, or refactor code with recurring branching, growing state logic, hard-to-extend construction, or inconsistent wrappers. Do not use this for broad system design unless the core question is pattern fit, refactoring shape, or whether a simpler non-pattern refactor is better.

Use this Skill: https://skilld.dev/gh/joacod/skills/refactor-design-patterns

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈147 tokens for metadata: the name and description. ≈699 when used: this file. ≈14k more on demand in 30 files.

How this Skill uses context

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

This Skill turns off automatic use in Claude Code. Its description stays out of the automatic Skill list by default.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Refactor Design Patterns

Use this skill to make design-pattern suggestions practical, incremental, and grounded in the code that already exists.

Start with references/refactoring-workflow.md.

If a pattern is warranted or the user requests a pattern comparison, use references/catalog.md to route by problem type:

  • references/creational/index.md for creation and configuration problems
  • references/structural/index.md for composition, wrapping, interoperability, or simplification problems
  • references/behavioral/index.md for control flow, runtime behavior, communication, or orchestration problems

Use references/agent-mappings.md only when an AI-agent analogy would clarify the recommendation.

Working style

Anchor every recommendation in the current codebase and the user's actual pain points.

Prefer the smallest useful refactor. The goal is not to force a pattern into the design; the goal is to decide whether a pattern makes the code easier to change, easier to test, or easier to understand.

When reviewing a feature:

  1. Identify the concrete design pressure.
  2. Decide whether a pattern is needed. Consider leaving the code as is or using a small extraction, rename, or local simplification first.
  3. If a pattern adds value, classify the problem and compare at most three candidates. Explain why the selected option improves on the simpler approach.
  4. Call out tradeoffs and anti-signals, and suggest an incremental path only when a change is warranted.
  5. Tailor implementation advice to the repository language and conventions.

What to look for

Look for recurring signs such as:

  • large conditional trees that choose behavior
  • tightly coupled modules with unclear boundaries
  • difficult object or service construction
  • wrapper code repeated across integrations
  • state transitions encoded as flags and branching
  • scattered side effects and notification logic
  • features that are correct but painful to extend

Output guidance

Prefer a practical structure like this:

  • Design problem
  • Does this need a pattern?
  • Recommended approach, including no change or a simpler refactor when appropriate
  • Pattern comparison, only when useful
  • Refactor sketch or steps, if a change is warranted
  • Risks, tradeoffs, and anti-signals

If the user asks for code changes, keep the implementation incremental and idiomatic for the language in the repo.

Guardrails

Do not recommend a pattern only because the terminology sounds familiar.

Do not abstract early when:

  • there is only one stable behavior
  • the variation is speculative
  • the new layer would hide simple code behind ceremony
  • the existing problem can be solved with a small extraction or rename

If no pattern is warranted, say so clearly and recommend the simpler refactor.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides architectural and design pattern guidelines for code refactoring and does not contain any executable code, remote dependencies, or suspicious instructions.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 652e752. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Steadyupdated last month
user-invocable
true
disable-model-invocation
true

README badge

README badge for joacod/skills/refactor-design-patterns