본문으로 건너뛰기
cccskills
무료GitHub에 공개

backend-debugging

Debug backend runtime errors (500s, crashes, unexpected behavior). Use when something is broken at runtime — not for writing new code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core스타 34(GitHub 34 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Backend Debugging

Step 0 — If it's a regression, check git history first

When the user reports "it worked before X" / "broke after the refactoring" / "used to work" — read the git history of the affected code path before proposing any fix. A defensive try/catch or null check is the wrong opening move on a regression; the bug is almost always something a recent commit dropped (a break, a return, a case arm, a relation in a query).

# Find the commits that touched the failing handler/file:
git log --oneline -20 -- <path/to/handler.ts>

# Diff against the last-known-good state:
git show <commit>:<path/to/handler.ts>
git log -p -5 -- <path/to/handler.ts>

The fix is then "restore what was lost," not "patch around the symptom." Only after you have the diff against the working version should you consider defensive code.

Step 1 — Read the logs

Before reading code, guessing, or querying the database, check the backend logs:

# From the repo root (slot is remembered from ./dev up):
./dev logs backend                # Last 80 lines
./dev logs --tail 200 backend     # More context

# Or read the log file directly:
cat .dev/slot-$(cat .dev/slot)/backend.log

The logs contain full stack traces with file names and line numbers. This tells you exactly what's broken — no guessing needed.

Do not skip this step. Code review without the actual error is guesswork.

Step 2 — Reproduce the error

Confirm the error independently with curl. This isolates whether the problem is backend vs. frontend vs. CORS:

# Login first (adjust credentials as needed):
curl -s -c /tmp/cookies.txt http://localhost:3020/api/auth/login \
  -X POST -H 'Content-Type: application/json' \
  -d '{"email":"...","password":"..."}'

# Hit the failing endpoint:
curl -s -b /tmp/cookies.txt "http://localhost:3020/api/..." | head -50

Replace port 3020 with whatever the current slot uses. Check with ./dev status.

Recognizing CORS errors

If the browser console shows "blocked by CORS policy" but the request returns a valid status code (e.g., 201), the backend works — the browser is rejecting the response. Look for:

  • Hardcoded Access-Control-Allow-Origin headers in the controller that override the global CORS middleware
  • The global CORS config in src/main.ts — in development mode (NODE_ENV !== 'production') it should allow all origins

Step 3 — Go to the error location

The stack trace gives you the exact file and line. Read that code. Common patterns:

"Cannot read properties of undefined (reading 'map')"

A relation wasn't loaded by TypeORM but the mapper assumes it's always present. Fix with optional chaining:

// Before — crashes when relation not loaded:
items.map(x => ...)

// After:
items?.map(x => ...) ?? []

This is especially common when:

  • A findAll query doesn't load the same relations as findOne
  • Eager relations don't cascade through deeply nested joins (e.g., thread → sourceAssignments → source → details → contentChunks)

"Invalid source type" / "Invalid message role"

A mapper's instanceof or switch doesn't cover all cases. Check what the database actually contains:

# Quick database query through the dev stack:
cd ayunis-core-backend
pnpm exec ts-node -r tsconfig-paths/register -e "
import './src/config/env';
import { DataSource } from 'typeorm';
// ... query the relevant table
"

Step 4 — Fix, verify, check logs again

  1. Make the fix
  2. Wait for nest --watch to reload (or check ./dev logs backend for compilation errors)
  3. Re-run the curl command from Step 2
  4. Check ./dev logs backend to confirm no new errors
  5. Load nestjs-hexagonal-backend and run its validation sequence at the level required by the repository's Proportional Workflow.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Query Ayunis deployed-environment telemetry in AppSignal — incidents, occurrence counts and error traces via the `appsignal-cli` binary; structured log attributes (user.id, org.id, nestjs.context, custom metadata) via the v2 logs API. Use when investigating a production/staging incident or log data — NOT for local dev logs (see backend-debugging).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Ayunis Core backend specifics — module boundaries, key files, and project conventions. Complements the nestjs-hexagonal-backend skill.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Frontend development in ayunis-core. Use when creating, modifying, or debugging frontend code (React, Feature-Sliced Design, API client).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Shared test fixtures for backend specs — port mock factories, domain builders, and shared IDs in a per-module testing/ folder. Use when a module's *.use-case.spec.ts files repeat the same mock-repository literal, inline entity construction, or hardcoded UUIDs across files.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Analyze Cursor Bugbot PR comments through a root-cause lens: is the finding valid, and is the suggested fix the real fix or a bandaid over a deeper problem? Use when the user asks to check, assess, or triage bugbot comments.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

Self-review local changes before creating a PR. Use when the user says "review", "review my code", "check my changes", or wants confidence before submitting.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ayunis-core/ayunis-core342026년 10월 26일 업데이트

ayunis-core의 스킬 모두 보기

이 스킬의 문제 신고