Skills Plugins MCP Prompt Model 博客 我的中心

code-simplifier

Review RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior.

DeepseekModel 官方收录技能 质量 优秀 · 90 v1.0.0

获取

https://deepseekmodel.com/api/download.php?id=rtk-ai-rtk-claude-skills-code-simplifier-skill-md&format=skill
下载 .skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用
.skill 文件中 system_prompt 字段的实际内容。
name code-simplifier description Review RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior. triggers ["simplify","too verbose","over-engineered","refactor this","make this idiomatic"] allowed-tools ["Read","Grep","Glob","Edit"] effort low tags ["rust","simplify","refactor","idioms","rtk"] RTK Code Simplifier Review and simplify Rust code in RTK while respecting the project's constraints. Constraints (never simplify away) LazyLock regex — cannot be moved inside functions even if "simpler" .context() on every ? — verbose but mandatory Fallback to raw command — never remove even if it looks like dead code Exit code propagation — never simplify to Ok(()) #[cfg(test)] mod tests — never remove test modules Simplification Patterns 1. Iterator chains over manual loops // ❌ Verbose let mut result = Vec :: new (); for line in input. lines () { let trimmed = line. trim (); if !trimmed. is_empty () && trimmed. starts_with ( "error" ) { result. push (trimmed. to_string ()); } } // ✅ Idiomatic let result : Vec < String > = input. lines () . map (|l| l. trim ()) . filter (|l| !l. is_empty () && l. starts_with ( "error" )) . map ( str ::to_string) . collect (); 2. String building // ❌ Verbose push loop let mut out = String :: new (); for (i, line) in lines. iter (). enumerate () { out. push_str (line); if i < lines. len () - 1 { out. push ( ' \n ' ); } } // ✅ join let out = lines. join ( "\n" ); 3. Option/Result chaining // ❌ Nested match let result = match maybe_value { Some (v) => match transform (v) { Ok (r) => r, Err (_) => default, }, None => default, }; // ✅ Chained let result = maybe_value . and_then (|v| transform (v). ok ()) . unwrap_or (default); 4. Struct destructuring // ❌ Repeated field access fn process (args: &MyArgs) -> String { format! ( "{} {}" , args.command, args.subcommand) } // ✅ Destructure fn process (&MyArgs { ref command, ref subcommand, .. }: &MyArgs) -> String { format! ( "{} {}" , command, subcommand) } 5. Early returns over nesting // ❌ Deeply nested fn filter (input: & str ) -> Option < String > { if !input. is_empty () { if let Some (line) = input. lines (). next () { if line. starts_with ( "error" ) { return Some (line. to_string ()); } } } None } // ✅ Early return fn filter (input: & str ) -> Option < String > { if input. is_empty () { return None ; } let line = input. lines (). next ()?; if !line. starts_with ( "error" ) { return None ; } Some (line. to_string ()) } 6. Avoid redundant clones // ❌ Unnecessary clone fn filter_output (input: & str ) -> String { let s = input. to_string (); // Pointless clone s. lines (). filter (|l| !l. is_empty ()).collect::< Vec <_>>(). join ( "\n" ) } // ✅ Work with &str fn filter_output (input: & str ) -> String { input. lines (). filter (|l| !l. is_empty ()).collect::< Vec <_>>(). join ( "\n" ) } 7. Use if let for single-variant match // ❌ Full match for one variant match output { Ok (s) => process (&s), Err (_) => {}, } // ✅ if let (but still handle errors in RTK — don't silently drop) if let Ok (s) = output { process (&s); } // Note: in RTK filters, always handle Err with eprintln! + fallback RTK-Specific Checks Run these after simplification: # Verify no regressions cargo fmt --all && cargo clippy --all-targets && cargo test # Verify no new regex in functions grep -n "Regex::new" src/<file>.rs # Fixed, reused patterns should be in `LazyLock<Regex>` statics # Verify no new unwrap in production grep -n "\.unwrap()" src/<file>.rs # Should only appear inside #[cfg(test)] blocks What NOT to Simplify static RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(...).unwrap()); — the .unwrap() here is acceptable, it's init-time .context("description")? chains — verbose but required The fallback match arm Err(e) => { eprintln!(...); raw_output } — looks redundant but is the safety net std::process::exit(code) at end of run() — looks like it could be Ok(()) but it isn't
Agent 识别该技能的关键词,点击任意一个即可复制。

该技能未提供触发词。

下载的 .skill 包内含以下字段。
字段 说明
format格式标识(skill/v1)
skill_id技能唯一 ID
name技能名称
version版本号
description技能描述
category所属分类(数组)
trigger_words触发词列表
tags标签列表
source来源标识
source_url来源链接(本页地址)
exported_at导出时间(每次下载生成)
system_prompt系统提示词正文
model_config模型参数:provider / model / temperature / max_tokens / top_p
examples示例
install_guide各平台导入说明(Coze / Dify / Claude / 自定义框架)
同一份技能可按不同平台格式导出。
.skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用 下载
.skillpro 增强格式,额外含脚本 / 工具 / 依赖 / 钩子占位 下载
.json 纯 JSON 导出,只含 system_prompt 与模型参数 下载
Coze 带 frontmatter 的 Markdown,Coze 平台导入用 下载
Dify Dify DSL,创建应用后直接导入 下载

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

验证码 --

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。