stylelint

GitHub

用于在.NET仓库中配置和运行Stylelint,专注于CSS/SCSS等样式表的静态检查、命名规范及重复清理。支持自动安装、配置生成及脚本集成,确保样式代码质量与一致性。

catalog/Tools/Stylelint/skills/stylelint/SKILL.md managedcode/dotnet-skills

Trigger Scenarios

仓库包含stylelint配置文件或CSS/SCSS资产 用户请求CSS linting或命名规范检查

Install

npx skills add managedcode/dotnet-skills --skill stylelint -g -y
More Options

Non-standard path

npx skills add https://github.com/managedcode/dotnet-skills/tree/main/catalog/Tools/Stylelint/skills/stylelint -g -y

Use without installing

npx skills use managedcode/dotnet-skills@stylelint

指定 Agent (Claude Code)

npx skills add managedcode/dotnet-skills --skill stylelint -a claude-code -g -y

安装 repo 全部 skill

npx skills add managedcode/dotnet-skills --all -g -y

预览 repo 内 skill

npx skills add managedcode/dotnet-skills --list

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 eslint or biome
  • 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.json
  • stylelint.config.* or .stylelintrc*
  • the stylesheet file types in scope: CSS, SCSS, Less, embedded styles, or generated output

Workflow

  1. Confirm what Stylelint should own:
    • plain CSS only
    • CSS plus SCSS
    • embedded styles in HTML, Markdown, or framework files
  2. Prefer repo-local installation and checked-in config.
  3. Start from a known shared config such as stylelint-config-standard, then add syntax-specific packages only when the repo truly needs them.
  4. Add repeatable scripts to package.json, for example:
    • stylelint "**/*.{css,scss}"
    • stylelint "**/*.{css,scss}" --fix
  5. Keep ignore patterns explicit so build output, vendored assets, and generated CSS do not pollute the signal.
  6. Treat autofix as controlled cleanup:
    • run on a bounded scope first
    • inspect the diff
    • rerun the frontend build if the repo compiles styles
  7. Use Stylelint for semantic CSS and selector policy, not as a replacement for site-level audits.

Bootstrap When Missing

  1. Detect current state:
    • rg --files -g 'package.json' -g 'stylelint.config.*' -g '.stylelintrc*'
    • rg -n '"stylelint"|"stylelint-config-" --glob 'package.json' .
  2. Prefer a repo-local install:
    • npm install --save-dev stylelint stylelint-config-standard
  3. Add syntax packages only when the repo needs them for SCSS or embedded styles.
  4. Create or refine stylelint.config.js, stylelint.config.mjs, or the existing config format.
  5. Add repeatable commands to AGENTS.md and package.json, then verify with:
    • npx stylelint "**/*.{css,scss}"
    • npx stylelint "**/*.{css,scss}" --fix
  6. Return status: configured if Stylelint is now wired and repeatable, or status: improved if the existing baseline was tightened.
  7. Return status: not_applicable only when another documented tool already owns stylesheet linting and migration is not requested.

Handle Failures

  • Unknown rule usually means the config expects a plugin or a different Stylelint major version.
  • Unknown word on 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.1 fixes quiet suppressing report* warnings, unknown-rule diagnostic ranges, invalid background shorthand autofixes when background-size is present, and rule-empty-line-before false positives around shared-line comments. Re-run lint with and without --quiet, and inspect any background autofix diff before accepting it.
  • Stylelint 17.8.0 also added languageOptions.directionality, property-layout-mappings, relative-selector-nesting-notation, and selector-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.directionality explicitly 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 *syntax deprecation under declaration-property-value-no-unknown still matters on the 17.x line. If the repo still relies on those options, move the compatibility into customSyntax or 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

  1. Plan: analyze current state, target outcome, constraints, and risks.
  2. Execute one step and produce a concrete delta.
  3. Review the result and capture findings.
  4. Apply fixes in small batches and rerun checks.
  5. Update the plan after each iteration.
  6. Repeat until outcomes are acceptable.
  7. If a dependency is missing, bootstrap it or return status: not_applicable with a reason.

