dj-services

Community

Structure testable Django business logic with service DI.

Authordvf
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill solves the common Django pain point of tangled, hard-to-test code where business logic is mixed into views, model methods, or scattered across the codebase, making changes risky and tests slow and dependent on the database.

Core Features & Use Cases

  • Structured Service Layer: Enforces plain Python service classes that hold all business logic, with dependencies injected via constructor for full testability.
  • Centralized Dependency Injection: Uses the svcs registry to wire services and repositories once at startup, so they can be resolved anywhere — views, Celery tasks, management commands, and tests.
  • Strict Separation of Concerns: Services never import Django ORM or models, all database access is delegated to repositories, and all layer boundaries use typed Pydantic DTOs to keep changes local.
  • Use Case: Refactor a fat Django view that handles order creation, inventory checks, and payment processing into a dedicated OrderService, inject the required OrderRepository and ProductRepository, register it in the svcs registry, and write fast, database-free unit tests for the business logic.

Quick Start

Use the dj-services skill to refactor the order creation logic from your Django view into a dedicated OrderService class with injected repository dependencies, registered in the project's svcs registry.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: dj-services
Download link: https://github.com/dvf/opinionated-django/archive/main.zip#dj-services

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.