Agent Skills
› managedcode/dotnet-skills
› stylelint
stylelint
GitHub用于在.NET仓库中配置和运行Stylelint,专注于CSS/SCSS等样式表的静态检查、命名规范及重复清理。支持自动安装、配置生成及脚本集成,确保样式代码质量与一致性。
Trigger Scenarios
仓库包含stylelint配置文件或CSS/SCSS资产
用户请求CSS linting或命名规范检查
Install
npx skills add managedcode/dotnet-skills --skill stylelint -g -y
SKILL.md
Frontmatter
{
"name": "stylelint",
"description": "Use Stylelint in .NET repositories that ship CSS, SCSS, or other stylesheet assets alongside web frontends. USE FOR: stylelint.config.*, .stylelintrc*, CSS or SCSS assets; CSS linting; duplicate style cleanup and naming-convention checks. DO NOT USE FOR: JavaScript or TypeScript lint ownership; runtime accessibility, performance, SEO, or header checks. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.",
"compatibility": "Requires a .NET repository with stylesheet assets such as `wwwroot\/`, `ClientApp\/`, `src\/`, or other frontend folders managed with Node tooling."
}
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
eslintorbiome - runtime accessibility, performance, SEO, or header checks; route that to
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.14 Guidance
- Stylelint
17.14.1fixesquietsuppressingreport*warnings, unknown-rule diagnostic ranges, invalidbackgroundshorthand autofixes whenbackground-sizeis present, andrule-empty-line-beforefalse positives around shared-line comments. Re-run lint with and without--quiet, and inspect any background autofix diff before accepting it. - Stylelint
17.8.0also addedlanguageOptions.directionality,property-layout-mappings,relative-selector-nesting-notation, andselector-no-deprecated. Re-run the repo baseline after upgrading so any new selector or layout findings are reviewed instead of preserved by default. - Use
languageOptions.directionalityexplicitly when the repo styles bidirectional UI or logical properties. That keeps direction-sensitive rules aligned with the intended writing direction rather than inferred behavior. - The earlier
*syntaxdeprecation underdeclaration-property-value-no-unknownstill matters on the 17.x line. If the repo still relies on those options, move the compatibility intocustomSyntaxor parser selection instead of extending deprecated rule config. - Keep repo ignores focused on generated or vendored assets. Re-check any broad ignore globs after upgrading so they are not masking selector or layout regressions that the new rules now catch.
Official Sources
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.14.1 and 17.8.0 release changes that matter for repo config, autofix review, rule tuning, and selector/layout validation
Version History
- 7ab7f03 Current 2026-07-25 05:28


