Systematic Code Refactoring
luongnv89/claude-howto
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
Scans code for complexity, long functions, duplicated blocks, naming problems and code smells with a Node script, then reports and suggests refactors.
SKILL.md written in Chinese; this summary is our English description.
$ npx skills add fengshao1227/ccg-workflow --skill verify-quality -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install fengshao1227/ccg-workflow verify-quality --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/fengshao1227/ccg-workflow.git skills-src && mkdir -p .claude/skills && cp -r skills-src/dsh-ccg/skills/verify-quality .claude/skills/verify-quality && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "verify-quality" agent skill from https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-quality into .claude/skills/verify-quality/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "verify-quality", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-qualityType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add fengshao1227/ccg-workflow --skill verify-quality -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install fengshao1227/ccg-workflow verify-quality --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/fengshao1227/ccg-workflow.git skills-src && mkdir -p .agents/skills && cp -r skills-src/dsh-ccg/skills/verify-quality .agents/skills/verify-quality && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "verify-quality" agent skill from https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-quality into .agents/skills/verify-quality/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "verify-quality", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add fengshao1227/ccg-workflow --skill verify-quality -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install fengshao1227/ccg-workflow verify-quality --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/fengshao1227/ccg-workflow.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/dsh-ccg/skills/verify-quality .cursor/skills/verify-quality && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "verify-quality" agent skill from https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-quality into .cursor/skills/verify-quality/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "verify-quality", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/fengshao1227/ccg-workflow.git --path dsh-ccg/skills/verify-quality--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add fengshao1227/ccg-workflow --skill verify-quality -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install fengshao1227/ccg-workflow verify-quality --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/fengshao1227/ccg-workflow.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/dsh-ccg/skills/verify-quality .gemini/skills/verify-quality && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "verify-quality" agent skill from https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-quality into .gemini/skills/verify-quality/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "verify-quality", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install fengshao1227/ccg-workflow verify-qualityInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add fengshao1227/ccg-workflow --skill verify-quality -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/fengshao1227/ccg-workflow.git skills-src && mkdir -p .github/skills && cp -r skills-src/dsh-ccg/skills/verify-quality .github/skills/verify-quality && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "verify-quality" agent skill from https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-quality into .github/skills/verify-quality/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "verify-quality", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add fengshao1227/ccg-workflow --skill verify-quality -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install fengshao1227/ccg-workflow verify-quality --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/fengshao1227/ccg-workflow.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/dsh-ccg/skills/verify-quality .opencode/skills/verify-quality && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "verify-quality" agent skill from https://github.com/fengshao1227/ccg-workflow/tree/main/dsh-ccg/skills/verify-quality into .opencode/skills/verify-quality/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "verify-quality", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
verify-qualityScans code for complexity, long functions, duplicated blocks, naming problems and code smells with a Node script, then reports and suggests refactors.
Written in Chinese, this skill is a code quality gate built on the idea that readability, maintainability and testability define quality. A bundled Node script scans a path, with a verbose option, and measures cyclomatic complexity, function length, file length, parameter count, nesting depth and line length, each against a threshold that produces a warning or a hint.
It also checks naming conventions, with PascalCase for classes, snake_case for functions and variables and upper snake case for constants, and flags code smells: duplicated blocks, long parameter lists, magic numbers, dead code and commented-out code, each with a severity. The report lists passes and failures, and the skill includes before-and-after examples for lowering complexity and removing duplication.
It is meant to run automatically on large modules, after a refactor, during code review and before a commit, and it requires Node 18 or later. The report shows a pass or fail summary for the scanned code.
Read from SKILL.md and the folder at commit f349e3d. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
BashReadGlobFrom allowed-tools in the SKILL.md frontmatter.
Ships 1 file in scripts/ (JavaScript), which the agent can run.
Shell commands in SKILL.md call:
nodeFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
node>=18
From compatibility in the SKILL.md frontmatter.
Code Quality Gate loads about 593 tokens when it runs. Until then it costs about 27 tokens; SKILL.md has 91 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
allowed-tools: Bash, Read, GlobAutomated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from fengshao1227/ccg-workflow at commit f349e3d, republished under its MIT licence (© fengshao1227). 91 words, ~593 tokens.
.claude/skills/verify-quality/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.代码质量 = 可读性 + 可维护性 + 可测试性
劣质代码是技术债,技术债是道基裂痕
复杂度是 bug 的温床运行质量检查脚本(跨平台):
# 在 skill 目录下运行
node scripts/quality_checker.js <扫描路径>
node scripts/quality_checker.js <扫描路径> -v # 详细模式
node scripts/quality_checker.js <扫描路径> --json # JSON 输出| 指标 | 阈值 | 超标后果 |
|---|---|---|
| 圈复杂度 | ≤ 10 | 🟠 警告,建议拆分 |
| 函数长度 | ≤ 50 行 | 🟠 警告,建议拆分 |
| 文件长度 | ≤ 500 行 | 🟡 提示,考虑拆分 |
| 参数数量 | ≤ 5 | 🟠 警告,考虑封装 |
| 嵌套深度 | ≤ 4 | 🟠 警告,建议重构 |
| 行长度 | ≤ 120 | 🔵 提示 |
| 类型 | 规范 | 示例 |
|---|---|---|
| 类名 | PascalCase | UserService, HttpClient |
| 函数名 | snake_case | get_user, process_data |
| 常量 | UPPER_SNAKE | MAX_RETRY, DEFAULT_TIMEOUT |
| 变量 | snake_case | user_id, total_count |
| 异味 | 说明 | 严重度 |
|---|---|---|
| 重复代码 | 相似代码块 > 10 行 | 🟠 High |
| 过长参数列表 | 参数 > 5 个 | 🟡 Medium |
| 魔法数字 | 未命名的常量 | 🟡 Medium |
| 死代码 | 未使用的函数/变量 | 🔵 Low |
| 注释代码 | 被注释的代码块 | 🔵 Low |
| 场景 | 触发条件 |
|---|---|
| 复杂模块 | 代码行数 > 200 |
| 重构完成 | 重构任务完成时 |
| 代码审查 | PR/MR 审查时 |
| 提交前 | 代码提交前检查 |
1. 扫描代码文件
2. 计算复杂度指标
3. 检测代码异味
4. 验证命名规范
5. 输出质量校验报告## 代码质量校验报告
✓ 通过 | ✗ 未通过
### 复杂度指标
- 平均函数复杂度: N
- 超标函数数: N
- 最大文件行数: N
### 代码异味
- 🟠 High: N
- 🟡 Medium: N
- 🔵 Low: N
### 问题清单
| 文件 | 行号 | 类型 | 严重度 | 描述 |
|------|------|------|--------|------|
| ... | ... | ... | ... | ... |
### 结论
可交付 / 需重构后交付# 🔴 高复杂度 - 道基不稳
def process(data):
if condition1:
if condition2:
if condition3:
# 深层嵌套
pass
# ✅ 低复杂度 - 道基稳固
def process(data):
if not condition1:
return
if not condition2:
return
if not condition3:
return
# 主逻辑# 🔴 重复代码 - 异端
def func1():
# 10行相同逻辑
pass
def func2():
# 10行相同逻辑
pass
# ✅ 提取公共函数 - 正道
def common_logic():
# 公共逻辑
pass
def func1():
common_logic()
def func2():
common_logic()© fengshao1227, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file (scripts) in dsh-ccg/skills/verify-quality of fengshao1227/ccg-workflow.
Open the folder on GitHubat commit f349e3d
Code Quality Gate next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Code Quality Gate this skillfengshao1227/ccg-workflow | 5.9k | — | ~593 | Automated safety check: Notes | MIT | |
| Systematic Code Refactoringluongnv89/claude-howto | 42k | — | ~3k | Automated safety check: Pass | MIT | |
| Code Refactoring Workflowluongnv89/claude-howto | 42k | — | ~3.1k | Automated safety check: Pass | MIT | |
| FIXME Resolvertailcallhq/forgecode | 7.6k | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| DesloppifyGit-on-my-level/codex-autorunner | 875 | — | ~3.4k | Automated safety check: Pass | MIT | |
| Tech Debt Analyzerailabs-393/ai-labs-claude-skills | 455 | 1 repos | ~3.9k | Automated safety check: Pass | MIT |
luongnv89/claude-howto
Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.
luongnv89/claude-howto
Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.
tailcallhq/forgecode
Finds every FIXME comment in a codebase, groups related ones across files into one task, implements the work they describe and removes the comments once it is done.
Git-on-my-level/codex-autorunner
Codebase health scanner and technical debt tracker. An agent skill from Git-on-my-level/codex-autorunner.
ailabs-393/ai-labs-claude-skills
This skill should be used when analyzing technical debt in a codebase, documenting code quality issues, creating technical debt registers, or assessing code maintainability.
tsz-org/tsz
Run a deep DRY + code-hygiene audit of the Rust workspace and turn the findings into verified, deduplicated, hierarchical GitHub tech-debt issues.
fengshao1227/ccg-workflow
Analyzes a code diff for documentation sync, test coverage and impact scope, warning when docs or tests lag behind a design-level change or a large edit.
fengshao1227/ccg-workflow
Scans a module directory for the required README.md and DESIGN.md plus recommended files and reports what is missing, so a module is not delivered incomplete.
fengshao1227/ccg-workflow
Scans code with a bundled Node script for injection, secrets, XSS and other risky patterns, ranks findings by severity and checks that security decisions are documented.
fengshao1227/ccg-workflow
Generates README.md and DESIGN.md skeletons for a module by scanning its structure with a Node script, then lists what to fill in by hand.
fengshao1227/ccg-workflow
How to run a non-trivial change end to end with the CCG role tools (ccganalyze / ccgdesign / ccgbuild / ccgdebug / ccgoptimize / ccgreview / ccgtest) and the verify- quality gates.
Categories
Scans code for complexity, long functions, duplicated blocks, naming problems and code smells with a Node script, then reports and suggests refactors. Written in Chinese, this skill is a code quality gate built on the idea that readability, maintainability and testability define quality. A bundled Node script scans a path, with a verbose option, and measures cyclomatic complexity, function length, file length, parameter count, nesting depth and line length, each against a threshold that produces a warning or a hint.
Code Quality Gate fits situations like: checking a module for complexity and code smells after a refactor; running a quality gate during pull request review; finding long functions, deep nesting or duplicated blocks; checking naming conventions before committing.
Run `npx skills add fengshao1227/ccg-workflow --skill verify-quality -a claude-code`. Or copy the skill folder (dsh-ccg/skills/verify-quality in fengshao1227/ccg-workflow) into .claude/skills/verify-quality in your project. Claude Code loads it when a task matches its description.
Run `npx skills add fengshao1227/ccg-workflow --skill verify-quality -a codex`. Or copy the skill folder (dsh-ccg/skills/verify-quality in fengshao1227/ccg-workflow) into .agents/skills/verify-quality in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add fengshao1227/ccg-workflow --skill verify-quality -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/verify-quality, .gemini/skills/verify-quality, .github/skills/verify-quality and .opencode/skills/verify-quality in your project.
Going by SKILL.md and its folder, Code Quality Gate needs JavaScript for the scripts in its folder and the command-line tools its instructions call (node). Our summary lists: Node.js 18 or later. Its frontmatter pre-approves these tools: Bash, Read, Glob. Compatibility (from SKILL.md): node>=18.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Code Quality Gate is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 593 tokens (SKILL.md is roughly 2.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Code Quality Gate: Systematic Code Refactoring (luongnv89/claude-howto, 42k stars), Code Refactoring Workflow (luongnv89/claude-howto, 42k stars), FIXME Resolver (tailcallhq/forgecode, 7.6k stars) and Desloppify (Git-on-my-level/codex-autorunner, 875 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
fengshao1227 (a GitHub user) maintains it in fengshao1227/ccg-workflow, which has 5,935 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on September 15, 2026.
Source: fengshao1227/ccg-workflow on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.