Django TDD
Django 测试策略,包括 pytest-django、TDD 方法、factory_boy、模拟、覆盖率以及测试 Django REST Framework API。
Install
/plugin marketplace add xu-xiang/everything-claude-code-zhThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add xu-xiang/everything-claude-code-zh --skill django-tddgit clone --depth 1 https://github.com/xu-xiang/everything-claude-code-zh.git /tmp/everything-claude-code-zh
mkdir -p ~/.claude/skills
cp -r /tmp/everything-claude-code-zh/docs/zh-CN/skills/django-tdd ~/.claude/skills/django-tddPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# 使用 TDD 进行 Django 测试
使用 pytest、factory\_boy 和 Django REST Framework 进行 Django 应用程序的测试驱动开发。
## 何时激活
* 编写新的 Django 应用程序时
* 实现 Django REST Framework API 时
* 测试 Django 模型、视图和序列化器时
* 为 Django 项目设置测试基础设施时
## Django 的 TDD 工作流
### 红-绿-重构循环
```python
# Step 1: RED - Write failing test
def test_user_creation():
user = User.objects.create_user(email='test@example.com', password='testpass123')
assert user.email == 'test@example.com'
assert user.check_password('testpass123')
assert not user.is_staff
# Step 2: GREEN - Make test pass
# Create User model or factory
# Step 3: REFACTOR - Improve while keeping tests green
```
## 设置
### pytest 配置
```ini
# pytest.ini
[pytest]
DJANGO_SETTINGS_MODULE = config.settings.test
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*
addopts =
--reuse-db
--nomigrations
--cov=apps
--cov-report=html
--cov-report=term-missing
--strict-markers
markers =
slow: marks tests as slow
integration: marks tests as integration tests
```
### 测试设置Details
- Skill name
django-tdd- Repository
- xu-xiang/everything-claude-code-zh
- Path
docs/zh-CN/skills/django-tdd/SKILL.md- License
- MIT
- Repo updated
- 5 March 2026
FAQ
What does the Django TDD skill do?
Django 测试策略,包括 pytest-django、TDD 方法、factory_boy、模拟、覆盖率以及测试 Django REST Framework API。
How do I install the Django TDD skill?
Claude Code plugin: /plugin marketplace add xu-xiang/everything-claude-code-zh. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Django TDD popular?
It lives in xu-xiang/everything-claude-code-zh, which has 2,037 GitHub stars and 332 forks.
Related skills
Backend Patterns
2kxu-xiang/everything-claude-code-zh
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Coding Standards
2kxu-xiang/everything-claude-code-zh
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
Frontend Patterns
2kxu-xiang/everything-claude-code-zh
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
Django TDD
2kxu-xiang/everything-claude-code-zh
使用 pytest-django 进行 Django 测试的策略、TDD 方法论、factory_boy、Mock 模拟、测试覆盖率以及测试 Django REST Framework API。
Django Security
2kxu-xiang/everything-claude-code-zh
Django 安全最佳实践、认证、授权、CSRF 防护、SQL 注入预防、XSS 预防和安全部署配置。
Django Verification
2kxu-xiang/everything-claude-code-zh
Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.