Files
gongxue-base/.agents/skills/systematic-debugging/CREATION-LOG.md
wangziqi b6d398b102 feat: 导入导出错误信息 Markdown 渲染升级
Phase 1: 共用类型定义
- apps/server/src/common/import-result.types.ts — ImportRowError + ImportResult<T>
- apps/admin/src/types/import.ts — 前端对应类型 + ImportDisplayConfig

Phase 2: 后端增强
- students.service.ts — batchImport/matchImport 改为 ImportResult 格式
  · 每行跳过时收集 ImportRowError(code + reason)
  · reason 支持 markdown 标记(**字段名** / `值`)
- archive.service.ts — batchImportArchive 统一用 ImportResult 格式
  · 各 Sheet 错误使用标准 error code
- archive.controller.ts — 日志使用新的 success 字段

Phase 3: 前端基础
- 安装 react-markdown
- ImportResultModal 组件(共用导入结果弹窗)
  · Statistic 成功统计 + Table 错误明细
  · 原因列支持 react-markdown 渲染(粗体字段名、等宽代码值)
  · 错误类型用 Tag 颜色区分
- api/index.ts — 403 错误从 console.warn 改为 message.warning 用户可见

Phase 4: 前端集成
- Students/index.tsx — 替换硬编码导入结果弹窗
  · 删除'后端只返回统计汇总'注释和跳过原因 hardcode
  · 新格式自动使用 ImportResultModal,旧格式兼容
- StudentProfileContent/index.tsx — 替换内联导入 Modal 为 ImportResultModal
2026-07-20 15:25:14 +08:00

4.2 KiB

Creation Log: Systematic Debugging Skill

Reference example of extracting, structuring, and bulletproofing a critical skill.

Source Material

Extracted debugging framework from ~/.claude/CLAUDE.md:

  • 4-phase systematic process (Investigation → Pattern Analysis → Hypothesis → Implementation)
  • Core mandate: ALWAYS find root cause, NEVER fix symptoms
  • Rules designed to resist time pressure and rationalization

Extraction Decisions

What to include:

  • Complete 4-phase framework with all rules
  • Anti-shortcuts ("NEVER fix symptom", "STOP and re-analyze")
  • Pressure-resistant language ("even if faster", "even if I seem in a hurry")
  • Concrete steps for each phase

What to leave out:

  • Project-specific context
  • Repetitive variations of same rule
  • Narrative explanations (condensed to principles)

Structure Following skill-creation/SKILL.md

  1. Rich when_to_use - Included symptoms and anti-patterns
  2. Type: technique - Concrete process with steps
  3. Keywords - "root cause", "symptom", "workaround", "debugging", "investigation"
  4. Flowchart - Decision point for "fix failed" → re-analyze vs add more fixes
  5. Phase-by-phase breakdown - Scannable checklist format
  6. Anti-patterns section - What NOT to do (critical for this skill)

Bulletproofing Elements

Framework designed to resist rationalization under pressure:

Language Choices

  • "ALWAYS" / "NEVER" (not "should" / "try to")
  • "even if faster" / "even if I seem in a hurry"
  • "STOP and re-analyze" (explicit pause)
  • "Don't skip past" (catches the actual behavior)

Structural Defenses

  • Phase 1 required - Can't skip to implementation
  • Single hypothesis rule - Forces thinking, prevents shotgun fixes
  • Explicit failure mode - "IF your first fix doesn't work" with mandatory action
  • Anti-patterns section - Shows exactly what shortcuts look like

Redundancy

  • Root cause mandate in overview + when_to_use + Phase 1 + implementation rules
  • "NEVER fix symptom" appears 4 times in different contexts
  • Each phase has explicit "don't skip" guidance

Testing Approach

Created 4 validation tests following skills/meta/testing-skills-with-subagents:

Test 1: Academic Context (No Pressure)

  • Simple bug, no time pressure
  • Result: Perfect compliance, complete investigation

Test 2: Time Pressure + Obvious Quick Fix

  • User "in a hurry", symptom fix looks easy
  • Result: Resisted shortcut, followed full process, found real root cause

Test 3: Complex System + Uncertainty

  • Multi-layer failure, unclear if can find root cause
  • Result: Systematic investigation, traced through all layers, found source

Test 4: Failed First Fix

  • Hypothesis doesn't work, temptation to add more fixes
  • Result: Stopped, re-analyzed, formed new hypothesis (no shotgun)

All tests passed. No rationalizations found.

Iterations

Initial Version

  • Complete 4-phase framework
  • Anti-patterns section
  • Flowchart for "fix failed" decision

Enhancement 1: TDD Reference

  • Added link to skills/testing/test-driven-development
  • Note explaining TDD's "simplest code" ≠ debugging's "root cause"
  • Prevents confusion between methodologies

Final Outcome

Bulletproof skill that:

  • Clearly mandates root cause investigation
  • Resists time pressure rationalization
  • Provides concrete steps for each phase
  • Shows anti-patterns explicitly
  • Tested under multiple pressure scenarios
  • Clarifies relationship to TDD
  • Ready for use

Key Insight

Most important bulletproofing: Anti-patterns section showing exact shortcuts that feel justified in the moment. When Claude thinks "I'll just add this one quick fix", seeing that exact pattern listed as wrong creates cognitive friction.

Usage Example

When encountering a bug:

  1. Load skill: skills/debugging/systematic-debugging
  2. Read overview (10 sec) - reminded of mandate
  3. Follow Phase 1 checklist - forced investigation
  4. If tempted to skip - see anti-pattern, stop
  5. Complete all phases - root cause found

Time investment: 5-10 minutes Time saved: Hours of symptom-whack-a-mole


Created: 2025-10-03 Purpose: Reference example for skill extraction and bulletproofing