local-debug
Use when debugging local failures, failed to fetch, API errors, Docker stack issues. Always apply for bug reports and runtime errors in Career Forge.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when debugging local failures, failed to fetch, API errors, Docker stack issues. Always apply for bug reports and runtime errors in Career Forge.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use LangSmith CLI to inspect LLM traces/runs for Career Forge debugging. Use when debugging diagnosis interview, forge SSE, mentor flows, or any upstream LLM execution.
Sync claude-design-docs with implemented UI after paradigm changes. Use when finishing UI work, when asked to "sync UI product docs", or when prototype vs code diverged.
Mandatory pre-merge triple gate for Career Forge — code evaluator, Playwright MCP, agent verify. Use before every merge.
Gate C — run make agent-verify for API + Postgres proof before merge. Extend scripts/agent-verify.sh for new behavior.
| name | local-debug |
| description | Use when debugging local failures, failed to fetch, API errors, Docker stack issues. Always apply for bug reports and runtime errors in Career Forge. |
Systematic checklist for local dev failures: failed to fetch, CORS, Docker, API 4xx/5xx, LLM flows.
cd /path/to/HB01-2026_soft-push
docker compose ps
make status # if available
| Service | Host port | Internal | Health |
|---|---|---|---|
| frontend | ${WEB_HOST_PORT:-3300} → 3000 | — | Next dev |
| backend | 8000 | backend:8000 | GET /health |
| postgres | 5432 | postgres:5432 | pg_isready |
Start / restart:
docker compose up -d --build
docker compose restart backend frontend
Docker (primary):
docker compose logs backend --tail 100
docker compose logs frontend --tail 50
docker compose logs postgres --tail 30
Watch live during repro:
docker compose logs -f backend
Local log files (only when ENV=local or DEBUG=true on backend):
logs/backend.log — structured Python logs from FastAPI startup onward.gitkeepFrontend: fetch errors log to browser Console; improved messages in api-client.ts mention CORS and backendUrl.
Browser TypeError: Failed to fetch on POST often means CORS preflight failed (OPTIONS 400), not a missing route.
Verify preflight:
curl -s -o /dev/null -w "%{http_code}\n" -X OPTIONS \
"http://localhost:8000/diagnosis/interview/start" \
-H "Origin: http://localhost:3300" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: content-type"
Expect 200. If 400, add the browser origin to CORS_ORIGINS in .env:
# Must match WEB_HOST_PORT (common: 3300)
CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:3300,http://127.0.0.1:3300
Restart backend after .env change: docker compose up -d backend.
API URL: frontend uses NEXT_PUBLIC_BACKEND_URL / NEXT_PUBLIC_API_URL (default http://localhost:8000). In Docker, browser calls host port 8000, not backend:8000.
# Health
curl -s http://localhost:8000/health | jq .
# Start interview (requires OPENAI_API_KEY in .env)
curl -s -X POST http://localhost:8000/diagnosis/interview/start \
-H "Content-Type: application/json" \
-d '{
"user_id": "debug-user",
"goal_id": "backend",
"motivation": "Quero crescer como backend engineer com foco em APIs.",
"years_xp": "1-3"
}' | jq .
| Variable | Purpose |
|---|---|
WEB_HOST_PORT | Host port for frontend (3300 common) |
CORS_ORIGINS | Must include http://localhost:<WEB_HOST_PORT> |
BACKEND_URL / NEXT_PUBLIC_BACKEND_URL | http://localhost:8000 |
OPENAI_API_KEY | Required for diagnosis interview LLM |
DATABASE_URL | Postgres connection |
ENV=local / DEBUG=true | Enables logs/backend.log |
Copy template: .env.example → .env. Never commit .env.
After API reaches backend but LLM misbehaves:
./scripts/langsmith-env.sh
./scripts/langsmith-env.sh trace list --project "$LANGSMITH_PROJECT" --last-n-minutes 30 --error
Full workflow: langsmith-inspect skill.
make test
# or
docker compose exec backend pytest
| Symptom | Cause | Fix |
|---|---|---|
failed to fetch on onboarding step 2 | CORS preflight 400 — frontend on :3300, CORS_ORIGINS missing that origin | Add :3300 origins to .env, restart backend |
| OPTIONS 400 in backend logs | Same as above | docker compose logs backend | grep OPTIONS |
| Interview 500 | Missing OPENAI_API_KEY | Set in .env, restart backend |
| Frontend can't reach API | Wrong NEXT_PUBLIC_BACKEND_URL | Must be host URL, not Docker service name |
make test fails with connection refused on localhost:5432 | Postgres was not started before pytest | Run make test from repo root (boots postgres, waits readiness, runs alembic upgrade head, then pytest) |
When you find a new local-only trick, append it to section 8 of this skill.