Token导航 LogoToken导航

Agent Skill · 前端设计

textual-app-lifecycle(文本应用程序生命周期)

textual-app-lifecycle 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

textual-app-lifecycle 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 9,985。

总安装 188周安装 8GitHub Stars 1下载 66核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:textual-app-lifecycle(文本应用程序生命周期)
来源仓库:https://github.com/dawiddutoit/custom-claude
仓库路径:skills/textual-app-lifecycle
安装命令:
npx skills add https://github.com/dawiddutoit/custom-claude --skill textual-app-lifecycle
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/dawiddutoit/custom-claude --skill textual-app-lifecycle

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

textual-app-lifecycle 用于处理 GitHub 仓库和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态进行整理。通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 核验用法。

安装前建议确认权限范围、维护状态,以及是否会触发联网或文件读写。当前暂无底部简介内容,可参考来源仓库获取更多功能说明。

来源仓库内路径:skills/textual-app-lifecycle

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/dawiddutoit/custom-claude --skill textual-app-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

textual-app-lifecycle 怎么安装?

在终端执行 npx skills add https://github.com/dawiddutoit/custom-claude --skill textual-app-lifecycle。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

textual-app-lifecycle 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

textual-app-lifecycle 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

textual-app-lifecycle 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

textual-app-lifecycle 用的人多吗?

公开数据是累计安装 188 次,近一周安装 8 次,下载 66 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

textual-app-lifecycle 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
textual-app-lifecycle

文本应用程序生命周期 · 本页

1881需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Textual App Lifecycle

Purpose

Understand and implement proper Textual application lifecycle patterns including initialization, mounting, screen management, background workers, and graceful shutdown. This is the foundation for building robust TUI applications.

Quick Start

from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Header, Footer, Static
from typing import ClassVar

class MyApp(App):
    """Minimal Textual application with proper lifecycle."""

    TITLE = "My Application"
    SUB_TITLE = "Powered by Textual"

    BINDINGS: ClassVar[list[Binding]] = [
        Binding("q", "quit", "Quit", show=True, priority=True),
        Binding("ctrl+c", "quit", "Quit", show=False, priority=True),
    ]

    def compose(self) -> ComposeResult:
        """Compose the application layout."""
        yield Header(show_clock=True)
        yield Static("Welcome to Textual!", id="content")
        yield Footer()

    def on_mount(self) -> None:
        """Handle application mount event."""
        # Initialize application state, load configuration, etc.
        self.notify("Application started", severity="information")

    def action_quit(self) -> None:
        """Handle quit action with cleanup."""
        self.exit()

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

Instructions

Step 1: Define App Class and Metadata

Create your App subclass with proper metadata and configuration:

from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.screen import Screen
from typing import ClassVar

class MyApp(App[None]):  # [T] is the return type for app.run()
    """Application description."""

    # Metadata
    TITLE = "Application Title"
    SUB_TITLE = "Optional subtitle"

    # Keyboard bindings
    BINDINGS: ClassVar[list[Binding | tuple]] = [
        Binding("q", "quit", "Quit", show=True, priority=True),
        Binding("ctrl+c", "quit", "Quit", show=False, priority=True),
        ("r", "refresh", "Refresh"),
    ]

    # CSS styling (inline or separate .css file)
    CSS = """
    Screen {
        background: $surface;
    }
    """

    # Theme selection
    THEME = "dracula"  # Built-in themes: nord, dracula, monokai, solarized-dark, etc.

Step 2: Implement Application Composition

Define compose() to return all top-level widgets:

def compose(self) -> ComposeResult:
    """Compose the application layout.

    Yields:
        Application components (Header, Footer, widgets, etc).

    Yields immediately - don't use async here.
    """
    yield Header(show_clock=True)  # Optional header with clock
    yield StaticContent()           # Your custom widgets
    yield Footer()                  # Optional footer with bindings

Key Points:

  • compose() is synchronous - don't use await
  • Widgets are yielded in order (they appear top-to-bottom)
  • Use Container, Horizontal, Vertical for layout
  • Containers support CSS Grid layout

Step 3: Handle App Initialization (on_mount)

Implement on_mount() for initialization after all widgets are mounted:

def on_mount(self) -> None:
    """Handle application mount event.

    Called after compose() completes and all widgets are mounted.
    Use for:
    - Loading configuration
    - Initializing state
    - Starting background workers
    - Setting up timers
    - Querying mounted widgets
    """
    # Load configuration
    try:
        self._config = self._load_config()
    except Exception as e:
        self.notify(f"Config error: {e}", severity="error")
        return

    # Query and configure widgets
    content = self.query_one("#content", Static)
    content.update("Initialized!")

    # Set up auto-refresh timer (runs every N seconds)
    self.set_interval(5.0, self._on_timer)

    # Start background worker
    self.run_worker(self._background_task())

