ワンクリックで
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior. Investigate root cause BEFORE proposing any fix.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when encountering any bug, test failure, or unexpected behavior. Investigate root cause BEFORE proposing any fix.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Check for drift between spec.md, plan.md, tasks.md, and the actual code. Reports the gaps; does not fix them.
Run a category-specific quality pass (security / performance / accessibility / i18n / privacy / observability) against the current plan and code.
Surface [NEEDS CLARIFICATION] markers in spec.md (or plan.md) to the user, one at a time, and edit the file with the answers.
Bootstrap or amend constitution.md (framework, preset, or project). Inspects existing project context first; enforces the amendment process: issue first, one article per PR, reviewer non-author.
Print the pipeline quick-reference — a one-screen summary of every /aia:* command and its hand-offs, prefixed by a state-aware "Próximo passo" line.
Execute an approved plan + tasks list by dispatching one fresh subagent per task and applying two-stage review (spec compliance, then code quality) before moving on.
| name | systematic-debugging |
| description | Use when encountering any bug, test failure, or unexpected behavior. Investigate root cause BEFORE proposing any fix. |
NO FIX WITHOUT ROOT CAUSE INVESTIGATION FIRST
After 3 failed fix attempts: STOP and question the architecture.
1. Read the error message carefully
2. Reproduce consistently
3. Check recent changes
git log --oneline -20
git diff HEAD~1 -- <suspect-file>
4. Collect evidence by layer
Django Backend:
# Django logs
cd backend && python manage.py shell
>>> from django.test import Client; c = Client()
>>> # reproduce manually
# SQL generated
>>> from django.db import connection; connection.queries
# Celery worker logs
docker compose logs -f celery
React Frontend:
# Console errors
# Network tab — see exact request/response
# React Query Devtools — inspect query state
cd frontend && npx tsc --noEmit # check TypeScript errors
Celery/Redis:
# Watch tasks in real-time
docker compose exec redis redis-cli monitor
# Check task errors
cd backend && celery -A config inspect active
Form a single hypothesis — the most likely cause
Test minimally:
When you don't know — say so explicitly:
"I don't know the root cause. My best hypothesis is X, but I need more evidence."
After 3+ failed fixes: Question the Architecture
# Lazy queryset evaluation bug
# WRONG: objects never evaluated properly
items = MyModel.objects.filter(user=user)
if items: # Evaluates, but creates new query on each access
process(items[0]) # Another query
# CORRECT:
items = list(MyModel.objects.filter(user=user).select_related('user'))
# Test transaction bug
# Symptom: "object created but not found in service"
# Fix: @pytest.mark.django_db(transaction=True)
# Signal firing in test causing unexpected side effects
# Fix: disconnect signal in test or mock it
# Bug: task not executing
# Check: CELERY_TASK_ALWAYS_EAGER=True in test settings?
# Check: task registered? celery -A config inspect registered
# Bug: retry storm
# Symptom: task retrying infinitely
# Fix: verify max_retries and exponential countdown
# Bug: object not found in task
# Cause: task ran before DB transaction committed
# Fix: use transaction.on_commit() to dispatch task
from django.db import transaction
transaction.on_commit(lambda: my_task.delay(obj.id))
# Bug: API key not found
# Check: settings.ANTHROPIC_API_KEY / GEMINI_API_KEY configured?
# Check: _get_api_key_for_model() resolves the provider correctly?
# Bug: AI response timeout
# Check: LiteLLM default timeout (300s)
# Fix: add explicit timeout in kwargs
# Bug: JSON parsing fails
# Cause: model returned text before/after JSON
# Fix: use re.search to extract JSON
import re, json
match = re.search(r'\{.*\}', content, re.DOTALL)
if match:
data = json.loads(match.group())
// Bug: undefined not handled
// Symptom: "Cannot read properties of undefined"
// Fix: optional chaining + nullish coalescing
const value = data?.field ?? defaultValue;
// Bug: stale closure in useEffect
// Symptom: outdated value inside effect
// Fix: include correct dependencies in array
useEffect(() => {
doSomething(currentValue); // currentValue must be in deps
}, [currentValue]);
// Bug: TanStack Query not refetching
// Check: queryKey includes all params that affect the result?
const { data } = useQuery({
queryKey: ['resource', userId, filter], // include BOTH userId AND filter
queryFn: () => fetchResource(userId, filter),
});
After identifying root cause:
**Bug**: [short description]
**Root Cause**: [identified cause with evidence]
**Fix Applied**: [description of fix]
**Regression Test**: `tests/path/test_bug_fix.py::test_name`
**Verified**: [test passes + all other tests still pass]