dj-services

dj-services is a skill for Claude Code from dvf/opinionated-django. It costs 80 tokens per session (2,535 once invoked), scanned A, original, MIT.

A pattern for organizing Django business logic into plain service classes. Django is a Python web framework; these services receive the other parts they need through their constructors and are registered so views, background jobs, commands, and tests can use them.

In plain words
What is it for?
It helps add services, refactor complicated views or model methods, connect repositories and services, and retrieve them consistently throughout a Django project.
Why use it?
It keeps business rules out of web views and database models, making the code easier to test without a database and easier to replace in tests.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit It helps add services, refactor complicated views or model methods, connect repositories and services, and retrieve them consistently throughout a Django project.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dvf/opinionated-django/dj-services
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 dvf/opinionated-django --skill dj-services
Clone the repo
git clone --depth 1 https://github.com/dvf/opinionated-django

Made for: Claude Code.

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 dj-services

README.md
[![agentmods](https://agentmods.dev/badge/skills/dvf/opinionated-django/dj-services/github.svg)](https://agentmods.dev/skills/dvf/opinionated-django/dj-services)
Your own site
<a href="https://agentmods.dev/skills/dvf/opinionated-django/dj-services"><img src="https://agentmods.dev/badge/skills/dvf/opinionated-django/dj-services/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 dj-services

Your own site · 80×15
<a href="https://agentmods.dev/skills/dvf/opinionated-django/dj-services"><img src="https://agentmods.dev/badge/skills/dvf/opinionated-django/dj-services.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 80 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,535 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.00080 $0.02535
Opus 5 $0.00040 $0.01267
Sonnet 5 $0.00016 $0.00507
Haiku 4.5 $0.00008 $0.00253

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

Security

Grade A, and why

dj-services 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.

skills/dj-services/SKILL.md · 275 lines

How it starts

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

Services + svcs Dependency Injection

This project separates Django's framework concerns from business logic using a plain service layer, wired with the svcs service locator. The result:

  • Views are one-liners. They pull a wired service and call a method.
  • Services contain the business logic. They take repositories (and other services) via __init__, call methods on them, and return DTOs.
  • Services never import Django ORM or models. Every test can run without a database.
  • One registry, one get[T]() helper. The same call works in views, tasks, commands, anywhere.

Why svcs Instead of Module-Level Singletons or a Custom Container

  • svcs is a tiny, typed, well-maintained service locator — no metaclasses, no decorators, no framework coupling.
  • Factories are lazy: a service is constructed only when something asks for it.
  • Generic get[T](type[T]) -> T preserves types through IDE/type-checker inference.
  • Swapping an implementation in tests is a one-line factory override.
  • No import-order gymnastics: the registry is populated once at startup and then used by name.

The Registry — src/project/services.py

import svcs

from products.repositories.product import ProductRepository
from products.services.product import ProductService
from orders.repositories.order import OrderRepository
from orders.services.order import OrderService

registry = svcs.Registry()


# --- Services (factories pull repos from the container) ------------------
def _product_service_factory(container: svcs.Container) -> ProductService:
    repo = container.get(ProductRepository)
    return ProductService(repo)


def _order_service_factory(container: svcs.Container) -> OrderService:
    repo = container.get(OrderRepository)
    product_repo = container.get(ProductRepository)
    return OrderService(repo, product_repo)


def register_services(registry: svcs.Registry) -> None:
    """Register every real factory. Tests re-run this to restore overrides."""
    # --- Repositories -----------------------------------------------------
    registry.register_factory(ProductRepository, ProductRepository)
    registry.register_factory(OrderRepository, OrderRepository)
    # --- Services ---------------------------------------------------------
    registry.register_factory(ProductService, _product_service_factory)
    registry.register_factory(OrderService, _order_service_factory)


register_services(registry)


def get[T](service_type: type[T]) -> T:
    """Resolve a service from the registry. Works anywhere — views, tasks, commands, tests."""
    return svcs.Container(registry).get(service_type)

Read the full file on GitHub · 275 lines

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 · 275 lines · 80 tokens per session scan A fa4b33094eb3

Subscribe to this mod's changes

dj-services is a skill published in the GitHub repository dvf/opinionated-django (110 stars, last pushed 26d ago), licensed MIT. It adds 80 tokens to every session and 2,535 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.