Skip to content
cccskills
FreePublished on GitHub

verify-quality

Check code for complex logic, duplication, naming issues, and oversized functions. Get a quality report with file locations and severity levels, plus guidance on splitting complex code and extracting shared logic during reviews or after refactoring.

OriginalShow the original description

代码质量校验关卡。检测复杂度、重复代码、命名规范、函数长度等质量指标。当用户提到代码质量、复杂度检查、代码异味、重构建议、lint检查、代码规范时使用。

在复杂模块、重构完成时自动触发。

See how to install

Good for

  • Checking code quality before a commit
  • Reviewing code after refactoring
  • Finding complex functions and duplicated code
  • Checking naming conventions during code review

Files included (2)

  • SKILL.md3.5 KB
  • scripts/quality_checker.js11.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

⚖ 校验关卡 · 代码质量

核心原则

代码质量 = 可读性 + 可维护性 + 可测试性
劣质代码是技术债,技术债是道基裂痕
复杂度是 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🔵 提示

命名规范

类型规范示例
类名PascalCaseUserService, HttpClient
函数名snake_caseget_user, process_data
常量UPPER_SNAKEMAX_RETRY, DEFAULT_TIMEOUT
变量snake_caseuser_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()

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

adapt

FreeSummary

Adapts existing designs for phones, tablets, desktops, print, and email. Adjusts layouts, navigation, content priorities, and touch controls to suit each context, with guidance for responsive sizing and verification across devices and input methods.

  • Adapting a desktop interface for mobile use
  • Adjusting tablet layouts for portrait and landscape
  • Expanding a mobile design for desktop screens
fengshao1227/ccg-workflow5.9KUpdated Oct 19, 2026

Audit a website for Google AdSense application readiness or ongoing ad-serving issues. Check content, navigation, crawler access, and disclosures against official requirements, then receive evidence-based findings, specific fixes, and a complete checklist with unresolved questions clearly marked.

  • Checking a site before applying for AdSense
  • Investigating issues after an AdSense rejection
  • Reviewing policy risks on a site that already serves ads
fengshao1227/ccg-workflow5.9KUpdated Oct 19, 2026

ai

FreeSummary

Routes AI development questions to focused references on agents, language model security, retrieval-augmented generation, which uses retrieved information in answers, and prompt design and evaluation. It also outlines principles for validation, safety boundaries, version control, and ongoing assessment.

  • Find guidance for agent development
  • Locate references on prompt injection defenses
  • Explore retrieval and reranking for RAG
fengshao1227/ccg-workflow5.9KUpdated Oct 19, 2026

animate

FreeSummary

Review an interface and add purposeful motion to buttons, forms, navigation, and state changes. Plan and implement animations that clarify actions and provide feedback, while checking performance and supporting users who prefer reduced motion.

  • Adding visual feedback to buttons and forms
  • Smoothing menu, modal, and tab transitions
  • Planning page entrances and scroll reveals
fengshao1227/ccg-workflow5.9KUpdated Oct 19, 2026

architecture

FreeSummary

Find the relevant architectural guidance for API design, security, cloud infrastructure, message queues, and caching. This skill acts as an index to specialized references and lists principles for structuring software, distributed systems, and access controls.

  • Finding guidance for API design
  • Reviewing security architecture topics
  • Exploring containers, K8s, and Serverless
fengshao1227/ccg-workflow5.9KUpdated Oct 19, 2026

arrange

FreeSummary

Improve interface layouts by reviewing spacing, alignment, content density, and visual hierarchy, the cues that show what matters most. Refine repetitive card grids and crowded sections into compositions with consistent spacing and responsive structure.

  • Adjusting spacing in a crowded interface
  • Making important content easier to spot
  • Varying repetitive card-based layouts
fengshao1227/ccg-workflow5.9KUpdated Oct 19, 2026

See all skills by fengshao1227

Report a problem with this skill