OpenLum.Core/Skills/csharp/SKILL.md
用于在 C# / .NET 项目中进行规划、实现、重构和调试。优先使用 dotnet CLI 完成项目管理与编译,结合 Grep / Glob / 子代理 / 网络搜索进行代码定位与 Debug。禁止执行 dotnet run / dotnet test,编译通过即视为任务完成。
npx skillsauth add ldotjdot/openlum csharpInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
适用于在 C# / .NET 项目中进行需求分析、架构设计、功能开发、重构与调试。
智能体应主动利用文件工具、搜索工具、子代理和网络搜索来完成较复杂的分析与 Debug,而不仅仅是单次编辑。
dotnet build 成功 = 任务完成标志。dotnet run、dotnet test 或等价命令(包括通过脚本间接运行)。程序运行与测试由用户自行执行。Read:读取 .cs、.csproj、.sln、配置文件等内容。ApplyPatch:对单个文件进行结构化修改(新增类/方法、重构逻辑、修复 Bug)。Glob:按模式列出 C# 相关文件(如 **/*.cs、**/*.csproj),避免硬编码文件列表。ReadLints:在修改后检查被编辑文件是否存在新的编译/分析错误,并尽量修复。Grep(rg):
class <Name>、interface <Name>、MethodName\( 或错误码。glob 或 type=cs 仅在 C# 文件中搜索。glob / grep(OpenLum 原生搜索;其他环境可能有 SemanticSearch):
; 而不是 &&。dotnet new sln -n MyAppdotnet new console -n MyAppdotnet new classlib -n MyLibdotnet sln add MyApp/MyApp.csprojdotnet add MyApp reference MyLib/MyLib.csprojdotnet add MyApp package <PackageId> [-v <Version>]dotnet restoredotnet build -v normal(推荐,用于捕获完整编译输出)dotnet build -c Releasegrep / rg,优先使用内置 Grep 工具完成搜索。当单次对话难以完成复杂任务(如大规模重构、全仓库架构梳理、复杂调试)时:
subagent_type: "explore":需要在大仓库中系统梳理结构、找调用链、罗列相关文件时使用。subagent_type: "generalPurpose":需要多轮推理、综合文档/网络信息来设计方案或长流程任务时使用。prompt 中明确:
readonly: true)。在以下场景主动使用网络:
使用建议:
WebSearch:根据错误消息 / API 名 + c# + 2026 搜索最新资料。WebFetch:对于具体的文档链接(如 learn.microsoft.com、GitHub README)拉取并阅读关键片段。与 coding skill 一致:识别分析问题 → 规划路径 → 代码编写 → 检查编译。C# 场景下具体化为:
Glob / Grep 找到项目入口、相关类/接口、调用链;读 .csproj、*.sln 确认依赖与目标框架。.cs、接口、方法?调用方与测试是否要同步改?dotnet build 验证。Read,定位用 Grep/Glob,修改用 StrReplace/text_edit/Write 或 editing skill 中的 Shell 方法(ReplaceRangeWithText、ReplaceAll 等),构建用 exec(dotnet build -v normal)。Read 目标文件及引用处,保持项目现有命名、异常处理、日志与 DI 风格。dotnet build,避免一次改很多再一起排错。dotnet restore(如有新包)和 dotnet build -v normal,以编译通过为完成标志。Read 查看,用 Grep 找引用与定义,修完再 build,直到零错误。dotnet run、dotnet test;运行与测试由用户自行完成。收尾时简要总结改动与后续建议。Glob/Grep 找入口、领域层、服务与配置。explore 生成分步 TODO。Read + ApplyPatch,遵循项目风格。dotnet restore + dotnet build -v normal,提取并分析错误。Read,Grep 查符号,修复后反复 build 直至通过。dotnet build -v normal 输出,记录第一个错误及其上下文(文件、行号、错误码)。Read 查看对应文件和附近代码。Grep 搜索相关类型或命名空间定义。WebSearch 查询错误码或异常信息,并结合当前 .NET 版本理解原因。dotnet build,重复直至通过。在不能运行程序的前提下:
Grep 搜索方法/接口的所有调用点。explore 生成调用链说明。WebSearch + WebFetch 查看官方文档与示例。所有命令均以工作区根目录或解决方案根目录为基准,注意相对路径。
| 命令 | 说明 |
|------|------|
| dotnet new sln -n <Name> | 创建解决方案 |
| dotnet new console -n <Name> | 创建控制台项目 |
| dotnet new classlib -n <Name> | 创建类库项目 |
| dotnet sln add <projPath> | 将项目加入解决方案 |
| dotnet add <projPath> reference <refProj> | 添加项目引用 |
| dotnet add <projPath> package <PackageId> [-v <Version>] | 向项目添加 NuGet 包 |
| dotnet restore | 还原所有依赖包 |
| dotnet build -v normal | Debug 编译并输出详细信息(推荐默认) |
| dotnet build -c Release | Release 编译 |
NuGet 包搜索(如本地 SDK 支持):
dotnet package search <关键词> [--take 10] [--exact-match] [--prerelease] [--source <url>] [--format json]Glob / Grep 列出受影响文件,再逐个 Read / ApplyPatch。dotnet build、dotnet test、dotnet run——仅作为建议,不代为执行)。development
浏览网页。与 read skill 风格一致:直接 exec 调用 exe,传参执行,stdout 为结果。
development
在缺少专用工具时,优先使用本地 Python 脚本完成复杂任务。临时脚本统一放在工作区 script 目录下的独立子文件夹中。
development
Local coding workflow: read/write/list_dir/exec,加上 Grep + Glob 的纯文本搜索。Use when: editing code, building, refactoring, or exploring a codebase. Success = compile passes; user runs the program.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.