async def _background_task(self) -> None:
    """Background async task that runs concurrently."""
    while True:
        # Do async work (I/O, network, etc.)
        await asyncio.sleep(1)
        self._update_ui()

def _on_timer(self) -> None:
    """Called by timer periodically."""
    # Synchronous callback - don't use await
    pass

Important Rules:

  • on_mount() is synchronous
  • Can use self.query_one() to access widgets (they're mounted now)
  • Use self.run_worker() to start async tasks
  • Use self.set_interval() for periodic tasks
  • Use self.notify() to show toast messages

Step 4: Implement Action Handlers

Actions are triggered by keybindings and can be async:

def action_refresh(self) -> None:
    """Synchronous action handler."""
    self.run_worker(self._async_refresh())

async def _async_refresh(self) -> None:
    """Async action implementation."""
    try:
        # Do async work (fetch data, update UI)
        data = await self._fetch_data()
        await self._update_ui(data)
    except Exception as e:
        self.notify(f"Refresh failed: {e}", severity="error")

def action_quit(self) -> None:
    """Exit the application."""
    # Cleanup happens automatically
    self.exit()

def action_add_item(self) -> None:
    """Action with optional argument."""
    self.run_worker(self._show_dialog())

Pattern:

  • Keybindings call action methods
  • Actions can be sync or async
  • For async work, use self.run_worker()
  • Action methods are public (no leading underscore)

Step 5: Handle Screen Navigation

Switch between screens for modal dialogs, multi-screen apps:

class MyApp(App):
    def action_show_settings(self) -> None:
        """Push settings screen on top of current screen."""
        self.push_screen(SettingsScreen())

    def action_close_settings(self) -> None:
        """Pop settings screen and return to previous."""
        self.pop_screen()

class SettingsScreen(Screen):
    """Modal settings dialog."""

    def compose(self) -> ComposeResult:
        yield Static("Settings")

    def on_mount(self) -> None:
        """Initialize settings screen."""
        pass

    def action_save(self) -> None:
        """Save settings and close."""
        self.pop_screen()  # Return to previous screen

    def action_cancel(self) -> None:
        """Close without saving."""
        self.pop_screen()

Screen Stack:

  • push_screen() adds screen on top (modal behavior)
  • pop_screen() removes top screen
  • switch_screen() replaces current screen
  • Screens can return values using pop_screen(result)

Step 6: Implement Graceful Shutdown

Cleanup resources on application exit:

def on_unmount(self) -> None:
    """Handle application unmount/exit.

    Called after widgets are unmounted but before app exits.
    Use for cleanup: closing connections, saving state, etc.
    """
    # Save state
    if self._config:
        self._config.save()

    # Close connections
    if self._connection:
        self._connection.close()

    # Cancel background tasks
    # (Textual handles this automatically)

async def on_shutdown(self) -> None:
    """Called when application is shutting down.

    This is async - use for async cleanup.
    """
    # Close async connections
    if self._async_client:
        await self._async_client.close()

Examples

Example 1: Dashboard with Auto-Refresh and Notifications

import asyncio
from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Header, Footer, Static, Container
from typing import ClassVar

class DashboardApp(App):
    """Dashboard that auto-refreshes data."""

    TITLE = "Agent Dashboard"
    BINDINGS: ClassVar[list[Binding]] = [
        ("q", "quit", "Quit"),
        ("r", "refresh", "Refresh"),
    ]

    def __init__(self) -> None:
        super().__init__()
        self._data: dict | None = None
        self._refresh_task_id: str | None = None

    def compose(self) -> ComposeResult:
        yield Header()
        yield Container(
            Static("Loading...", id="status"),
            Static("", id="content"),
            Static("", id="footer-info"),
        )
        yield Footer()

    def on_mount(self) -> None:
        """Initialize dashboard on mount."""
        # Start auto-refresh (every 3 seconds)
        self.set_interval(3.0, self._silent_refresh)

        # Initial load with notification
        self.run_worker(self._refresh_with_notification())

    async def _refresh_with_notification(self) -> None:
        """Refresh and show notification."""
        try:
            self._data = await self._fetch_data()
            await self._update_display()
            self.notify("Dashboard refreshed", severity="information")
        except Exception as e:
            self.notify(f"Refresh error: {e}", severity="error")

    def _silent_refresh(self) -> None:
        """Auto-refresh without notification."""
        self.run_worker(self._refresh_async())

    async def _refresh_async(self) -> None:
        """Background refresh."""
        try:
            self._data = await self._fetch_data()
            await self._update_display()
        except Exception:
            pass  # Silent fail on background refresh

    async def _fetch_data(self) -> dict:
        """Simulate fetching data from remote."""
        await asyncio.sleep(0.5)  # Simulate network delay
        return {
            "status": "running",
            "agents": 3,
            "cpu": 45.2,
            "memory": 62.8,
        }

    async def _update_display(self) -> None:
        """Update display with current data."""
        if not self._data:
            return

        status = self.query_one("#status", Static)
        status.update(f"Status: {self._data['status']}")

        content = self.query_one("#content", Static)
        content.update(
            f"Agents: {self._data['agents']}\n"
            f"CPU: {self._data['cpu']:.1f}%\n"
            f"Memory: {self._data['memory']:.1f}%"
        )

    def action_refresh(self) -> None:
        """Manual refresh action."""
        self.run_worker(self._refresh_with_notification())

    def on_unmount(self) -> None:
        """Cleanup on exit."""
        # Textual automatically cancels timers and workers
        pass

if __name__ == "__main__":
    app = DashboardApp()
    app.run()

Example 2: Multi-Screen Application with Modal Dialog

from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.containers import Container
from textual.screen import Screen
from textual.widgets import Header, Footer, Static, Button, Input
from typing import ClassVar

class MainScreen(Screen):
    """Main application screen."""

    BINDINGS: ClassVar[list[Binding]] = [
        ("q", "quit", "Quit"),
        ("o", "open_dialog", "Open"),
    ]

    def compose(self) -> ComposeResult:
        yield Header()
        yield Static("Main Screen", id="content")
        yield Footer()

    def action_open_dialog(self) -> None:
        """Open modal dialog."""
        self.app.push_screen(ModalDialog())

class ModalDialog(Screen):
    """Modal dialog example."""

    BINDINGS: ClassVar[list[Binding]] = [
        ("escape", "cancel", "Cancel"),
        ("enter", "confirm", "Confirm"),
    ]

    CSS = """
    ModalDialog {
        align: center middle;
    }

    ModalDialog > Container {
        width: 40;
        height: 10;
        border: solid $primary;
        padding: 1;
    }
    """

    def compose(self) -> ComposeResult:
        with Container():
            yield Static("Dialog Title", id="dialog-title")
            yield Input("Enter something:", id="dialog-input")
            yield Button("OK", id="btn-ok")
            yield Button("Cancel", id="btn-cancel")

    def action_confirm(self) -> None:
        """Confirm and return data."""
        input_field = self.query_one("#dialog-input", Input)
        self.app.pop_screen(result=input_field.value)

    def action_cancel(self) -> None:
        """Cancel without returning data."""
        self.app.pop_screen()

class MultiScreenApp(App):
    """App with multiple screens."""

    def compose(self) -> ComposeResult:
        yield MainScreen()

if __name__ == "__main__":
    app = MultiScreenApp()
    app.run()

Requirements

  • Textual >= 0.45.0 (install with pip install textual)
  • Python 3.9+ for type hints
  • For syntax highlighting in TextArea: pip install "textual[syntax]"

Common Pitfalls

1. Calling async functions synchronously:

# ❌ WRONG - can't await in sync context
def on_mount(self) -> None:
    self._data = await self._fetch_data()  # Error!

# ✅ CORRECT - use run_worker
def on_mount(self) -> None:
    self.run_worker(self._load_data())

2. Querying widgets before mount:

# ❌ WRONG - compose() runs before mount
def compose(self) -> ComposeResult:
    yield Static("Test")
    widget = self.query_one("#something")  # Fails!

# ✅ CORRECT - query in on_mount or later
def on_mount(self) -> None:
    widget = self.query_one("#something")  # Works!

3. Forgetting to set interval ID:

# ❌ Can't cancel later
self.set_interval(5.0, callback)

# ✅ Save ID if you need to cancel
self._timer_id = self.set_interval(5.0, callback)
# Later: self.remove_timer(self._timer_id)

4. Not handling async errors in workers:

# ❌ Errors are silent
def on_mount(self) -> None:
    self.run_worker(self._fetch_data())

# ✅ Handle errors
def on_mount(self) -> None:
    self.run_worker(self._safe_fetch())

async def _safe_fetch(self) -> None:
    try:
        await self._fetch_data()
    except Exception as e:
        self.notify(f"Error: {e}", severity="error")

See Also

平台分布

Codex

32.42%
按下载量换算21

Claude

30.1%
按下载量换算20

Cursor

17.91%
按下载量换算12

Gemini CLI

10.2%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills