Skip to main content
style-enforcement Validate code against style rules from .editorconfig, StyleCop.json, and Directory.Build.props. Use when you say "check style compliance", "validate editorconfig rules", "run style enforcement", "check naming conventions", or "validate line endings". Detects line ending violations, naming convention issues, indentation problems, and charset mismatches across C#, Python, PowerShell, and JavaScript. Do NOT use for taste/style invariants like file size or structured logging (use taste-lints).
Jump to install Skills Marketplace Discover and explore AI skills built by the community.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Copy promptShow prompt details A direct command skips the review prompt. Inspect the source before running it.
npx skills add https://github.com/rjmurillo/ai-agents --skill style-enforcementThe command stays on one line. Scroll horizontally to inspect it before copying.
Prefer a local copy? Download the files currently available to SkillsMP.
Download Zip Downloading... More from this repository Related occupations SOC
Based on SOC occupation classification
name style-enforcement description Validate code against style rules from .editorconfig, StyleCop.json, and Directory.Build.props. Use when you say "check style compliance", "validate editorconfig rules", "run style enforcement", "check naming conventions", or "validate line endings". Detects line ending violations, naming convention issues, indentation problems, and charset mismatches across C#, Python, PowerShell, and JavaScript. Do NOT use for taste/style invariants like file size or structured logging (use taste-lints). license MIT metadata {"version":"1.0.0"}
Style Enforcement
Validate code files against configured style rules from project configuration files.
Triggers
check style compliance
validate editorconfig rules
run style enforcement
check naming conventions
validate line endings
Quick Start
python3 scripts/check_style.py --target .
python3 scripts/check_style.py --git-staged
python3 scripts/check_style.py src/models/user.cs src/services/auth.cs
python3 scripts/check_style.py --target . --format json --output violations.json
Evidence Created based on analysis of moq.analyzers closed PR reviewer patterns:
9.8% of human reviewer feedback (11 of 112 comments) addressed naming/style conventions
Common patterns: line endings (CRLF vs LF), naming conventions (FooAsync), style guide violations
Examples: "Use lf not crlf", "Should be named FooAsync", "Conflicting style rules"
Source: .agents/analysis/moq-analyzers-reviewer-patterns-2026-02-08.md
Configuration Sources The skill reads style configuration from these files (in priority order):
File Purpose Scope .editorconfigEditorConfig standard All languages .stylecop.json / stylecop.jsonStyleCop Analyzers rules C# Directory.Build.propsMSBuild properties .NET projects
.editorconfig Properties Checked Property Values Languages end_of_linelf, crlf, cr All indent_stylespace, tab All indent_sizenumber All charsetutf-8, utf-8-bom, latin1 All trim_trailing_whitespacetrue, false All insert_final_newlinetrue, false All
.editorconfig Naming Conventions (C#)
dotnet_naming_rule.async_methods_should_end_with_async.symbols = async_methods
dotnet_naming_rule.async_methods_should_end_with_async.style = async_suffix_style
dotnet_naming_rule.async_methods_should_end_with_async.severity = warning
dotnet_naming_style.async_suffix_style.required_suffix = Async
Detection Capabilities
Line Ending Violations Detects when file line endings differ from .editorconfig end_of_line setting.
Rule: STYLE-001
Severity: warning
Example: "File uses CRLF but editorconfig requires LF"
Indentation Violations Detects tabs vs spaces mismatches and incorrect indent sizes.
Rule: STYLE-002
Severity: warning
Example: "Line uses tabs but editorconfig requires spaces (indent_size=4)"
Charset Violations Detects incorrect file encoding (BOM presence/absence).
Rule: STYLE-003
Severity: warning
Example: "File has UTF-8 BOM but editorconfig requires utf-8 (no BOM)"
Trailing Whitespace Detects trailing whitespace when trim_trailing_whitespace = true.
Rule: STYLE-004
Severity: info
Example: "Line 42 has trailing whitespace"
Final Newline Detects missing final newline when insert_final_newline = true.
Rule: STYLE-005
Severity: info
Example: "File does not end with newline"
Naming Convention Violations (C#) Detects async method naming when dotnet_naming_rule configured.
Rule: STYLE-010
Severity: warning
Example: "Async method 'GetUser' should end with 'Async' suffix"
Process โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. Configuration Discovery โ
โ - Walk up from target to find root โ
โ - Parse .editorconfig hierarchy โ
โ - Parse .stylecop.json if present โ
โ - Parse Directory.Build.props โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 2. Rule Compilation โ
โ - Match globs to file extensions โ
โ - Build per-file rule set โ
โ - Merge inherited properties โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 3. File Scanning โ
โ - Check each file against its rules โ
โ - Detect violations with line info โ
โ - Apply suppression comments โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 4. Report Generation โ
โ - Format: markdown, JSON, or SARIF โ
โ - Include violation counts โ
โ - Exit code based on findings โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Command Reference
Basic Usage python3 scripts/check_style.py [options] [files...]
Parameters Parameter Required Default Description --targetNo . Directory or file to scan --git-stagedNo false Check only git staged files --formatNo text Output format: text, json, sarif --outputNo stdout Output file path --configNo auto Path to .editorconfig (auto-discovers) --severityNo warning Minimum severity: error, warning, info
Exit Codes Code Meaning 0 All files compliant 1 Script error (invalid arguments, config parse failure) 10 Violations detected
Scripts Script Purpose Exit codes scripts/check_style.pyValidate target files against .editorconfig, StyleCop.json, and Directory.Build.props rules; supports --target, --git-staged, explicit file lists, and --format (text, json, sarif) with --output. 0 all files compliant; 1 script error (invalid arguments, config parse failure); 10 violations detected.
Integration
Pre-commit Hook
repos:
- repo: local
hooks:
- id: style-enforcement
name: Style Enforcement
entry: python3 .claude/skills/style-enforcement/scripts/check_style.py
args: [--git-staged ]
language: python
pass_filenames: false
GitHub Actions
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check style
run: |
python3 .claude/skills/style-enforcement/scripts/check_style.py \
--target . \
--format sarif \
--output style-results.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: style-results.sarif
Agent Pre-Submission Before creating a PR, run style enforcement:
python3 .claude/skills/style-enforcement/scripts/check_style.py --git-staged
If exit code is 10, fix violations before proceeding.
Examples
Example 1: Check Single File python3 scripts/check_style.py src/models/User.cs
Style Enforcement Report
========================
Violations: 2
src/models/User.cs
Line 1: [STYLE-001] File uses CRLF but editorconfig requires LF
Line 45: [STYLE-010] Async method 'GetUser' should end with 'Async' suffix
Exit code: 10 (violations detected)
Example 2: JSON Output for CI python3 scripts/check_style.py --target . --format json
{
"scan_timestamp" : "2026-02-08T10:30:00Z" ,
"files_scanned" : 42 ,
"violations" : [
{
"file" : "src/models/User.cs" ,
"line" : 1 ,
"column" : 1 ,
"rule" : "STYLE-001" ,
"message" : "File uses CRLF but editorconfig requires LF" ,
"severity" : "warning"
}
] ,
"summary" : {
"total" : 1 ,
"by_severity" : { "warning" : 1 }
}
}
Example 3: SARIF for GitHub Code Scanning python3 scripts/check_style.py --target . --format sarif --output results.sarif
Suppression Suppress specific violations with inline comments:
When to Use
Checking style compliance before commits
Enforcing consistent code formatting in CI
Validating editorconfig rules are applied correctly
Detecting naming convention violations
Use existing linters instead when:
Full ESLint/Prettier rules needed (JavaScript)
Full StyleCop Analyzer output needed (C#, use dotnet build)
Auto-formatting is desired (use dotnet format, black, prettier)
Language Support
Fully Supported Language Extensions Naming Rules C# .cs Async suffix, interface prefix Python .py snake_case validation PowerShell .ps1, .psm1 Verb-Noun validation JavaScript/TypeScript .js, .ts, .jsx, .tsx camelCase validation
Basic Support (line endings, indentation, charset)
Go (.go)
Rust (.rs)
Java (.java)
Ruby (.rb)
Markdown (.md)
YAML (.yml, .yaml)
JSON (.json)
Anti-Patterns Avoid Why Instead Running without .editorconfig No rules to enforce Create .editorconfig first Ignoring all violations Defeats purpose Fix root causes, suppress sparingly Checking generated files False positives Add to .gitignore or ignore patterns Mixing with auto-formatters Conflicts Run formatter first, then check
Verification After running style check, the gate is check_style.py's exit code, not a self-check:
python3 .claude/skills/style-enforcement/scripts/check_style.py "$TARGET_PATH "
echo "exit=$?"
Related Skills
References
Timelessness: 8/10 EditorConfig is an industry standard (2012+) supported by all major editors and IDEs.
Style conventions (naming, indentation, line endings) are fundamental to code quality.
The skill delegates language-specific rules to external analyzers when available.