# Django security

> Django security is an open-source agent skill for security. Gives your agent Django security guidance for auth, CSRF, XSS, SQL injection. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/django-security
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 66
- **License:** MIT
- **Skill name:** django-security
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [security](https://ai-powered.com/categories/security), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill is a reference guide for hardening Django projects. It walks through production settings such as HTTPS enforcement, secure cookies, HSTS, secret key handling and password validators, then covers custom user models, password hashers and session configuration. Authorization patterns include model permissions, class-based view mixins, custom DRF permission classes and a simple role-based approach.

The remaining sections cover injection and output-escaping risks: safe ORM and raw() query usage, template escaping, careful use of mark_safe, CSRF handling for forms and AJAX, and csrf_exempt for webhooks. It also includes file upload validation using magic bytes, API throttling and authentication defaults, Content Security Policy middleware, environment-based secrets and security logging. The skill contains no scripts; it is made of code examples and a closing checklist.

Using it assumes a Django project, and some examples depend on third-party packages such as python-magic or filetype, djangorestframework, django-environ and django-csp-style settings. The examples are Python and HTML templates with JavaScript for the CSRF fetch sample.

## When your agent uses it

> Django security best practices, authentication, authorization, CSRF protection, SQL injection prevention, XSS prevention, and secure deployment configurations. Use when reviewing Django authentication, authorization, input handling, or deployment settings.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/django-security)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/django-security)

## Features

- **Production settings hardening:** Covers HTTPS redirects, secure cookies, HSTS, frame and content-type headers, and required secret keys.
- **Authentication setup:** Shows custom user models, password hasher ordering, password validators and session lifetime options.
- **Authorization patterns:** Explains model permissions, permission mixins, object-level checks and role-based access helpers.
- **Injection and XSS defenses:** Demonstrates safe ORM queries, parameterized raw SQL, template escaping and safe HTML handling.
- **CSRF and upload checks:** Describes CSRF usage for forms and AJAX and validates uploads by content type and size.

## Good for

- Review a Django app's login and permission logic for weaknesses
- Check production settings before deploying a Django site
- Find unsafe raw SQL or unescaped template output in a codebase
- Add file upload validation to a Django model
- Set up CSRF handling for a JavaScript frontend calling Django views

## Install

### Claude Code

This skill ships in the `rea-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath
```

Or copy only this skill to `~/.claude/skills/django-security`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/django-security &&
cp -R "$tmp/.agents/skills/django-security" ~/.claude/skills/django-security &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/django-security` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/django-security` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/django-security &&
cp -R "$tmp/.agents/skills/django-security" ~/.agents/skills/django-security &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/django-security` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/django-security` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/django-security &&
cp -R "$tmp/.agents/skills/django-security" ~/.cursor/skills/django-security &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/django-security` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/django-security
```

Or copy the folder to `~/.gemini/skills/django-security` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/django-security`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/django-security &&
cp -R "$tmp/.agents/skills/django-security" ~/.copilot/skills/django-security &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/django-security` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git
```

Then copy `REA_Skill/.agents/skills/django-security` into your agent's skills folder as `django-security`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does Django security need to be installed?

It is a plain SKILL.md folder with no scripts. The examples rely on Django and some optional packages such as djangorestframework, python-magic or filetype, and django-environ, depending on the code you adopt.

### Does Django security change my Django project automatically?

No. It gives the agent reference patterns and checklists to follow when a task matches, such as reviewing authentication or deployment settings.

### When does the agent use Django security?

When the task involves reviewing Django authentication, authorization, input handling or deployment settings, as described in its SKILL.md.

### Does Django security include scripts or automated checks?

No scripts are included. The guidance is delivered as code examples and a quick security checklist.

### How do I install Django security in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/django-security to use it in all your projects, or to .claude/skills/django-security in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

### Does Django security run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Django security?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Django security?

The closest alternatives to Django security are Django patterns, Django access review, Security review, Spring security and Django TDD.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Django patterns](https://ai-powered.com/skills/django-patterns): Django patterns is an open-source agent skill for developer tools.
- [Django access review](https://ai-powered.com/skills/django-access-review): Django access review is an open-source agent skill for security.
- [Security review](https://ai-powered.com/skills/security-review-getsentry): Security review is an open-source agent skill for security.
- [Spring security](https://ai-powered.com/skills/spring-security): Spring security is an open-source agent skill for security.
- [Django TDD](https://ai-powered.com/skills/django-tdd): Django TDD is an open-source agent skill for developer tools.
- [Django verification](https://ai-powered.com/skills/django-verification): Django verification is an open-source agent skill for developer tools.
- [Frontend security](https://ai-powered.com/skills/frontend-security): Frontend security is an open-source agent skill for security.
- [Agent security hardening](https://ai-powered.com/skills/agent-security-hardening): Agent security hardening is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/django-security
