rnd-code-simplify
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "rnd-code-simplify":https://skillpi.com/zh/skills/deepskill-8fbad6c317f4fd1fb52f64c6a7147c9ab4f359c5bd44abe64ff590de94018927。安装前核对上游来源和版本:https://github.com/chendongqi/OPB-Skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
代码简化和重构专家。专注在不改变功能的前提下提升代码清晰度、一致性和可维护性。适用场景:当前会话中刚编写或修改过的代码自动优化;在完成任何编码任务后主动提升代码质量;应用项目特定编码规范(如 CLAUDE.md);消除不必要的复杂性并提高可读性。说明:在代码变更后可无需用户明确请求自主运行。
介绍来源: third_party · chendongqi · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 适合谁
- 来源文档未说明。
- 输入和输出
- 来源文档未说明。
- 软件、账号及付费要求
- 来源文档未说明。
- 限制与区别
- 来源文档未说明。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: rnd-code-simplify
description: Expert code simplification and refactoring specialist that autonomously enhances code clarity, consistency, and maintainability while preserving exact functionality. Use when (1) Code has been recently written or modified in the current session, (2) After completing any coding task to proactively improve code quality, (3) When applying project-specific coding standards from CLAUDE.md, (4) To eliminate unnecessary complexity and improve readability without changing behavior. Operates autonomously after code changes without explicit user requests.Code Simplification Specialist
Autonomously refine and simplify recently modified code to enhance clarity, consistency, and maintainability while preserving exact functionality.
Core Principles
1. Preserve Functionality
Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
2. Apply Project Standards
Follow established coding standards from CLAUDE.md, including:
- Use ES modules with proper import sorting and extensions
- Prefer
functionkeyword over arrow functions for top-level functions - Use explicit return type annotations for top-level functions
- Follow proper React component patterns with explicit Props types
- Use proper error handling patterns (avoid try/catch when possible)
- Maintain consistent naming conventions (camelCase, PascalCase, etc.)
3. Enhance Clarity
Simplify code structure by:
- Reducing unnecessary complexity and nesting levels
- Eliminating redundant code and abstractions
- Improving readability through clear variable and function names
- Consolidating related logic into cohesive units
- Removing unnecessary comments that describe obvious code
- IMPORTANT: Avoid nested ternary operators - prefer switch statements or if/else chains for multiple conditions
- Choose clarity over brevity - explicit code is often better than overly compact code
4. Maintain Balance
Avoid over-simplification that could:
- Reduce code clarity or maintainability
- Create overly clever solutions that are hard to understand
- Combine too many concerns into single functions or components
- Remove helpful abstractions that improve code organization
- Prioritize "fewer lines" over readability (e.g., nested ternaries, dense one-liners)
- Make the code harder to debug or extend
5. Focus Scope
Only refine code that has been recently modified or touched in the current session, unless explicitly instructed to review a broader scope.
Refinement Process
Follow this systematic approach when simplifying code:
Step 1: Identify Modified Code
Determine which code sections were recently written or modified in the current session.
Step 2: Analyze for Improvements
Review the code for opportunities to:
- Reduce complexity and nesting
- Improve naming and clarity
- Apply project coding standards
- Eliminate redundancy
- Enhance maintainability
Step 3: Apply Best Practices
Implement refinements that align with project standards:
Import Organization:
// Before
import React from 'react';
import { useState } from 'react';
import axios from 'axios';
import './styles.css';
// After - grouped and sorted
import React, { useState } from 'react';
import axios from 'axios';
import './styles.css';
Function Style:
// Before - arrow function for top-level
const processData = (data) => {
return data.map(item => item.value);
};
// After - function keyword with return type
function processData(data: DataItem[]): number[] {
return data.map(item => item.value);
}
Conditional Clarity:
// Before - nested ternary (hard to read)
const status = user.isActive ? user.isPremium ? 'premium-active' : 'basic-active' : 'inactive';
// After - if/else chain (clear and maintainable)
function getUserStatus(user: User): string {
if (!user.isActive) return 'inactive';
if (user.isPremium) return 'premium-active';
return 'basic-active';
}
Component Props:
// Before - implicit types
function Button({ label, onClick, disabled }) {
return <button onClick={onClick} disabled={disabled}>{label}</button>;
}
// After - explicit Props type
interface ButtonProps {
label: string;
onClick: () => void;
disabled?: boolean;
}
function Button({ label, onClick, disabled = false }: ButtonProps) {
return <button onClick={onClick} disabled={disabled}>{label}</button>;
}
Step 4: Verify Unchanged Functionality
Ensure all refinements preserve the exact behavior:
- Same inputs produce same outputs
- No changed side effects
- Preserved error handling behavior
- Maintained edge case handling
Step 5: Document Significant Changes
Only document changes that affect understanding:
- New patterns introduced
- Non-obvious optimizations
- Important refactoring decisions
Avoid documenting:
- Obvious code behavior
- Simple variable renames
- Standard formatting changes
Autonomous Operation
This skill operates proactively and autonomously:
- After code completion: Automatically review and refine the code just written
- No explicit request needed: Begin refinement immediately after code modifications
- Silent improvements: Apply refinements without lengthy explanations unless changes are significant
- Preserve user intent: Never change functionality or architecture, only improve implementation
Refactoring Patterns
Pattern 1: Reduce Nesting
// Before - nested conditions
function processOrder(order) {
if (order) {
if (order.items) {
if (order.items.length > 0) {
return order.items.reduce((sum, item) => sum + item.price, 0);
}
}
}
return 0;
}
// After - early returns
function processOrder(order: Order | null): number {
if (!order?.items?.length) return 0;
return order.items.reduce((sum, item) => sum + item.price, 0);
}
Pattern 2: Extract Meaningful Functions
// Before - complex logic in one place
function validateAndSaveUser(userData) {
if (!userData.email || !userData.email.includes('@')) return false;
if (!userData.password || userData.password.length < 8) return false;
if (!userData.name || userData.name.trim().length === 0) return false;
const user = { ...userData, createdAt: Date.now() };
saveToDatabase(user);
return true;
}
// After - extracted validation logic
function isValidEmail(email: string): boolean {
return email && email.includes('@');
}
function isValidPassword(password: string): boolean {
return password && password.length >= 8;
}
function isValidName(name: string): boolean {
return name && name.trim().length > 0;
}
function validateAndSaveUser(userData: UserData): boolean {
if (!isValidEmail(userData.email)) return false;
if (!isValidPassword(userData.password)) return false;
if (!isValidName(userData.name)) return false;
const user: User = { ...userData, createdAt: Date.now() };
saveToDatabase(user);
return true;
}
Pattern 3: Improve Naming
// Before - unclear names
function fn(x, y) {
const tmp = x.filter(i => i.val > y);
return tmp.map(i => i.id);
}
// After - descriptive names
function getActiveUserIds(users: User[], minimumScore: number): string[] {
const activeUsers = users.filter(user => user.score > minimumScore);
return activeUsers.map(user => user.id);
}
Pattern 4: Consolidate Related Logic
// Before - scattered logic
function handleSubmit(data) {
validateData(data);
const cleaned = cleanData(data);
const formatted = formatData(cleaned);
const result = submitData(formatted);
logSubmission(result);
return result;
}
// After - consolidated pipeline
function handleSubmit(data: FormData): SubmitResult {
const processedData = processFormData(data);
const result = submitData(processedData);
logSubmission(result);
return result;
}
function processFormData(data: FormData): ProcessedData {
validateData(data);
const cleaned = cleanData(data);
return formatData(cleaned);
}
Quality Checklist
Before completing refinement, verify:
- [ ] All functionality remains unchanged
- [ ] Code is more readable and maintainable
- [ ] Project coding standards are applied
- [ ] Complexity is reduced where possible
- [ ] Naming is clear and descriptive
- [ ] No nested ternaries or overly compact code
- [ ] Helpful abstractions are preserved
- [ ] Error handling is appropriate
- [ ] Type annotations are explicit (where applicable)
When NOT to Refactor
Do not refactor when:
- Code was not recently modified in this session
- User explicitly requested specific code style
- Refactoring would change external behavior or API
- Code is generated or external (e.g., third-party libraries)
- Project has conflicting style guidelines
- Clarity would be reduced by changes
当前收录版本
0.0.1
安全与评测信息
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供代码简化与重构的专业能力,解决开发者日常编码优化需求
- 明确的使用场景定义,包括当前会话代码修改后、编码任务完成后等
- 强调保持功能不变的前提下提升代码质量,符合开发者核心诉求
亮点
- 触发场景描述完整,覆盖多种代码优化时机
- 边界清晰,明确说明自主运行机制
- 触发词精准,包含代码简化、重构、可维护性等关键词
待提升项
-
缺少 When to Use 章节 原报告严重程度:轻微
虽然有触发场景描述,但无明确章节标题组织
改进建议:建议添加明确的 When to Use 章节,提升文档结构清晰度
-
缺少端到端完整示例 原报告严重程度:轻微
虽然有代码片段示例,但缺少完整项目级别的端到端示例
改进建议:建议添加一个完整的项目重构示例,展示从原始代码到优化后代码的全过程
亮点
- Refinement Process 步骤清晰,包含5个明确的执行阶段
- 提供丰富的代码示例,展示 Before/After 对比
- Quality Checklist 提供完整的验证标准
亮点
- 基于 CLAUDE.md 项目编码规范,工具来源明确
- 强调 Preserve Functionality,确保行为不变
- When NOT to Refactor 部分覆盖了重要的边界情况
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
来源文档未说明。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。