← Back to registryView on GitHub **单一职责**: 每个函数只做一件事 **长度控制**: 目标 < 50 行,理想 10-30 行 **参数控制**: ≤ 4 个参数;超过时使用数据类或配置对象 **早期返回**: 用 guard clauses 避免深层嵌套 **DRY**: 提取重复逻辑为公共函数 **命名清晰**: 变量名反映意图,避免单字母(循环变量除外) **无魔法数字**: 提取为命名常量 **嵌套控制**: 嵌套层级 ≤ 3 层 捕获具体异常,不使用裸 `except:` 保留原始异常链 (`raise ... from e`) 使用 context manager 管理资源 [ ] 函数长度 < 50 行 [ ] 嵌套层级 < 3 层 [ ] 单一职责 [ ] 命名有意义 [ ] 无重复代码 [ ] 无魔法数字 [ ] 无未使用变量/导入 [ ] 错误处理具体 [ ] 符合语言规范 [ ] 类型注解/标注完整 [ ] 可读性良好 [ ] 易于维护 **重构模式**: [refactoring_patterns.md](references/refactoring_patterns.md) — Early Return、Extract Method、Guard Clauses、Async/Await 等 20+ 模式 **最佳实践**: [best-practices.md](references/best-practices.md) — 函数设计、代码组织、错误处理、性能优化、测试友好设计 **故障排除**: [troubleshooting.md](references/troubleshooting.md) — 代码异味诊断、复杂度分析、自动化工具、重构工作流
⚡
// Skill profile
Code Simplifier
name: code-simplifier
by aqbjqtd · published 2026-04-01
邮件处理数据处理
Total installs
0
Stars
★ 0
Last updated
2026-04
// Install command
$ claw add gh:aqbjqtd/aqbjqtd-code-simplifier// Full documentation
---
name: code-simplifier
description: 当用户要求简化代码、重构代码、优化代码、改进代码质量时使用此技能。提供代码简化原则和最佳实践指导,确保代码符合质量标准。
---
# Code Simplifier
提供代码简化、重构和优化的原则指导。
核心原则
函数设计
代码组织
错误处理
语言特定规范
Python
# ✅ 类型注解
def process(user_id: int, data: dict) -> dict | None:
...
# ✅ list/dict comprehension(避免嵌套)
result = [x for x in items if x.condition]
# ✅ 命名
snake_case(变量/函数), PascalCase(类), UPPER_SNAKE_CASE(常量)
# ❌ 避免
# - 嵌套 comprehension
# - 过度使用 lambda
# - 裸 except:JavaScript / TypeScript
// ✅ const/let,无 var
// ✅ 箭头函数
const process = (data) => data.filter(x => x.valid);
// ✅ 解构
const { name, email } = user;
// ✅ 命名
camelCase(变量/函数), PascalCase(类/接口), UPPER_SNAKE_CASE(常量)质量检查清单
函数级别
代码级别
整体质量
参考文档
// Comments
Sign in with GitHub to leave a comment.
// Related skills
More tools from the same signal band
⚡
04551lh
2026-03
order
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
数据处理API集成
0 installs★ 1
⚡
0isone
2026-03
0.protocol
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
开发工具数据处理
3 installs★ 0
⚡
00xmorty
2026-03
Conatus
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...
日历管理数据处理
1 installs★ 0