specx-diwire-composition
Skill by maksimzayats
Guides an AI assistant to wire dependency injection in a specx Python service with the diwire library. It covers container registrations, constructor injection, FastAPI lifecycle composition and test overrides. It is aimed at developers building specx services.
Install specx-diwire-composition
Built from the published package, never by AI.
git clone --depth 1 https://github.com/maksimzayats/specx /tmp/specx && mkdir -p ~/.claude/skills && cp -r /tmp/specx/skills/specx-diwire-composition ~/.claude/skills/specx-diwire-compositionRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install specx-diwire-composition in Claude Code
git clone --depth 1 https://github.com/maksimzayats/specx /tmp/specx && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/specx/skills/specx-diwire-composition ~/.gemini/antigravity-cli/skills/specx-diwire-compositionAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install specx-diwire-composition in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill tells an AI assistant how to wire dependency injection for a specx Python service using the diwire library. It covers adding ioc/container.py, registering capabilities, repositories, gateways, unit-of-work managers, clients, settings and factories, and using Injected[...] constructor fields. It also covers FastAPI app factory and lifecycle composition and test overrides.
The skill sets rules on where containers may be created and used. Only ioc/, top-level entry modules and tests may use diwire.Container, and core use cases and services must not call container.resolve(). Unit tests use a native pytest container fixture built by get_container(), and integration tests use a transactional real-app fixture. It is written for developers working on specx services that use diwire.
Written from the project's SKILL.md and checked against it.
What it can do
- Constructor injectionApplication classes receive dependencies through Injected[DependencyType] constructor fields.
- Container registrationRegisters abstractions, adapters, gateways and factories in a private _register_dependencies function in ioc/container.py.
- Unit-of-work wiringRegisters unit-of-work managers for UoW abstractions, with use cases opening the active UoW inside execute().
- Settings auto-registrationAuto-registers BaseRuntimeSettings subclasses as root-scoped singleton factories.
- FastAPI lifecycleComposes the FastAPI app factory and lifecycle, using the container only to call aclose() at shutdown.
- Readiness checksRegisters readiness gateways such as SQLAlchemyReadinessCheckGateway for ReadinessCheckGateway for /readyz.
- Test overridesPlaces project-wide overrides in the pytest container fixture and scenario overrides directly in each test.
- Test doubles placementDefines where one-off and reused fake modules may live in the unit test tree.
What you need
- Python
- diwire library
- FastAPI for app lifecycle composition
- A specx Python service
Try asking
- Wire constructor injection with Injected[...] for my new use case class
- Register a readiness gateway for /readyz in my FastAPI app
- Set up a pytest container fixture with an override for one test
Good to know
- Only ioc/, top-level entry modules and tests may create or use diwire.Container.
- Do not enable diwire.integrations.pytest_plugin; tests use native pytest fixtures.
- Core use cases and services must not call container.resolve().
- Integration tests must use the real internal graph, not mocked internal use cases.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/specx-diwire-composition/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to specx-diwire-composition
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
specx-diwire-composition: common questions
What does this skill cover?
It covers wiring dependency injection with diwire in a specx Python service, including container registrations, constructor injection and FastAPI lifecycle composition.
Can I resolve dependencies inside a use case?
No. The rules say not to call container.resolve() inside core use cases or services.
How are tests set up with this skill?
Unit tests receive a fresh native pytest container fixture built by the project's get_container(). Integration tests use a transactional real-app container fixture.
How do I install specx-diwire-composition?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is specx-diwire-composition free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is specx-diwire-composition safe to use?
It scores 63 of 100. Grades: maintenance C, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to specx-diwire-composition?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
