/project-toolkit:style-enforcementfrom project-toolkit
Validates 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.
Ships in project-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --target .; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Check only changed files (CI mode)
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --git-staged; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Check specific files
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py src/models/user.cs src/services/auth.cs; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# JSON output for automation
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --target . --format json --output violations.json; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
Created based on analysis of moq.analyzers closed PR reviewer patterns:
Source: .project-toolkit/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 │
└─────────────────────────────────────────┘
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py [options] [files...]; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
| 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 |
| Script | Purpose | Exit codes |
|---|---|---|
scripts/check_style.py | Validate 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. |
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: style-enforcement
name: Style Enforcement
entry: >-
bash -c '( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --git-staged; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )'
language: python
pass_filenames: false
pre-commit runs entry without a shell, so the locator sits inside bash -c. The --git-staged flag is part of the locator, so the hook has no args: key.
# .github/workflows/style.yml
jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check style
run: |
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --target . --format sarif --output style-results.sarif; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: style-results.sarif
Before creating a PR, run style enforcement:
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --git-staged; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
If exit code is 10, fix violations before proceeding.
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py src/models/User.cs; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
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)
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --target . --format json; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
{
"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}
}
}
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py --target . --format sarif --output results.sarif; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
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, the gate is check_style.py's exit code, not a self-check:
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/style-enforcement/scripts/check_style.py "$TARGET_PATH"; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
echo "exit=$?" # 0 = clean, 10 = violations found, 1 = tool error
| Skill | Relationship |
|---|---|
| code-qualities-assessment | Design quality vs style |
| analyze | Broad codebase investigation |
| security-scan | Security vs style violations |
| File | Content |
|---|---|
| dotnet-monorepo-standards.md | .NET monorepo coding style, naming conventions, datetime, project layout, SDK-style projects |
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.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
105 skills in this plugin
/adr-generatorCreate comprehensive Architectural Decision Records (ADRs). Researches the destination directory to detect existing template conventions, gathers context, determines next ADR number, generates the ADR, validates completeness, and saves. Supports multiple ADR formats (MADR, Nygard, Alexandrian, project canonical). Use when documenting technical decisions, creating new ADR files, or capturing rationale so future readers can revisit a choice. Use when you say "write an ADR", "document this decision", "document these design choices", "record why we chose this", "capture the rationale", or "for future maintainers", or when creating an ADR-like markdown file under docs/decisions/, docs/adr/, docs/architecture/, architecture/decisions/, or .project-toolkit/architecture/. Do NOT use to debate or review an existing ADR (use adr-review)./adr-reviewMulti-agent debate orchestration for Architecture Decision Records. Automatically triggers on ADR create/edit/delete. Coordinates architect, critic, independent-thinker, security, analyst, and high-level-advisor agents in structured debate rounds until consensus. Use when you say "review this ADR", when an ADR is created/edited/deleted, or when reviewing, accepting, or updating a decision file under .project-toolkit/architecture/, docs/architecture/, docs/decisions/, docs/adr/, or architecture/decisions/, including intent like "review this decision record" or "check this rationale for future maintainers". Do NOT use to author a new ADR (use adr-generator).npx claudepluginhub rjmurillo/ai-agents --plugin project-toolkit2 plugins in one repository ship this exact skill · first indexed Nov 13, 2026
Other plugins' skills for the same job