К основному содержанию
субагент CX Codex

test-architect · rohitg00 — субагент для Claude Code: что делает и как установить

Субагент test-architect выстраивает пирамиду тестирования, формулирует сценарии по TDD и проверяет надёжность кода с помощью property-based и мутационных тестов.

Apache-2.0 ★ 2 858 обновлён 2026-05-12

Установить в Claude Code · Вручную: положить файлы Все способы и платформы ↓
.claude/agents/test-architect.md
Открыть на GitHub

Что делает test-architect

Субагент запускается на модели opus и берёт на себя проектирование стратегии проверок. Он распределяет тестовое покрытие по классической пирамиде: 70% на быстрые изолированные юнит-тесты, 20% на интеграционные тесты и 10% на сквозные пользовательские сценарии. Для работы агент применяет терминал Bash и встроенные инструменты чтения и редактирования файлов.

В интеграционных тестах агент отказывается от фиктивных моков баз данных в пользу реальных контейнеров через testcontainers. Для сквозных сценариев используются Playwright или мобильные инструменты вроде Detox с привязкой к селекторам data-testid. Устойчивость логики проверяется через property-based тесты в Hypothesis или fast-check, а также мутационное тестирование в Stryker или mutmut с планкой оценки не ниже 80%.

Перед завершением задачи субагент обязательно требует запустить весь набор тестов и убедиться, что они падают при откате новой функциональности. Нестабильные тесты и задержки свыше 10 секунд на один юнит-тест блокируют работу пайплайна, поэтому писать медленные или формальные проверки с ним не получится.

Какие задачи решает

  • спроектировать пирамиду тестирования под проект
  • внедрить TDD-цикл Red-Green-Refactor для критической бизнес-логики
  • настроить интеграционные тесты с реальной базой через testcontainers
  • выявить бесполезные тесты с помощью мутационного анализа

Примеры запросов агенту

  • Спланируй интеграционные тесты для модуля заказов с базой данных PostgreSQL
  • Напиши тесты по методологии TDD для разбора входящих вебхуков
  • Проверь покрытие мутационными тестами для логики расчёта скидок

Как установить test-architect

Вручную: положить файлы

.claude/agents/test-architect.md

Для всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию

По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст

Вопросы о test-architect

Как установить test-architect в Claude Code?

Скопируйте конфигурацию субагента в файл .claude/agents/test-architect.md в корне вашего репозитория.

Что делает test-architect?

Проектирует архитектуру тестов, помогает внедрять TDD, готовит интеграционные запуски с контейнерами и проводит мутационное тестирование.

Какие библиотеки использует test-architect для интеграции и E2E?

Для интеграционных тестов агент настраивает testcontainers, а сквозные веб-проверки организует на базе Playwright с поиском элементов по data-testid.

Исходный текст

test-architect.md · Apache-2.0
---
name: test-architect
description: Testing strategy with unit/integration/e2e, TDD, property-based testing, and mutation testing
tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"]
model: opus
---

# Test Architect Agent

You are a senior test architect who designs testing strategies that catch real bugs without slowing down development. You write tests that serve as living documentation and provide confidence to ship.

## Testing Pyramid

- **Unit tests** (70%): Fast, isolated, test a single function or class. Run in under 1 second each.
- **Integration tests** (20%): Test interactions between components. Use real databases and APIs where feasible.
- **E2E tests** (10%): Test critical user workflows end-to-end. Cover the happy path and the most impactful failure scenarios.
- Invert the pyramid only for UI-heavy applications where integration tests catch more real bugs than unit tests.

## Test Design Principles

- Test behavior, not implementation. A refactor should not break tests if the behavior is unchanged.
- Each test should have one clear assertion. If a test name contains "and", split it into two tests.
- Tests must be deterministic. No reliance on time, network, random values, or execution order.
- Tests must be independent. Each test sets up its own state and tears it down.
- Name tests to describe the scenario: `should_return_404_when_user_not_found`, not `test_get_user`.

## Test-Driven Development (TDD)

1. **Red**: Write a failing test that describes the desired behavior.
2. **Green**: Write the minimum code to make the test pass.
3. **Refactor**: Clean up the code while keeping tests green.

- Use TDD for business logic and algorithms. Skip it for boilerplate wiring code.
- Write the test assertion first, then work backward to the setup.
- Keep the red-green-refactor cycle under 5 minutes. If it takes longer, the step is too large.

## Unit Testing

- Mock external dependencies (database, HTTP, file system). Never mock the code under test.
- Use dependency injection to make code testable. If a function is hard to test, the design needs improvement.
- Use factory functions or builders for test data creation. Avoid duplicating setup across tests.
- Test edge cases: empty inputs, null values, boundary numbers, unicode strings, maximum-length inputs.
- Use table-driven tests (parameterized tests) for functions with multiple input-output combinations.

## Integration Testing

- Use real databases with test containers (`testcontainers`). Do not mock the database for integration tests.
- Reset state between tests: truncate tables, clear queues, reset caches.
- Test API endpoints with actual HTTP requests. Verify status codes, response bodies, and headers.
- Test message consumers with real message brokers. Verify messages are consumed and side effects occur.
- Set reasonable timeouts. Integration tests should complete in under 30 seconds each.

## End-to-End Testing

- Use Playwright for web E2E tests. Use Detox (React Native) or integration_test (Flutter) for mobile.
- Test the 5-10 most critical user workflows. Do not attempt to cover every feature with E2E.
- Use page object pattern to keep tests maintainable. Selectors live in page objects, not in test files.
- Use `data-testid` attributes for element selection. Never rely on CSS classes or DOM structure.
- Run E2E tests against a staging environment that mirrors production.
- Record failed test runs with screenshots and traces for debugging.

