Agent Skill
2/7/2026opentui-debug
Debug OpenTUI applications using file-based logging when console.log is captured by the TUI overlay.
J
jcha0713
0GitHub Stars
1Views
npx skills add jcha0713/igl
SKILL.md
| Name | opentui-debug |
| Description | Debug OpenTUI applications using file-based logging when console.log is captured by the TUI overlay. |
name: opentui-debug description: Debug OpenTUI applications using file-based logging when console.log is captured by the TUI overlay.
OpenTUI Debug
File-based debugging for OpenTUI apps since console.log output is captured by the TUI's debug overlay.
Quick Start
Log from components:
import { logDebug } from "./utils/debug.ts";
logDebug("render", { width, height, scrollOffset });
Agent reads the log:
read /path/to/project/debug.log
When to Use
Use when:
console.logdoesn't appear in terminal (captured by OpenTUI)- Need to trace state changes across renders
- Debugging scroll behavior, layout calculations
- Analyzing key input handling
Setup (Already in Project)
src/utils/debug.ts- Logger utilitydebug.log- Output file (project root, gitignored)- Auto-clears on app start
API
logDebug(label: string, data: unknown): void
Logs are appended with timestamps:
[2026-02-06T04:35:04.309Z] label:
{
"key": "value"
}
Best Practices
- Log state changes in
useEffect - Log key presses in
useKeyboardhandlers - Log calculated values (visible rows, scroll offsets)
- Restart app after adding debug points (logger initializes on import)
Example
useKeyboard((key) => {
logDebug("key", { name: key.name, mode: currentMode });
// ... handle
});
useEffect(() => {
logDebug("scroll", { offset, maxScroll, visible: rows.length });
}, [offset]);
Troubleshooting
| Issue | Fix |
|---|---|
| No log file | Restart app after adding logDebug() |
| Log not updating | Check logDebug() is actually called |
| Too verbose | Remove logs from frequently-rendered components |
Skills Info
Original Name:opentui-debugAuthor:jcha0713
Download