# pytest-test-architect

> Generate professional pytest suites using behavior-driven matrices, AAA patterns, and resilient fixture architecture.

pytest-test-architect is a paid AI agent skill on Agensi by Tommi Sullivan, in Testing & Debugging. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [Tommi Sullivan](https://www.agensi.io/creators/tommi-sullivan)
- Category: [Testing & Debugging](https://www.agensi.io/skills/testing-debugging)
- Version: 1.0
- Last updated: 2026-07-04
- Security: scan passed (2026-07-04); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/pytest-test-architect
- Tags: testing, python, pytest, unit-testing, tdd, code-quality

## About this skill

### The problem

Writing tests often results in brittle suites that break during refactors because they target implementation details instead of behavior. Developers frequently miss critical edge cases and fail to verify that the system state remains intact after an error is raised.

### What it does

- Generates a comprehensive test matrix covering the happy path, boundary conditions, error paths, and side effects.
- Builds production-grade pytest suites using the Arrange-Act-Assert (AAA) pattern and clean fixture architecture.
- Implements robust mocking strategies limited to system boundaries like HTTP, clocks, and third-party SDKs.
- Enforces state-preservation assertions to ensure failed operations do not corrupt data.
- Delivers runnable test files along with a coverage report and a list of identified code smells.

### Frameworks & tools

Python, `pytest`, `freezegun`, `monkeypatch`, `tmp_path`.

### Why this beats prompting it yourself

Standard prompts usually produce shallow tests that only check the happy path. This skill enforces a disciplined architectural approach to testing, ensuring every public method is exercised against a four-category matrix and that fixtures are composed rather than duplicated.

### Use cases

- Generating a complete test suite for a new Python module or class.
- Increasing test coverage for legacy code by identifying unhandled boundary conditions.
- Refactoring brittle mocks into stable, behavior-based assertions.
- Auditing existing codebases for "testability" and identifying hidden I/O or state issues.

### Known limitations

Requires the environment to have necessary dependencies installed to verify the tests via execution. Prefers fakes over MagicMock for complex interfaces, which may require manual implementation of the fake if not provided.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the pytest-test-architect skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this skill differ from standard AI-generated unit tests?

The skill uses a behavior-driven matrix to automatically identify and write tests for happy paths, boundary conditions, error handling, and state preservation, ensuring your suite covers more than just basic functionality.

### Which languages and testing frameworks are supported?

The skill focuses on the Python ecosystem and is optimized for workflows using pytest, along with supporting tools like freezegun for time-sensitive logic and monkeypatch for mocking.

### What specific deliverables will I receive after running the pytest-test-architect?

Each execution delivers fully structured .py test files following the AAA pattern, a detailed coverage analysis, and a report identifying potential code smells in your source module.

### Can I use this skill to improve test coverage for an existing project?

Yes, the skill is designed to audit legacy modules, identify untested edge cases, and replace brittle implementation-focused mocks with stable, behavior-based assertions.

### Are there any limitations when mocking external APIs or hardware interfaces?

For complex third-party integrations, the architect prefers using 'fakes' over 'MagicMocks' to ensure stability; you may need to provide a simple fake implementation if the interface is highly specialized.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
