ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified developer tools Safety 5/5

pytest-code-review

Reviews pytest test code for async patterns, fixtures, parametrize, and mocking. Use when reviewing test_*.py files, checking async test functions, fixture usage, or mock patterns.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/anderskev/pytest-code-review
Or

What This Skill Does

The pytest-code-review skill acts as an specialized auditing assistant for Python test suites utilizing the pytest framework. It focuses on modernizing and hardening test code by enforcing best practices for asynchronous operations, fixture management, and mocking strategies. By evaluating test functions against established patterns, it ensures that your test suite is not only robust but also maintainable and readable.

Installation

To integrate this skill into your OpenClaw environment, use the following command in your terminal: clawhub install openclaw/skills/skills/anderskev/pytest-code-review Ensure that you have the necessary permissions within your development environment and that the OpenClaw CLI is correctly authenticated.

Use Cases

  • Legacy Code Refactoring: Use this skill to transition legacy synchronous tests that interact with async dependencies to proper async def test_* patterns.
  • Fixture Optimization: Use it to analyze conftest.py files to determine if fixture scopes (function, class, module, or session) are inefficient and suggest cleanup improvements.
  • Mocking Cleanup: Identify incorrect usage of Mock objects where AsyncMock is required, and verify that all patch() targets are correctly scoped to prevent common test leakage issues.
  • DRY Code Enforcement: Detect repetitive test logic that could be collapsed into single parametrized functions using @pytest.mark.parametrize.

Example Prompts

  1. "Review test_user_service.py and identify why my AsyncMock calls are not properly awaiting the results."
  2. "I have several duplicate test functions for different database edge cases; can you help me refactor these using parametrize?"
  3. "Check the fixtures in my conftest.py; are there any issues with the current scope configuration or potential resource leaks?"

Tips & Limitations

  • Context is Key: Always provide the full file context or related conftest.py files to ensure the skill can verify patch targets and fixture availability accurately.
  • Not a Linter: While this skill checks for architectural and pattern issues, it does not replace static analysis tools like pylint or flake8. Use them in tandem for the best results.
  • Security: Be mindful when granting file-read access to production codebases, although this skill is strictly for analyzing local test files. It will not execute your code, keeping the process safe.

Metadata

Author@anderskev
Stars4473
Views0
Updated2026-05-01
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-anderskev-pytest-code-review": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#pytest#python#testing#asyncio#code-review
Safety Score: 5/5

Flags: file-read