Validate code against style rules from .editorconfig, StyleCop.json, and Directory.Build.props. Detects line ending violations, naming convention issues, indentation problems, and charset mismatches across C#, Python, PowerShell, and JavaScript. Produces JSON reports for pre-commit hooks and CI pipelines.
Validates code style compliance against .editorconfig, StyleCop.json, and Directory.Build.props rules.
/plugin marketplace add rjmurillo/ai-agents/plugin install project-toolkit@ai-agentsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Validate code files against configured style rules from project configuration files.
check style compliancevalidate editorconfig rulesrun style enforcementcheck naming conventionsvalidate line endings# Check all files in current directory
python3 scripts/check_style.py --target .
# Check only changed files (CI mode)
python3 scripts/check_style.py --git-staged
# Check specific files
python3 scripts/check_style.py src/models/user.cs src/services/auth.cs
# JSON output for automation
python3 scripts/check_style.py --target . --format json --output violations.json
Created based on analysis of moq.analyzers closed PR reviewer patterns:
Source: .agents/analysis/moq-analyzers-reviewer-patterns-2026-02-08.md
The skill reads style configuration from these files (in priority order):
| File | Purpose | Scope |
|---|---|---|
.editorconfig | EditorConfig standard | All languages |
.stylecop.json / stylecop.json | StyleCop Analyzers rules | C# |
Directory.Build.props | MSBuild properties | .NET projects |
| Property | Values | Languages |
|---|---|---|
end_of_line | lf, crlf, cr | All |
indent_style | space, tab | All |
indent_size | number | All |
charset | utf-8, utf-8-bom, latin1 | All |
trim_trailing_whitespace | true, false | All |
insert_final_newline | true, false | All |
# Example naming rules
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
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"
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)"
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)"
Detects trailing whitespace when trim_trailing_whitespace = true.
Rule: STYLE-004
Severity: info
Example: "Line 42 has trailing whitespace"
Detects missing final newline when insert_final_newline = true.
Rule: STYLE-005
Severity: info
Example: "File does not end with newline"
Detects async method naming when dotnet_naming_rule configured.
Rule: STYLE-010
Severity: warning
Example: "Async method 'GetUser' should end with 'Async' suffix"
┌─────────────────────────────────────────┐
│ 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 │
└─────────────────────────────────────────┘
python3 scripts/check_style.py [options] [files...]
| Parameter | Required | Default | Description |
|---|---|---|---|
--target | No | . | Directory or file to scan |
--git-staged | No | false | Check only git staged files |
--format | No | text | Output format: text, json, sarif |
--output | No | stdout | Output file path |
--config | No | auto | Path to .editorconfig (auto-discovers) |
--severity | No | warning | Minimum severity: error, warning, info |
| Code | Meaning |
|---|---|
| 0 | All files compliant |
| 1 | Script error (invalid arguments, config parse failure) |
| 10 | Violations detected |
# .pre-commit-config.yaml
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/workflows/style.yml
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
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.
python3 scripts/check_style.py src/models/User.cs
Output:
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)
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}
}
}
python3 scripts/check_style.py --target . --format sarif --output results.sarif
Suppress specific violations with inline comments:
// style-enforcement: ignore STYLE-001
var data = GetData(); // CRLF line ending allowed here
# style-enforcement: ignore STYLE-002
pass # Tab indentation allowed here
Use this skill when:
Use existing linters instead when:
dotnet build)dotnet format, black, prettier)| 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 |
| 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 |
After running style check:
| Skill | Relationship |
|---|---|
| code-qualities-assessment | Design quality vs style |
| analyze | Broad codebase investigation |
| security-scan | Security vs style violations |
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.
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.