Token导航 LogoToken导航

Agent Skill · 研究检索

debug%3adjango(调试 3adjango)

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

debug%3adjango 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,暂无第三方扫描结果,按安装量在研究检索类的 73,675 个 Skill 里排第 52,216。

总安装 563周安装 23GitHub Stars 7下载 180核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:debug%3adjango(调试 3adjango)
来源仓库:https://github.com/snakeo/claude-debug-and-refactor-skills-plugin
仓库路径:skills/debug%3Adjango
安装命令:
npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:django
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:django

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件或访问数据库时应明确运行目录和输入输出范围。

安装命令为 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:django,适用于主流 AI 宿主环境。注意该技能归类为研究检索,建议在使用前进一步验证其适用场景和安全边界。

来源仓库内路径:skills/debug%3Adjango

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

debug%3adjango 怎么安装?

在终端执行 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill d…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

debug%3adjango 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

debug%3adjango 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:django 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

debug%3adjango 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

debug%3adjango 用的人多吗?

公开数据是累计安装 563 次,近一周安装 23 次,下载 180 次,GitHub 7 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

debug%3adjango 安全吗?

没有查到第三方扫描结果,安全性无法从公开资料判断,安装前请自行审查源码、依赖和命令行为。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 没有第三方扫描结果,安全性只能靠自己读源码判断。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 要求有安全扫描结论才肯安装的团队。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
debug%3adjango

调试 3adjango · 本页

5637执行命令未明确未收录

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Django Debugging Guide

Overview

Django debugging requires understanding the framework's layered architecture: settings, URL routing, views, templates, models, and middleware. Effective debugging follows a systematic approach - reproducing the bug, isolating the problem, gathering evidence, and implementing verified fixes.

Key principles:

  • Reproduce first: Repeat the exact steps that cause the issue
  • Isolate systematically: Identify the exact module, function, or code path
  • Gather evidence: Collect error messages, stack traces, logs, and database state
  • Test your fix: Verify the solution with automated tests

Common Error Patterns

TemplateDoesNotExist

Cause: Django cannot find the specified template file.

Investigation steps:

  1. Check template exists in the correct directory
  2. Verify TEMPLATES['DIRS'] setting includes your template directories
  3. Check for typos in template path
  4. Ensure app is in INSTALLED_APPS if using app-specific templates
# Check template configuration
python manage.py shell -c "from django.conf import settings; print(settings.TEMPLATES)"

# Verify template directories exist
python manage.py shell -c "import os; from django.conf import settings; print([d for d in settings.TEMPLATES[0]['DIRS'] if os.path.exists(d)])"

ImproperlyConfigured

Cause: Django configuration error in settings.py or environment.

Common causes:

  • Missing or incorrect DJANGO_SETTINGS_MODULE
  • Invalid database configuration
  • Missing required settings
  • Incorrect app configuration
# Check settings module
echo $DJANGO_SETTINGS_MODULE

# Validate configuration
python manage.py check

# Compare with defaults
python manage.py diffsettings

IntegrityError / Database Errors

Cause: Database constraint violations or missing migrations.

OperationalError (missing column/table):

# Check migration status
python manage.py showmigrations

# Create missing migrations
python manage.py makemigrations

# Apply migrations
python manage.py migrate

# Check SQL that would be executed
python manage.py sqlmigrate <app_name> <migration_number>

IntegrityError (constraint violation):

# Check for duplicates before insert
from django.db import IntegrityError

try:
    obj.save()
except IntegrityError as e:
    # Log the error, check constraint name
    print(f"Constraint violation: {e}")

N+1 Query Problems

Cause: Inefficient database queries in loops.

Detection:

# In settings.py (development only)
LOGGING = {
    'version': 1,
    'handlers': {'console': {'class': 'logging.StreamHandler'}},
    'loggers': {
        'django.db.backends': {
            'level': 'DEBUG',
            'handlers': ['console'],
        }
    }
}

Solution - use select_related/prefetch_related:

# Bad: N+1 queries
for order in Order.objects.all():
    print(order.customer.name)  # Extra query per order

# Good: Single query with join
for order in Order.objects.select_related('customer'):
    print(order.customer.name)

# For many-to-many or reverse foreign keys
orders = Order.objects.prefetch_related('items')

Migration Conflicts

Cause: Multiple developers creating migrations on same app.

# View migration graph
python manage.py showmigrations --plan

# Merge conflicting migrations
python manage.py makemigrations --merge

# Reset migrations (development only - DANGEROUS)
python manage.py migrate <app_name> zero
python manage.py makemigrations <app_name>
python manage.py migrate <app_name>

CSRF Verification Failures

Cause: Missing CSRF token or misconfigured trusted origins.

Checklist:

  1. Include {% csrf_token %} in forms
  2. Check CSRF_TRUSTED_ORIGINS for HTTPS sites
  3. Verify middleware includes CsrfViewMiddleware
  4. For AJAX, include CSRF token in headers
