dotnet-resharper-clt

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ReSharper Command Line Tools

ReSharper 命令行工具

Trigger On

适用场景

  • the repo uses or wants ReSharper Command Line Tools
  • the team wants
    jb inspectcode
    or
    jb cleanupcode
  • the user asks for stronger C# inspections, cleanup profiles, or ReSharper-based CI gates
  • 仓库使用或想要使用 ReSharper 命令行工具
  • 团队需要使用
    jb inspectcode
    jb cleanupcode
  • 用户需要更强大的C#检查能力、清理配置,或者基于ReSharper的CI门禁

Value

价值

  • produce a concrete project delta: code, docs, config, tests, CI, or review artifact
  • reduce ambiguity through explicit planning, verification, and final validation skills
  • leave reusable project context so future tasks are faster and safer
  • 生成具体的项目变更:代码、文档、配置、测试、CI或评审产物
  • 通过明确的规划、验证和最终校验能力减少歧义
  • 留存可复用的项目上下文,让后续任务执行更高效安全

Do Not Use For

不适用场景

  • replacing tests with inspection output
  • ad-hoc formatting-only work when the repo intentionally standardizes on another formatter
  • repos that do not want JetBrains settings or CLT-based gates in their workflow
  • 用检查输出替代测试
  • 当仓库明确指定使用其他格式化工具的临时格式化需求
  • 工作流中不希望使用JetBrains设置或基于CLT的门禁的仓库

Inputs

输入

  • the nearest
    AGENTS.md
  • the target
    .sln
    ,
    .csproj
    , or bounded file set
  • repo-root
    .editorconfig
  • solution shared settings such as
    YourSolution.sln.DotSettings
  • 最近的
    AGENTS.md
    文件
  • 目标
    .sln
    .csproj
    或限定的文件集合
  • 仓库根目录的
    .editorconfig
    文件
  • 解决方案共享配置,例如
    YourSolution.sln.DotSettings

Quick Start

快速开始

  1. Read the nearest
    AGENTS.md
    and confirm scope and constraints.
  2. Run this skill's
    Workflow
    through the
    Ralph Loop
    until outcomes are acceptable.
  3. Return the
    Required Result Format
    with concrete artifacts and verification evidence.
  1. 阅读最近的
    AGENTS.md
    文件,确认范围和约束。
  2. 通过
    Ralph Loop
    运行本技能的
    工作流
    ,直到结果符合预期。
  3. 返回符合
    要求结果格式
    的内容,包含具体产物和验证证据。

Workflow

工作流

  1. Prefer solution-level runs when possible so ReSharper can resolve references and apply full inspections.
  2. Build the solution before
    jb cleanupcode
    when working at solution scope.
  3. Use
    jb inspectcode
    first to surface issues before editing anything broad.
  4. Treat surfaced issues as mandatory fixes when this gate is enabled for the repo; do not just dump a report and stop.
  5. Use
    jb cleanupcode
    with an explicit cleanup profile:
    • Built-in: Full Cleanup
    • Built-in: Reformat Code
    • Built-in: Reformat & Apply Syntax Style
    • or a checked-in custom profile
  6. Keep durable ReSharper settings in the team-shared solution layer and commit the solution
    .DotSettings
    file when policy changes.
  7. Re-run
    jb inspectcode
    after cleanup or fixes, then run the repo's normal quality pass and tests.
  1. 尽可能优先使用解决方案级运行,以便ReSharper可以解析引用并执行完整检查。
  2. 在解决方案范围执行
    jb cleanupcode
    前先构建解决方案。
  3. 先运行
    jb inspectcode
    暴露问题,再进行大范围编辑。
  4. 当仓库启用该门禁时,暴露的问题必须修复,不要只输出报告就结束。
  5. 配合明确的清理配置使用
    jb cleanupcode
    • Built-in: Full Cleanup
    • Built-in: Reformat Code
    • Built-in: Reformat & Apply Syntax Style
    • 或者已提交的自定义配置
  6. 将持久化的ReSharper配置保存在团队共享的解决方案层,策略变更时提交解决方案的
    .DotSettings
    文件。
  7. 清理或修复后重新运行
    jb inspectcode
    ,再运行仓库常规的质量检查和测试。

Bootstrap When Missing

缺失时的引导安装

If ReSharper Command Line Tools are not available yet:
  1. Detect current state:
    • rg --files -g '.config/dotnet-tools.json' -g '*.sln.DotSettings'
    • dotnet tool list --local
    • dotnet tool list --global
    • command -v jb
  2. Choose the install path deliberately:
    • preferred repo-local install for reproducible CI:
      • dotnet new tool-manifest
        (if missing)
      • dotnet tool install JetBrains.ReSharper.GlobalTools
    • global fallback:
      • dotnet tool install --global JetBrains.ReSharper.GlobalTools
  3. Verify the installed commands resolve correctly:
    • jb inspectcode --help
    • jb cleanupcode --help
  4. Record exact commands in
    AGENTS.md
    , for example:
    • dotnet build MySolution.sln -c Release
    • jb inspectcode MySolution.sln -o=artifacts/inspectcode.sarif
    • jb cleanupcode MySolution.sln --profile="Built-in: Full Cleanup"
  5. If the repo needs stable settings, save them into the solution team-shared layer and commit
    YourSolution.sln.DotSettings
    .
  6. Run
    jb inspectcode
    once, fix or triage the surfaced issues, rerun it, and return
    status: configured
    or
    status: improved
    .
  7. If the repo intentionally excludes ReSharper CLT from its toolchain, return
    status: not_applicable
    .
