Agent skill
dotnet-stylelint
Use Stylelint in .NET repositories that ship CSS, SCSS, or other stylesheet assets alongside web frontends. Use when a repo needs a dedicated CLI lint gate for selectors, properties, duplicate styles, naming conventions, or design-system rule enforcement.
Install this agent skill to your Project
npx add-skill https://github.com/managedcode/dotnet-skills/tree/main/catalog/Tools/Stylelint/skills/dotnet-stylelint
SKILL.md
Stylelint for Stylesheets in .NET Repositories
Trigger On
- the repo has
stylelint.config.*,.stylelintrc*, or CSS and SCSS assets under frontend folders - the user asks for CSS linting, duplicate style cleanup, naming convention enforcement, or design-system guardrails
- the repo needs a stylesheet gate beyond formatting alone
Do Not Use For
- JavaScript or TypeScript ownership; route that to
dotnet-eslintordotnet-biome - runtime accessibility, performance, SEO, or header checks; route that to
dotnet-webhint - repos that intentionally use only Biome for CSS linting and do not want a separate stylesheet linter
Inputs
- the nearest
AGENTS.md package.jsonstylelint.config.*or.stylelintrc*- the stylesheet file types in scope: CSS, SCSS, Less, embedded styles, or generated output
Workflow
- Confirm what Stylelint should own:
- plain CSS only
- CSS plus SCSS
- embedded styles in HTML, Markdown, or framework files
- Prefer repo-local installation and checked-in config.
- Start from a known shared config such as
stylelint-config-standard, then add syntax-specific packages only when the repo truly needs them. - Add repeatable scripts to
package.json, for example:stylelint "**/*.{css,scss}"stylelint "**/*.{css,scss}" --fix
- Keep ignore patterns explicit so build output, vendored assets, and generated CSS do not pollute the signal.
- Treat autofix as controlled cleanup:
- run on a bounded scope first
- inspect the diff
- rerun the frontend build if the repo compiles styles
- Use Stylelint for semantic CSS and selector policy, not as a replacement for site-level audits.
Bootstrap When Missing
- Detect current state:
rg --files -g 'package.json' -g 'stylelint.config.*' -g '.stylelintrc*'rg -n '"stylelint"|"stylelint-config-" --glob 'package.json' .
- Prefer a repo-local install:
npm install --save-dev stylelint stylelint-config-standard
- Add syntax packages only when the repo needs them for SCSS or embedded styles.
- Create or refine
stylelint.config.js,stylelint.config.mjs, or the existing config format. - Add repeatable commands to
AGENTS.mdandpackage.json, then verify with:npx stylelint "**/*.{css,scss}"npx stylelint "**/*.{css,scss}" --fix
- Return
status: configuredif Stylelint is now wired and repeatable, orstatus: improvedif the existing baseline was tightened. - Return
status: not_applicableonly when another documented tool already owns stylesheet linting and migration is not requested.
Handle Failures
Unknown ruleusually means the config expects a plugin or a different Stylelint major version.Unknown wordon SCSS, Vue, or mixed-content files usually means the repo needs the matching custom syntax package instead of plain CSS parsing.- Massive autofix churn usually means generated assets or third-party CSS slipped into the lint target.
- Design-system rule noise should be handled by tuning the checked-in config, not by skipping the linter entirely.
Current 17.5 Guidance
- Stylelint
17.5.0deprecates the*syntaxrule options underdeclaration-property-value-no-unknown. If the repo still relies on those options, move the compatibility intocustomSyntaxor parser selection instead of extending deprecated rule config. media-feature-name-value-no-unknownnow supportsignoreMediaFeatureNameValues. Use it when the design system or platform layer intentionally allows non-standard media feature values and you want that exception recorded explicitly.- Stylelint
17.5.0fixednode_modulesignore behavior in Node.js API flows that passcodeFilename. Keep repo ignores focused on generated or vendored assets instead of compensating for the old bug with over-broad globs. - Selector and deprecated-keyword false-positive fixes landed in
no-descending-specificity,no-duplicate-selectors, anddeclaration-property-value-keyword-no-deprecated. Re-run the repo baseline before preserving stale disables or waivers.
Official Sources
- Stylelint 17.5.0 release notes
references/release-notes.md
Deliver
- explicit stylesheet lint ownership
- checked-in config and repeatable commands
- clear scope boundaries for CSS, SCSS, and generated assets
Validate
- the lint target matches the repo's real stylesheet sources
- ignores exclude generated or vendored assets
- Stylelint ownership does not conflict with Biome without an explicit plan
- fixes were verified against the repo's stylesheet build flow when one exists
Ralph Loop
- Plan: analyze current state, target outcome, constraints, and risks.
- Execute one step and produce a concrete delta.
- Review the result and capture findings.
- Apply fixes in small batches and rerun checks.
- Update the plan after each iteration.
- Repeat until outcomes are acceptable.
- If a dependency is missing, bootstrap it or return
status: not_applicablewith a reason.
Required Result Format
status:complete|clean|improved|configured|not_applicable|blockedplan: concise plan and current stepactions_taken: concrete changes madeverification: commands, checks, or review evidenceremaining: unresolved items ornone
Example Requests
- "Add Stylelint for the SCSS in this ASP.NET Core app."
- "Block duplicate selectors and invalid CSS in CI."
- "Fix the current Stylelint violations without touching generated CSS."
References
- release-notes.md - Current 17.5.0 release changes that matter for repo config, rule tuning, and Node API integrations
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
dotnet-project-setup
Create or reorganize .NET solutions with clean project boundaries, repeatable SDK settings, and a maintainable baseline for libraries, apps, tests, CI, and local development.
csharp-scripts
Run single-file C# programs as scripts (file-based apps) for quick experimentation, prototyping, and concept testing. Use when the user wants to write and execute a small C# program without creating a full project.
dotnet-pinvoke
Correctly call native (C/C++) libraries from .NET using P/Invoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P/Invoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed/native boundary. DO NOT USE FOR: COM interop, C++/CLI mixed-mode assemblies, or pure managed code with no native dependencies.
nuget-trusted-publishing
Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet OIDC, keyless NuGet publish, migrate from NuGet API key, NuGet/login, secure NuGet publishing. DO NOT USE FOR: publishing to private feeds or Azure Artifacts (OIDC is nuget.org only). INVOKES: shell (powershell or bash), edit, create, ask_user for guided repo setup.
dotnet-legacy-aspnet
Maintain classic ASP.NET applications on .NET Framework, including Web Forms, older MVC, and legacy hosting patterns, while planning realistic modernization boundaries.
dotnet-code-review
Review .NET changes for bugs, regressions, architectural drift, missing tests, incorrect async or disposal behavior, and platform-specific pitfalls before you approve or merge them.
Didn't find tool you were looking for?