Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

pyqt6-ui-development-rules

БесплатноЗапускает вложенные скриптыНе проверен

PyQt6 desktop GUI development rules -- signal/slot architecture, QSS theming, QThread concurrency, layout management, and cross-platform rendering. Enforces…

oimiragieoот oimiragieo★ 48 звёзд на GitHub

Об этом скилле

PyQt6 UI Development Rules Skill

PyQt6 desktop GUI development specialist enforcing MVC separation, signal/slot architecture, QSS theming, threaded concurrency, and cross-platform rendering best practices. Ensures responsive, accessible, and visually consistent desktop applications. - Design MVC-separated PyQt6 application architecture - Implement signal/slot communication patterns between UI and business logic - Configure QSS application-level theming with dark/light mode support - Manage background operations with QThread, QRunnable, and QThreadPool - Build responsive layouts using QVBoxLayout, QHBoxLayout, QGridLayout, and QFormLayout - Implement custom QWidget subclasses with proper paintEvent handling - Set up cross-platform DPI-aware rendering - Configure accessibility features (screen reader support, keyboard navigation)

Overview

This skill enforces rules for building production-quality PyQt6 desktop applications. The core principles are: strict MVC separation via signals/slots, never blocking the UI thread, centralized theming via QSS, and layout-manager-driven responsive design. These rules prevent the most common PyQt6 failures: frozen UIs, untestable coupling, and platform-specific rendering bugs.

When to Use

  • When building new PyQt6 desktop applications
  • When refactoring existing PyQt/PySide code to PyQt6
  • When debugging frozen or unresponsive Qt UIs
  • When implementing custom widgets or complex layouts
  • When setting up cross-platform desktop application builds

Iron Laws

  1. ALWAYS use Qt's signal/slot mechanism for UI-to-logic communication -- direct method calls between UI and business logic layers break MVC separation and cause untestable coupling.
  2. NEVER perform long-running operations on the main UI thread -- blocking the Qt event loop makes the interface unresponsive and triggers OS "not responding" dialogs.
  3. ALWAYS apply QSS stylesheets at the QApplication level rather than per-widget -- per-widget inline styles create inconsistent themes and unmaintainable styling sprawl.
  4. NEVER use absolute pixel coordinates for widget layout -- use Qt layout managers (QVBoxLayout, QHBoxLayout, QGridLayout) to ensure DPI-aware and cross-platform rendering.
  5. ALWAYS test the UI on all target platforms before release -- PyQt6 rendering, font scaling, and widget sizing differ between Windows, macOS, and Linux.

Anti-Patterns

Anti-Pattern Why It Fails Correct Approach
Calling business logic directly from UI slots Couples UI to logic; makes testing impossible and breaks MVC architecture Emit signals from UI; connect to controller/service methods via slot
Running network or file I/O on the main thread Blocks the Qt event loop; UI freezes until operation completes Use QThread, QRunnable, or asyncio with qasync for background operations
Hardcoding pixel sizes and positions Breaks on high-DPI displays and different OS DPI scaling settings Use layout managers and size policies; use logicalDpiX() for DPI-aware sizing
Setting styles inline on individual widgets Creates visual inconsistency; extremely difficult to theme or maintain Define a single QSS stylesheet at QApplication level and use object names/classes
Ignoring cross-platform rendering differences Widget sizes, fonts, and margins differ significantly between Windows/macOS/Linux Test on all target platforms; use platform-conditional logic where rendering diverges

Workflow

Step 1: Application Architecture (MVC)

# model.py -- Business logic, no Qt dependencies
class DataModel:
    def __init__(self):
        self._items = []

    def add_item(self, item: str) -> bool:
        if item and item not in self._items:
            self._items.append(item)
            return True
        return False

# controller.py -- Mediates between Model and View
from PyQt6.QtCore import QObject, pyqtSignal

class Controller(QObject):
    items_changed = pyqtSignal(list)
    error_occurred = pyqtSignal(str)

    def __init__(self, model: DataModel):
        super().__init__()
        self._model = model

    def add_item(self, item: str) -> None:
        if self._model.add_item(item):
            self.items_changed.emit(self._model._items.copy())
        else:
            self.error_occurred.emit(f"Could not add: {item}")

Step 2: Signal/Slot Wiring

# view.py -- UI only, connects via signals/
Полный SKILL.md на GitHub

Установить pyqt6-ui-development-rules в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash
Glob
Grep

Вложенные файлы

commands/pyqt6-ui-development-rules.mdhooks/post-execute.cjshooks/pre-execute.cjsreferences/research-requirements.mdrules/pyqt6-ui-development-rules.mdschemas/input.schema.jsonschemas/output.schema.jsonscripts/main.cjstemplates/implementation-template.md

FAQ

Что делает скилл pyqt6-ui-development-rules?

PyQt6 desktop GUI development rules -- signal/slot architecture, QSS theming, QThread concurrency, layout management, and cross-platform rendering. Enforces MVC separation and responsive UI patterns.

Как установить скилл pyqt6-ui-development-rules?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл pyqt6-ui-development-rules запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить pyqt6-ui-development-rules с