技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
testing-and-debugging【数据与研究】Diagnose and debug issues in the vehicle insurance data analysis platform. Use when user encounters errors, data not refreshing, filters not working, charts not displaying, API failures, or performance issues. Provides quick diagnostic checklists and proven troubleshooting steps specific to this Vue 3 + Flask + Pandas stack.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
You are assisting with debugging the vehicle insurance data analysis platform (Vue 3 frontend + Flask backend + Pandas data processing).
Activate this skill when the user reports:
Ask the user to describe the symptom, then categorize:
Frontend Issues (Vue/UI):
Backend Issues (Flask/Pandas):
backend/backend.log)Integration Issues:
Guide the user through these checks:
# Check if dev server is running
lsof -i :5173
# View browser console
# Open DevTools (F12) → Console tab → Check for errors
# Check Vue DevTools
# Install Vue DevTools extension → Inspect component state
# Check if backend is running
lsof -i :5000
# View backend logs
tail -f backend/backend.log
# Test API directly
curl http://localhost:5000/api/latest-date
Refer to the Common Issues Reference for detailed troubleshooting steps.
项目/
├── frontend/ # Vue 3 + Vite
│ ├── src/
│ │ ├── components/ # KpiCard, FilterPanel, ChartView
│ │ ├── stores/ # data.js, filter.js, app.js (Pinia)
│ │ ├── views/ # Dashboard.vue
│ │ └── services/ # api.js (Axios)
│ └── package.json # NO testing libraries installed yet
├── backend/
│ ├── api_server.py # Flask routes
│ ├── data_processor.py # Pandas logic
│ └── backend.log # Runtime logs
└── data/ # CSV files
Important Context:
Symptom: KPI values not updating
Diagnostic checklist:
value, trend, loadingstore.kpiDataCommon causes:
fetchKpiData() actionvalueType propSymptom: Filters applied but data doesn't change
Diagnostic steps:
activeInstitution, activeTeam, etc. are updatedapplyFilters() action was triggeredQuick fix:
// In browser console
const filterStore = useFilterStore()
console.log('Active filters:', filterStore.activeInstitution, filterStore.activeTeam)
const dataStore = useDataStore()
dataStore.fetchFilteredData() // Force refresh
Symptom: Chart not rendering
Diagnostic checklist:
chartData prop structure matches ECharts formatQuick fixes:
// In ChartView.vue, add logging
onMounted(() => {
console.log('Chart container:', chartRef.value)
console.log('Chart data:', props.chartData)
console.log('Container size:', chartRef.value?.offsetWidth, chartRef.value?.offsetHeight)
})
Symptom: API returns 500 or 404
Diagnostic steps:
backend/backend.log for Python exceptionscurl -X GET 'http://localhost:5000/api/kpi?period=day'
ps aux | grep api_serverCommon causes:
车险清单_2025年10-11月_合并.csv not found → Run scan_and_process_new_files()data_processor.pyCheck these:
Optimization tips:
# In data_processor.py
# SLOW (avoid)
for index, row in df.iterrows():
df.at[index, 'new_col'] = some_function(row)
# FAST (vectorized)
df['new_col'] = df.apply(lambda row: some_function(row), axis=1)
Symptoms: Browser/Python crashes
Diagnostic:
# Check memory usage
# macOS:
top -o MEM
# Check Python process
ps aux | grep python | awk '{print $11, $6/1024 "MB"}'
Solutions:
Current approach (add to components as needed):
// In stores/data.js
export const useDataStore = defineStore('data', {
actions: {
async fetchKpiData() {
console.log('[DataStore] Fetching KPI data...')
try {
const response = await api.getKpiData()
console.log('[DataStore] KPI data loaded:', response.data)
this.kpiData = response.data
} catch (error) {
console.error('[DataStore] Fetch error:', error)
this.error = error.message
}
}
}
})
Current configuration (already in place):
# backend/api_server.py uses Python logging
import logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s [%(levelname)s] %(name)s: %(message)s',
handlers=[
logging.FileHandler('backend/backend.log'),
logging.StreamHandler()
]
)
View logs:
# Real-time monitoring
tail -f backend/backend.log
# Search for errors
grep -i "error" backend/backend.log
# Last 50 lines
tail -n 50 backend/backend.log
1. User reports: "Data not refreshing"
2. Open Console → Check for errors
3. Open Network → Filter by XHR → Check API calls
4. Open Vue DevTools → Pinia → Inspect DataStore state
5. If API failed → Check backend logs
6. If API succeeded but UI not updated → Check component reactive data
Note: Project does not currently have automated testing configured.
If user wants to add testing:
# Stop all processes
pkill -f api_server
pkill -f vite
# Clear caches
rm -rf frontend/node_modules/.vite
rm -rf frontend/dist
# Restart backend
cd backend && python api_server.py &
# Restart frontend
cd frontend && npm run dev
# Backup current data
cp 车险清单_2025年10-11月_合并.csv 车险清单_backup.csv
# Re-scan and rebuild
# (Python)
from data_processor import DataProcessor
processor = DataProcessor()
processor.scan_and_process_new_files()
This skill focuses on practical debugging for the current project state. It assumes:
For advanced testing setup, refer to companion guides. For deployment debugging, use the deployment-and-ops skill.
Key principle: Always start with logs (browser Console + backend.log) before diving into code.