sc-log-fix
БесплатноБез исполняемых скриптовНе проверенAnalyze application logs, identify errors, perform root cause analysis, and interactively fix issues with a learned knowledge base. Use when debugging from…
от Tony363★ 21 звезда на GitHubОб этом скилле
Log-Fix: Iterative Bug Fixing from Log Analysis
Analyze logs from multiple sources, identify errors, perform root cause analysis, and interactively fix issues with pattern learning.
Quick Start
# Analyze recent errors from all log sources
/sc:log-fix
# Filter by time and severity
/sc:log-fix --time 1h --level ERROR
# Target specific log source
/sc:log-fix --source backend --component app.services
# Trace a specific request
/sc:log-fix --request-id abc-123-def
# Dry run - analyze without fixing
/sc:log-fix --dry-run
Behavioral Flow
- Discover - Detect available log sources (files, docker, systemd)
- Load Knowledge - Check for learned patterns from previous fixes
- Collect - Parse and normalize logs from detected sources
- Triage - Cluster errors, rank by severity, match known patterns
- Analyze - Root cause analysis with stack traces and code inspection
- Fix - Interactive fix loop with user approval
- Learn - Save successful fix patterns to knowledge base
- Report - Summary of session with remaining issues
Flags
| Flag | Type | Default | Description |
|---|---|---|---|
--time |
string | 1h | Time range: 30m, 1h, 1d, 7d |
--source |
string | all | Log source: backend, frontend, docker, all |
--level |
string | ERROR | Minimum severity: ERROR, WARNING, all |
--component |
string | - | Filter by logger/module name |
--request-id |
string | - | Trace specific request across logs |
--dry-run |
bool | false | Analyze and report without applying fixes |
--fix |
bool | true | Enable interactive fix loop |
Phase 0: Log Source Discovery
Auto-detect all available log sources before analysis.
Detection Strategy
| Source | Detection Method | Common Locations |
|---|---|---|
| File logs | Glob for logs/**/*.log, *.log |
logs/, var/log/ |
| Docker | Check docker compose ps |
docker-compose.yml |
| Systemd | Check journalctl availability |
System services |
| PM2 | Check pm2 list |
Node.js apps |
Log Format Detection
Auto-detect log format:
- JSON (structured) - Parse with
jq - Text (unstructured) - Parse with regex patterns
- Combined (nginx/apache style) - Parse with format-specific regex
# Detect format by reading first line
head -1 logs/app.log | python3 -c "import sys,json; json.loads(sys.stdin.read()); print('json')" 2>/dev/null || echo "text"
Phase 1: Knowledge Loading
Load historical fix knowledge for enhanced analysis.
Knowledge File Structure
{
"version": "1.0",
"error_patterns": [
{
"id": "pattern-001",
"signature": {
"message_pattern": "Connection refused.*port \\d+",
"component": "app.services.database",
"exception_type": "ConnectionError"
},
"fixes": [{
"description": "Check database is running, verify connection string",
"file_changed": "src/config.py",
"validation_command": "pytest tests/test_db.py -v",
"success_count": 3,
"confidence": 0.9
}]
}
],
"component_knowledge": {},
"metadata": {
"total_fixes": 0,
"updated_at": null
}
}
Location: .claude/knowledge/log-fix-knowledge.json
When knowledge is loaded:
- Triage: Show "Known issue" badge for previously seen errors
- Root Cause: Suggest fixes with historical success rates
- Fix Loop: Offer one-click application of proven fixes
Phase 2: Triage and Clustering
Incident Clustering
Group by:
- Same error type (identical/similar messages)
- Same component (logger/service name)
- Same request (request_id correlation)
- Same time window (errors within 5s)
Severity Ranking
| Priority | Criteria |
|---|---|
| P0 | Stack trace, service crash, database errors |
| P1 | ERROR level, API failures, auth issues |
| P2 | WARNING level, deprecation, performance |
| P3 | Informational, cleanup suggestions |
Triage Summary Output
## Error Triage Summary
**Time Range**: [start] to [end]
**Total Errors**: N | **Unique Types**: M | **Known Patterns**: K
### Top Issues by Frequency
| # | Count | Component | Error Pattern | Priority | Historical |
|---|-------|-----------|---------------|----------|------------|
| 1 | 15 | app.services.api | Connection timeout | P1 | Known: 3 fixes, 90% |
| 2 | 8 | app.models | Validation failed | P1 | New pattern |
Phase 3: Root Cause Analysis
For each incident cluster:
- Stack Trace Analysis - Extract file paths, identify failing line, map to components
- Log Correlation - Follow request_id across services
- Pattern Matching - Check knowledge base, then use code-level analysis
- Code Inspection - Read relevant source files, identify the bug
Root Cause Output
## Root Cause: [Error Type]
**Occurrences**: N | **Component**: [logger]
### Error Details
[Full error and
Установить sc-log-fix в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл sc-log-fix?
Analyze application logs, identify errors, perform root cause analysis, and interactively fix issues with a learned knowledge base. Use when debugging from logs, triaging errors, or fixing recurring issues.
Как установить скилл sc-log-fix?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sc-log-fix запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic