Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

dotnet-editorconfig

БесплатноБез исполняемых скриптовНе проверен

Authoring .editorconfig rules. IDE/CA severity, AnalysisLevel, globalconfig, code style enforcement.

wshaddixот wshaddix★ 94 звезды на GitHub

Об этом скилле

dotnet-editorconfig

Comprehensive guide to configuring .NET code analysis rules via .editorconfig and global AnalyzerConfig files. Covers code style rules (IDE*), code quality rules (CA*), severity levels, AnalysisLevel, EnforceCodeStyleInBuild, directory hierarchy precedence, and .globalconfig files.

Scope boundary: This skill covers configuring and tuning analyzer rules. For adding analyzer packages to a project, see [skill:dotnet-add-analyzers]. For authoring custom analyzers, see [skill:dotnet-roslyn-analyzers]. For project-level build configuration (Directory.Build.props, solution layout), see [skill:dotnet-project-structure].

Cross-references: [skill:dotnet-add-analyzers] for adding analyzer packages and AnalysisLevel setup, [skill:dotnet-roslyn-analyzers] for authoring custom analyzers, [skill:dotnet-project-structure] for Directory.Build.props and solution layout, [skill:dotnet-csharp-coding-standards] for naming and formatting conventions enforced by EditorConfig rules.


EditorConfig Overview

.editorconfig is the standard configuration file for controlling code style and analysis rule behavior in .NET projects. The .NET compiler (Roslyn) reads .editorconfig to determine:

  • Code style preferences -- naming, formatting, expression-level patterns (IDE* rules)
  • Code quality rule severity -- suppress, demote, or escalate CA* and IDE* diagnostics
  • Formatting rules -- indentation, spacing, newlines

Directory Hierarchy and Precedence

EditorConfig files apply hierarchically. The compiler searches upward from the source file to the filesystem root, merging settings from each .editorconfig found. Closest file wins -- a setting in src/MyApp/.editorconfig overrides the same setting in the repo root .editorconfig.

repo-root/
  .editorconfig              # Shared baseline (root = true)
  src/
    .editorconfig            # Overrides for production code
    MyApp.Api/
      .editorconfig          # API-specific overrides (if needed)
  tests/
    .editorconfig            # Relaxed rules for test projects

Set root = true in the topmost file to stop upward traversal. Without this, the editor traverses above the repo root into user or system-level EditorConfig files, producing non-reproducible behavior.

# repo-root/.editorconfig
root = true

[*.cs]
indent_style = space
indent_size = 4

File Glob Patterns

EditorConfig sections use glob patterns to scope settings to specific files:

Pattern Matches
[*.cs] All C# files
[*.{cs,vb}] C# and Visual Basic files
[**/test/**/*.cs] C# files under any test directory
[Program.cs] Exact file name

Code Style Rules (IDE*)

IDE rules control code style preferences enforced by the Roslyn compiler and IDE. They are configured with dotnet_style_*, csharp_style_*, and dotnet_diagnostic.IDE*.severity entries.

Key IDE Rule Categories

Range Category Examples
IDE0001-IDE0009 Simplification IDE0001 (simplify name), IDE0003 (remove this. qualification), IDE0005 (remove unnecessary using)
IDE0010-IDE0039 Expression preferences IDE0016 (throw expression), IDE0017 (object initializer), IDE0018 (inline variable), IDE0028 (collection initializer), IDE0034 (simplify default), IDE0039 (use local function)
IDE0040-IDE0069 Modifier and access preferences IDE0040 (add accessibility modifiers), IDE0044 (add readonly), IDE0062 (make local function static)
IDE0070-IDE0090+ Pattern matching and modern syntax IDE0071 (simplify interpolation), IDE0078 (use pattern matching), IDE0090 (simplify new expression)
IDE0100-IDE0180 Additional simplification IDE0130 (namespace match folder), IDE0160/IDE0161 (block vs file-scoped namespace)
IDE0200-IDE0260 Lambda and method preferences IDE0200 (remove unnecessary lambda), IDE0230 (use UTF-8 string literal)
IDE1005-IDE1006 Naming rules IDE1006 (naming rule violation)

Configuring Code Style Preferences

[*.cs]
# Expression-level preferences
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_expression_bodied_constructors = false:silent

# Pattern matching
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion

# Null checking
csharp_style_prefer_null_check_over_type_check = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion

# var preferences
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion

# Namespace style (.NET 6+)
csharp_style_namespace_declarations = file_scoped:warning

# Using directives
csharp_using_directive_
Полный SKILL.md на GitHub

Установить dotnet-editorconfig в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл dotnet-editorconfig?

Authoring .editorconfig rules. IDE/CA severity, AnalysisLevel, globalconfig, code style enforcement.

Как установить скилл dotnet-editorconfig?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл dotnet-editorconfig запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить dotnet-editorconfig с