debug
Skill1 starsChanged 5 months agoMITView on GitHub
A root-cause debugging method for the Django/DRF + Celery + Channels + Next.js stack — reproduce, isolate, hypothesize, fix the cause not the symptom, verify, add a regression test. Use when tracking down a bug, a 500, a flaky test, missing data, a stale UI, or an N+1 query, when asked to "debug", "why is this broken", "figure out why", or "find the root cause", and when deciding where to read logs (Django, Celery, Daphne, browser console/network). Not for proving a finished change works end to end (see verify) or optimizing already-correct code (see perf-review).
144 other projects use a version of this.
Adopted by
Most recently taken up by
- AllThingsSmitty/proven-skillstheir own version, first seen Oct 6, 2026
- prathish-ks/isthmustheir own version, first seen Oct 6, 2026
- muon-m2/magento2-toolstheir own version, first seen Oct 4, 2026
- andeeplus/aplustheir own version, first seen Oct 4, 2026
- nanocoai/nanoclawtheir own version, first seen Oct 4, 2026
- agentic-community/mcp-gateway-registrytheir own version, first seen Oct 4, 2026
Used with
Projects with it also use add-ollama-tool, add-slack and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkilladd-ollama-tool
Add Ollama MCP server so the container agent can call local models and optionally manage the Ollama model library.
Also in 6 projects that use this
MicrosoftSkilladd-slack
Add Slack channel integration via Chat SDK.
Also in 6 projects that use this
sskarzSkilladd-telegram-swarm
Add Agent Swarm (Teams) support to Telegram. Each subagent gets its own bot identity in the group. Requires Telegram channel to be set up first (use /add-telegram). Triggers on "agent swarm", "agent teams telegram", "telegram swarm", "bot pool".
Also in 5 projects that use this
- +9 more from microsoft
Other versions144 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 144
- Yeachan-Heo/oh-my-claudecode★ 40ksame name
- nanocoai/nanoclaw★ 31ksame name
- openai/symphony★ 28ksame name
- anthropics/knowledge-work-plugins★ 26ksame name
- NVIDIA/Model-Optimizer★ 5.2ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- jsmastery-pro/skills★ 1.4ksame name
- agentic-community/mcp-gateway-registry★ 956same name
- suboss87/FDEOps★ 950same name
- kdlbs/kandev★ 899same name
134 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- accessibilitySkill
- ai-evalsSkill
- ai-integrationSkill
- architecture-decisionsSkill
- audit-loggingSkill
- aws-servicesSkill
- browser-e2e-testingSkill
- celery-tasksSkill
- changelogSkill
- ci-cdSkill
- codebase-guideSkill
- code-reviewSkill
- commit-messageSkill
- cookie-auth-csrfSkill
- dashboard-data-designSkill
- db-concurrencySkill
- dependency-auditSkill
- deploy-awsSkill
- design-systemSkill
- drf-apiSkill
- drf-zod-contractSkill
- frontend-perfSkill
- git-workflowSkill
- i18n-rtlSkill
- incident-responseSkill
- migrationsSkill
- money-decimalSkill
- multi-tenancySkill
- nextjs-moduleSkill
- observabilitySkill
- perf-reviewSkill
- production-readinessSkill
- product-ux-designSkill
- rbac-permissionsSkill
- react-querySkill
- security-reviewSkill
- skill-authoringSkill
- tailwind-shadcnSkill
- tenant-session-switchSkill
- threat-modelingSkill
- verifySkill
- version-checkSkill
- visual-ui-designSkill
- webhook-handlerSkill
- websockets-channelsSkill
- write-testsSkill
- zod-formsSkill
- zustand-stateSkill
- example-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 127 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 61
When jobs are stuck or websocket events go missing, the stall is usually in the pipeline between producer and consumer — inspect the …
- Very specific: line 77
Absolute rule: never mutate or flush prod broker/cache state while debugging — no FLUSHALL, DEL, PURGE, or requeue on a live system.
- Very specific: line 100
No repro = no fix. If it's intermittent, find the ordering/timing/data that triggers it.
“Common” is measured: kept by at least 6 in 10 of the 127 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debug (find the root cause, not the symptom)
When to use
Something is wrong — a 500, a wrong number, a UI that won't update, a query storm, a test that fails one run in ten — and you need to find why, not paper over it. The goal is a fix at the cause, backed by a test that would have caught it.
Pattern
Five steps, in order — skipping one is how band-aids happen:
- Reproduce. A reliable repro (command, click-path, failing test) before any fix. Can't reproduce it → you can't confirm you fixed it.
- Isolate. Bisect the surface — narrow which layer, request, or line owns the failure. Read the logs at that layer (below), don't guess. Read a traceback bottom-up: the final line is the real error, the frames above are how you got there — jump to the deepest frame that is your code, not the framework. Change one thing at a time; batched edits hide which change mattered.
- Hypothesize. State a specific, falsifiable cause ("stale cache because the mutation never invalidates the list key"), then test that.
- Fix the root cause. Change the thing that is actually wrong, not the symptom.
A
try/exceptthat swallows the error, a hard-coded retry, arefetchIntervalmasking a missing invalidation — those are band-aids. Resist them. - Verify + regression test. Reproduce the original failure, show it gone (see
verify), and add a test that fails on the old code (seewrite-tests).
Where the logs live
| Layer | Where to look |
| Django request/500 | dev server stdout; set DEBUG=True locally for the traceback |
| Celery task | worker stdout (celery -A myproject worker -l info), not the web log |
| Channels/websocket | Daphne stdout (daphne myproject.asgi:application) — the dev ASGI server |
| Frontend | browser Console (errors) + Network tab (status, payload, timing) |
Playbook: N+1 query (symptom = slow list, log full of near-identical SELECTs)
Spot it: one query per row instead of one for the set. Fix at the queryset, not by caching.
# BEFORE — 1 query for invoices + 1 per invoice for .client + N for .lines (N+1)
qs = Invoice.objects.filter(entreprise=request.user.entreprise)
# AFTER — FK followed in the join; reverse/M2M batched into one extra query
qs = (Invoice.objects
.filter(entreprise=request.user.entreprise)
.select_related("client") # forward FK / OneToOne → SQL JOIN
.prefetch_related("lines")) # reverse FK / M2M → one batched IN query
# Confirm the count dropped: assertNumQueries, or django-debug-toolbar.Playbook: React Query stale data (symptom = UI shows old value until refresh)
Root cause is usually a mutation that changes the server but never invalidates the
cache — not a caching bug to mask with refetchInterval. In the mutation's
onSuccess, call queryClient.invalidateQueries for the exact keys the mutation
touches (the list key and the affected detail key), so both refetch. See
react-query for the key-factory pattern.
Read-only Redis/Valkey + queue inspection
When jobs are stuck or websocket events go missing, the stall is usually in the pipeline between producer and consumer — inspect the broker/cache read-only to see where it stops.
- Queue depth.
LLEN <queue>(default Celery queue iscelery) — a growing depth means tasks are enqueued but no worker is consuming; zero depth with no result means they never enqueued. - Reserved / active tasks.
celery -A myproject inspect active/reserved/statsshows what each worker is holding — a task stuck "active" for minutes is blocking a slot. - Stuck / unacked messages. With late-ack, a crashed worker leaves messages unacked until its visibility timeout expires; look for the same task redelivered in a loop.
- Channels group membership. A missing websocket event usually means the
consumer never joined the group, or the sender used a different group name — check
the group key the code builds (e.g.
entreprise_{id}) matches on both sides.
Absolute rule: never mutate or flush prod broker/cache state while debugging — no
FLUSHALL, DEL, PURGE, or requeue on a live system. That destroys the evidence and
can drop real work. Observe, form a hypothesis, then fix in code. See celery-tasks
and websockets-channels.
Adapt to your repo
Rename Entreprise/entreprise, myproject.asgi, and the query keys/routes to
match your project. Confirm your actual log locations and the command that starts
each process (worker, Daphne/ASGI). Match query keys to your app's real key factory.
Gotchas
- A 403 or an empty list is often the auth/tenant layer working correctly, not a bug.
Confirm the request carried the right identity and scope (auth header, tenant id such
as
X-Tenant-ID) before you touch a guard. Never "fix" a 403 by deleting the permission check, or an empty list by loosening the tenant filter — that ships a security hole. Fix the missing permission or the wrong scope instead. - Many unrelated endpoints failing at once points at a shared resource (DB, connection
pool, cache, auth, load balancer), not one view. Suspect the common layer first — see
incident-response. - Believe the evidence over your memory, and assume your code is wrong before the framework's — the bug is far more likely in the line you wrote yesterday.
- Fixing the symptom (swallow the exception, add a retry, poll on an interval) leaves the cause live — it resurfaces elsewhere. Name the cause before you touch code.
- No repro = no fix. If it's intermittent, find the ordering/timing/data that triggers it.
select_relatedis for forward FK/OneToOne (a JOIN);prefetch_relatedis for reverse FK/M2M (a second batched query). Swapping them silently does nothing.- A 500 with
DEBUG=Falsehides the traceback — read the server log, don't guess. - Close the loop: a fix without a failing-then-passing regression test isn't done.
See also
verifyperf-reviewreact-queryincident-responsecelery-taskswebsockets-channels
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

