Specx Tests logo

Specx Tests

Community
maksimzayats
specx-tests

Add or refine tests for specx Python services. Use when creating unit tests for use cases/services, integration tests for FastAPI controllers or infrastructure adapters, e2e smoke tests, architecture import guardrails, DI override tests, pytest fixtures, or coverage and boundary checks.

Overview

Publishermaksimzayats
Repositoryspecx
Skill namespecx-tests
Stars
201
Forks
34
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by maksimzayats on GitHub. Read the source before you install it.

Installation

Install the Specx Tests AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/maksimzayats/specx/tree/main/.agents/skills/specx-tests
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maksimzayats/specx.git /tmp/specx
mkdir -p .claude/skills
cp -r /tmp/specx/.agents/skills/specx-tests .claude/skills/specx-tests
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Specx Tests in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Specx Tests on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Specx Tests is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

specx Tests

Use this skill when behavior, wiring, or architecture boundaries need tests. Read references/testing.md before creating test files.

Test Layers

  • tests/_support/: generic clients, DB helpers, and shared integration helpers only. This is not a test suite and does not hold project-specific doubles.
  • tests/unit/: core services, use cases, and capabilities resolved from a fresh application container returned by the project's get_container().
  • tests/integration/: real internal graph tests. Core use-case integration tests call resolved use cases against the transactional DB; delivery integration tests exercise HTTP mapping; migrations prove Alembic behavior.
  • tests/e2e/: optional whole-app smoke flows.
  • tests/guardrails/: optional programmatic specx.testing.architecture.assert_specx_architecture wrappers for genuinely project-specific extra rules. Standard packaged rules run through uv run specx check.

Rules

  • Test behavior and boundaries, not implementation ceremony.
  • Required generated coverage is currently scoped to core services, use cases, and capabilities.
  • Mirror source module paths directly with flat test files, for example tests/unit/core/tasks/services/test_title_service.py.
  • Do not create per-target test folders, harness.py, target factories, or target harnesses.
  • tests/unit/conftest.py owns the fresh real-app Container fixture for unit tests and any project-wide test overrides. tests/integration/conftest.py owns the transactional DB-backed container fixture for integration tests.
  • Test functions receive container, register any scenario-specific overrides before resolution, then call container.resolve(Target).
  • If a complete replacement is needed by every test in one module, a module-local container fixture may register it before returning the container.
  • Keep one-off class-based test doubles in the test_*.py module that uses them. When the same double is reused by multiple unit modules, put it in a mirrored tests/unit/core/<scope>/{capabilities,gateways,repositories}/fake_<source_module>.py file.
  • Do not create tests/_support/fakes, tests/**/_fakes.py, generic _scenarios.py, fake modules outside those mirrored unit port/capability packages, or double classes in conftest.py.
  • Use MagicMock or AsyncMock inline in the test function when only one behavior needs to be changed for that scenario. Prefer autospeccing when call signatures matter and spec_set when unexpected attributes must fail.
  • Unit tests replace external IO, time, randomness, network, Redis, database, and framework resources with local doubles or inline mocks.
  • Integration tests use the real internal app graph. Do not mock internal use cases, services, or capabilities; stub only external systems when needed.
  • Add core use-case integration tests under tests/integration/core/... for use cases that inject a UoW manager; delivery tests should own HTTP mapping, not be the only persistence proof.
  • Persistence integration tests use the production database family when dialect behavior matters. A rollback harness may not replace isolated commit-visible tests for locking, concurrency, isolation, or after-commit behavior.
  • Core health tests cover required-dependency readiness and any reusable probe services and use cases. Delivery probe tests cover /healthz and /readyz as operational endpoints, not versioned business API routes. /healthz must prove a lightweight process response only; /readyz must prove required infrastructure readiness, including a real bounded DB check for SQLAlchemy services.
  • Probe route tests assert Cache-Control: no-store, readiness failure returns 503, probe routes are excluded from OpenAPI, and legacy /api/v1/health is absent when replacing old generated health endpoints.
  • Unit-test logging configurators by overriding logging settings, monkeypatching logging.config.dictConfig, and asserting the generated stdlib config. Use caplog only when a log record is meaningful behavior.
  • Unit-test FastAPI lifecycle managers by overriding closeable infrastructure resources and asserting shutdown order. Route integration helpers must run ASGI lifespan explicitly.
  • Use httpx2, not legacy httpx, for generated HTTP client and ASGI transport tests. Enter LifespanManager, then pass the yielded manager's manager.app to ASGITransport so request scopes receive lifespan state.
  • FastAPI route tests compare response status codes with fastapi.status constants, not raw integer literals.
  • Use container.resolve(...) for normal synchronous graph construction, even when the resolved use case has an async execute(...); use await container.aresolve(...) only when DI construction itself has async providers.
  • Mock fixtures should register one external collaborator for the behavior under test. Do not bundle unrelated mocks in a dict or class-keyed fixture.
  • Use native pytest fixtures for test dependencies. Do not enable diwire.integrations.pytest_plugin, and do not use Injected[...] parameters in tests.
  • AnyIO runs tests on every installed supported backend by default. If the app graph is asyncio-specific, override the top-level anyio_backend fixture to return "asyncio"; leave it unpinned only when the suite intentionally supports every installed backend.
  • Do not add filler smoke tests that only assert container.resolve(...) returns an instance.
  • Do not hand-build application graphs in test bodies. Resolve project classes from the container; local test doubles may be instantiated in the test module before registration.
  • Keep unit tests free from FastAPI request objects and real external IO.
  • Every test directory must include an empty __init__.py file.
  • Use uv run specx check as the default guardrail mechanism for specx boundaries such as docstrings, use-case inputs, UoW injection, route paths, direct persistence dependency rejection in use cases, container imports, and AGENTS.md command coverage.
  • Disable built-in guardrails only with exact semantic IDs under [tool.specx].ignore and a project reason recorded beside the configuration.
  • Generated projects use [tool.specx].select = ["ALL"]. Narrower projects enable technology-specific families explicitly with [tool.specx].extend-select; FastAPI projects select fastapi.
  • Add extra_rules only for project-specific checks that are not covered by a built-in SpecxRuleId; use the programmatic wrapper for those projects.
  • Existing workflows and projects with custom rules may use references/render_architecture_guardrails.py to render the tiny wrapper.

Code Style

Use blank lines as logical separators in all code. Keep related statements together, but separate independent setup, action, assertion, response, branch, and transformation groups so long blocks stay readable.

References

  • references/testing.md - folder layout, fixtures, unit/integration examples, and architecture guardrail snippets.
  • references/render_architecture_guardrails.py - compatibility renderer for the tiny specx architecture wrapper.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Specx Tests AI skill do?

Add or refine tests for specx Python services. Use when creating unit tests for use cases/services, integration tests for FastAPI controllers or infrastructure adapters, e2e smoke tests, architecture import guardrails, DI override tests, pytest fixtures, or coverage and boundary checks.

Why use Specx Tests on TypingMind?

Because you install it once and use it with any model. Specx Tests is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Specx Tests in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/maksimzayats/specx/tree/main/.agents/skills/specx-tests. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Specx Tests?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Specx Tests?

As many as you like. As long as a model supports skills, you can use Specx Tests with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Specx Tests AI skill free?

Yes. It is published on GitHub by maksimzayats under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