بنقرة واحدة
debugger
Identifica e corrige bugs, memory leaks, hydration mismatches, e erros silenciosos no CYPHER V3
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Identifica e corrige bugs, memory leaks, hydration mismatches, e erros silenciosos no CYPHER V3
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Testa cada API route do CYPHER V3 com dados reais — valida schemas, mede performance, detecta breaking changes, garante que cada endpoint retorna o que promete
Especialista em Bitcoin Ordinals, Runes, BRC-20, Rare Sats, wallet integration e protocolo Bitcoin para CYPHER V3
Modo John Carmack — foco absoluto numa única tarefa técnica, sem distrações, implementação direta e eficiente
Escreve código TypeScript/React/Next.js de produção para CYPHER V3
Garante o fluxo correto de dados desde APIs externas até ao utilizador — cache em camadas, fallbacks inteligentes, transformação de dados, sem dados stale ou inválidos na UI
Protege o CYPHER V3 em produção — checklist de deploy, environment variables, health checks, rollback automático, zero downtime
| name | debugger |
| description | Identifica e corrige bugs, memory leaks, hydration mismatches, e erros silenciosos no CYPHER V3 |
| version | 2.0 |
| tags | ["debug","bugs","errors","hydration","memory-leaks"] |
Antes de qualquer debug, executar sempre:
npm run type-check 2>&1 | head -50
npm run lint 2>&1 | head -50
grep -rn "console\.log\|TODO\|FIXME\|HACK\|XXX\|@ts-ignore\|@ts-nocheck\|as any" src/ --include="*.ts" --include="*.tsx"
Sintoma: Error: Hydration failed because the initial UI does not match...
Causas comuns:
Date.now() ou new Date() sem suppressHydrationWarningwindow, localStorage, ou navigatorFix padrão:
// ❌ ERRADO — causa hydration mismatch
function PriceDisplay({ price }: { price: number }) {
return <span>{price.toFixed(2)}</span>
}
// ✅ CORRETO — usar useEffect para valores dinâmicos
'use client'
import { useState, useEffect } from 'react'
function PriceDisplay({ initialPrice }: { initialPrice: number }) {
const [price, setPrice] = useState(initialPrice)
const [mounted, setMounted] = useState(false)
useEffect(() => {
setMounted(true)
// subscrever a WebSocket/live data aqui
}, [])
if (!mounted) return <span className="animate-pulse bg-[#1a1a1a] w-20 h-4 inline-block rounded" />
return <span>{price.toFixed(2)}</span>
}
Sintoma: CPU/RAM a subir progressivamente, performance degrada com o tempo
Causas no CYPHER V3:
AgentOrchestrator com setInterval sem cleanupremoveEventListenerFix padrão:
// ❌ ERRADO
useEffect(() => {
const interval = setInterval(() => fetchData(), 5000)
// sem cleanup!
}, [])
// ✅ CORRETO
useEffect(() => {
const interval = setInterval(() => fetchData(), 5000)
const ws = new WebSocket(WS_URL)
ws.onmessage = handleMessage
return () => {
clearInterval(interval)
ws.close()
ws.removeEventListener('message', handleMessage)
}
}, [])
Scan:
grep -rn "\.then(" src/ | grep -v "\.catch\|\.finally" | grep -v "test\|spec"
grep -rn "async.*=>" src/ | grep -v "try\|await" | head -20
Fix:
// ❌ ERRADO
fetchData().then(setData)
// ✅ CORRETO
fetchData()
.then(setData)
.catch((err) => {
console.error('[ComponentName] fetchData failed:', err)
setError(err.message)
})
Sintoma: App quebra quando REDIS_URL está vazio
Verificar em /lib/cache/redis.ts:
// DEVE ter fallback in-memory
const redis = process.env.REDIS_URL
? new Redis(process.env.REDIS_URL)
: new MemoryCache() // implementação local
any Silencioso# Encontrar todos os `any` explícitos e implícitos
grep -rn ": any\|as any\|<any>" src/ --include="*.ts" --include="*.tsx"
# Scan completo de mock data
grep -rn "mockData\|MOCK_DATA\|mock_data\|isMock\|useMock\|fakePrices\|dummyData" src/
grep -rn "Math\.random()\|Math\.floor(Math\.random" src/ --include="*.ts" --include="*.tsx"
Se encontrado: SUBSTITUIR pela API real imediatamente — nunca comentar ou condicionar.
Sintoma: Dados parados após perda de conexão
Fix com exponential backoff:
class WebSocketManager {
private reconnectDelay = 1000
private maxDelay = 30000
private ws: WebSocket | null = null
connect(url: string) {
this.ws = new WebSocket(url)
this.ws.onclose = () => {
setTimeout(() => {
this.reconnectDelay = Math.min(this.reconnectDelay * 2, this.maxDelay)
this.connect(url)
}, this.reconnectDelay)
}
this.ws.onopen = () => {
this.reconnectDelay = 1000 // reset
}
}
}
npm run dev
# Abrir browser com DevTools
# Console → filtrar por Errors
# Network → filtrar por Failed
# Identificar ficheiro exato
npm run type-check 2>&1 | grep "error TS"
# Verificar linha específica
# Após fix
npm run type-check
npm run lint
npm run test -- --testPathPattern="[módulo afetado]"
| Erro | Causa | Fix |
|---|---|---|
Cannot read property 'price' of undefined | API response sem validação | Adicionar optional chaining + Zod |
WebSocket is closed | Sem reconnection logic | WebSocketManager com backoff |
Hydration failed | Server/client state diferente | useEffect + mounted flag |
Redis connection refused | REDIS_URL vazio | Fallback in-memory |
Cannot find module '@/...' | Path alias errado | Verificar tsconfig.json paths |
ChunkLoadError | Code splitting falhou | next.config.js chunk config |
# Ver todos os erros de TypeScript
npx tsc --noEmit 2>&1
# Verificar bundle size
npm run build 2>&1 | grep "First Load JS"
# Memory usage em dev
node --expose-gc --max-old-space-size=4096 node_modules/.bin/next dev