textual-scaffolder
Generate Textual (Python) TUI application structure with widgets, screens, and CSS styling.
What this skill does
# Textual Scaffolder
Generate Textual TUI applications with Python and modern async patterns.
## Capabilities
- Generate Textual project structure
- Create custom widgets and screens
- Set up CSS-based styling
- Implement reactive attributes
- Create component composition
- Set up testing with textual.testing
## Usage
Invoke this skill when you need to:
- Build terminal UIs in Python
- Create interactive CLI with CSS styling
- Implement multi-screen TUI applications
- Set up Textual project structure
## Inputs
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| projectName | string | Yes | Project name |
| screens | array | No | Screen definitions |
| widgets | array | No | Custom widget definitions |
## Generated Patterns
### Main Application
```python
from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Static, Button, Input
from textual.containers import Container, Horizontal, Vertical
from textual.screen import Screen
class MainScreen(Screen):
"""Main application screen."""
CSS = """
MainScreen {
layout: grid;
grid-size: 2;
grid-gutter: 1;
}
#sidebar {
width: 30;
background: $surface;
border: solid $primary;
}
#content {
background: $surface;
border: solid $secondary;
}
"""
def compose(self) -> ComposeResult:
yield Header()
yield Container(
Static("Sidebar", id="sidebar"),
Static("Content", id="content"),
)
yield Footer()
class MyApp(App):
"""Main TUI application."""
BINDINGS = [
("q", "quit", "Quit"),
("d", "toggle_dark", "Toggle dark mode"),
]
CSS_PATH = "styles.tcss"
def on_mount(self) -> None:
self.push_screen(MainScreen())
def action_toggle_dark(self) -> None:
self.dark = not self.dark
if __name__ == "__main__":
app = MyApp()
app.run()
```
### Custom Widget
```python
from textual.widget import Widget
from textual.reactive import reactive
from textual.message import Message
class Counter(Widget):
"""A counter widget with increment/decrement."""
value = reactive(0)
class Changed(Message):
"""Counter value changed."""
def __init__(self, value: int) -> None:
self.value = value
super().__init__()
def render(self) -> str:
return f"Count: {self.value}"
def increment(self) -> None:
self.value += 1
self.post_message(self.Changed(self.value))
def decrement(self) -> None:
self.value -= 1
self.post_message(self.Changed(self.value))
```
### CSS Styles (styles.tcss)
```css
Screen {
background: $surface;
}
Header {
dock: top;
background: $primary;
}
Footer {
dock: bottom;
background: $primary;
}
Button {
margin: 1;
}
Button:hover {
background: $primary-lighten-1;
}
Input {
margin: 1;
border: tall $secondary;
}
Input:focus {
border: tall $primary;
}
.error {
color: $error;
}
.success {
color: $success;
}
```
### Data Table Widget
```python
from textual.widgets import DataTable
from textual.app import ComposeResult
class DataScreen(Screen):
def compose(self) -> ComposeResult:
yield DataTable()
def on_mount(self) -> None:
table = self.query_one(DataTable)
table.add_columns("Name", "Email", "Role")
table.add_rows([
("Alice", "[email protected]", "Admin"),
("Bob", "[email protected]", "User"),
("Charlie", "[email protected]", "User"),
])
```
## Dependencies
```toml
[project]
dependencies = [
"textual>=0.40.0",
]
[project.optional-dependencies]
dev = [
"textual-dev>=1.0.0",
]
```
## Target Processes
- tui-application-framework
- interactive-form-implementation
- dashboard-monitoring-tui
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.