terminal-expert
БесплатноБез исполняемых скриптовНе проверенThis skill provides unified expert-level guidance for terminal implementation in VS Code extensions. Covers xterm.js API and addons, VS Code terminal…
Об этом скилле
Terminal Expert
Overview
This skill provides comprehensive knowledge for implementing terminal features in VS Code extensions. It unifies xterm.js implementation details with VS Code's terminal architecture patterns, ensuring consistency with the official VS Code terminal implementation.
When to Use This Skill
- Creating and configuring xterm.js Terminal instances
- Implementing terminal addons (fit, webgl, serialize, search, etc.)
- Integrating with VS Code WebViews
- Implementing PTY (pseudo-terminal) process management
- Creating terminal session persistence and restoration
- Handling keyboard input, IME composition, and mouse events
- Implementing shell integration with OSC 633 sequences
- Optimizing terminal performance (GPU acceleration, buffering)
- Managing terminal lifecycle and resource cleanup
Quick Reference
Essential Addons
| Addon | Package | Purpose | Loading |
|---|---|---|---|
| FitAddon | @xterm/addon-fit |
Auto-resize to container | Always |
| WebglAddon | @xterm/addon-webgl |
GPU acceleration (30%+ perf) | Lazy |
| SerializeAddon | @xterm/addon-serialize |
Session persistence | Lazy |
| SearchAddon | @xterm/addon-search |
Find in terminal | Lazy |
| Unicode11Addon | @xterm/addon-unicode11 |
Extended Unicode | Config |
| WebLinksAddon | @xterm/addon-web-links |
Clickable URLs | Config |
| ImageAddon | @xterm/addon-image |
Inline images | Config |
Performance Targets
| Operation | Target | Notes |
|---|---|---|
| Terminal creation | <500ms | Including PTY spawn |
| Session restore | <3s | 1000 lines scrollback |
| Terminal disposal | <100ms | Full cleanup |
| Resize handling | 100ms debounce | Prevents excessive calls |
| Output buffering | 16ms flush | ~60fps rendering |
xterm.js Implementation
Basic Terminal Setup
import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit';
import { WebglAddon } from '@xterm/addon-webgl';
class TerminalManager {
private terminal: Terminal;
private fitAddon: FitAddon;
private container: HTMLElement;
constructor(container: HTMLElement) {
this.container = container;
this.terminal = this.createTerminal();
this.fitAddon = new FitAddon();
}
private createTerminal(): Terminal {
return new Terminal({
// Appearance
fontFamily: '"Cascadia Code", "Fira Code", monospace',
fontSize: 14,
lineHeight: 1.2,
cursorStyle: 'block',
cursorBlink: true,
// Behavior
scrollback: 5000,
altClickMovesCursor: true,
// Performance
fastScrollModifier: 'alt',
smoothScrollDuration: 0,
// Theme
theme: {
background: '#1e1e1e',
foreground: '#d4d4d4',
cursor: '#d4d4d4',
selectionBackground: '#264f78'
}
});
}
initialize(): void {
this.terminal.loadAddon(this.fitAddon);
this.terminal.open(this.container);
this.fitAddon.fit();
this.setupResizeObserver();
}
private setupResizeObserver(): void {
const resizeObserver = new ResizeObserver(() => {
requestAnimationFrame(() => this.fitAddon.fit());
});
resizeObserver.observe(this.container);
}
}
WebGL Renderer with Fallback
class RenderingManager {
private webglAddon: WebglAddon | undefined;
private terminal: Terminal;
enableWebGL(): boolean {
try {
this.webglAddon = new WebglAddon();
this.webglAddon.onContextLoss(() => {
console.warn('WebGL context lost, falling back to canvas');
this.disableWebGL();
});
this.terminal.loadAddon(this.webglAddon);
return true;
} catch (error) {
console.warn('WebGL not available:', error);
return false;
}
}
disableWebGL(): void {
this.webglAddon?.dispose();
this.webglAddon = undefined;
}
}
Session Persistence with SerializeAddon
import { SerializeAddon } from '@xterm/addon-serialize';
class ScrollbackManager {
private serializeAddon: SerializeAddon;
private terminal: Terminal;
constructor(terminal: Terminal) {
this.terminal = terminal;
this.serializeAddon = new SerializeAddon();
this.terminal.loadAddon(this.serializeAddon);
}
saveScrollback(options?: { scrollback?: number }): string {
return this.serializeAddon.serialize({
scrollback: options?.scrollback ?? 1000,
excludeModes: true,
excludeAltBuffer: true
});
}
restoreScrollback(content: string): void {
this.terminal.write(content);
}
}
Output Buffering for High-Frequency Output
class OutputBuffer {
private terminal: Terminal;
private buffer: string = '';
private flushScheduled = false;
private flushInterval: number;
constructor(terminal: Terminal, flushInterval: number = 16) {
this.terminal = terminal;
this.flushInterval = flushInterval;
}
write(data: string): void {
this.buffer += da
Установить terminal-expert в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл terminal-expert?
This skill provides unified expert-level guidance for terminal implementation in VS Code extensions. Covers xterm.js API and addons, VS Code terminal architecture, PTY integration, session persistence, input handling (keyboard/IME/mouse), shell integration with OSC sequences, and performance optimization. Use when implementing any terminal-related features.
Как установить скилл terminal-expert?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл terminal-expert запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic