parallel-fix-django

Fix Django-specific blockers identified in parallelization readiness assessment

9 stars

Best use case

parallel-fix-django is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Fix Django-specific blockers identified in parallelization readiness assessment

Teams using parallel-fix-django should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/parallel-fix-django/SKILL.md --create-dirs "https://raw.githubusercontent.com/jpoutrin/product-forge/main/plugins/python-experts/skills/parallel-fix-django/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/parallel-fix-django/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How parallel-fix-django Compares

Feature / Agentparallel-fix-djangoStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Fix Django-specific blockers identified in parallelization readiness assessment

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# parallel-fix-django

**Category**: Parallel Development (Django)

## Usage

```bash
/parallel-fix-django [--dimension <name>] [--dry-run]
```

## Arguments

- `--dimension`: Optional - Focus on specific dimension (app-boundaries, shared-state, contracts, tests, docs, deps)
- `--dry-run`: Optional - Show what would be fixed without making changes

## Purpose

Fix blockers identified by `/parallel-ready-django` to prepare the Django codebase for parallel multi-agent development. References the `remediation-checklist.md` from the skill.

## Prerequisites

- Run `/parallel-ready-django` first
- `.claude/readiness-report.md` must exist with identified blockers

## Execution Instructions for Claude Code

When this command is run, Claude Code should:

### 1. Read Readiness Report

```bash
cat .claude/readiness-report.md
```

Parse the "Blockers" and "Risks" sections to identify what needs fixing.

### 2. Fix by Dimension

#### App Boundaries Fixes

**Problem: God App (>15 models)**
```
1. Identify models that can be grouped by domain
2. Create new Django app: python manage.py startapp [domain] apps/[domain]
3. Move models incrementally with migrations
4. Update all imports
5. Verify tests pass
```

**Problem: Circular Imports**
```python
# Before - circular import
from apps.orders.models import Order  # in users/models.py
from apps.users.models import User    # in orders/models.py

# After - use string reference
class Order(models.Model):
    user = models.ForeignKey("users.User", on_delete=models.CASCADE)
```

**Problem: Cross-App Imports >30%**
```
1. Identify shared types/utilities
2. Create apps/shared/ app for common code
3. Move shared code to shared app
4. Update imports to use shared
```

#### Shared State Fixes

**Problem: Cross-App Signals**
```python
# Before - implicit signal
@receiver(post_save, sender=User)
def create_user_stats(sender, instance, created, **kwargs):
    if created:
        UserStats.objects.create(user=instance)

# After - explicit service call
class UserService:
    def __init__(self, stats_service: StatsService):
        self.stats_service = stats_service

    def create_user(self, email: str, name: str) -> User:
        user = User.objects.create(email=email, name=name)
        self.stats_service.initialize_for_user(user.id)
        return user
```

**Problem: Global Mutable State**
```python
# Before - global variable
_cache = {}

# After - use Django cache
from django.core.cache import cache

def get_cached_value(key: str):
    return cache.get(key)
```

#### API Contracts Fixes

**Problem: Serializers with `__all__`**
```python
# Before
class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = "__all__"

# After - explicit fields
class UserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ["id", "email", "name", "created_at"]
        read_only_fields = ["id", "created_at"]
```

**Problem: No Mypy Configuration**

Add to `pyproject.toml`:
```toml
[tool.mypy]
python_version = "3.11"
strict = true
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]

[[tool.mypy.overrides]]
module = "*.migrations.*"
ignore_errors = true

[tool.django-stubs]
django_settings_module = "config.settings.local"
```

Install dependencies:
```bash
pip install django-stubs djangorestframework-stubs mypy
```

**Problem: No OpenAPI**

Add drf-spectacular:
```bash
pip install drf-spectacular
```

Update settings:
```python
INSTALLED_APPS = [..., "drf_spectacular"]

REST_FRAMEWORK = {
    "DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}

SPECTACULAR_SETTINGS = {
    "TITLE": "Project API",
    "VERSION": "1.0.0",
}
```

Add URL:
```python
from drf_spectacular.views import SpectacularAPIView

urlpatterns = [
    path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
]
```

#### Test Infrastructure Fixes

**Problem: No Pytest Setup**
```bash
pip install pytest pytest-django factory-boy
```

Create `conftest.py`:
```python
import pytest

@pytest.fixture(autouse=True)
def enable_db_access_for_all_tests(db):
    pass
```

Add to `pyproject.toml`:
```toml
[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "config.settings.test"
python_files = ["test_*.py"]
addopts = "-v --tb=short"
```

