本文へ移動
cccskills
無料GitHub で公開

debugging-error-tracking

Systematic debugging workflow for errors, performance issues, and runtime problems in the portfolio.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Debugging & Error Tracking

When to use this skill

  • Investigating console errors or warnings
  • Debugging hydration mismatches
  • Tracking down performance regressions
  • Diagnosing network request failures
  • Analyzing memory leaks or slow render cycles
  • Troubleshooting browser-specific issues

Workflow

1. Error triage

Classify the error:

CategoryExamplesPriority
Build-timeTypeScript errors, lint failures, missing importsFix before commit
RuntimeConsole errors, unhandled promises, null referencesFix before deploy
HydrationServer/client HTML mismatch, useEffect missingFix before deploy
NetworkAPI failures, CORS errors, timeoutFix based on user impact
PerformanceSlow LCP, high CLS, janky animationsFix if regression
Browser-specificSafari-only, mobile-only, Firefox-onlyFix if significant audience

2. Console error investigation

Step 1: Reproduce the error

  • Open browser DevTools → Console tab
  • Clear console and reload the page
  • Note the exact error message, file, and line number

Step 2: Read the error carefully

  • The first line is the error type (TypeError, ReferenceError, etc.)
  • The second line is usually the component stack trace
  • Look for the file path and line number in the source

Step 3: Check common patterns

Error patternLikely causeFix
Cannot read property of undefinedNull data from APIAdd null checks or ?? defaults
Hydration mismatchServer/client render differenceAdd useEffect guard, mounted state
Too many re-rendersState update in renderMove to useEffect or callback
Invalid hook callConditional hook or wrong ReactEnsure hooks are called unconditionally
404 on _next/staticStale service workerClear SW cache (see PWA skill)
CORS errorMissing headersCheck API route CORS config

3. Hydration mismatch debugging

Symptoms: Warning in console about hydration mismatch, content flickers on load.

Common causes:

  1. Date/time rendering -- Server and client generate different strings

    // BAD: server and client time differ
    <span>{new Date().toLocaleDateString()}</span>
    
    // GOOD: render only on client
    const [mounted, setMounted] = useState(false);
    useEffect(() => setMounted(true), []);
    <span>{mounted ? new Date().toLocaleDateString() : ''}</span>
    
  2. Browser extensions -- Extensions inject elements into the DOM

    • Test in incognito mode with extensions disabled
  3. Conditional rendering based on window/document

    // BAD
    <div>{typeof window !== 'undefined' ? 'client' : 'server'}</div>
    
    // GOOD: use useEffect
    const [isClient, setIsClient] = useState(false);
    useEffect(() => setIsClient(true), []);
    

4. Network request debugging

DevTools → Network tab:

  1. Filter by Fetch/XHR to see API calls
  2. Check the Status column for failures (4xx, 5xx)
  3. Click the failed request → Preview tab for error details
  4. Check Response Headers for CORS issues

Common network issues:

StatusMeaningFix
400Bad requestCheck request body/params
401UnauthorizedCheck API token
403ForbiddenCheck permissions/CORS
404Not foundCheck the API route exists
429Rate limitedAdd retry logic, back off
500Server errorCheck server logs
CORS errorMissing Access-Control-Allow-OriginAdd CORS headers to API route

5. Performance debugging

Chrome DevTools → Performance tab:

  1. Click record, interact with the page, stop recording
  2. Look for long tasks (red bars in the timeline)
  3. Check the Summary tab for breakdown (scripting, rendering, painting)

React DevTools → Profiler:

  1. Open React DevTools → Profiler tab
  2. Click record, interact, stop
  3. Check which components re-rendered and why
  4. Look for components rendering too often (unnecessary re-renders)

Quick performance checks:

# Lighthouse audit
npx lighthouse http://localhost:3000 --output html --view

# Bundle size check
npm run build 2>&1 | grep -E "First Load|shared"

6. Memory leak detection

DevTools → Memory tab:

  1. Take a heap snapshot
  2. Perform actions (navigate, open modals, etc.)
  3. Take another snapshot
  4. Compare snapshots -- look for detached DOM nodes

Common memory leak sources:

  • Event listeners not cleaned up in useEffect return
  • setInterval not cleared
  • SWR fetchers holding references
  • Third-party widgets (analytics, chat) not disposed

7. Mobile debugging

Chrome DevTools → Toggle Device Toolbar:

  1. Select a device preset (iPhone, Pixel, etc.)
  2. Check for touch event issues
  3. Verify tap targets are ≥ 44px
  4. Test scroll behavior (iOS momentum scrolling)
  5. Check for viewport meta tag issues

Remote debugging (real device):

  • Android: chrome://inspect with USB debugging
  • iOS: Safari → Develop → [device]

Quick reference

ProblemFirst thing to check
Page is blankConsole errors, build errors
Data not loadingNetwork tab, API routes
Styling brokenTailwind classes, dark mode toggle
Slow pagePerformance tab, bundle size
Works on desktop, broken on mobileResponsive breakpoints, touch events
Works in Chrome, broken in SafariCSS features, JS compatibility
Intermittent errorRace conditions, async timing

Delivery checks

  • Console is clean (no errors or warnings)
  • Network tab shows no failed requests
  • Hydration warnings are resolved
  • Performance metrics are within targets (LCP < 2.5s, CLS < 0.1)
  • Tested on mobile viewport
  • Tested in incognito (no extension interference)

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audit and fix accessibility issues across the portfolio to ensure WCAG 2.1 AA compliance.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月7日 更新

Creates a new blog post document in the Sanity studio. Use when the user wants to write a blog post, publish an article, or schedule a future post.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月7日 更新

Creates a new certification document in the Sanity studio. Use when the user wants to add a credential, certificate, or professional accreditation to the Certifications collection.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月7日 更新

Adds a new skill MD file to the studio's skills collection. Use when the user wants to author a new step-by-step recipe for the studio's in-app Skills tool or the .agents mirror.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月7日 更新

Creates a new project document in the Sanity studio. Use when the user wants to add a new portfolio project, a case study, or a work sample to the Projects collection.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月7日 更新

Creates a new experience document in the Sanity studio. Use when the user wants to add a job, role, internship, or work history entry to the Experience collection.

日本語の概要は準備中です。原文の説明を表示しています。

PP-Namias/Portfolio22026年10月7日 更新

PP-Namias のスキルをすべて見る

このスキルの問題を報告する