AgentSkillsCN

debugging

在遇到错误、堆栈跟踪,或排查 Bug 时加载。提供系统化的调试模式,以及来自 141 条工作流日志的常见陷阱与技巧。

SKILL.md
--- frontmatter
name: debugging
description: Load when encountering errors, tracebacks, or investigating bugs. Provides systematic debugging patterns and common gotchas from 141 workflow logs.

Debugging

Merged Skills

  • error-analysis: Reading tracebacks, identifying root cause
  • gotcha-lookup: Known issues from project history

⚠️ Critical Gotchas (from 131 logs)

CategoryPatternSolution
API307 redirect on POSTAdd trailing slash to URL
API401 on valid tokenCheck auth headers, token expiry
AuthlocalStorage returns nullCheck nop-auth key, not auth_token
StatePersisted state staleVersion storage key, clear cache
StateNested object not updatingUse immutable update or flag_modified
StateReact state stale in asyncUse callback/ref patterns
StateConfigPanel save lostPersist to backend, not just Zustand
BuildChanges not visibleRebuild with --no-cache
BuildContainer old codeUse --build --force-recreate
SyntaxJSX comment errorUse {/* */} not // in JSX
CSSElement hiddenCheck z-index, overflow, position
FrontendDropdown flickeringMemoize options with useMemo
FrontendBlack screenAdd error boundary/try-catch
MockBlock executor mock dataCheck mock vs real implementation
JSONBNested object not updatingUse flag_modified() after update
WorkflowProgress stuck at 3/4Set 100% on execution_completed event
WorkflowBlack screen on switchCall reset() to clear execution state
ContextConnection menu hiddenCheck DOM ordering, z-index, pointer-events
CacheSame skill reloadedLoad skill ONCE per domain, cache list
ScriptsParse failsCreate log BEFORE running scripts
WorkflowEND scripts failCreate workflow log FIRST
TerminalLine wrapping corruptsLimit line length, handle overflow
Undo/RedoDeep state breaksUse immutable update patterns
CredentialsParams missingValidate block config completeness
JSEmpty object {} is truthyUse Object.keys(obj).length > 0 check
WebSocketexecution_completed missing stateInclude nodeStatuses in WS completion event

Rules

RulePattern
Check gotchas first75% of issues are known - check table above
Read full tracebackDon't stop at first error line
Root cause focusFix cause, not symptoms
Plan before fixUnderstand problem before coding
Verify fix worksTest that issue is actually resolved
Document findingsAdd new gotchas to workflow log

Avoid

❌ Bad✅ Good
Fix symptomsFind root cause
Ignore tracebackRead entire error
Skip gotcha checkCheck known issues first
Assume fix worksVerify with test
Undocumented fixAdd to gotchas if new

Patterns

python
# Pattern 1: JSONB mutation fix (SQLAlchemy)
from sqlalchemy.orm.attributes import flag_modified

agent.agent_metadata['key'] = value
flag_modified(agent, 'agent_metadata')  # CRITICAL
await db.commit()

# Pattern 2: Async state capture (React)
const handleClick = async () => {
  const capturedState = { ...localState };  // Capture BEFORE async
  await updateNode(nodeId, capturedState);
  await saveCurrentWorkflow();
};
tsx
// Pattern 3: Error boundary wrapper
<ErrorBoundary fallback={<ErrorFallback />}>
  <RiskyComponent />
</ErrorBoundary>
bash
# Pattern 4: Container debugging
docker compose logs -f backend --tail 100
docker exec -it nop-backend bash
docker compose down && docker compose up -d --build

Debug Protocol

StepAction
1CHECK gotchas table (75% are known)
2READ full error/traceback
3ANALYZE root cause (not symptoms)
4PLAN fix before implementing
5VERIFY fix resolves issue
6DOCUMENT in workflow log

Commands

IssueCommand
Backend logsdocker compose logs -f backend
Frontend logsdocker compose logs -f frontend
Rebuild cleandocker compose build --no-cache
Full resetdocker compose down && docker compose up -d --build
Check processesdocker compose ps
Enter containerdocker exec -it nop-backend bash