yq-code-refactor

yq-code-refactor is a skill for Claude Code, Codex from rockyflux/yq-workflow. It costs 31 tokens per session (658 once invoked), scanned A, original, MIT.

A guide for safely improving the structure of existing code without intentionally changing what it does. It focuses on responsibilities, naming, boundaries, duplication, and testability.

In plain words
What is it for?
Use it when removing duplication, splitting modules, reducing coupling, or improving code that is hard to test or maintain.
Why use it?
It helps make difficult code easier to understand and change while limiting the risk of breaking existing behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when removing duplication, splitting modules, reducing coupling, or improving code that is hard to test or maintain.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rockyflux/yq-workflow/yq-code-refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add rockyflux/yq-workflow --skill yq-code-refactor
Clone the repo
git clone --depth 1 https://github.com/rockyflux/yq-workflow

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for yq-code-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/rockyflux/yq-workflow/yq-code-refactor/github.svg)](https://agentmods.dev/skills/rockyflux/yq-workflow/yq-code-refactor)
Your own site
<a href="https://agentmods.dev/skills/rockyflux/yq-workflow/yq-code-refactor"><img src="https://agentmods.dev/badge/skills/rockyflux/yq-workflow/yq-code-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for yq-code-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/rockyflux/yq-workflow/yq-code-refactor"><img src="https://agentmods.dev/badge/skills/rockyflux/yq-workflow/yq-code-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 658 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.00658
Opus 5 $0.00015 $0.00329
Sonnet 5 $0.00006 $0.00132
Haiku 4.5 $0.00003 $0.00066

Measured 7d ago against content hash 49280dc3b786, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

yq-code-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/yq-skills/yq-code-refactor/SKILL.md · 87 lines

What it actually says

YQ Code Refactor

Overview

在行为守恒前提下改善结构、命名、职责和边界,降低理解成本、改动成本和回归风险。

Core principle: 先保护行为,再调整结构。

When to Use

  • 用户要重构、拆模块、去重或收敛职责
  • 代码难测、难扩展、耦合过高或命名失真
  • 评审已经指出明显的可维护性问题
  • 功能反复出错,但根因在结构而不是单点 bug

Route Elsewhere

  • 主要是新增功能:转 yq-code-gen
  • 主要是根因排查:转 yq-debug
  • 主要是质量审查:转 yq-code-review

Process

  1. 识别重复、长函数、隐式耦合和职责混杂。
  2. 明确行为保护方式:现有测试、补测或验证清单。
  3. 选择最小有效改法,避免大爆炸重写。
  4. 检查结构是否更清晰、更易测、更易改。
  5. 记录本次已处理项和剩余技术债。

Output

# Refactor Summary
## Problems Addressed
## Refactor Strategy
## Behavior Preservation Notes
## Structural Improvements
## Remaining Debt
## Recommended Next Step
  • 上游常来自 yq-code-reviewyq-performance-opt
  • 下游通常接 yq-test-genyq-code-review
  • 验证完成前可参考 superpowers:verification-before-completion
  • 默认接 yq-test-gen,先保护重构后的行为边界
  • 然后回到 yq-code-review,确认结构改善没有引入新的回归风险
  • 如果需要沉淀结构调整理由和影响面,可补 yq-doc-gen

Common Mistakes

  • 把功能变更伪装成重构
  • 没有行为保护就大范围重写
  • 只改格式和命名,没有解决真实结构问题
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 87 lines · 31 tokens per session scan A 49280dc3b786

Subscribe to this mod's changes

yq-code-refactor is a skill published in the GitHub repository rockyflux/yq-workflow (2 stars, last pushed yesterday), licensed MIT. It adds 31 tokens to every session and 658 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

adversarial-reviewer

Adversarial code review that assumes bugs exist and hunts for them. Use when asked to review code, find bugs, audit for correctness, stress-test a PR, or when someone says "tear this apart" or "what's wrong with this". Give no benefit of the doubt — every line is guilty until proven innocent.

emdash-cms/emdash · 71 tokens

gsd-ns-review

Route to the appropriate quality / review skill based on the user's intent. gsd-code-review-fix was absorbed by gsd-code-review --fix in #2790.

open-gsd/gsd-core · 16 tokens

issue

Use when starting a chain from a GitHub issue — turning an issue URL or number into a triaged, planned, dispatched, and reviewed pull request. Classifies the thread (bug → root-cause discipline, feature → plan chain, question → drafted reply), synthesizes a spec from the issue's own acceptance criteria, then runs the…

jeremylongshore/tons-of-skills-marketplace · 115 tokens

gitnexus

A code-graph analysis add-on for examining an existing codebase, including symbols, call paths, execution flows, and effects across repositories. It can query GitNexus through its command-line or MCP interfaces.

hashgraph-online/awesome-codex-plugins · 58 tokens

cleanup-code-inspections

Reduce technical debt and improve code quality by systematically resolving static analysis warnings.

flutter/flutter-intellij · 19 tokens

sonarqube-mcp

Provides SonarQube and SonarCloud integration patterns via the Model Context Protocol (MCP) server. Enables quality gate monitoring, issue discovery and triaging, pre-push code analysis, and rule education directly in the agent workflow. Use when the user wants to check quality gates, search for Sonar issues, analyze…

giuseppe-trisciuoglio/developer-kit · 127 tokens