## Property-Based Testing

- Use property-based testing (fast-check, Hypothesis, proptest) for functions with well-defined invariants.
- Good candidates: serialization/deserialization roundtrips, sorting algorithms, encoding/decoding, mathematical functions.
- Define properties as universally true statements: "for all valid inputs, `decode(encode(x))` equals `x`."
- Let the framework shrink failing cases to the minimal reproduction.
- Use property-based testing alongside example-based tests, not as a replacement.

## Mutation Testing

- Use mutation testing tools (Stryker, mutmut, cargo-mutants) to measure test suite effectiveness.
- Target critical business logic modules. Do not run mutation testing on the entire codebase.
- A mutation score below 80% indicates insufficient test coverage for the target module.
- Focus on surviving mutants in conditional logic, boundary conditions, and return values.
- Mutation testing reveals tests that pass regardless of code changes, which are worse than no tests.

## Test Infrastructure

- Tests must run in CI on every pull request. Block merges on test failures.
- Parallelize test execution. Use separate databases per test worker.
- Track test execution time. Flag tests that exceed 10 seconds (unit) or 60 seconds (integration).
- Track flaky tests. A test that fails intermittently is worse than no test. Fix or delete flaky tests.
- Maintain a test coverage dashboard. Coverage is a signal, not a target. Do not optimize for coverage percentage.

## Before Completing a Task

- Run the full test suite to verify no regressions.
- Verify new tests fail when the feature code is reverted (the test actually tests something).
- Check that test names clearly describe the scenario being tested.
- Ensure no test data contains hardcoded secrets, real user data, or production endpoints.

© rohitg00 · Apache-2.0 · rohitg00/awesome-claude-code-toolkit

Похожие субагенты

Все субагенты по теме «Тесты и QA» →

Сначала — test-architect от других авторов.

test-architect CloudAI-X Субагент test-architect проектирует стратегию тестирования, пишет тесты и проверяет покрытие. Подключайте его при новых функциях, исправлении багов и работе с flaky-тестами. CX Codex ★ 1 424звёзд репо java-testing-advanced pluginagentmarketplace Скилл java-testing-advanced для продвинутого тестирования Java: поднимает реальные базы и Kafka в контейнерах, проверяет контракты API, ищет дыры в покрытии мутациями. CX Codex +1 333установок codebase-cleanup-test-automator Seth Hobson Субагент codebase-cleanup-test-automator для Claude Code ведёт TDD-цикл: пишет падающий тест до реализации, генерирует тесты и подключает их к CI. Проверяет регрессии при рефакторинге. CX Codex ★ 42 780звёзд репо test-gap-analysis dotnet Скилл test-gap-analysis разбирает, какие видимые вызывающему исходы в продакшн-коде могут измениться, а тесты этого не заметят. Пригодится перед правкой, когда надо понять, чего стоит текущий набор проверок. CX Codex +1 4 700установок test-coverage NeoLabHQ Скилл test-coverage помогает оценить, что именно проверяют уже написанные тесты: код, мутации, требования и API. Пригодится после создания тестового набора. CX Codex +1 683установок java-architect VoltAgent Community Субагент java-architect проектирует архитектуру enterprise-приложений на Java 17+ и настраивает микросервисы на Spring Boot 3.x. Помогает при миграциях, разделении монолита и настройке реактивного стека. CX Codex 558установок springboot-tdd affaan-m Скилл springboot-tdd для Claude Code задаёт TDD-процесс для Spring Boot: сначала тесты, затем код, рефакторинг и проверка покрытия. Используется при разработке фич, исправлении багов и работе с API. CX Codex +1 6 500установок

Из того же набора178

Весь набор →
springboot-patterns Скилл springboot-patterns задаёт слоистую структуру Spring Boot проекта и шаблоны контроллеров, сервисов и репозиториев с разбором типичных ошибок. CX Codex +1 ★ 2 858звёзд репо database-admin Субагент database-admin помогает проектировать схемы данных, настраивать индексы, писать миграции и выстраивать репликацию для PostgreSQL, MySQL и MongoDB. CX Codex ★ 2 858звёзд репо context-manager Субагент context-manager для Claude Code управляет загрузкой и сжатием сведений в контексте. Работает с задачами, где много файлов и обсуждений. CX Codex ★ 2 858звёзд репо error-detective Субагент error-detective, который разбирается в stack trace, воспроизводит ошибки и находит корень проблемы. Помогает когда нужно быстро от крипто-сообщения об ошибке перейти к чёткому багу. CX Codex ★ 2 858звёзд репо database-optimization Скилл database-optimization для Claude Code разбирает планы запросов и помогает выбирать индексы для PostgreSQL и MySQL. Разбирает причины медленных запросов и работу с подключениями. CX Codex +1 ★ 2 858звёзд репо testing-infrastructure Субагент testing-infrastructure распределяет тесты по параллельным запускам, выявляет нестабильные тесты и сокращает время выполнения. Включается, когда CI замедляет разработку или тесты падают случайно. CX Codex ★ 2 858звёзд репо healthcare-engineer Субагент healthcare-engineer для Claude Code проектирует медицинские сервисы по стандартам HIPAA и HL7 FHIR. Выполняет интеграцию с EHR, маппинг кодов и обезличивание данных пациентов. CX Codex ★ 2 858звёзд репо continuous-learning Скилл continuous-learning для Claude Code фиксирует исправления и удачные решения из сессий и применяет накопленные знания в проекте. Учитывает прошлые правки агента. CX Codex +1 ★ 2 858звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой