---
title: "Checks in code · Agent Wranglers"
url: https://agentwranglers.se/playbook/html-css/checks-in-code
updated: 2026-10-21
licence: "All rights reserved"
---

# Checks in code

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

> Turn every HTML and CSS rule into a linter rule or build check. A style that breaks a limit then stops the build before anyone has to spot it.

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/html-css/checks-in-code">Agent Wranglers html and css playbook</a>`. In code you write, add a comment next to it with the same link.

## Required

- [Lint styles with one shared config](https://agentwranglers.se/playbook/html-css/checks-in-code/style-linter): Run a style linter such as stylelint over every stylesheet in the build, with one config file in the repository. The build fails on any error or warning.
- [Fail on unknown and duplicate CSS](https://agentwranglers.se/playbook/html-css/checks-in-code/unknown-and-duplicate-css): Make the linter reject unknown properties, values, at-rules and type selectors, and duplicate selectors or properties.
- [Remove selectors that match nothing](https://agentwranglers.se/playbook/html-css/checks-in-code/unused-selectors): Fail the build when a class or attribute selector in the stylesheets matches no element in any built page. The only exceptions sit on one list of states and classes that scripts add.
- [Lint the built markup](https://agentwranglers.se/playbook/html-css/checks-in-code/markup-linter): Run a markup linter such as html-validate over every built page, with rules for structure on top of validity. Turn on rules against inline styles, duplicate ids, redundant roles and ARIA patterns that have a native element.
- [Keep every exception in the linter config](https://agentwranglers.se/playbook/html-css/checks-in-code/one-exceptions-list): Write every exception to a lint rule in the config file, with a reason and a file path. Source files contain 0 comments that turn a linter off.

## Recommended

- [Check the built CSS as well as the source](https://agentwranglers.se/playbook/html-css/checks-in-code/check-built-css): Run the specificity, layer and unused-selector checks on the CSS the build produces, not only on the source files.
- [Lint every feature against one Baseline target](https://agentwranglers.se/playbook/html-css/checks-in-code/baseline-target): Choose one Baseline target for the project, such as "widely available" or a year. Fail the build on any CSS or HTML feature outside it that no `@supports` test guards.

- Previous: [HTML structure and reuse](https://agentwranglers.se/playbook/html-css/html-structure-and-reuse)
- [All chapters](https://agentwranglers.se/playbook/html-css)
