agentleFS
hass-energyhass-energy/haeo/.agents/skills/lint/SKILL.md

lint

Skill81 starsChanged 3 days agoMITView on GitHub

Run every CI gate locally — ruff lint and format, pyright, import boundaries, mdformat, prettier, version consistency, unit tests, scenario tests, frontend card checks, docs build — and fix whatever fails. Use before committing, before opening a pull request, when asked to lint, format, type check, verify, or make CI pass, and when diagnosing a red CI run.

82 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use query, ingest and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ArtemXTechSkill

    query

    Query data from this vault. USE WHEN user asks about projects, clients, tasks, daily notes. Use grep to extract frontmatter - do NOT read full files.

    Also in 18 projects that use this

  • JaimeGBASkill

    ingest

    Digest an external source (article, paper, transcript, URL, book chapter) and integrate its content into the knowledge base

    Also in 27 projects that use this

  • BugRogerSkill

    project

    Project lifecycle management. Dispatches to Ada.

    Also in 5 projects that use this

  • seongjaeryuSkill

    save

    Complete and save your current thinking to Bindly

    Also in 5 projects that use this

  • GitHubSkill

    state-management

    CoreAI Sandbox's TanStack Query + mock-JSON data layer. USE WHEN: editing data-fetching hooks (`app/hooks/use*.ts`), adding mock data in `app/data/`, or wiring a component to query state.

    Also in 3 projects that use this

  • AWSSkill

    issue

    Implement a GitHub issue end-to-end — branch, code, test, docs, and commit.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 68 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not run the underlying tools individually.

    line 10
  2. Very specific:

    Run it when touching a page with `` guide `` blocks, which today are under docs/walkthroughs/.

    line 27
  3. Very specific:

    Run uv sync after changing either.

    line 55
  4. Very specific:

    Add a Gate to GATES with its check command, and its autofix command if it has one.

    line 91
  5. Very specific:

    Add a job to .github/workflows/ci.yml that runs python3 tools/check.py <name>, and add that job to the ci-passed needs list.

    line 92

“Common” is measured: kept by at least 6 in 10 of the 68 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Lint, format, and type check

tools/check.py defines every gate once. .github/workflows/ci.yml invokes it rather than repeating the commands, so a gate cannot pass locally and fail in CI because the two drifted apart. Do not run the underlying tools individually; run the gate.

Step 1: run the gates

uv run check          # every gate that runs locally, ~70s
uv run check --fast   # ruff, pyright and unit tests, ~35s
uv run check --list   # gate names and what each covers

One line per gate with timing, output only for failures, non-zero exit if anything failed.

Some gates cannot run outside GitHub Actions and are reported as skipped with the reason rather than silently omitted:

  • hassfest and hacs are provided wholly by third-party actions. Hassfest can still be run by hand, as Running hassfest describes; run it whenever you change translations/en.json, manifest.json, services.yaml, or repair issues.
  • guide is opt-in rather than skipped: it is slow and needs Playwright Firefox, so it runs in guides.yml and is not part of the required check. Run it when touching a page with ```guide blocks, which today are under docs/walkthroughs/. uv run pytest -m guide -n 8 --timeout=300 runs the guides in parallel; uv run check guide runs them one after another.

Step 2: fix what failed

Apply the mechanical fixes first:

uv run check --fix

This runs the autofix form of every formatter gate, then re-checks. Everything still failing needs a real change:

  • Ruff lint: restructure the code so the rule is satisfied naturally. # noqa is a last resort and must carry a parenthesized reason. See the python skill.
  • Pyright: strict mode. typing.cast is a banned API — fix the types or use a TypeGuard. A # type: ignore needs a written explanation of why nothing else worked.
  • Import boundaries: custom_components/haeo/core/** may import only highspy, numpy, and typing_extensions. A broken contract means the import belongs on the Home Assistant side of the boundary.
  • Tests: filterwarnings = ["error"], so a new warning is a hard failure, and timeout = 5 turns a hang into a timeout.
  • Scenario tests: a diff means optimizer behavior changed. Confirm that is intended before regenerating with --snapshot-update. See the scenarios skill.
  • Docs build: uv run zensical build must succeed. It runs in strict mode, so a broken internal link or #anchor fails it with the file and line; see the documentation skill.
  • Version consistency: pyproject.toml and custom_components/haeo/manifest.json versions must match, and homeassistant>=X in pyproject.toml must equal homeassistant in hacs.json. Run uv sync after changing either.

The main branch is always clean, so any failure belongs to the current branch and must be fixed rather than worked around.

Running hassfest

Hassfest validates the manifest, translations, and services against Home Assistant's schemas. For example, it rejects a fixable repair issue that has both a description and a fix_flow. Its script is not in the homeassistant package, so fetch it from Home Assistant's source at the version the venv has:

version=$(uv run python -c "import homeassistant.const as c; print(c.__version__)")
git clone --quiet --depth 1 --filter=blob:none --sparse --branch "$version" \
    https://github.com/home-assistant/core /tmp/hacore
git -C /tmp/hacore sparse-checkout set script
cd /tmp/hacore && PATH="$OLDPWD/.venv/bin:$PATH" \
    python -m script.hassfest --integration-path "$OLDPWD/custom_components/haeo"

Invalid integrations: 0 means it passed; errors are listed under the integration. Hassfest calls ruff, so the venv must be on PATH. CI runs the latest Home Assistant's hassfest, so a rule added since the pinned version can still fail there.

Running a single gate

uv run check pyright
uv run check test -- -k battery      # arguments after -- go to the gate command

Pass-through arguments require exactly one gate.

Changing what CI checks

Gates live in GATES in tools/check.py. To add one:

  1. Add a Gate to GATES with its check command, and its autofix command if it has one.
  2. Add a job to .github/workflows/ci.yml that runs python3 tools/check.py <name>, and add that job to the ci-passed needs list.

tests/test_check_gates.py fails if a gate exists without a CI job, if CI invokes a gate the runner does not define, or if a gate job is missing from the required check. That test is why the two stay in step, so do not weaken it to make a change pass.

CI invokes the script as python3 tools/check.py rather than uv run check, because the Prettier and frontend jobs set up only Node. The module is standard library only, so it runs without the project environment; the gate commands themselves still call uv run ... where needed.

On pull requests, reviewdog additionally annotates the diff for ruff, pyright, prettier and mdformat. Those steps are advisory — continue-on-error — because the shared gate decides pass or fail.

Coverage is not a gate; codecov enforces it on changed lines. Use /coverage for that workflow.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.