如果还没有安装ReSharper命令行工具:
  1. 检测当前状态:
    • rg --files -g '.config/dotnet-tools.json' -g '*.sln.DotSettings'
    • dotnet tool list --local
    • dotnet tool list --global
    • command -v jb
  2. 谨慎选择安装路径:
    • 优先选择仓库本地安装,保证CI可复现:
      • dotnet new tool-manifest
        (如果缺失)
      • dotnet tool install JetBrains.ReSharper.GlobalTools
    • 全局安装备选:
      • dotnet tool install --global JetBrains.ReSharper.GlobalTools
  3. 验证安装的命令可正常解析:
    • jb inspectcode --help
    • jb cleanupcode --help
  4. AGENTS.md
    中记录具体命令,例如:
    • dotnet build MySolution.sln -c Release
    • jb inspectcode MySolution.sln -o=artifacts/inspectcode.sarif
    • jb cleanupcode MySolution.sln --profile="Built-in: Full Cleanup"
  5. 如果仓库需要稳定配置,将其保存到解决方案团队共享层并提交
    YourSolution.sln.DotSettings
  6. 运行一次
    jb inspectcode
    ,修复或分类处理暴露的问题,重新运行,返回
    status: configured
    status: improved
  7. 如果仓库明确拒绝将ReSharper CLT纳入工具链,返回
    status: not_applicable

Deliver

交付物

  • explicit
    jb inspectcode
    and
    jb cleanupcode
    commands
  • durable ReSharper settings in shared solution config
  • a quality gate that surfaces issues which are then fixed, not ignored
  • 明确的
    jb inspectcode
    jb cleanupcode
    命令
  • 保存在共享解决方案配置中的持久化ReSharper设置
  • 可暴露问题并推动修复而非忽略的质量门禁

Validate

验证

  • the target solution or project builds before solution-wide cleanup
  • jb inspectcode
    output is reviewed and acted on
  • cleanup profiles and shared settings are explicit
  • tests and the wider quality pass still run after ReSharper-driven fixes
  • 目标解决方案或项目在全解决方案级清理前可正常构建
  • jb inspectcode
    输出已被审阅并采取了对应处理
  • 清理配置和共享设置明确
  • ReSharper驱动的修复完成后,测试和更广泛的质量检查仍可正常运行

Ralph Loop

Ralph Ralph Loop

Use the Ralph Loop for every task, including docs, architecture, testing, and tooling work.
  1. Plan first (mandatory):
    • analyze current state
    • define target outcome, constraints, and risks
    • write a detailed execution plan
    • list final validation skills to run at the end, with order and reason
  2. Execute one planned step and produce a concrete delta.
  3. Review the result and capture findings with actionable next fixes.
  4. Apply fixes in small batches and rerun the relevant checks or review steps.
  5. Update the plan after each iteration.
  6. Repeat until outcomes are acceptable or only explicit exceptions remain.
  7. If a dependency is missing, bootstrap it or return
    status: not_applicable
    with explicit reason and fallback path.
所有任务都需使用Ralph Loop,包括文档、架构、测试和工具相关工作。
  1. 优先规划(强制要求):
    • 分析当前状态
    • 定义目标结果、约束和风险
    • 编写详细的执行计划
    • 列出最终要运行的最终校验能力,包含顺序和原因
  2. 执行一个规划好的步骤,生成具体变更。
  3. 评审结果,记录发现和可执行的后续修复项。
  4. 小批量应用修复,重新运行相关检查或评审步骤。
  5. 每次迭代后更新计划。
  6. 重复直到结果符合预期,或仅剩余明确的例外项。
  7. 如果缺少依赖,引导安装依赖或返回
    status: not_applicable
    并附明确原因和备选方案。

Required Result Format

要求的结果格式

  • status
    :
    complete
    |
    clean
    |
    improved
    |
    configured
    |
    not_applicable
    |
    blocked
  • plan
    : concise plan and current iteration step
  • actions_taken
    : concrete changes made
  • validation_skills
    : final skills run, or skipped with reasons
  • verification
    : commands, checks, or review evidence summary
  • remaining
    : top unresolved items or
    none
For setup-only requests with no execution, return
status: configured
and exact next commands.
  • status
    :
    complete
    |
    clean
    |
    improved
    |
    configured
    |
    not_applicable
    |
    blocked
  • plan
    : 简要计划和当前迭代步骤
  • actions_taken
    : 已执行的具体变更
  • validation_skills
    : 已运行的最终校验能力,或跳过的原因
  • verification
    : 命令、检查或评审证据摘要
  • remaining
    : 主要未解决项或
    none
仅设置类请求无执行内容时,返回
status: configured
和具体的后续命令。

Load References

参考文档

  • references/resharper-clt.md
  • references/commands.md
  • references/config.md
  • references/resharper-clt.md
  • references/commands.md
  • references/config.md

Example Requests

请求示例

  • "Add ReSharper CLI inspections to this .NET repo."
  • "Run InspectCode and fix what it finds."
  • "Set up CleanupCode with a shared profile."
  • "Use JetBrains ReSharper command line tools in CI."
  • "给这个.NET仓库添加ReSharper CLI检查。"
  • "运行InspectCode并修复发现的问题。"
  • "使用共享配置设置CleanupCode。"
  • "在CI中使用JetBrains ReSharper命令行工具。"