Required Result Format

  • status: complete | clean | improved | configured | not_applicable | blocked
  • plan: concise plan and current step
  • actions_taken: concrete changes made
  • verification: commands, checks, or review evidence
  • remaining: unresolved items or none

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

Same Skill Collection

catalog/Frameworks/gRPC/skills/grpc/SKILL.md
catalog/Frameworks/Official-Astro/skills/astro-developer/SKILL.md
catalog/Frameworks/Official-DotNet-ASPNetCore/skills/configuring-opentelemetry-dotnet/SKILL.md
catalog/Frameworks/Official-DotNet-ASPNetCore/skills/dotnet-webapi/SKILL.md
catalog/Frameworks/Official-DotNet-ASPNetCore/skills/minimal-api-file-upload/SKILL.md
catalog/Frameworks/Orleans/skills/orleans/SKILL.md
catalog/Frameworks/ThreeJS-WebGPU-TSL/skills/webgpu-threejs-tsl/SKILL.md
catalog/Libraries/Official-DotNet-Data/skills/optimizing-ef-core-queries/SKILL.md
catalog/Platform/Official-DotNet-Advanced/skills/csharp-scripts/SKILL.md
catalog/Platform/Official-DotNet-Advanced/skills/nuget-trusted-publishing/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/create-blazor-project/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/fetch-and-send-data/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/support-prerendering/SKILL.md
catalog/Platform/Official-DotNet-Blazor/skills/use-js-interop/SKILL.md
catalog/Platform/Official-DotNet-Experimental/skills/exp-mock-usage-analysis/SKILL.md
catalog/Platform/Official-DotNet-Experimental/skills/exp-simd-vectorization/SKILL.md
catalog/Platform/Official-DotNet-Test-Migration/skills/migrate-xunit-to-mstest/SKILL.md
catalog/Platform/Official-DotNet-Test-Migration/skills/migrate-xunit-to-xunit-v3/SKILL.md
catalog/Platform/Official-DotNet-Upgrade/skills/dotnet-aot-compat/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/code-testing-extensions/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/filter-syntax/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/find-untested-sources/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/platform-detection/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/scaffold-dotnet-test-project/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/test-gap-analysis/SKILL.md
catalog/Testing/Official-DotNet-Test/skills/testability-obstacle/SKILL.md
catalog/Testing/Playwright/skills/playwright-visual-testing/SKILL.md
catalog/Testing/xUnit/skills/xunit/SKILL.md
catalog/Tools/Code-Analysis/skills/code-analysis/SKILL.md
catalog/Tools/HTMLHint/skills/htmlhint/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/analyzing-dotnet-performance/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/clr-activation-debugging/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/dotnet-trace-collect/SKILL.md
catalog/Tools/Official-DotNet-Diagnostics/skills/dump-collect/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/binlog-failure-analysis/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/copy-to-output-directory/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/msbuild-server/SKILL.md
catalog/Tools/Official-DotNet-MSBuild/skills/resolve-project-references/SKILL.md
catalog/Tools/ReportGenerator/skills/reportgenerator/SKILL.md
catalog/Tools/ReSharper-CLT/skills/resharper-clt/SKILL.md
catalog/Tools/Roslynator/skills/roslynator/SKILL.md
external-sources/upstreams/webgpu-claude-skill/skills/webgpu-threejs-tsl/SKILL.md
catalog/Frameworks/ASP.NET-Core/skills/aspnet-core/SKILL.md
catalog/Frameworks/Aspire/skills/aspire/SKILL.md
catalog/Frameworks/Azure-Functions/skills/azure-functions/SKILL.md
catalog/Frameworks/Blazor/skills/blazor/SKILL.md
catalog/Frameworks/Entity-Framework-6/skills/entity-framework6/SKILL.md
catalog/Frameworks/Entity-Framework-Core/skills/entity-framework-core/SKILL.md
catalog/Frameworks/MAUI/skills/maui/SKILL.md

Metadata

Files
0
Version
0559476
Hash
648f1638
Indexed
2026-07-25 05:28

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 04:44
浙ICP备14020137号-1 $mapa de visitantes$