specx-diwire-composition

specx-diwire-composition is a skill for Codex from maksimzayats/specx. It costs 83 tokens per session (969 once invoked), scanned A, original, MIT.

A guide for setting up dependency injection in a specx Python service with diwire, a tool that supplies required objects to classes. It covers application wiring, injectable constructor fields, factories, web application setup, and test replacements.

In plain words
What is it for?
Use it to connect services, repositories, gateways, database transaction managers, clients, settings, controllers, application factories, and test overrides.
Why use it?
It reduces manual object construction and keeps the application's dependency graph in one place. It also makes it easier for tests to substitute controlled dependencies.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to connect services, repositories, gateways, database transaction managers, clients, settings, controllers, application factories, and test overrides.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/maksimzayats/specx/specx-diwire-composition
Install

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.

Any agent
npx skills add maksimzayats/specx --skill specx-diwire-composition
Clone the repo
git clone --depth 1 https://github.com/maksimzayats/specx

Made for: Codex.

Wrote 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.

agentmods badge for specx-diwire-composition

README.md
[![agentmods](https://agentmods.dev/badge/skills/maksimzayats/specx/specx-diwire-composition/github.svg)](https://agentmods.dev/skills/maksimzayats/specx/specx-diwire-composition)
Your own site
<a href="https://agentmods.dev/skills/maksimzayats/specx/specx-diwire-composition"><img src="https://agentmods.dev/badge/skills/maksimzayats/specx/specx-diwire-composition/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.

agentmods 80×15 button for specx-diwire-composition

Your own site · 80×15
<a href="https://agentmods.dev/skills/maksimzayats/specx/specx-diwire-composition"><img src="https://agentmods.dev/badge/skills/maksimzayats/specx/specx-diwire-composition.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 83 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 969 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00083 $0.00969
Opus 5 $0.00042 $0.00485
Sonnet 5 $0.00017 $0.00194
Haiku 4.5 $0.00008 $0.00097

Measured 9d ago against content hash beec2f2a1c49, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

specx-diwire-composition 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.

.agents/skills/specx-diwire-composition/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

specx Diwire Composition

Use this skill whenever object graphs, factories, controllers, adapters, or test overrides need diwire. Read references/diwire.md before writing DI code.

Rules

  • Application classes receive dependencies through constructor fields typed as Injected[DependencyType].
  • Keep injection constructor-based. Do not hide dependency resolution in application functions with resolver_context.inject.
  • Capabilities are normal injectable collaborators. Register only capability abstractions or existing instances that auto-wiring cannot infer.
  • Only ioc/, top-level delivery __main__.py/factory/lifecycle modules, and tests create or use diwire.Container.
  • Do not inject Container except in FastAPILifecycle, where it is used only to call container.aclose() during app shutdown.
  • Do not inject logging.Logger or register loggers in the container. Runtime logging is configured once by a top-level infrastructure configurator; classes that log create local stdlib loggers.
  • Do not call container.resolve() inside core use cases or services.
  • Let diwire auto-wire concrete project classes.
  • Let diwire auto-register BaseRuntimeSettings subclasses as root-scoped singleton factories. Register a settings instance only for an intentional test override or an explicitly prebuilt configuration object.
  • Register only abstractions, external adapter bindings, gateway implementations, factories, and instances that auto-wiring cannot infer. Keep registration in private _register_dependencies(...) inside ioc/container.py.
  • Register the container instance itself with provides=Container only for the FastAPI lifecycle shutdown dependency.
  • Register concrete gateway implementations for their core BaseGateway ports.
  • Register health readiness gateway implementations, such as SQLAlchemyReadinessCheckGateway, for ReadinessCheckGateway when /readyz needs infrastructure checks.
  • Register unit-of-work managers for UoW abstractions. Persistence use cases inject the manager and open the active UoW inside execute(...); they do not inject repositories, active UoWs, providers, SQLAlchemy sessions, engines, session factories, or concrete infrastructure adapters directly.
  • Unit tests receive a fresh native pytest container fixture built by the project's real get_container(). Put project-wide test overrides in that fixture and register scenario-specific overrides directly in the test before resolving the target.
  • Integration tests receive the transactional real-app container fixture. They must use the real internal graph; do not mock internal use cases, services, or capabilities.
  • Use container.resolve(...) for normal synchronous graph construction, even for targets with async methods; use await container.aresolve(...) only when DI construction itself has async providers.
  • One-off class-based test doubles live in the test_*.py module that uses them. Reused unit-test doubles may live in mirrored tests/unit/core/<scope>/{capabilities,gateways,repositories}/fake_<source_module>.py modules.
  • Inline MagicMock or AsyncMock in the test function when only one behavior needs to change.
  • Do not create DI-backed test factories, target harnesses, harness.py, tests/_support/fakes, tests/**/_fakes.py, or fake modules outside those mirrored unit port/capability packages.
  • Keep tests on native pytest fixtures. Do not enable diwire.integrations.pytest_plugin, and do not use Injected[...] parameters in test functions.
  • FastAPI async test helpers must enter LifespanManager and pass the yielded manager's state-aware manager.app to the HTTPX2 ASGITransport.

Read the full file on GitHub · 80 lines

Files

What ships with it

2 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.

Changes

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.

  1. 9d ago First seen · 80 lines · 83 tokens per session scan A beec2f2a1c49

Subscribe to this mod's changes

specx-diwire-composition is a skill published in the GitHub repository maksimzayats/specx (201 stars, last pushed 1mo ago), licensed MIT. It adds 83 tokens to every session and 969 once invoked, about $0.0004 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.