Skip to content

viewflow/seedkit / skills/django-seedkit

django-seedkit

Flagged

Bootstrap a new Django project, or add components — auth (allauth, magic-link, axes, 2FA), payments (Stripe, dj-stripe), REST (django-modern-rest, django-bolt), Celery / Django Tasks, async views & WebSockets (ASGI, uvicorn worker, django-channels, channels-redis), Tailwind+DaisyUI, favicon, SEO meta tags + sitemap, HTML email templates, S3 storage, structlog, healthchecks, Docker, CI, deploy (VPS / Fly / GitHub-SSH), dbbackup, Sentry/Bugsink — to an existing Django codebase. Use whenever the user wants to scaffold Django, integrate a Django package, set up async / WebSockets, set up production deploys, wire CI/CD, or extend an existing Django project.

FileKindSize
SKILL.mdskill md17.7 KB
references/analytics.mdmarkdown6.3 KB
references/async.mdmarkdown4.4 KB
references/auth-hardening.mdmarkdown4.3 KB
references/auth.mdmarkdown7.9 KB
references/billing.mdmarkdown10.6 KB
references/ci.mdmarkdown3.9 KB
references/conventions.mdmarkdown2.5 KB
references/cors.mdmarkdown2.3 KB
references/csp.mdmarkdown3.6 KB
references/custom-user.mdmarkdown5.6 KB
references/database.mdmarkdown7.4 KB
references/dbbackup.mdmarkdown5.0 KB
references/deploy-github-ssh.mdmarkdown6.4 KB
references/deploy-managed.mdmarkdown2.9 KB
references/deploy-vps.mdmarkdown7.0 KB
references/dev-tasks.mdmarkdown6.5 KB
references/dev-tools.mdmarkdown14.5 KB
references/devcontainer.mdmarkdown2.1 KB
references/docker.mdmarkdown15.0 KB
references/email.mdmarkdown3.9 KB
references/error-reporting.mdmarkdown3.7 KB
references/existing-project.mdmarkdown4.7 KB
references/favicon.mdmarkdown2.7 KB
references/gdpr.mdmarkdown3.9 KB
references/healthcheck.mdmarkdown2.3 KB
references/i18n.mdmarkdown4.1 KB
references/lint.mdmarkdown2.2 KB
references/logging.mdmarkdown3.9 KB
references/new-project.mdmarkdown7.2 KB
references/pre-commit.mdmarkdown3.0 KB
references/pytest.mdmarkdown2.6 KB
references/realtime.mdmarkdown8.6 KB
references/redis.mdmarkdown2.6 KB
references/rest-bolt.mdmarkdown7.4 KB
references/rest-modern-rest.mdmarkdown3.4 KB
references/rest.mdmarkdown2.7 KB
references/robots.mdmarkdown1.8 KB
references/security.mdmarkdown2.0 KB
references/seo.mdmarkdown3.1 KB
references/storage-s3.mdmarkdown7.7 KB
references/storage-whitenoise.mdmarkdown2.8 KB
references/tailwind.mdmarkdown11.6 KB
references/tasks-celery.mdmarkdown5.3 KB
references/tasks-django-cron.mdmarkdown1012 B
references/tasks-django.mdmarkdown1.2 KB
references/typecheck.mdmarkdown4.3 KB
references/uv.mdmarkdown670 B

references/logging.md

View on GitHub
# Logging — structured (structlog + django-structlog)

Docs: <https://www.structlog.org/> · <https://django-structlog.readthedocs.io/>

Pretty console in dev, JSON lines in prod. Foreign loggers (Django, Celery, urllib3) render identically because both renderers are stdlib `logging` formatters wrapped by `ProcessorFormatter`. `django-structlog` ships the request middleware and Celery signal handlers — per-request `request_id`, `correlation_id`, `user_id` and per-task `task_id`/`task_name` flow via `contextvars` without project code.

## Install

```sh
uv add structlog django-structlog
```

## Settings

In `config/settings.py` (or `config/settings/base.py` for split):

```python
import structlog

# Shared chain. Used as `foreign_pre_chain` (stdlib records) and inside
# structlog.configure() (structlog-native records). Each record runs it once.
PRE_CHAIN = [
    structlog.contextvars.merge_contextvars,
    structlog.stdlib.add_log_level,
    structlog.stdlib.add_logger_name,
    structlog.processors.TimeStamper(fmt="iso", utc=True),
    structlog.processors.StackInfoRenderer(),
    structlog.processors.format_exc_info,
]

LOGGING = {
    "version": 1,
    "disable_existing_loggers": False,
    "formatters": {
        "json": {
            "()": "structlog.stdlib.ProcessorFormatter",
            "processor": structlog.processors.JSONRenderer(),
            "foreign_pre_chain": PRE_CHAIN,
        },
        "console": {
            "()": "structlog.stdlib.ProcessorFormatter",
            "processor": structlog.dev.ConsoleRenderer(colors=True),
            "foreign_pre_chain": PRE_CHAIN,
        },
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "formatter": "console" if DEBUG else "json",
        },
    },
    "root": {"handlers": ["console"], "level": "INFO"},
    "loggers": {
        "django.db.backends": {"level": "WARNING"},
        "django.request": {"level": "WARNING"},
        "urllib3": {"level": "WARNING"},
        "botocore": {"level": "WARNING"},
        "celery": {"level": "INFO"},
    },
}

structlog.configure(
    processors=[*PRE_CHAIN, structlog.stdlib.ProcessorFormatter.wrap_for_formatter],
    logger_factory=structlog.stdlib.LoggerFactory(),
    wrapper_class=structlog.stdlib.BoundLogger,
    cache_logger_on_first_use=True,
)
```

## Per-request context

Add `django_structlog` to `INSTALLED_APPS` and insert its middleware **after** `AuthenticationMiddleware` (`request.user` must exist before the middleware binds `user_id`):

```python
auth_idx = MIDDLEWARE.index("django.contrib.auth.middleware.AuthenticationMiddleware")
MIDDLEWARE.insert(auth_idx + 1, "django_structlog.middlewares.RequestMiddleware")
```

Always-on. `LOGGING` belongs at module scope in `base.py` — never inside an `if DEBUG:` block, or production runs with bare Django defaults (no console handler at the root level).

For Celery, add `django_structlog.celery.steps.DjangoStructLogInitStep` to the app's boot steps — it binds `task_id` / `task_name` and propagates the parent request's `correlation_id`. This is a one-line delta to the existing `config/celery.py` from `references/tasks-celery.md`; do **not** rewrite the file from scratch:

```python
# config/celery.py — additions only
from django_structlog.celery.steps import DjangoStructLogInitStep

# ... existing Celery() / config_from_object / autodiscover_tasks lines stay ...

app.steps["worker"].add(DjangoStructLogInitStep)
```

## Sentry / GlitchTip / Bugsink

If `error-reporting.md` is in use, sentry-sdk's `LoggingIntegration` already routes `WARNING+` to breadcrumbs and `ERROR+` to events. Override per-logger via `LoggingIntegration(level=…, event_level=…)`.

## Pitfalls

- Call `structlog.configure()` only from settings (loaded once, before any logger).
- Keep `cache_logger_on_first_use=True`.
- No `ConsoleRenderer` in prod — ANSI codes break JSON parsers.
- `log.exception(...)` already implies `exc_info=True`; don't pass it again.
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall