Pre commit

From mihai-dinculescu/tapo · View interactive version

Pre commit is an AI agent skill from the GitHub repository mihai-dinculescu/tapo. Run Rust/Python/MCP checks, fix issues, then summarize findings before committing

How to use this skill

Skill file

Pre-Commit

Run all checks, fix any issues found, then present a summary table.

Checks

Rust checks

Run the following checks if there are changes in the tapo/, tapo-py/, or tapo-mcp/ directories. Fix all issues found. Run independent checks (cargo check, cargo clippy, cargo fmt, cargo make test) in parallel.

Unless otherwise specified, run checks at the workspace level (no -p flags) with --all-features to ensure cross-crate issues are caught.

Link-free checks (check, clippy) take --workspace so they cover tapo-py too.

Tests are the exception: run them with cargo make test, as CI does, never with cargo test --all-features. --all-features turns on tapo/python, which makes every test binary load the Python DLL and fail on Windows with STATUS_DLL_NOT_FOUND.

Python checks

Run the following checks if there are changes in the tapo/ or tapo-py/ directories. Fix all issues found.

MCP checks

Run the following checks if there are changes in the tapo-mcp/ directory. Fix all issues found.

Non-exhaustive enum checks

Run these checks if a change adds a variant to a #[non_exhaustive] enum in tapo/src (DeviceType, DiscoveryResult, ChildDeviceHubResult, ChildDeviceHubIrResult, RecordingType, …). Fix all issues found.

#[non_exhaustive] lets end users of tapo skip new variants with a _ => arm. tapo-py, tapo-mcp and the examples in tapo/examples don't get that choice: they must support every variant tapo has. Their matches end in a _ => unreachable!() arm only to compile, so the compiler no longer flags a missing variant there. The grep below lists those enums and their unreachable!() sites. Other _ => arms (the capability matches in tapo-mcp) don't show up in it and are covered by the MCP capabilities check:

grep -rn -A2 '#\[non_exhaustive\]' tapo/src/api/discovery tapo/src/responses | grep 'pub enum'
grep -rn 'unreachable!()' tapo-py/src tapo-mcp/src tapo/examples

For each new variant:

Documentation checks

Run the following checks if there are changes in the tapo/ or tapo-py/ directories. Fix all issues found.

Decompiled app checks

Run these checks on every change, whatever directories it touches. Fix all issues found.

The decompiled Tapo Android app is a private reverse-engineering aid that lives outside the repo, and its names are obfuscated per app release. Nothing committed may point at it.

```bash

{ git diff --name-only --diff-filter=d HEAD -- . ':!.claude/skills/pre-commit/SKILL.md' ':!.claude/skills/review-loop/SKILL.md'; git ls-files -o --exclude-standard -- . ':!.claude/skills/pre-commit/SKILL.md' ':!.claude/skills/review-loop/SKILL.md'; } | xargs grep -nEi '\.(java|kt|smali)\b|decompil|base\.apk|apkmirror|jadx|com[./]tplink'

{ git diff --name-only --diff-filter=d HEAD -- . ':!.claude/skills/pre-commit/SKILL.md' ':!.claude/skills/review-loop/SKILL.md'; git ls-files -o --exclude-standard -- . ':!.claude/skills/pre-commit/SKILL.md' ':!.claude/skills/review-loop/SKILL.md'; } | xargs grep -nE '[A-Z][A-Za-z0-9]*\.([A-Z_]+|[a-z][A-Za-z0-9]*\(\))|app(.s)?[^]{0,30}[A-Z][a-z]+[A-Z][A-Za-z]*`'

```

The second pattern works one line at a time, so it misses a class name that wraps onto the line after "app". Then read every comment in the touched files that mentions the app, not only the lines the diff changed, for what the patterns miss: two/three-character package or class names (ab1, xy2, zz9/c1), app-internal class and method names (KeyMixer.d(), StreamGatewayImpl), and absolute paths into the decompiled tree.

Integration test checks

Run these checks if anything under tapo/tests/ was added or changed, including new untracked files. Fix all issues found.

The simulator stands in for a real device, so a test only proves something if the simulator behaves like the device and not like the library. Everything it knows comes from a fixture or from what real devices were seen to do.

Fixtures

Read every added or changed fixture in full.

Leave values that only describe the device: model, versions, component lists, signal strength, settings, and usage or energy counters.

Simulator

```bash

grep -rnE '\btapo::|use tapo\b' tapo/tests/simulator/

```

Code Review

After fixing all issues found in the checks, review the code changes for correctness, readability, and maintainability and propose improvements.

Summarize the findings according to severity.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.