**Problem: No Factories**

Create `apps/[app]/tests/factories.py`:
```python
import factory
from apps.users.models import User

class UserFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = User

    email = factory.Sequence(lambda n: f"user{n}@example.com")
    name = factory.Faker("name")
```

#### Documentation Fixes

**Problem: No CLAUDE.md**

Create `CLAUDE.md` with Django conventions. Reference `infrastructure-setup.md` from skill for full template.

**Problem: No Linting**

Add to `pyproject.toml`:
```toml
[tool.ruff]
target-version = "py311"
line-length = 88
select = ["E", "W", "F", "I", "B", "C4", "UP"]

[tool.ruff.isort]
known-first-party = ["apps", "config"]
```

Run initial format:
```bash
pip install ruff
ruff format .
ruff check . --fix
```

#### Dependencies Fixes

**Problem: Too Many Migrations**
```bash
# Squash migrations
python manage.py squashmigrations [app] 0001 [last_migration]
```

**Problem: Unpinned Dependencies**
```bash
# Pin all dependencies
pip freeze > requirements.txt
# Or use poetry
poetry lock
```

### 3. Re-run Assessment

After fixes, suggest re-running assessment:
```
/parallel-ready-django
```

### 4. Report Results

Output:
```
🔧 Django Parallelization Fixes Applied

Fixed Issues:
✅ Converted 5 serializers from __all__ to explicit fields
✅ Added mypy configuration to pyproject.toml
✅ Created CLAUDE.md with Django conventions
✅ Added ruff linting configuration

Remaining Issues:
⚠️ 2 cross-app signals need manual review (apps/orders/signals.py)
⚠️ God app 'core' has 18 models - consider splitting

Next steps:
1. Review remaining issues manually
2. Run /parallel-ready-django to verify score improved
3. Target score ≥80 before running /parallel-decompose
```

## Example

```bash
# Fix all blockers
/parallel-fix-django

# Fix only serializer issues
/parallel-fix-django --dimension contracts

# Preview changes without applying
/parallel-fix-django --dry-run

# After fixing, re-assess
/parallel-ready-django
```

## Related Commands

- `/parallel-ready-django` - Run assessment first
- `/parallel-setup` - Ensure infrastructure exists
- `/parallel-decompose` - Create tasks after score ≥80

Related Skills

review-django-commands

9
from jpoutrin/product-forge

Review Django management commands for proper structure and refactor if needed

parallel-ready-django

9
from jpoutrin/product-forge

Audit and prepare a Django codebase for parallel multi-agent development. Use when asked to check if a Django project is ready for parallelization, prepare a repo for multi-agent work, audit codebase structure, set up orchestration infrastructure, or identify blockers for parallel development. Analyzes Django apps, models, migrations, and module boundaries.

django-project-setup

9
from jpoutrin/product-forge

Set up a new Django 6.0 project with modern tooling (uv, direnv, HTMX, OAuth, DRF, testing). Use when the user wants to create a Django project from scratch with production-ready configuration.

django

9
from jpoutrin/product-forge

Django development patterns and conventions (2025). Auto-loads when working with Django models, views, URLs, forms, templates, management commands, or project structure. Includes async support and type hints.

django-api

9
from jpoutrin/product-forge

Django API development for 2025. Covers Django Ninja (modern, async-first, type-safe) and Django REST Framework (mature, ecosystem-rich). Use when building REST APIs, choosing between frameworks, implementing authentication, permissions, filtering, pagination, or async endpoints.

parallel-validate-prompts

9
from jpoutrin/product-forge

Validate and fix parallel prompts for required sections

parallel-task-format

9
from jpoutrin/product-forge

Compact YAML format for defining parallel task specifications with scope, boundaries, and agent assignments. Use when creating task files for parallel development.

parallel-setup

9
from jpoutrin/product-forge

One-time setup of parallel/ directory for multi-agent development

parallel-run

9
from jpoutrin/product-forge

Orchestrate parallel agent execution with git worktrees

parallel-prompt-generator

9
from jpoutrin/product-forge

Generate agent-ready prompts from existing task specification files. Use when regenerating prompts after editing tasks, updating prompt templates, or preparing tasks for cpo execution.

parallel-integrate

9
from jpoutrin/product-forge

Verify integration after parallel agent execution and generate report

parallel-execution

9
from jpoutrin/product-forge

Execute multiple Claude Code agents in parallel using the cpo CLI tool. Use when running parallel tasks, monitoring execution, or understanding the execution workflow.