update
This commit is contained in:
parent
03d2c6c005
commit
5e26b197e3
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
### Installation
|
||||||
|
|
||||||
|
{
|
||||||
|
"global": {
|
||||||
|
"systemPromptPath": "/Users/DEINNAME/Work/claude-vault/system/global-instructions.md"
|
||||||
|
}
|
||||||
|
}
|
||||||
13
knowledge/anti-patterns/template.md
Normal file
13
knowledge/anti-patterns/template.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# ANTI-PATTERN: [TITEL DES FEHLERS]
|
||||||
|
|
||||||
|
## KONTEXT
|
||||||
|
In welchem Projekt/Zusammenhang trat das Problem auf?
|
||||||
|
|
||||||
|
## WAS IST PASSIERT?
|
||||||
|
Beschreibung der fehlerhaften Implementierung oder der schlechten Erfahrung.
|
||||||
|
|
||||||
|
## WARUM WAR ES SCHLECHT?
|
||||||
|
(z.B. Performance-Einbruch, schwer wartbar, Sicherheitslücke).
|
||||||
|
|
||||||
|
## DIE BESSERE ALTERNATIVE
|
||||||
|
Was sollen wir in Zukunft stattdessen tun?
|
||||||
11
knowledge/preferences.md
Normal file
11
knowledge/preferences.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# PERSÖNLICHE PRÄFERENZEN
|
||||||
|
|
||||||
|
## TECH-STACKS
|
||||||
|
- **Frontend:** React, Tailwind CSS, TypeScript, Next.js.
|
||||||
|
- **Backend:** Python (Django).
|
||||||
|
- **Datenbank:** PostgreSQL.
|
||||||
|
|
||||||
|
## CODING STYLE
|
||||||
|
|
||||||
|
## WORKFLOW
|
||||||
|
- Dokumentation immer in Markdown.
|
||||||
15
memory/snapshots/template.md
Normal file
15
memory/snapshots/template.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# SNAPSHOT: [PROJEKT-NAME] - [DATUM]
|
||||||
|
|
||||||
|
## 1. STATUS QUO
|
||||||
|
- Was wurde heute erreicht?
|
||||||
|
- Welche Dateien wurden maßgeblich verändert?
|
||||||
|
|
||||||
|
## 2. TECHNISCHE ENTSCHEIDUNGEN
|
||||||
|
- Warum wurde Lösung A statt B gewählt? (Verweis auf ADR falls nötig).
|
||||||
|
|
||||||
|
## 3. NEXT STEPS (Dringend)
|
||||||
|
- [ ] Task 1
|
||||||
|
- [ ] Task 2
|
||||||
|
|
||||||
|
## 4. BLOCKER / OFFENE FRAGEN
|
||||||
|
- Worüber müssen wir in der nächsten Session nachdenken?
|
||||||
@ -1,513 +0,0 @@
|
|||||||
---
|
|
||||||
name: django-6-upgrade
|
|
||||||
description: "⚠️ DRAFT/SPEKULATIV - Django 6.0 ist noch nicht released! Diese Dokumentation basiert auf erwarteten Features. Für aktuelle Upgrades (4.2 → 5.2) bitte offizielle Django Docs verwenden."
|
|
||||||
argument-hint: [--check-only | --full-upgrade]
|
|
||||||
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, WebFetch
|
|
||||||
---
|
|
||||||
|
|
||||||
> **⚠️ DRAFT - NICHT PRODUKTIONSREIF**
|
|
||||||
>
|
|
||||||
> Django 6.0 ist noch nicht released (Stand: Februar 2026).
|
|
||||||
> Diese Dokumentation basiert auf Spekulationen und erwarteten Features.
|
|
||||||
> Features wie "Background Tasks Framework", "Template Partials", "CSP Middleware" sind NICHT bestätigt.
|
|
||||||
>
|
|
||||||
> **Für aktuelle Upgrades bitte offizielle Django Dokumentation verwenden:**
|
|
||||||
> - Django 4.2 → 5.0: https://docs.djangoproject.com/en/5.0/releases/5.0/
|
|
||||||
> - Django 5.0 → 5.1: https://docs.djangoproject.com/en/5.1/releases/5.1/
|
|
||||||
> - Django 5.1 → 5.2: https://docs.djangoproject.com/en/5.2/releases/5.2/
|
|
||||||
|
|
||||||
# Django 5.2 → 6.0 Upgrade Guide (DRAFT/SPEKULATIV)
|
|
||||||
|
|
||||||
Comprehensive guide for upgrading Django projects from 5.2 LTS to 6.0, covering breaking changes, removed deprecations, and new features like background tasks, template partials, and CSP support.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- Upgrading a Django 5.2 project to Django 6.0
|
|
||||||
- Checking compatibility before upgrading
|
|
||||||
- Fixing deprecation warnings from Django 5.x
|
|
||||||
- Adopting new Django 6.0 features (CSP, template partials, background tasks)
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- **Python 3.12+** required (Django 6.0 drops Python 3.10/3.11 support)
|
|
||||||
- Django 5.2 project with passing tests
|
|
||||||
- All third-party packages compatible with Django 6.0
|
|
||||||
|
|
||||||
## Upgrade Checklist
|
|
||||||
|
|
||||||
### Phase 1: Pre-Upgrade Preparation
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Check Python version (must be 3.12+)
|
|
||||||
python --version
|
|
||||||
|
|
||||||
# 2. Run deprecation warnings check
|
|
||||||
python -Wd manage.py check
|
|
||||||
python -Wd manage.py test
|
|
||||||
|
|
||||||
# 3. Run django-upgrade tool (automatic fixes)
|
|
||||||
pip install django-upgrade
|
|
||||||
django-upgrade --target-version 6.0 **/*.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Phase 2: Breaking Changes
|
|
||||||
|
|
||||||
#### 1. Python Version Requirement
|
|
||||||
|
|
||||||
```python
|
|
||||||
# pyproject.toml or setup.py
|
|
||||||
# BEFORE
|
|
||||||
python_requires = ">=3.10"
|
|
||||||
|
|
||||||
# AFTER
|
|
||||||
python_requires = ">=3.12"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. DEFAULT_AUTO_FIELD Change
|
|
||||||
|
|
||||||
Django 6.0 defaults to `BigAutoField`. If your project already sets this, you can remove it:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# settings.py
|
|
||||||
# REMOVE this line if it's set to BigAutoField (now the default)
|
|
||||||
# DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
|
||||||
|
|
||||||
# KEEP if using a different field type
|
|
||||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' # Keep if intentional
|
|
||||||
```
|
|
||||||
|
|
||||||
**WARNING**: Removing `DEFAULT_AUTO_FIELD` when set to `AutoField` will cause migrations!
|
|
||||||
|
|
||||||
#### 3. Database Backend Changes
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2)
|
|
||||||
class MyDatabaseOperations(DatabaseOperations):
|
|
||||||
def return_insert_columns(self, fields):
|
|
||||||
...
|
|
||||||
def fetch_returned_insert_rows(self, cursor):
|
|
||||||
...
|
|
||||||
def fetch_returned_insert_columns(self, cursor):
|
|
||||||
...
|
|
||||||
|
|
||||||
# AFTER (Django 6.0)
|
|
||||||
class MyDatabaseOperations(DatabaseOperations):
|
|
||||||
def returning_columns(self, fields): # Renamed
|
|
||||||
...
|
|
||||||
def fetch_returned_rows(self, cursor): # Renamed
|
|
||||||
...
|
|
||||||
# fetch_returned_insert_columns is REMOVED
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4. Email API Changes
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2)
|
|
||||||
from django.core.mail import BadHeaderError, SafeMIMEText, SafeMIMEMultipart
|
|
||||||
from django.core.mail.message import sanitize_address, forbid_multi_line_headers
|
|
||||||
|
|
||||||
try:
|
|
||||||
send_mail(subject, message, from_email, [to_email])
|
|
||||||
except BadHeaderError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# AFTER (Django 6.0)
|
|
||||||
# BadHeaderError → ValueError
|
|
||||||
# SafeMIMEText/SafeMIMEMultipart → Use Python's email.mime classes directly
|
|
||||||
# sanitize_address/forbid_multi_line_headers → Removed
|
|
||||||
|
|
||||||
try:
|
|
||||||
send_mail(subject, message, from_email, [to_email])
|
|
||||||
except ValueError: # Replaces BadHeaderError
|
|
||||||
pass
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 5. ADMINS/MANAGERS Settings
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2) - Deprecated tuple format
|
|
||||||
ADMINS = [
|
|
||||||
('Admin Name', 'admin@example.com'),
|
|
||||||
('Another Admin', 'another@example.com'),
|
|
||||||
]
|
|
||||||
|
|
||||||
# AFTER (Django 6.0) - Email strings only
|
|
||||||
ADMINS = [
|
|
||||||
'admin@example.com',
|
|
||||||
'another@example.com',
|
|
||||||
]
|
|
||||||
|
|
||||||
# Same for MANAGERS
|
|
||||||
MANAGERS = [
|
|
||||||
'manager@example.com',
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 6. BaseConstraint Positional Arguments
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2)
|
|
||||||
class MyConstraint(BaseConstraint):
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
# AFTER (Django 6.0) - Positional args removed
|
|
||||||
class MyConstraint(BaseConstraint):
|
|
||||||
def __init__(self, *, name, violation_error_code=None, violation_error_message=None):
|
|
||||||
super().__init__(
|
|
||||||
name=name,
|
|
||||||
violation_error_code=violation_error_code,
|
|
||||||
violation_error_message=violation_error_message,
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 7. ModelAdmin.lookup_allowed() Signature
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2)
|
|
||||||
class MyModelAdmin(admin.ModelAdmin):
|
|
||||||
def lookup_allowed(self, lookup, value):
|
|
||||||
return super().lookup_allowed(lookup, value)
|
|
||||||
|
|
||||||
# AFTER (Django 6.0) - request is required
|
|
||||||
class MyModelAdmin(admin.ModelAdmin):
|
|
||||||
def lookup_allowed(self, lookup, value, request): # request added
|
|
||||||
return super().lookup_allowed(lookup, value, request)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 8. Prefetch QuerySet Method
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2)
|
|
||||||
class MyManager(Manager):
|
|
||||||
def get_prefetch_queryset(self, instances, queryset=None):
|
|
||||||
...
|
|
||||||
|
|
||||||
# AFTER (Django 6.0)
|
|
||||||
class MyManager(Manager):
|
|
||||||
def get_prefetch_querysets(self, instances, querysets=None): # Plural
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 9. Form Renderer Changes
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2) - Transitional renderers
|
|
||||||
from django.forms.renderers import DjangoDivFormRenderer, Jinja2DivFormRenderer
|
|
||||||
|
|
||||||
# AFTER (Django 6.0) - Removed, use standard renderers
|
|
||||||
from django.forms.renderers import DjangoTemplates, Jinja2
|
|
||||||
# Or the new default which uses div-based rendering
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 10. StringAgg Import Location
|
|
||||||
|
|
||||||
```python
|
|
||||||
# BEFORE (Django 5.2) - PostgreSQL only
|
|
||||||
from django.contrib.postgres.aggregates import StringAgg
|
|
||||||
|
|
||||||
# AFTER (Django 6.0) - Available for all databases
|
|
||||||
from django.db.models import StringAgg
|
|
||||||
|
|
||||||
# Note: Delimiter must be wrapped in Value() for string literals
|
|
||||||
from django.db.models import Value
|
|
||||||
result = MyModel.objects.aggregate(
|
|
||||||
names=StringAgg('name', delimiter=Value(', '))
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Phase 3: New Features to Adopt
|
|
||||||
|
|
||||||
#### 1. Content Security Policy (CSP)
|
|
||||||
|
|
||||||
```python
|
|
||||||
# settings.py
|
|
||||||
MIDDLEWARE = [
|
|
||||||
...
|
|
||||||
'django.middleware.security.ContentSecurityPolicyMiddleware', # Add
|
|
||||||
...
|
|
||||||
]
|
|
||||||
|
|
||||||
# CSP Configuration
|
|
||||||
SECURE_CSP = {
|
|
||||||
'default-src': ["'self'"],
|
|
||||||
'script-src': ["'self'", "'nonce'"], # 'nonce' enables nonce support
|
|
||||||
'style-src': ["'self'", "'unsafe-inline'"],
|
|
||||||
'img-src': ["'self'", 'data:', 'https:'],
|
|
||||||
'font-src': ["'self'"],
|
|
||||||
'connect-src': ["'self'"],
|
|
||||||
'frame-ancestors': ["'none'"],
|
|
||||||
}
|
|
||||||
|
|
||||||
# Report-only mode for testing
|
|
||||||
SECURE_CSP_REPORT_ONLY = {
|
|
||||||
'default-src': ["'self'"],
|
|
||||||
'report-uri': '/csp-report/',
|
|
||||||
}
|
|
||||||
|
|
||||||
# templates/base.html
|
|
||||||
TEMPLATES = [
|
|
||||||
{
|
|
||||||
...
|
|
||||||
'OPTIONS': {
|
|
||||||
'context_processors': [
|
|
||||||
...
|
|
||||||
'django.template.context_processors.csp', # Add for nonce support
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
```html
|
|
||||||
<!-- Template usage with nonce -->
|
|
||||||
<script nonce="{{ csp_nonce }}">
|
|
||||||
// Inline script with CSP nonce
|
|
||||||
</script>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. Template Partials
|
|
||||||
|
|
||||||
```html
|
|
||||||
<!-- templates/components.html -->
|
|
||||||
|
|
||||||
<!-- Define a partial -->
|
|
||||||
{% partialdef card %}
|
|
||||||
<div class="card">
|
|
||||||
<h3>{{ title }}</h3>
|
|
||||||
<p>{{ content }}</p>
|
|
||||||
</div>
|
|
||||||
{% endpartialdef %}
|
|
||||||
|
|
||||||
<!-- Define another partial -->
|
|
||||||
{% partialdef button %}
|
|
||||||
<button class="btn btn-{{ variant|default:'primary' }}">
|
|
||||||
{{ text }}
|
|
||||||
</button>
|
|
||||||
{% endpartialdef %}
|
|
||||||
|
|
||||||
|
|
||||||
<!-- templates/page.html -->
|
|
||||||
{% extends "base.html" %}
|
|
||||||
{% load partials %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<!-- Render partials -->
|
|
||||||
{% partial "components.html#card" title="Hello" content="World" %}
|
|
||||||
|
|
||||||
{% partial "components.html#button" text="Click me" variant="success" %}
|
|
||||||
|
|
||||||
<!-- Inline partial definition and use -->
|
|
||||||
{% partialdef alert %}
|
|
||||||
<div class="alert alert-{{ level }}">{{ message }}</div>
|
|
||||||
{% endpartialdef %}
|
|
||||||
|
|
||||||
{% partial alert level="warning" message="This is a warning" %}
|
|
||||||
{% endblock %}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3. Background Tasks Framework
|
|
||||||
|
|
||||||
```python
|
|
||||||
# myapp/tasks.py
|
|
||||||
from django.tasks import task, TaskResult
|
|
||||||
|
|
||||||
@task
|
|
||||||
def send_welcome_email(user_id: int) -> TaskResult:
|
|
||||||
"""Send welcome email to user."""
|
|
||||||
from django.contrib.auth import get_user_model
|
|
||||||
from django.core.mail import send_mail
|
|
||||||
|
|
||||||
User = get_user_model()
|
|
||||||
user = User.objects.get(pk=user_id)
|
|
||||||
|
|
||||||
send_mail(
|
|
||||||
subject='Welcome!',
|
|
||||||
message=f'Welcome to our site, {user.username}!',
|
|
||||||
from_email='noreply@example.com',
|
|
||||||
recipient_list=[user.email],
|
|
||||||
)
|
|
||||||
|
|
||||||
return TaskResult(success=True, result={'user_id': user_id})
|
|
||||||
|
|
||||||
|
|
||||||
@task(priority=10, queue='high-priority')
|
|
||||||
def process_order(order_id: int) -> TaskResult:
|
|
||||||
"""Process an order in the background."""
|
|
||||||
from myapp.models import Order
|
|
||||||
|
|
||||||
order = Order.objects.get(pk=order_id)
|
|
||||||
order.process()
|
|
||||||
|
|
||||||
return TaskResult(success=True, result={'order_id': order_id})
|
|
||||||
|
|
||||||
|
|
||||||
# views.py - Enqueue tasks
|
|
||||||
from myapp.tasks import send_welcome_email, process_order
|
|
||||||
|
|
||||||
def register_user(request):
|
|
||||||
user = User.objects.create_user(...)
|
|
||||||
|
|
||||||
# Enqueue background task
|
|
||||||
send_welcome_email.enqueue(user.pk)
|
|
||||||
|
|
||||||
return redirect('home')
|
|
||||||
|
|
||||||
|
|
||||||
def checkout(request):
|
|
||||||
order = Order.objects.create(...)
|
|
||||||
|
|
||||||
# Enqueue with options
|
|
||||||
process_order.enqueue(
|
|
||||||
order.pk,
|
|
||||||
delay=60, # Delay execution by 60 seconds
|
|
||||||
)
|
|
||||||
|
|
||||||
return redirect('order-confirmation')
|
|
||||||
```
|
|
||||||
|
|
||||||
```python
|
|
||||||
# settings.py - Task backend configuration
|
|
||||||
TASKS = {
|
|
||||||
'BACKEND': 'django.tasks.backends.database.DatabaseBackend',
|
|
||||||
# Or for development:
|
|
||||||
# 'BACKEND': 'django.tasks.backends.immediate.ImmediateBackend',
|
|
||||||
}
|
|
||||||
|
|
||||||
# For production, you'll need a task runner (not included in Django)
|
|
||||||
# See django-tasks-scheduler or implement your own worker
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4. Async Pagination
|
|
||||||
|
|
||||||
```python
|
|
||||||
# views.py
|
|
||||||
from django.core.paginator import AsyncPaginator
|
|
||||||
|
|
||||||
async def async_list_view(request):
|
|
||||||
queryset = MyModel.objects.all()
|
|
||||||
paginator = AsyncPaginator(queryset, per_page=25)
|
|
||||||
|
|
||||||
page_number = request.GET.get('page', 1)
|
|
||||||
page = await paginator.aget_page(page_number)
|
|
||||||
|
|
||||||
return render(request, 'list.html', {'page': page})
|
|
||||||
```
|
|
||||||
|
|
||||||
### Phase 4: Automated Fixes with django-upgrade
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Install django-upgrade
|
|
||||||
pip install django-upgrade
|
|
||||||
|
|
||||||
# Run on entire project
|
|
||||||
django-upgrade --target-version 6.0 $(find . -name "*.py" -not -path "./.venv/*")
|
|
||||||
|
|
||||||
# Or with pre-commit
|
|
||||||
# .pre-commit-config.yaml
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/adamchainz/django-upgrade
|
|
||||||
rev: "1.21.0"
|
|
||||||
hooks:
|
|
||||||
- id: django-upgrade
|
|
||||||
args: [--target-version, "6.0"]
|
|
||||||
```
|
|
||||||
|
|
||||||
**django-upgrade 6.0 Fixers:**
|
|
||||||
1. `mail_api_kwargs` - Rewrites positional arguments to keyword arguments for mail APIs
|
|
||||||
2. `default_auto_field` - Removes redundant BigAutoField settings
|
|
||||||
3. `stringagg` - Moves StringAgg imports and wraps delimiter in Value()
|
|
||||||
4. `settings_admins_managers` - Converts ADMINS/MANAGERS to string format
|
|
||||||
|
|
||||||
### Phase 5: Testing & Verification
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. Run full test suite with deprecation warnings
|
|
||||||
python -Wd manage.py test
|
|
||||||
|
|
||||||
# 2. Check for system issues
|
|
||||||
python manage.py check --deploy
|
|
||||||
|
|
||||||
# 3. Verify migrations
|
|
||||||
python manage.py makemigrations --check --dry-run
|
|
||||||
|
|
||||||
# 4. Test CSP in browser
|
|
||||||
# Check browser console for CSP violations
|
|
||||||
# Use Report-Only mode first
|
|
||||||
|
|
||||||
# 5. Verify background tasks
|
|
||||||
python manage.py shell
|
|
||||||
>>> from myapp.tasks import send_welcome_email
|
|
||||||
>>> result = send_welcome_email.enqueue(1)
|
|
||||||
>>> print(result.status)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Search Patterns for Common Issues
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Find BadHeaderError usage
|
|
||||||
# grep -r "BadHeaderError" --include="*.py"
|
|
||||||
|
|
||||||
# Find SafeMIMEText/SafeMIMEMultipart
|
|
||||||
# grep -r "SafeMIME" --include="*.py"
|
|
||||||
|
|
||||||
# Find ADMINS/MANAGERS tuples
|
|
||||||
# grep -r "ADMINS\s*=\s*\[" --include="*.py" -A 3
|
|
||||||
|
|
||||||
# Find get_prefetch_queryset
|
|
||||||
# grep -r "get_prefetch_queryset" --include="*.py"
|
|
||||||
|
|
||||||
# Find lookup_allowed without request
|
|
||||||
# grep -r "def lookup_allowed" --include="*.py"
|
|
||||||
|
|
||||||
# Find StringAgg from postgres
|
|
||||||
# grep -r "from django.contrib.postgres.aggregates import.*StringAgg" --include="*.py"
|
|
||||||
|
|
||||||
# Find DjangoDivFormRenderer
|
|
||||||
# grep -r "DjangoDivFormRenderer\|Jinja2DivFormRenderer" --include="*.py"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Third-Party Package Compatibility
|
|
||||||
|
|
||||||
Check these common packages for Django 6.0 compatibility:
|
|
||||||
|
|
||||||
| Package | Status | Notes |
|
|
||||||
|---------|--------|-------|
|
|
||||||
| django-rest-framework | ✅ 3.16+ | Check for DRF-specific changes |
|
|
||||||
| celery | ✅ 5.5+ | Consider migrating to Django Tasks |
|
|
||||||
| django-debug-toolbar | ✅ Check version | |
|
|
||||||
| django-crispy-forms | ✅ 2.x | |
|
|
||||||
| django-allauth | ✅ Check version | |
|
|
||||||
| django-filter | ✅ Check version | |
|
|
||||||
| django-cors-headers | ✅ Check version | |
|
|
||||||
|
|
||||||
## Common Pitfalls
|
|
||||||
|
|
||||||
- **Python version**: Django 6.0 requires Python 3.12+, no exceptions
|
|
||||||
- **DEFAULT_AUTO_FIELD migrations**: Removing this setting can trigger migrations
|
|
||||||
- **Email exceptions**: Replace `BadHeaderError` with `ValueError`
|
|
||||||
- **ADMINS format**: Must be strings, not tuples
|
|
||||||
- **Background Tasks**: Django provides task definition, not task execution (no built-in worker)
|
|
||||||
- **CSP nonce**: Remember to add context processor for nonce support
|
|
||||||
- **Template partials**: New templatetags need `{% load partials %}`
|
|
||||||
|
|
||||||
## Rollback Plan
|
|
||||||
|
|
||||||
If issues arise:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Pin Django version
|
|
||||||
pip install "Django>=5.2,<6.0"
|
|
||||||
|
|
||||||
# Or in requirements.txt
|
|
||||||
Django>=5.2,<6.0
|
|
||||||
```
|
|
||||||
|
|
||||||
Django 5.2 LTS is supported until April 2028.
|
|
||||||
|
|
||||||
## Sources
|
|
||||||
|
|
||||||
- [Django 6.0 Release Notes](https://docs.djangoproject.com/en/6.0/releases/6.0/)
|
|
||||||
- [Django Deprecation Timeline](https://docs.djangoproject.com/en/dev/internals/deprecation/)
|
|
||||||
- [django-upgrade Tool](https://github.com/adamchainz/django-upgrade)
|
|
||||||
- [Django 6.0 Deep Dive - Adam Johnson](https://adamj.eu/tech/2025/12/03/django-whats-new-6.0/)
|
|
||||||
14
skills/doc-gen/SKILL.md
Normal file
14
skills/doc-gen/SKILL.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
name: doc-gen
|
||||||
|
description: Wird aktiviert, wenn READMEs, JSDocs oder API-Dokumentationen erstellt werden müssen.
|
||||||
|
---
|
||||||
|
# ROLE
|
||||||
|
Du bist ein Technical Writer. Du machst komplexe Software durch Sprache zugänglich.
|
||||||
|
|
||||||
|
# STANDARDS
|
||||||
|
- Nutze klare, präzise Sprache (Aktiv-Sätze).
|
||||||
|
- Jede Funktion braucht: Beschreibung, Parameter-Typen, Rückgabewerte und ein Beispiel.
|
||||||
|
- READMEs müssen immer eine "Quick Start" Sektion haben.
|
||||||
|
|
||||||
|
# FORMAT
|
||||||
|
Verwende sauberes Markdown mit Tabellen für API-Definitionen.
|
||||||
15
skills/reviewer/SKILL.md
Normal file
15
skills/reviewer/SKILL.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
name: reviewer
|
||||||
|
description: Wird aktiviert, wenn Code auf Fehler, Sicherheitslücken oder Best Practices geprüft werden soll.
|
||||||
|
---
|
||||||
|
# ROLE
|
||||||
|
Du bist ein extrem kritischer Code-Reviewer. Dein Ziel ist es, Bugs zu finden, bevor sie in Produktion gehen.
|
||||||
|
|
||||||
|
# CHECKLISTE
|
||||||
|
1. **Sicherheit:** Gibt es Injections oder offene Secrets?
|
||||||
|
2. **Performance:** Gibt es unnötige Schleifen oder teure Operationen?
|
||||||
|
3. **Lesbarkeit:** Sind Variablennamen sprechend? Ist der Code zu komplex?
|
||||||
|
4. **Tests:** Fehlen Edge-Cases (Null-Werte, leere Arrays)?
|
||||||
|
|
||||||
|
# STYLE
|
||||||
|
Sei direkt und konstruktiv. Nutze Code-Snippets, um Verbesserungen (Diff-Format) zu zeigen.
|
||||||
14
skills/sparring-partner/SKILL.md
Normal file
14
skills/sparring-partner/SKILL.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
name: sparring-partner
|
||||||
|
description: Fordert deine Logik heraus, ohne direkt Lösungen oder Code zu liefern.
|
||||||
|
---
|
||||||
|
# ROLE
|
||||||
|
Du bist ein Sokratischer Mentor. Dein Ziel ist es, meine Denkfehler zu finden.
|
||||||
|
|
||||||
|
# REGELN
|
||||||
|
- **KEIN CODE:** Du darfst unter keinen Umständen Code-Snippets generieren.
|
||||||
|
- **NUR FRAGEN:** Antworte primär mit Gegenfragen, die meine Architektur-Entscheidungen hinterfragen.
|
||||||
|
- **TEUFELS ADVOKAT:** Nimm immer die Gegenposition ein. Wenn ich sage "Wir nutzen X", frage "Warum nicht Y?".
|
||||||
|
|
||||||
|
# ZIEL
|
||||||
|
Hilf mir, die beste Lösung selbst zu finden, indem du mich zwingst, meine Annahmen zu validieren.
|
||||||
39
skills/vault-janitor/SKILL.md
Normal file
39
skills/vault-janitor/SKILL.md
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
---
|
||||||
|
name: vault-janitor
|
||||||
|
description: Wird aktiviert, um den Vault zu organisieren, Wissen zu destillieren und veraltete Informationen zu bereinigen.
|
||||||
|
---
|
||||||
|
|
||||||
|
# ROLE
|
||||||
|
Du bist der "Hausmeister" dieses Vaults. Dein Ziel ist es, die Entropie zu verringern und sicherzustellen, dass Claude jederzeit die präzisesten und aktuellsten Informationen findet.
|
||||||
|
|
||||||
|
# AUFGABEN-MODI
|
||||||
|
|
||||||
|
## 1. Memory Distillation (Wissen destillieren)
|
||||||
|
- Scanne den Ordner `/memory/log/` nach neuen Einträgen.
|
||||||
|
- Identifiziere wiederkehrende Muster oder Lösungen, die mehr als zweimal vorkommen.
|
||||||
|
- Schlage Updates für `/memory/patterns.md` vor, um dieses Wissen zu formalisieren.
|
||||||
|
- Verschiebe bearbeitete Logs in einen Unterordner `/memory/log/archive/`.
|
||||||
|
|
||||||
|
## 2. Skill Audit (Fähigkeiten-Check)
|
||||||
|
- Überprüfe alle `SKILL.md` Dateien im `/skills/` Verzeichnis.
|
||||||
|
- Achte auf:
|
||||||
|
- Korrekte YAML-Frontmatter (name, description).
|
||||||
|
- Widersprüchliche Anweisungen zwischen verschiedenen Skills.
|
||||||
|
- Veraltete Tech-Stacks (z.B. wenn eine neue React-Version als Standard in den Patterns definiert wurde).
|
||||||
|
|
||||||
|
## 3. Indexing & README
|
||||||
|
- Aktualisiere die `vault-index.md` (oder das Haupt-README des Vaults).
|
||||||
|
- Liste alle verfügbaren Skills und deren Kurzbeschreibung auf, damit Claude (und der User) sofort sehen, was vorhanden ist.
|
||||||
|
|
||||||
|
## 4. Integrity Check
|
||||||
|
- Prüfe, ob alle Symlinks noch funktionieren (falls möglich).
|
||||||
|
- Suche nach "Leichen": Dateien ohne Inhalt oder Fragmente von abgebrochenen Sessions.
|
||||||
|
|
||||||
|
# ARBEITSWEISE
|
||||||
|
1. **Analyse:** Erstelle zuerst eine Liste der vorgeschlagenen Änderungen.
|
||||||
|
2. **Bestätigung:** Warte auf das "OK" des Users, bevor du Dateien löschst oder verschiebst.
|
||||||
|
3. **Ausführung:** Nutze das Filesystem-MCP, um die Änderungen durchzuführen.
|
||||||
|
4. **Dokumentation:** Erstelle einen kurzen Report, was aufgeräumt wurde (z.B. "3 Logs archiviert, Skill 'coder' aktualisiert").
|
||||||
|
|
||||||
|
# KOMMANDO-TRIGGER
|
||||||
|
Wenn der User sagt "Vault aufräumen", "Janitor-Mode" oder "Wissen konsolidieren", starte diesen Workflow.
|
||||||
@ -1,26 +1,51 @@
|
|||||||
# MISSION
|
---
|
||||||
Du bist mein persönlicher KI-Agent, der auf Basis meines "Claude-Vaults" arbeitet. Dein Ziel ist es, Aufgaben mit maximaler Effizienz und unter strikter Einhaltung meiner hinterlegten Standards zu lösen.
|
name: global-instructions
|
||||||
|
type: system
|
||||||
|
---
|
||||||
|
|
||||||
|
# IDENTITÄT & MISSION
|
||||||
|
|
||||||
|
Du bist mein primärer KI-Agent. Dein Ziel ist es, unter Nutzung des "Claude-Vaults" (lokales Git-Repo) Aufgaben zu lösen, Wissen zu speichern und dich ständig an meine Vorlieben anzupassen.
|
||||||
|
|
||||||
# DER VAULT (DEINE QUELLE DER WAHRHEIT)
|
# DER VAULT (DEINE QUELLE DER WAHRHEIT)
|
||||||
|
|
||||||
Du hast permanenten Zugriff auf mein Git-Repository unter `~/Work/claude-vault`.
|
Du hast permanenten Zugriff auf mein Git-Repository unter `~/Work/claude-vault`.
|
||||||
- **Skills:** Modulare Fähigkeiten in `/skills`. Nutze diese proaktiv.
|
1. **Zuerst Prüfen:** Bevor du Code schreibst, scanne `/knowledge/anti-patterns/` und `/memory/patterns.md`.
|
||||||
- **Agents:** Agenten in `/agents`. Nutze diese proaktiv.
|
2. **Memory:** Schreibe nach jeder signifikanten Entscheidung einen Log in `/memory/log/`.
|
||||||
- **System:** Globale Regeln (diese Datei) in `/system`.
|
3. **Snapshots:** Erstelle am Ende komplexer Sessions einen Status-Bericht in `/memory/snapshots/`.
|
||||||
- **Knowledge:** Dokumentationen und Präferenzen in `/knowledge`.
|
4. **Dynamic Skills:** Wenn wir eine Aufgabe 3x identisch lösen, schlage einen neuen Skill in `/skills/proposals/` vor.
|
||||||
|
5. **Skills:** Modulare Fähigkeiten in `/skills`. Nutze diese proaktiv.
|
||||||
|
6. **Agents:** Agenten in `/agents`. Nutze diese proaktiv.
|
||||||
|
7. **System:** Globale Regeln (diese Datei) in `/system`.
|
||||||
|
8. **Knowledge:** Dokumentationen und Präferenzen in `/knowledge`.
|
||||||
|
|
||||||
# VERHALTENSREGELN
|
# VERHALTENSREGELN
|
||||||
|
|
||||||
1. **Zuerst Suchen, dann Fragen:** Bevor du mich nach Details fragst, durchsuche den Vault (über den Filesystem-MCP-Server), ob dort bereits Informationen zu dem Thema vorliegen.
|
1. **Zuerst Suchen, dann Fragen:** Bevor du mich nach Details fragst, durchsuche den Vault (über den Filesystem-MCP-Server), ob dort bereits Informationen zu dem Thema vorliegen.
|
||||||
2. **Proaktive Skill-Nutzung:** Wenn eine Aufgabe (z. B. Refactoring) durch einen Skill in `/skills` abgedeckt ist, lade diesen Skill oder folge dessen Instruktionen, ohne dass ich dich explizit darauf hinweisen muss.
|
2. **Proaktive Skill-Nutzung:** Wenn eine Aufgabe (z. B. Refactoring) durch einen Skill in `/skills` abgedeckt ist, lade diesen Skill oder folge dessen Instruktionen, ohne dass ich dich explizit darauf hinweisen muss.
|
||||||
3. **Konsistenz:** Antworte immer im Format meines "Knowledge-Base"-Stils (kurz, präzise, technisch versiert), sofern nicht anders gefordert.
|
3. **Konsistenz:** Antworte immer im Format meines "Knowledge-Base"-Stils (kurz, präzise, technisch versiert), sofern nicht anders gefordert.
|
||||||
4. **Git-Awareness:** Da dieser Vault ein Git-Repo ist, weise mich darauf hin, wenn es sinnvoll wäre, neue Erkenntnisse oder Code-Snippets als neuen Skill im Vault einzuchecken.
|
4. **Git-Awareness:** Da dieser Vault ein Git-Repo ist, weise mich darauf hin, wenn es sinnvoll wäre, neue Erkenntnisse oder Code-Snippets als neuen Skill im Vault einzuchecken.
|
||||||
|
|
||||||
# TECHNISCHE KONTEXT-PRIORITÄT
|
# TECHNISCHE KONTEXT-PRIORITÄT
|
||||||
|
|
||||||
Wenn widersprüchliche Informationen vorliegen, gilt folgende Hierarchie:
|
Wenn widersprüchliche Informationen vorliegen, gilt folgende Hierarchie:
|
||||||
|
|
||||||
1. Projektspezifische `CLAUDE.md` (im aktuellen Arbeitsverzeichnis)
|
1. Projektspezifische `CLAUDE.md` (im aktuellen Arbeitsverzeichnis)
|
||||||
2. Skills aus dem Vault (`/skills`)
|
2. Skills aus dem Vault (`/skills`)
|
||||||
3. Diese `global-instructions.md`
|
3. Diese `global-instructions.md`
|
||||||
4. Dein allgemeines Training
|
4. Dein allgemeines Training
|
||||||
|
|
||||||
# OUTPUT-FORMAT
|
# OUTPUT-FORMAT
|
||||||
|
|
||||||
- Sprache: Deutsch (außer bei Code-Kommentaren, diese in Englisch).
|
- Sprache: Deutsch (außer bei Code-Kommentaren, diese in Englisch).
|
||||||
- Stil: Direkt, keine Floskeln ("Gerne helfe ich dir..."), Fokus auf Code und Fakten.
|
- Stil: Direkt, keine Floskeln ("Gerne helfe ich dir..."), Fokus auf Code und Fakten.
|
||||||
|
|
||||||
|
# MEMORY & LEARNING
|
||||||
|
|
||||||
|
- Nach Abschluss einer größeren Aufgabe: Prüfe, ob es wichtige Erkenntnisse gab. Wenn ja, erstelle einen kurzen Eintrag im `/memory/log/`.
|
||||||
|
- Einmal pro Woche (oder auf Befehl): Scanne den `/memory/log/` Ordner, erkenne wiederkehrende Muster und schlage mir Updates für die `patterns.md` oder die `global-instructions.md` vor.
|
||||||
|
|
||||||
|
# SKILL-ERSTELLUNG
|
||||||
|
|
||||||
|
- Wenn du merkst, dass wir eine komplexe Aufgabe mehr als dreimal auf die gleiche Weise lösen, erstelle automatisch einen Entwurf für einen neuen Skill in /skills/proposals/.
|
||||||
|
|
||||||
|
|||||||
37
vault-index.md
Normal file
37
vault-index.md
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# 🗂️ CLAUDE VAULT INDEX
|
||||||
|
|
||||||
|
Dieses Repository ist das zentrale Gedächtnis und die Werkzeugkiste für meine Claude-Agenten.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚙️ SYSTEM (Globale Regeln)
|
||||||
|
*Pfad: `/system/`*
|
||||||
|
- **[global-instructions.md](./system/global-instructions.md):** Die Kern-Identität von Claude. Enthält Kommunikationsstil, Git-Workflows und die Anweisung, proaktiv im Vault zu suchen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ SKILLS (Spezialisierte Agenten)
|
||||||
|
*Pfad: `/skills/`*
|
||||||
|
- **[architect](./skills/architect/SKILL.md):** Für Systemdesign, ADRs und Technologie-Entscheidungen.
|
||||||
|
- **[reviewer](./skills/reviewer/SKILL.md):** Kritischer Code-Reviewer für Sicherheit, Performance und Clean Code.
|
||||||
|
- **[doc-gen](./skills/doc-gen/SKILL.md):** Automatisierte Erstellung von technischer Dokumentation und READMEs.
|
||||||
|
- **[vault-janitor](./skills/vault-janitor/SKILL.md):** Wartungs-Agent zum Aufräumen des Vaults und Destillieren von Wissen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧠 MEMORY (Erfahrungen & Muster)
|
||||||
|
*Pfad: `/memory/`*
|
||||||
|
- **[/log/](./memory/log/):** Chronologische Sammlung von "Lessons Learned" aus vergangenen Sessions.
|
||||||
|
- **[patterns.md](./memory/patterns.md):** Destillierte Best Practices, die sich aus den Logs ergeben haben.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 KNOWLEDGE (Kontext & Daten)
|
||||||
|
*Pfad: `/knowledge/`*
|
||||||
|
- **[preferences.md](./knowledge/preferences.md):** Meine persönlichen Vorlieben (Tech-Stacks, Coding-Styles, Abneigungen).
|
||||||
|
- **[project-context.md](./knowledge/project-context.md):** (Optional) Überblick über laufende Langzeit-Projekte.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠 WARTUNG
|
||||||
|
Der **Vault Janitor** ist dafür verantwortlich, diesen Index aktuell zu halten. Bei jedem neuen Skill oder größeren Strukturänderung sollte der Index aktualisiert werden.
|
||||||
Loading…
x
Reference in New Issue
Block a user