# Pre Commit

> Run Rust/Python/MCP checks, fix issues, then summarize findings before committing

- Skill: `mihai-dinculescu/pre-commit` (Agent Skill)
- Install (CLI): `npx skillmds@latest add mihai-dinculescu/pre-commit`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mihai-dinculescu/pre-commit/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: mihai-dinculescu (https://skillmd.com/u/mihai-dinculescu)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/mihai-dinculescu/pre-commit

---


# 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 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; `cargo test` must NOT — it links test binaries and examples, which fails with `tapo-py`'s `pyo3/extension-module`, so it relies on `default-members` excluding `tapo-py`.

- `cargo check --workspace --all-features`
- `cargo clippy --workspace --all-features`
- `cargo fmt --all`
- `cargo test --all-features`
- `cargo clean --doc && RUSTDOCFLAGS="-D warnings" cargo doc -p tapo --no-deps --all-features`
- No `unwrap()` in non-test code without a `// safe:` comment
- No `unsafe` in non-test code without a `// SAFETY:` comment
- No unnecessary clones
- No deeply nested `use` (max one level of `{}` nesting)

### Python checks

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

- Update `.pyi` stubs if Python-exposed Rust types changed
- Verify new `#[pyclass]` types are imported and registered in `tapo-py/src/lib.rs`
- Verify Python examples in `tapo-py/examples/` are updated to match corresponding Rust examples in `tapo/examples/`
- `cd tapo-py` and activate the virtual environment
- `uv run mypy .` — fix all type errors
- `uv run black .` — fix all formatting issues

### MCP checks

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

- Verify that **all** `#[derive(JsonSchema)]` types have `schemars` annotations — including tool input params, response types, enums, and their fields/variants. Check for descriptions and range constraints where applicable.
- Verify that `tapo-mcp/README.md` reflects any MCP API changes (tools, resources, capabilities, env vars, auth)
- Verify that the OpenClaw skill reflects any MCP API changes. The skill spans three files — check each:
  - `tapo-mcp/openclaw-skill/SKILL.md` — frontmatter (`description`, `version`, `requires`), Setup, Tools section with example `npx mcporter call` invocations
  - `tapo-mcp/openclaw-skill/references/setup.md` — verification table (tool, description, parameters)
  - `tapo-mcp/openclaw-skill/references/tapo-mcp-setup.md` — Tools table, Resources table, Configuration env vars, Authentication, Deployment (kept in sync with `tapo-mcp/README.md`)
- When device-support categories change (e.g. adding a new family like the H100 hub), verify the device-type enumeration is in sync across both surfaces that list it:
  - `tapo-mcp/src/server.rs` `with_instructions(...)` (e.g. `"plugs, lights, power strips, hubs and their child sensors, cameras"`)
  - `tapo-mcp/openclaw-skill/SKILL.md` frontmatter `description:` (e.g. `(lights, plugs, power strips, hubs and sensors, cameras)`)

### Documentation checks

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

- Verify that `SUPPORTED_DEVICES.md` is up to date: add, remove, or regroup rows/columns when a handler's public method list changed, a device model was added/removed, or a method's `#[cfg(feature = "debug")]` gating changed

## 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.