# settings.py - for cross-origin requests
CSRF_TRUSTED_ORIGINS = [
    'https://your-domain.com',
]

Import Errors / Circular Imports

Cause: Circular dependencies between modules.

Detection:

# Check for import errors
python -c "import your_app"

# Verbose import tracing
python -v -c "import your_app" 2>&1 | grep "import"

Solutions:

  • Move imports inside functions (lazy import)
  • Restructure modules to break cycles
  • Use string references for model relationships
# Avoid circular import with lazy import
def my_function():
    from other_module import SomeClass  # Import inside function
    return SomeClass()

# Use string reference in ForeignKey
class Order(models.Model):
    customer = models.ForeignKey('customers.Customer', on_delete=models.CASCADE)

DoesNotExist

Cause: Querying for an object that does not exist in the database.

# Bad: Raises DoesNotExist
user = User.objects.get(id=999)

# Good: Handle missing objects
from django.shortcuts import get_object_or_404
user = get_object_or_404(User, id=999)

# Or use get_or_create
user, created = User.objects.get_or_create(
    username='john',
    defaults={'email': 'john@example.com'}
)

# Or wrap in try-except
try:
    user = User.objects.get(id=999)
except User.DoesNotExist:
    user = None

DisallowedHost

Cause: Request host not in ALLOWED_HOSTS setting.

# settings.py
ALLOWED_HOSTS = [
    'localhost',
    '127.0.0.1',
    'your-domain.com',
    '.your-domain.com',  # Wildcard for subdomains
]

NoReverseMatch

Cause: URL reverse lookup failed - URL name not found or wrong arguments.

# List all URL patterns
python manage.py show_urls  # requires django-extensions

# Or manually inspect
python manage.py shell -c "from django.urls import get_resolver; print([p.name for p in get_resolver().url_patterns])"
# Check URL name matches exactly
from django.urls import reverse
url = reverse('app_name:view_name', args=[object_id])
url = reverse('app_name:view_name', kwargs={'pk': object_id})

Debugging Tools

Django Debug Toolbar

The most powerful visual debugging tool for Django development.

Installation:

pip install django-debug-toolbar

Configuration:

# settings.py (development only)
INSTALLED_APPS = [
    # ...
    'debug_toolbar',
]

MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    # ... other middleware
]

INTERNAL_IPS = ['127.0.0.1']

# For Docker
DEBUG_TOOLBAR_CONFIG = {
    'SHOW_TOOLBAR_CALLBACK': 'debug_toolbar.middleware.show_toolbar_with_docker',
}
# urls.py
from debug_toolbar.toolbar import debug_toolbar_urls

urlpatterns = [
    # ... your URLs
] + debug_toolbar_urls()

Key panels:

  • SQL: All database queries with timing and EXPLAIN
  • Templates: Rendered templates and context variables
  • Cache: Cache hits/misses
  • Request: Headers, cookies, session data
  • Signals: Django signals fired

Python Debugger (pdb/ipdb)

# Insert breakpoint in code
breakpoint()  # Python 3.7+ (uses PYTHONBREAKPOINT env var)

# Or explicitly
import pdb; pdb.set_trace()

# For better experience
import ipdb; ipdb.set_trace()

Common pdb commands:

  • n (next): Execute next line
  • s (step): Step into function
  • c (continue): Continue execution
  • p variable: Print variable value
  • pp variable: Pretty print
  • l (list): Show current code
  • w (where): Show stack trace
  • q (quit): Exit debugger

django-extensions shell_plus

pip install django-extensions

# Add to INSTALLED_APPS
INSTALLED_APPS = ['django_extensions', ...]

# Use enhanced shell with auto-imports
python manage.py shell_plus

# With IPython
python manage.py shell_plus --ipython

# Print SQL queries
python manage.py shell_plus --print-sql

Logging Configuration

# settings.py
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '{levelname} {asctime} {module} {message}',
            'style': '{',
        },
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'verbose',
        },
        'file': {
            'class': 'logging.FileHandler',
            'filename': 'debug.log',
            'formatter': 'verbose',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console'],
            'level': 'INFO',
        },
        'django.db.backends': {
            'handlers': ['console'],
            'level': 'DEBUG',  # Shows all SQL queries
        },
        'myapp': {
            'handlers': ['console', 'file'],
            'level': 'DEBUG',
        },
    },
}

Usage in code:

import logging
logger = logging.getLogger(__name__)

logger.debug('Detailed information')
logger.info('General information')
logger.warning('Warning message')
logger.error('Error occurred', exc_info=True)  # Include traceback
logger.exception('Exception occurred')  # Auto-includes traceback

SQL Query Logging

# In Django shell
from django.db import connection
from django.db import reset_queries

reset_queries()
# ... execute your queries ...
print(connection.queries)

# Or use QuerySet.explain()
queryset = User.objects.filter(is_active=True)
print(queryset.explain())

The Four Phases (Django-Specific)

Phase 1: Root Cause Investigation

Gather evidence systematically:

# 1. Check Django configuration
python manage.py check
python manage.py check --deploy  # Production security checks

# 2. Review migration state
python manage.py showmigrations
python manage.py showmigrations --plan  # Execution order

# 3. Inspect settings
python manage.py diffsettings  # Compare with Django defaults

# 4. Check logs
tail -f debug.log
docker compose logs -f api  # If using Docker

Examine the error traceback:

  • Note the exception type (determines error category)
  • Find the last line of YOUR code (not Django internals)
  • Check variable values in the frame

Database state inspection:

# In shell
python manage.py shell

from myapp.models import MyModel
MyModel.objects.count()
MyModel.objects.filter(status='error').values()

Phase 2: Pattern Analysis

Compare with working patterns:

  1. Check similar working code: Find views/functions that work and compare
  2. Review Django documentation: Verify correct usage of APIs
  3. Check third-party package versions: Ensure compatibility
# Check installed versions
pip freeze | grep -i django
pip show django-rest-framework

Common pattern mismatches:

  • Missing return in view functions
  • Wrong queryset method order
  • Incorrect URL pattern syntax
  • Missing model field attributes

Phase 3: Hypothesis and Testing

Write a failing test first:

# tests/test_debug.py
import pytest
from django.test import TestCase, Client

@pytest.mark.django_db
class TestBugFix(TestCase):
    def test_reproduces_bug(self):
        """This test should fail until bug is fixed."""
        client = Client()
        response = client.get('/problematic-url/')
        self.assertEqual(response.status_code, 200)
        # Add assertions that currently fail

    def test_edge_case(self):
        """Test the specific input that causes the bug."""
        from myapp.services import problematic_function
        result = problematic_function(edge_case_input)
        self.assertEqual(result, expected_output)

Run tests in isolation:

# Run single test
pytest tests/test_debug.py::TestBugFix::test_reproduces_bug -v

# Run with verbose SQL output
pytest tests/test_debug.py -v --capture=no

# Run with debugger on failure
pytest tests/test_debug.py --pdb

# Run with coverage
pytest tests/test_debug.py --cov=myapp --cov-report=term-missing

Phase 4: Implementation

Implement the fix:

  1. Make minimal changes to fix the issue
  2. Ensure existing tests still pass
  3. Add new tests for the specific bug
  4. Document the fix in commit message

Verify the fix:

# Run all tests
pytest -v

# Run specific test file
pytest tests/test_affected_module.py -v

# Check for regressions
pytest tests/ -v --tb=short

# Verify in development server
python manage.py runserver

Post-fix checklist:

  • All tests pass
  • No new warnings introduced
  • python manage.py check passes
  • Related functionality manually tested
  • Code reviewed

Quick Reference Commands

Django Management Commands

# System checks
python manage.py check                    # Run system checks
python manage.py check --deploy           # Production deployment checks
python manage.py check --tag security     # Security-specific checks

# Migrations
python manage.py showmigrations           # List all migrations and status
python manage.py showmigrations --plan    # Show execution order
python manage.py sqlmigrate app 0001      # Show SQL for migration
python manage.py makemigrations --dry-run # Preview migration creation
python manage.py migrate --plan           # Show migration plan

# Settings
python manage.py diffsettings             # Show non-default settings
python manage.py diffsettings --all       # Show all settings

# Database
python manage.py dbshell                  # Database shell
python manage.py inspectdb                # Generate models from database

# Shell
python manage.py shell                    # Django shell
python manage.py shell_plus               # Enhanced shell (django-extensions)
python manage.py shell_plus --print-sql   # Shell with SQL logging

# URLs
python manage.py show_urls                # List all URLs (django-extensions)

# Cleanup
python manage.py clearsessions            # Clear expired sessions
python manage.py flush                    # Clear database (DANGEROUS)

Quick Debugging Snippets

# Print all SQL queries in view
from django.db import connection
def my_view(request):
    # ... view logic ...
    for query in connection.queries:
        print(query['sql'])

# Check if request is AJAX
request.headers.get('X-Requested-With') == 'XMLHttpRequest'

# Inspect request data
print(request.GET.dict())
print(request.POST.dict())
print(request.body)
print(dict(request.headers))

# Debug template context
# In template:
{% debug %}

# Or in view:
from django.template import engines
engine = engines['django']
template = engine.from_string("{{ debug }}")

Environment Debugging

# Check Python environment
which python
python --version
pip list

# Check Django version
python -c "import django; print(django.VERSION)"

# Check database connection
python manage.py dbshell -c "SELECT 1;"

# Check Redis connection (if using)
redis-cli ping

# Check Celery workers
celery -A config inspect active
celery -A config inspect stats

Additional Resources

平台分布

Codex

34.67%
按下载量换算62

Claude

31.89%
按下载量换算57

Cursor

19.13%
按下载量换算34

Gemini CLI

10.84%
按下载量换算20

安全审计

暂无安全审计结果可展示。

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/snakeo/claude-debug-and-refactor-skills-plugin --skill debug:django 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills