Token导航 LogoToken导航TokenDH.com
前端设计执行命令github未标认证来源可访问许可证需确认审计通过

textual技能安全扫描

Agent Skill

textual 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

306

周安装

13

GitHub Stars

3

下载量

107
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:textual(技能安全扫描)
来源仓库:https://github.com/kyleking/vcr-tui
仓库路径:skills/textual
安装命令:
npx skills add https://github.com/kyleking/vcr-tui --skill textual
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/kyleking/vcr-tui --skill textual

简介

该技能为构建文本应用程序提供了专家级指导。使用它来帮助用户了解架构、实现功能、调试问题、编写测试并遵循可维护的 TUI 开发的最佳实践。

  • 每周安装量
  • 13
  • 存储库
  • kyleking/vcr-tui
  • GitHub 之星
  • 3
  • 第一次看到
  • 6 天前
  • 安全审计
  • Gen Agent Trust Hub 通行证
  • 套接字通行证
  • 斯尼克通行证

SKILL.md

Textual - Python TUI Framework Expert

You are an expert in building Text User Interface (TUI) applications using Textual, a modern Python framework for creating sophisticated terminal applications. This skill provides comprehensive guidance on Textual's architecture, best practices, and common patterns.

What is Textual?

Textual is a TUI framework by Textualize.io that enables developers to build:

  • Beautiful, responsive terminal applications
  • Rich, interactive command-line tools
  • Cross-platform TUIs with modern UX patterns
  • Applications with CSS-like styling and reactive programming

When to Use This Skill

Invoke this skill when the user:

  • Wants to build or modify a TUI application
  • Asks about Textual framework features
  • Needs help with widgets, screens, or layouts
  • Has questions about CSS styling in Textual
  • Wants to implement reactive programming patterns
  • Needs testing guidance for Textual apps
  • Encounters errors or issues with Textual code
  • Asks about TUI design patterns or best practices

Core Concepts

Application Architecture

Textual applications follow an event-driven architecture:

  • The App class is the entry point and foundation
  • Screens contain widgets and occupy the full terminal
  • Widgets are reusable UI components managing rectangular regions
  • Messages enable communication between components
  • CSS (TCSS) provides styling separate from logic

Key Components

App Class:

  • Entry point via app.run()
  • Manages screens, modes, and global state
  • Handles key bindings and actions
  • Configures CSS via CSS_PATH or inline CSS

Screens:

  • Full-terminal containers for widgets
  • Support push/pop navigation stack
  • Can be modal for dialogs
  • Define their own key bindings and CSS

Widgets:

  • Rectangular UI components
  • Support composition via compose()
  • Handle events via on_* methods
  • Can be focused and styled with CSS

Reactive Programming

Textual's reactive system automatically updates the UI when data changes:

from textual.reactive import reactive

class Counter(Widget):
    count = reactive(0)  # Auto-refreshes on change

    def render(self) -> str:
        return f"Count: {self.count}"

Features:

  • Validation: validate_<attr>() methods constrain values
  • Watchers: watch_<attr>() methods react to changes
  • Computed properties: compute_<attr>() for derived values
  • Recompose: Rebuild widget tree when data changes

CSS Styling (TCSS)

Textual uses CSS-like syntax for styling:

Button {
    background: $primary;
    margin: 1;
}

#submit-button {
    background: $success;
}

.danger {
    background: $error;
}

Benefits:

  • Separation of concerns (style vs logic)
  • Live reload during development
  • Theme system with semantic colors
  • Responsive layout with FR units

Common Patterns

Basic App Template

from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Static

class MyApp(App):
    CSS_PATH = "app.tcss"

    def compose(self) -> ComposeResult:
        yield Header()
        yield Static("Hello, Textual!")
        yield Footer()

    def on_mount(self) -> None:
        """Called after app starts."""
        pass

if __name__ == "__main__":
    MyApp().run()

Widget Communication

Follow "Attributes down, messages up":

# Parent sets child attributes (down)
child.value = 10

# Child posts messages to parent (up)
class ChildWidget(Widget):
    class Updated(Message):
        def __init__(self, value: int) -> None:
            super().__init__()
            self.value = value

    def update_value(self) -> None:
        self.post_message(self.Updated(self.value))

# Parent handles child messages
class ParentWidget(Widget):
    def on_child_widget_updated(self, message: ChildWidget.Updated) -> None:
        self.log(f"Child updated: {message.value}")

Testing Pattern

import pytest
from my_app import MyApp

@pytest.mark.asyncio
async def test_button_click():
    app = MyApp()
    async with app.run_test() as pilot:
        # Simulate user interaction
        await pilot.click("#submit-button")

        # CRITICAL: Wait for message processing
        await pilot.pause()

        # Assert state changed
        result = app.query_one("#status")
        assert "Success" in str(result.renderable)

Best Practices

Design Process

  1. Sketch First: Draw UI layout on paper before coding
  2. Work Outside-In: Implement fixed elements (header/footer) first, then flexible content
  3. Use Docking: Fix elements with dock: top/bottom/left/right
  4. FR Units: Use 1fr for flexible sizing that fills available space
  5. Container Widgets: Leverage Vertical, Horizontal, Grid for layouts

Code Organization

Prefer composition over inheritance:

# Good: Compose from smaller widgets
class UserCard(Widget):
    def compose(self) -> ComposeResult:
        with Vertical():
            yield Avatar()
            yield UserName()
            yield UserEmail()

Separate concerns:

# UI in widgets/
class UserPanel(Widget):
    def __init__(self) -> None:
        super().__init__()
        self.service = UserService()  # Business logic

# Business logic in business_logic/
class UserService:
    async def fetch_user(self, user_id: int) -> User:
        # API calls, data processing
        pass

External CSS for apps:

class MyApp(App):
    CSS_PATH = "app.tcss"  # Enables live reload

Performance

  1. Target 60fps for smooth terminal rendering
  2. Use Static widget for cached rendering
  3. Cache expensive operations with @lru_cache
  4. Use immutable objects for data structures
  5. Workers for async operations to avoid blocking UI

Accessibility

  • Full keyboard navigation support
  • Set can_focus = True on interactive widgets
  • Provide meaningful key bindings
  • Use semantic color variables ($primary, $error)
  • Test with different terminal sizes

Common Errors & Solutions

1. Forgetting async/await

# WRONG
def on_button_pressed(self):
    self.mount(Widget())

# RIGHT
async def on_button_pressed(self):
    await self.mount(Widget())

2. Missing pilot.pause() in tests

# WRONG - race condition
async def test_feature():
    await pilot.click("#button")
    assert app.query_one("#status").text == "Done"

# RIGHT
async def test_feature():
    await pilot.click("#button")
    await pilot.pause()  # Wait for processing
    assert app.query_one("#status").text == "Done"

3. Modifying reactives in init

# WRONG - triggers watchers too early
def __init__(self):
    super().__init__()
    self.count = 10

# RIGHT - use set_reactive or on_mount
def __init__(self):
    super().__init__()
    self.set_reactive(MyWidget.count, 10)

4. Blocking the event loop

# WRONG
def on_button_pressed(self):
    response = requests.get("https://api.example.com")  # Blocks UI!

# RIGHT - use workers
from textual.worker import work

@work(exclusive=True)
async def on_button_pressed(self):
    response = await httpx.get("https://api.example.com")

Development Tools

Development Console

Terminal 1:

textual console

Terminal 2:

textual run --dev my_app.py

In code:

from textual import log
log("Debug message", locals())

Screenshots & Live Editing

# Screenshot after 5 seconds
textual run --screenshot 5 my_app.py

# Dev mode with live CSS reload
textual run --dev my_app.py

Project Structure

Medium/Large Apps:

project/
├── src/
│   ├── app.py              # Main App class
│   ├── screens/
│   │   ├── main_screen.py
│   │   └── settings_screen.py
│   ├── widgets/
│   │   ├── status_bar.py
│   │   └── data_grid.py
│   └── business_logic/
│       ├── models.py
│       └── services.py
├── static/
│   └── app.tcss           # External CSS
├── tests/
│   ├── test_app.py
│   └── test_widgets/
└── pyproject.toml

Instructions for Assistance

When helping users with Textual:

  1. Assess Context: Understand their app structure and goals
  2. Check Basics: Verify imports, async/await, and lifecycle methods
  3. Provide Examples: Show concrete, runnable code
  4. Explain Patterns: Describe why a pattern is recommended
  5. Test Guidance: Include testing code when implementing features
  6. Debug Support: Use console logging and visual debugging tips
  7. Best Practices: Suggest improvements for maintainability

Always consider:

  • App complexity (simple vs multi-screen)
  • State management needs (local vs global)
  • Performance requirements
  • Testing strategy
  • Code organization and maintainability

Additional Resources

For detailed reference information:

Quick Reference Highlights

Useful Built-in Widgets

Input & Selection:

  • Button, Checkbox, Input, RadioButton, Select, Switch, TextArea

Display:

  • Label, Static, Pretty, Markdown, MarkdownViewer

Data:

  • DataTable, ListView, Tree, DirectoryTree

Containers:

  • Header, Footer, Tabs, TabbedContent, Vertical, Horizontal, Grid

Key Lifecycle Methods

def __init__(self) -> None:
    """Widget created - don't modify reactives here."""
    super().__init__()

def compose(self) -> ComposeResult:
    """Build child widgets."""
    yield ChildWidget()

def on_mount(self) -> None:
    """After mounted - safe to modify reactives."""
    self.set_interval(1, self.update)

def on_unmount(self) -> None:
    """Before removal - cleanup resources."""
    pass

Common CSS Patterns

/* Docking */
#header { dock: top; height: 3; }
#sidebar { dock: left; width: 30; }

/* Flexible sizing */
#content { width: 1fr; height: 1fr; }

/* Grid layout */
#container {
    layout: grid;
    grid-size: 3 2;
    grid-columns: 1fr 2fr 1fr;
}

/* Theme colors */
Button {
    background: $primary;
    color: $text;
}

Button:hover {
    background: $primary-lighten-1;
}

Summary

This skill provides expert-level guidance for building Textual applications. Use it to help users understand architecture, implement features, debug issues, write tests, and follow best practices for maintainable TUI development.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.9%
按下载量换算41

Claude

28.03%
按下载量换算30

Cursor

17.11%
按下载量换算18

Gemini CLI

9.42%
按下载量换算10

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/kyleking/vcr-tui --skill textual 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills