django-security

django-security is a skill for Claude Code from loulanyue/awesome-claude-notes. It costs 30 tokens per session (4,353 once invoked), scanned A, original, MIT.

A security guide for Django web applications, covering login, permissions, request forgery protection, injection prevention, browser attacks, and production settings.

In plain words
What is it for?
Use it when reviewing Django security, setting up authentication and user roles, configuring production, or preparing an application for deployment.
Why use it?
It helps prevent common ways attackers can misuse an application or steal data. It also highlights unsafe deployment settings, such as leaving debugging enabled or exposing secret keys.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the awesome-claude-notes plugin — 106 skills, 61 commands, 28 agents shipped together

Good fit Use it when reviewing Django security, setting up authentication and user roles, configuring production, or preparing an application for deployment.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/loulanyue/awesome-claude-notes/django-security
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 loulanyue/awesome-claude-notes --skill django-security
Clone the repo
git clone --depth 1 https://github.com/loulanyue/awesome-claude-notes

Made for: Claude Code.

Or install awesome-claude-notes, the plugin that ships this one along with the rest of its 106 skills, 61 commands, 28 agents.

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-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/loulanyue/awesome-claude-notes/django-security/github.svg)](https://agentmods.dev/skills/loulanyue/awesome-claude-notes/django-security)
Your own site
<a href="https://agentmods.dev/skills/loulanyue/awesome-claude-notes/django-security"><img src="https://agentmods.dev/badge/skills/loulanyue/awesome-claude-notes/django-security/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 django-security

Your own site · 80×15
<a href="https://agentmods.dev/skills/loulanyue/awesome-claude-notes/django-security"><img src="https://agentmods.dev/badge/skills/loulanyue/awesome-claude-notes/django-security.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,353 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 warn 7 Sept 2026
SkillSpector: 2 findings, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Agent Snooping · line 4
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
  • medium Agent Snooping · line 596
    Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.
    Fix: Remove all code or instructions that list or read other skills' files or directories. Skills should operate independently; cross-skill access is a privilege escalation.
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.00030 $0.04353
Opus 5 $0.00015 $0.02176
Sonnet 5 $0.00006 $0.00871
Haiku 4.5 $0.00003 $0.00435

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

Security

Grade A, and why

django-security 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.

docs/ja-JP/skills/django-security/SKILL.md · 602 lines

How it starts

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

Django セキュリティベストプラクティス

一般的な脆弱性から保護するためのDjangoアプリケーションの包括的なセキュリティガイドライン。

いつ有効化するか

  • Django認証と認可を設定するとき
  • ユーザー権限とロールを実装するとき
  • 本番セキュリティ設定を構成するとき
  • Djangoアプリケーションのセキュリティ問題をレビューするとき
  • Djangoアプリケーションを本番環境にデプロイするとき

核となるセキュリティ設定

本番設定の構成

# settings/production.py
import os

DEBUG = False  # 重要: 本番環境では絶対にTrueにしない

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')

# セキュリティヘッダー
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_HSTS_SECONDS = 31536000  # 1年
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
X_FRAME_OPTIONS = 'DENY'

# HTTPSとクッキー
SESSION_COOKIE_HTTPONLY = True
CSRF_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SAMESITE = 'Lax'

# シークレットキー(環境変数経由で設定する必要があります)
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')
if not SECRET_KEY:
    raise ImproperlyConfigured('DJANGO_SECRET_KEY environment variable is required')

# パスワード検証
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
        'OPTIONS': {
            'min_length': 12,
        }
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

認証

カスタムユーザーモデル

# apps/users/models.py
from django.contrib.auth.models import AbstractUser
from django.db import models

class User(AbstractUser):
    """より良いセキュリティのためのカスタムユーザーモデル。"""

    email = models.EmailField(unique=True)
    phone = models.CharField(max_length=20, blank=True)

    USERNAME_FIELD = 'email'  # メールをユーザー名として使用
    REQUIRED_FIELDS = ['username']

    class Meta:
        db_table = 'users'
        verbose_name = 'User'
        verbose_name_plural = 'Users'

    def __str__(self):
        return self.email

# settings/base.py
AUTH_USER_MODEL = 'users.User'

Read the full file on GitHub · 602 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 · 602 lines · 30 tokens per session scan A ce1603dc648d

Subscribe to this mod's changes

django-security is a skill published in the GitHub repository loulanyue/awesome-claude-notes (270 stars, last pushed 6d ago), licensed MIT. It adds 30 tokens to every session and 4,353 once invoked, about $0.0002 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-09-03.