Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add litestar-org/litestar-skills --skill polyfactorygit clone --depth 1 https://github.com/litestar-org/litestar-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/litestar-org/litestar-skills/polyfactory)<a href="https://agentmods.dev/skills/litestar-org/litestar-skills/polyfactory"><img src="https://agentmods.dev/badge/skills/litestar-org/litestar-skills/polyfactory/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/litestar-org/litestar-skills/polyfactory"><img src="https://agentmods.dev/badge/skills/litestar-org/litestar-skills/polyfactory.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00046 | $0.02983 |
| Opus 5 | $0.00023 | $0.01491 |
| Sonnet 5 | $0.00009 | $0.00597 |
| Haiku 4.5 | $0.00005 | $0.00298 |
Grade A, and why
polyfactory scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 306 lines — stays where its author put it; the contents beside it link to each section on GitHub.
polyfactory
Polyfactory is a typed mock-data factory library: declare ModelFactory[T] (or DataclassFactory, MsgspecFactory, AttrsFactory, TypedDictFactory) and .build() returns a populated instance of T. The matching factory base inspects the model's annotations and supported constraints so tests do not need hand-written happy-path fixtures.
In Litestar projects, polyfactory's pytest plugin is the canonical way to feed TestClient.post(...) / AsyncTestClient.put(...) payloads. The companion skill litestar:litestar-testing covers the request side.
Code Style Rules
- PEP 604 unions:
T | None, neverOptional[T]. - One factory per model. Don't reuse a factory across unrelated models — clarity beats DRY when the test fails at 3am.
- Pick the right factory base by backend:
ModelFactory(Pydantic),DataclassFactory,MsgspecFactory,AttrsFactory,TypedDictFactory. A mismatched base raisesConfigurationException. - Prefer
register_fixtureover hand-rolled@pytest.fixturewrappers. Call it in a pytest-discovered test module orconftest.pyso the injected fixture is collected.
Quick Reference
Picking the right factory base
| Model kind | Factory base | Import |
|---|---|---|
pydantic.BaseModel |
ModelFactory |
from polyfactory.factories.pydantic_factory import ModelFactory |
@dataclass |
DataclassFactory |
from polyfactory.factories import DataclassFactory |
msgspec.Struct |
MsgspecFactory |
from polyfactory.factories.msgspec_factory import MsgspecFactory |
@attrs.define / attr.s |
AttrsFactory |
from polyfactory.factories.attrs_factory import AttrsFactory |
TypedDict |
TypedDictFactory |
from polyfactory.factories.typed_dict_factory import TypedDictFactory |
| Beanie / Odmantic / SQLA | dedicated bases | see factories.md |
Defining a factory
from dataclasses import dataclass
from polyfactory.factories import DataclassFactory
@dataclass
class Order:
id: int
customer_email: str
total_cents: int
status: str
class OrderFactory(DataclassFactory[Order]):
pass
# Use it
one = OrderFactory.build()
many = OrderFactory.batch(10)
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 306 lines · 46 tokens per session scan A 64c517c1e38a
polyfactory is a skill published in the GitHub repository litestar-org/litestar-skills (14 stars, last pushed 19d ago), licensed MIT. It adds 46 tokens to every session and 2,983 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
craft-pest
Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…
tools-unity-test-framework
Unity Test Framework patterns for EditMode and PlayMode tests including async testing, mocking, and test organization.
solution-validation-testing
When the user wants to verify optimization code: independent feasibility checkers, objective recomputation separate from the solver, unit tests for constraint builders and operators, known-optimum regression tests, and exact-vs-heuristic cross-validation on small instances. Also use when the user mentions "validate…
phx-verify
Verify Elixir/Phoenix changes — compile, format, and test in one loop. Use after implementation, before PRs, or after fixing bugs.
swi-prolog-programmer
SWI-Prolog-specific tooling, standards, and idioms. Use when working with SWI-Prolog code. Emphasizes relational thinking, steadfastness, DCGs, constraints, and mandatory testing with PlUnit.
test-writer
Generates comprehensive unit and integration tests for a given file or function, auto-detecting the project test framework and matching existing test style.