Size Check logo

Size Check

CommunityPopular
doccker
size-check

Review changed code for reuse, quality, and efficiency, then fix any issues found. Also scans project files for size limit violations.

Overview

Publisherdoccker
Repositorycc-use-exp
Skill namesize-check
Stars
1.1K
Forks
116
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by doccker on GitHub. Read the source before you install it.

Installation

Install the Size Check AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/doccker/cc-use-exp/tree/main/.claude/skills/size-check
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/doccker/cc-use-exp.git /tmp/cc-use-exp
mkdir -p .claude/skills
cp -r /tmp/cc-use-exp/.claude/skills/size-check .claude/skills/size-check
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Size Check in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Size Check on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Size Check is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Size Check - 代码简化与文件行数检查

触发方式

用户执行 /size-check 或描述"简化代码"、"检查文件大小"时触发。


功能 1:代码简化(原有能力)

审查变更代码的复用性、质量和效率,修复发现的问题。

检查项

检查项说明
重复代码提取公共方法/组件
过度抽象简化不必要的设计模式
冗余逻辑合并可简化的条件分支
未使用代码删除死代码、无用 import

功能 2:文件行数扫描

行数阈值

语言上限拆分方式
Java300Service 拆分职责、提取 Helper/Converter
Go400按功能拆分同包文件
Vue200提取子组件、composables
TSX/JSX200提取子组件
TypeScript/JS300提取工具函数、常量、类型
Python300按职责拆分模块

执行流程

全项目扫描模式(用户未指定文件时):

1. 扫描项目所有代码文件(排除 node_modules、vendor、dist、build、.git)
2. 统计每个文件行数,对照阈值标记超限文件
3. 检测 Markdown 文件中的重复章节(相同标题出现多次)
4. 输出超限清单 + 拆分建议

单文件模式(用户指定文件时):

1. 检查代码复用、质量、效率
2. 检查行数是否超限
3. 如果超限,给出具体拆分方案

输出格式

markdown
## 文件行数扫描结果

### 超限文件

| 文件 | 行数 | 阈值 | 超限 | 建议 |
|------|------|------|------|------|
| path/to/file.py | 450 | 300 | +150 | 按职责拆分为 xxx.py 和 yyy.py |

### 合规文件(前 10 个最大的)

| 文件 | 行数 | 阈值 | 余量 |
|------|------|------|------|
| path/to/big.go | 380 | 400 | 20 |

### 总结

- 扫描文件数:N
- 超限文件数:N
- 建议操作:[具体建议]

扫描排除规则

以下目录和文件不参与扫描:

  • 目录:node_modules/、vendor/、dist/、build/、.git/、__pycache__/、.venv/
  • 文件:*.min.js、*.min.css、*.lock、*.sum
  • 配置:.toml、.json、.yaml、.yml(命令/配置文件不适用代码行数限制)
  • 文档:.md(Markdown 无硬性行数限制,但检测重复章节)

功能 3:CSS 提取检查

触发条件

扫描 Vue/TSX/JSX 文件时,检测内联 <style> 块行数。

检查规则

检查项条件建议
内联样式过长<style> 块超过 30 行提取公共样式到 assets/styles/
非 scoped 全局样式Vue SFC 中存在 <style>(无 scoped)移到 assets/styles/common.scss

不触发:<style scoped> 且行数 ≤ 30 行的组件级样式。

输出格式

在文件行数扫描结果中追加:

markdown
### CSS 提取建议

| 文件 | <style> 行数 | 类型 | 建议 |
|------|-------------|------|------|
| src/views/User.vue | 45 | scoped | 提取公共部分(变量/mixin)到 assets/styles/ |
| src/views/Home.vue | 12 | 非 scoped | 移到 assets/styles/common.scss |

修复流程

扫描完毕后,如发现超限文件或 CSS 提取建议,执行以下流程:

1. 用户确认

使用 AskUserQuestion 询问:

扫描发现 N 个问题(X 个文件超限 + Y 个 CSS 提取建议)。
是否修复?

1. 修复所有问题(推荐)
   修复文件行数超限 + CSS 提取建议。改动后确保原有功能不受影响。

2. 跳过
   不做任何修改,仅保留扫描报告。

用户选择「跳过」→ 结束。

2. 执行修复

逐文件修复,每个文件:

  1. 阅读完整文件,理解上下文和调用关系
  2. 检查是否涉及重构:
    • 如果涉及表格列、数据结构、条件分支的修改,触发 refactor-safety 规则
    • 完整读取原始代码(不凭记忆或推测)
    • 制作对比清单(列/字段/配置项)
    • 逐项验证一致性(数量/顺序/命名)
  3. 按扫描建议拆分/提取:
    • 行数超限 → 拆分文件
    • CSS → 提取到 assets/styles/
  4. 确保拆分后的入口文件保持原有导出/接口不变
  5. 优先处理超限最严重的文件

重构安全检查:

  • ✅ 表格重构:列数、列名、列顺序与原始代码一致
  • ✅ 数据结构重构:字段完整,没有遗漏
  • ✅ 条件分支重构:所有 if/else/switch 分支都已处理

3. 验证

修复完成后:

  1. 检测项目是否有测试命令(npm test / go test ./... / pytest 等)
  2. 有测试 → 运行测试,全部通过才继续
  3. 无测试 → 输出变更清单,提示用户手动验证

4. 自审

自动执行 /review quick 对修复内容进行快速审查。


安全原则

  • 先报告,确认后修复 —— 扫描结果需用户确认才执行修复
  • 不改变现有行为 —— 拆分后的入口文件保持原有接口
  • 渐进式处理 —— 优先处理超限最严重的文件

规则溯源

> 📋 本回复遵循:`size-check` - [功能1/功能2/功能3]

Frequently asked questions

What does the Size Check AI skill do?

Review changed code for reuse, quality, and efficiency, then fix any issues found. Also scans project files for size limit violations.

Why use Size Check on TypingMind?

Because you install it once and use it with any model. Size Check is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Size Check in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/doccker/cc-use-exp/tree/main/.claude/skills/size-check. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Size Check?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Size Check?

As many as you like. As long as a model supports skills, you can use Size Check with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Size Check AI skill free?

It is published on GitHub by doccker. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