django-cart CLAUDE.md

django-cart CLAUDE.md is an instructions file for Claude Code from bmentges/django-cart. It costs 6,118 tokens per session, scanned A, original, MIT.

A project guide for coding agents working on django-cart, a Python library that provides shopping-cart functions for Django websites. It explains the repository layout, architecture, conventions, and important cautions.

In plain words
What is it for?
Use it when modifying, reviewing, testing, or releasing the django-cart codebase.
Why use it?
It gives an agent the project-specific context needed to change the code without guessing how the library is organized or used.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

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.

agentmods
npx agentmods add instructions/bmentges/django-cart/claude-md
Clone the repo
git clone --depth 1 https://github.com/bmentges/django-cart

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 django-cart CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/bmentges/django-cart/claude-md.svg)](https://agentmods.dev/instructions/bmentges/django-cart/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/bmentges/django-cart/claude-md"><img src="https://agentmods.dev/badge/instructions/bmentges/django-cart/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 6,118 This file is loaded in full into every session.
When invoked 6,118 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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.06118 $0.06118
Opus 5 $0.03059 $0.03059
Sonnet 5 $0.01224 $0.01224
Haiku 4.5 $0.00612 $0.00612

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

Security

Grade A, and why

django-cart CLAUDE.md 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 6d 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.

CLAUDE.md · 517 lines

How it starts

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

CLAUDE.md

Guidance for Claude Code when working in this repository. Conversational rules shared by the maintainer already live under .claude/rules/; this file covers project-specific architecture, conventions, and gotchas that are not derivable from the code in seconds.


1. What this project is

django-cart is a lightweight, session-backed shopping cart library for Django 4.2+. It is distributed on PyPI and has been maintained since ~2012. The public API surface is the Cart class in cart/cart.py; everything else (models, templatetags, signals, pluggable calculators) exists to support that class.

  • Package name on PyPI: django-cart
  • Importable app name: cart (not django_cart)
  • Python: 3.10+, Django: 4.2+ (CI matrix up to Py 3.14 / Dj 6.0)
  • Current version: see pyproject.toml (version field). Bump this when releasing; CI publishes on tag push.
  • License: MIT (LICENSE). Relicensed from LGPL-3.0 in v3.0.11 — see CHANGELOG.md for the rationale. Copying code in from other MIT / BSD / Apache-2.0 projects is fine; avoid copying from GPL / LGPL / AGPL sources without clearing it first.

2. Repository map

cart/                        # the installable Django app
├── __init__.py              # (legacy default_app_config — see gotcha §7.1)
├── apps.py                  # CartConfig
├── admin.py                 # CartAdmin + ItemInline (Discount NOT registered — §7.7)
├── cart.py                  # Cart class + exceptions + CART_ID — main API
├── models.py                # Cart, Item (GFK), ItemManager, Discount, DiscountType
├── signals.py               # 5 Django signals (optional import in cart.py)
├── session.py               # CartSessionAdapter, DjangoSessionAdapter, CookieSessionAdapter
│                            #   ⚠️ declared but NOT wired into Cart — see §7.2
├── tax.py                   # TaxCalculator base + DefaultTaxCalculator + get_tax_calculator()
├── shipping.py              # ShippingCalculator base + default + factory
├── inventory.py             # InventoryChecker base + default + factory
├── templatetags/cart_tags.py  # cart_item_count, cart_summary, cart_is_empty, cart_link
├── management/commands/clean_carts.py  # cron-friendly purge command
├── migrations/              # 0001..0005 — do NOT squash without version bump
└── views.py                 # intentionally empty

tests/
├── settings.py              # used by pytest (pyproject sets DJANGO_SETTINGS_MODULE)
├── urls.py                  # admin only — most tests don't hit HTTP
├── test_app/                # FakeProduct + FakeProductNoPrice (test-only product models)
├── fixtures/fake_products.json  # present but UNUSED by tests (§7.9)
├── test_cart.py             # ~2200 lines, 177 tests — the bulk of the suite
├── test_v300.py             # discounts/tax/shipping/inventory (64 tests)
├── test_integration.py      # "integration" — still uses MagicMock requests (§7.3)
├── test_performance.py      # 3 loose timing benchmarks
├── test_session.py          # session adapters (14 tests)
├── test_signals.py          # 7 tests
└── test_templatetags.py     # 13 tests

docs/
├── PROJECT_ANALYSIS.md              # Mar 2026 analysis (partly stale — ref v2.2.13)
├── PROJECT_ANALYSIS_2026_03_29_0243am.md  # earlier snapshot
└── ROADMAP.md                       # thin "future considerations" list

pyproject.toml               # pytest + coverage config (runtests.py deleted in Phase 8; .coveragerc folded in at Phase 0)
.pre-commit-config.yaml      # black, isort, flake8, mypy — NOT run in CI (§7.8)
.github/workflows/ci.yml     # test matrix + publish-on-tag to PyPI
.github/dependabot.yml       # weekly pip + gh-actions updates

Read the full file on GitHub · 517 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. 6d ago First seen · 517 lines · 6,118 tokens per session scan A 1bba8c23faad

Subscribe to this mod's changes

django-cart CLAUDE.md is an instructions file published in the GitHub repository bmentges/django-cart (333 stars, last pushed 1mo ago), licensed MIT. It adds 6,118 tokens to every session, about $0.0306 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.