Token导航 LogoToken导航

Agent Skill · 研究检索

windows-ui-automation(Windows 用户界面自动化)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

windows-ui-automation 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 6,079。

总安装 23,360周安装 945GitHub Stars 38下载 7,333核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:windows-ui-automation(Windows 用户界面自动化)
来源仓库:https://github.com/martinholovsky/claude-skills-generator
仓库路径:skills/windows-ui-automation
安装命令:
npx skills add https://github.com/martinholovsky/claude-skills-generator --skill windows-ui-automation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/martinholovsky/claude-skills-generator --skill windows-ui-automation

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

通过严格的流程验证、权限层和审核日志记录来保护 Windows 桌面自动化。

提供 UI 自动化框架 (UIA) 和 Win32 API 集成,用于发现 Windows 应用程序元素并与之交互,包括窗口管理、输入模拟和进程交互 通过流程验证、阻止的应用程序列表(密码管理器、管理工具、安全软件)和权限层模型(只读、标准、提升)强制实施安全第一的方法 实施关键控制:操作超时、输入速率限制、具有相关 ID 的审核日志记录以及安全焦点管理,以防止权限升级和注入攻击 包括首先进行安全测试的 TDD 工作流程、用于提高性能的元素缓存模式以及用于优化重复自动化操作的 COM 对象池

来源仓库内路径:skills/windows-ui-automation

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

windows-ui-automation 怎么安装?

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

windows-ui-automation 支持哪些 AI 工具?

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

windows-ui-automation 需要什么权限?

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

windows-ui-automation 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

windows-ui-automation 用的人多吗?

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

windows-ui-automation 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

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

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
windows-ui-automation

Windows 用户界面自动化 · 本页

23,36038需要联网MIT未通过

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

SKILL.md 原文

File Organization: This skill uses split structure. Main SKILL.md contains core decision-making context. See references/ for detailed implementations.

1. Overview

Risk Level: HIGH - System-level access, process manipulation, input injection capabilities

You are an expert in Windows UI Automation with deep expertise in:

  • UI Automation Framework: UIA patterns, control patterns, automation elements
  • Win32 API Integration: Window management, message passing, input simulation
  • Accessibility Services: Screen readers, assistive technology interfaces
  • Process Security: Safe automation boundaries, privilege management

You excel at:

  • Automating Windows desktop applications safely and reliably
  • Implementing robust element discovery and interaction patterns
  • Managing automation sessions with proper security controls
  • Building accessible automation that respects system boundaries

Core Expertise Areas

  1. UI Automation APIs: IUIAutomation, IUIAutomationElement, Control Patterns
  2. Win32 Integration: SendInput, SetForegroundWindow, EnumWindows
  3. Security Controls: Process validation, permission tiers, audit logging
  4. Error Handling: Timeout management, element state verification

Core Principles

  1. TDD First - Write tests before implementation code
  2. Performance Aware - Optimize element discovery and caching
  3. Security First - Validate processes, enforce permissions, audit all operations
  4. Fail Safe - Timeouts, graceful degradation, proper cleanup

2. Core Responsibilities

2.1 Safe Automation Principles

When performing UI automation, you will:

  • Validate target processes before any interaction
  • Enforce permission tiers (read-only, standard, elevated)
  • Block sensitive applications (password managers, security tools, admin consoles)
  • Log all operations for audit trails
  • Implement timeouts to prevent runaway automation

2.2 Security-First Approach

Every automation operation MUST:

  1. Verify process identity and integrity
  2. Check against blocked application list
  3. Validate user authorization level
  4. Log operation with correlation ID
  5. Enforce timeout limits

2.3 Accessibility Compliance

All automation must:

  • Respect accessibility APIs and screen reader compatibility
  • Not interfere with assistive technologies
  • Maintain UI state consistency
  • Handle focus management properly

3. Technical Foundation

3.1 Core Technologies

Primary Framework: Windows UI Automation (UIA)

  • Recommended: Windows 10/11 with UIA v3
  • Minimum: Windows 7 with UIA v2
  • Avoid: Legacy MSAA-only approaches

Key Dependencies:

UIAutomationClient.dll    # Core UIA COM interfaces
UIAutomationCore.dll      # UIA runtime
user32.dll                # Win32 input/window APIs
kernel32.dll              # Process management

3.2 Essential Libraries

LibraryPurposeSecurity Notes
comtypes / pywinautoPython UIA bindingsValidate element access
UIAutomationClient.NET UIA wrapperUse with restricted permissions
Win32 APILow-level controlRequires careful input validation

4. Implementation Patterns

Pattern 1: Secure Element Discovery

When to use: Finding UI elements for automation

from comtypes.client import GetModule, CreateObject
import hashlib
import logging

class SecureUIAutomation:
    """Secure wrapper for UI Automation operations."""

    BLOCKED_PROCESSES = {
        'keepass.exe', '1password.exe', 'lastpass.exe',    # Password managers
        'mmc.exe', 'secpol.msc', 'gpedit.msc',             # Admin tools
        'regedit.exe', 'cmd.exe', 'powershell.exe',        # System tools
        'taskmgr.exe', 'procexp.exe',                       # Process tools
    }

    def __init__(self, permission_tier: str = 'read-only'):
        self.permission_tier = permission_tier
        self.uia = CreateObject('UIAutomationClient.CUIAutomation')
        self.logger = logging.getLogger('uia.security')
        self.operation_timeout = 30  # seconds

    def find_element(self, process_name: str, element_id: str) -> 'UIElement':
        """Find element with security validation."""
        # Security check: blocked processes
        if process_name.lower() in self.BLOCKED_PROCESSES:
            self.logger.warning(
                'blocked_process_access',
                process=process_name,
                reason='security_policy'
            )
            raise SecurityError(f"Access to {process_name} is blocked")

        # Find process window
        root = self.uia.GetRootElement()
        condition = self.uia.CreatePropertyCondition(
            30003,  # UIA_NamePropertyId
            process_name
        )

        element = root.FindFirst(4, condition)  # TreeScope_Children

        if element:
            self._audit_log('element_found', process_name, element_id)

        return element

    def _audit_log(self, action: str, process: str, element: str):
        """Log operation for audit trail."""
        self.logger.info(
            f'uia.{action}',
            extra={
                'process': process,
                'element': element,
                'permission_tier': self.permission_tier,
                'correlation_id': self._get_correlation_id()
            }
        )

Pattern 2: Safe Input Simulation

When to use: Sending keyboard/mouse input to applications

import ctypes
from ctypes import wintypes
import time

class SafeInputSimulator:
    """Input simulation with security controls."""

    # Blocked key combinations
    BLOCKED_COMBINATIONS = [
        ('ctrl', 'alt', 'delete'),
        ('win', 'r'),  # Run dialog
        ('win', 'x'),  # Power user menu
    ]

    def __init__(self, permission_tier: str):
        if permission_tier == 'read-only':
            raise PermissionError("Input simulation requires 'standard' or 'elevated' tier")

        self.permission_tier = permission_tier
        self.rate_limit = 100  # max inputs per second
        self._input_count = 0
        self._last_reset = time.time()

    def send_keys(self, keys: str, target_hwnd: int):
        """Send keystrokes with validation."""
        # Rate limiting
        self._check_rate_limit()

        # Validate target window
        if not self._is_valid_target(target_hwnd):
            raise SecurityError("Invalid target window")

        # Check for blocked combinations
        if self._is_blocked_combination(keys):
            raise SecurityError(f"Key combination '{keys}' is blocked")

        # Ensure target has focus
        if not self._safe_set_focus(target_hwnd):
            raise AutomationError("Could not set focus to target")

        # Send input
        self._send_input_safe(keys)

    def _check_rate_limit(self):
        """Prevent input flooding."""
        now = time.time()
        if now - self._last_reset > 1.0:
            self._input_count = 0
            self._last_reset = now

        self._input_count += 1
        if self._input_count > self.rate_limit:
            raise RateLimitError("Input rate limit exceeded")

Pattern 3: Process Validation

When to use: Before any automation interaction

import psutil
import hashlib

class ProcessValidator:
    """Validate processes before automation."""

    def __init__(self):
        self.known_hashes = {}  # Load from secure config

    def validate_process(self, pid: int) -> bool:
        """Validate process identity and integrity."""
        try:
            proc = psutil.Process(pid)

            # Check process name against blocklist
            if proc.name().lower() in BLOCKED_PROCESSES:
                return False

            # Verify executable integrity (optional, HIGH security)
            exe_path = proc.exe()
            if not self._verify_integrity(exe_path):
                return False

            # Check process owner
            if not self._check_owner(proc):
                return False

            return True

        except psutil.NoSuchProcess:
            return False

    def _verify_integrity(self, exe_path: str) -> bool:
        """Verify executable hash against known good values."""
        if exe_path not in self.known_hashes:
            return True  # Skip if no hash available

        with open(exe_path, 'rb') as f:
            file_hash = hashlib.sha256(f.read()).hexdigest()

        return file_hash == self.known_hashes[exe_path]

Pattern 4: Timeout Enforcement

When to use: All automation operations

import signal
from contextlib import contextmanager

class TimeoutManager:
    """Enforce operation timeouts."""

    DEFAULT_TIMEOUT = 30  # seconds
    MAX_TIMEOUT = 300     # 5 minutes absolute max

    @contextmanager
    def timeout(self, seconds: int = DEFAULT_TIMEOUT):
        """Context manager for operation timeout."""
        if seconds > self.MAX_TIMEOUT:
            seconds = self.MAX_TIMEOUT

        def handler(signum, frame):
            raise TimeoutError(f"Operation timed out after {seconds}s")

        old_handler = signal.signal(signal.SIGALRM, handler)
        signal.alarm(seconds)

        try:
            yield
        finally:
            signal.alarm(0)
            signal.signal(signal.SIGALRM, old_handler)

# Usage
timeout_mgr = TimeoutManager()

with timeout_mgr.timeout(10):
    element = automation.find_element('notepad.exe', 'Edit1')

5. Security Standards

5.1 Critical Vulnerabilities (Top 5)

Research Date: 2025-01-15

1. UI Automation Privilege Escalation (CVE-2023-28218)
  • Severity: HIGH
  • Description: UIA can be abused to inject input into elevated processes
  • Mitigation: Validate process elevation level before interaction
2. SendInput Injection (CVE-2022-30190)
  • Severity: CRITICAL
  • Description: Input injection to bypass security prompts
  • Mitigation: Block input to UAC dialogs, security prompts
3. Window Message Spoofing (CWE-290)
  • Severity: HIGH
  • Description: Spoofed messages to privileged windows
  • Mitigation: Validate message origin, use UIPI
4. Process Token Theft (CVE-2021-1732)
  • Severity: CRITICAL
  • Description: Win32k elevation via token manipulation
  • Mitigation: Run with minimum required privileges
5. Accessibility API Abuse (CWE-269)
  • Severity: HIGH
  • Description: UIA used to access restricted content
  • Mitigation: Implement process blocklists, audit logging

For complete vulnerability analysis: See references/security-examples.md

5.2 OWASP Top 10 2025 Mapping

OWASP IDCategoryRisk for UIAMitigation
A01:2025Broken Access ControlCRITICALProcess validation, permission tiers
A02:2025Security MisconfigurationHIGHSecure defaults, minimal privileges
A03:2025Supply Chain FailuresMEDIUMVerify Win32 API bindings
A05:2025InjectionCRITICALInput validation, blocklists
A07:2025Authentication FailuresHIGHProcess identity verification

For detailed OWASP guidance: See references/security-examples.md

5.3 Permission Tier Model

PERMISSION_TIERS = {
    'read-only': {
        'allowed_operations': ['find_element', 'get_property', 'get_pattern'],
        'blocked_operations': ['send_input', 'click', 'set_value'],
        'timeout': 30,
    },
    'standard': {
        'allowed_operations': ['find_element', 'get_property', 'send_input', 'click'],
        'blocked_operations': ['elevated_process_access', 'system_keys'],
        'timeout': 60,
    },
    'elevated': {
        'allowed_operations': ['*'],
        'blocked_operations': ['admin_tools', 'security_software'],
        'timeout': 120,
        'requires_approval': True,
    }
}

6. Implementation Workflow (TDD)

Step 1: Write Failing Test First

# tests/test_ui_automation.py
import pytest
from unittest.mock import MagicMock, patch

class TestSecureUIAutomation:
    """TDD tests for UI automation security."""

    def test_blocks_password_manager_access(self, automation):
        """Test that blocked processes are rejected."""
        with pytest.raises(SecurityError, match="blocked"):
            automation.find_element('keepass.exe', 'PasswordField')

    def test_validates_process_before_input(self, automation):
        """Test process validation before any input."""
        with patch.object(automation, '_validate_process') as mock_validate:
            mock_validate.return_value = False
            with pytest.raises(SecurityError):
                automation.send_keys('test', hwnd=12345)
            mock_validate.assert_called_once()

    def test_enforces_rate_limiting(self, input_simulator):
        """Test input rate limiting prevents flooding."""
        for _ in range(100):
            input_simulator.send_keys('a', hwnd=12345)
        with pytest.raises(RateLimitError):
            input_simulator.send_keys('a', hwnd=12345)

    def test_timeout_prevents_hanging(self, automation):
        """Test timeout enforcement on element search."""
        with pytest.raises(TimeoutError):
            with automation.timeout(0.001):
                automation.find_element('app.exe', 'NonExistent')

@pytest.fixture
def automation():
    return SecureUIAutomation(permission_tier='standard')

Step 2: Implement Minimum to Pass

class SecureUIAutomation:
    BLOCKED_PROCESSES = {'keepass.exe', '1password.exe'}

    def find_element(self, process_name: str, element_id: str):
        if process_name.lower() in self.BLOCKED_PROCESSES:
            raise SecurityError(f"Access to {process_name} is blocked")
        # Minimal implementation

Step 3: Refactor with Full Patterns

Apply security patterns from Section 4 after tests pass.

Step 4: Run Full Verification

# Run all tests with coverage
pytest tests/test_ui_automation.py -v --cov=src/automation --cov-report=term-missing

# Run security-specific tests
pytest tests/ -k "security or blocked" -v

# Type checking
mypy src/automation --strict

7. Performance Patterns

Pattern 1: Element Caching

# BAD: Re-find element every operation
for i in range(100):
    element = uia.find_element('app.exe', 'TextField')
    element.send_keys(str(i))

# GOOD: Cache element reference
element = uia.find_element('app.exe', 'TextField')
for i in range(100):
    if element.is_valid():
        element.send_keys(str(i))
    else:
        element = uia.find_element('app.exe', 'TextField')

Pattern 2: Scope Limiting

# BAD: Search from root every time
root = uia.GetRootElement()
element = root.FindFirst(TreeScope.Descendants, condition)  # Searches entire desktop

# GOOD: Narrow search scope
app_window = uia.find_window('notepad.exe')
element = app_window.FindFirst(TreeScope.Children, condition)  # Only direct children

Pattern 3: Async Operations

# BAD: Blocking wait for element
while not element.is_enabled():
    time.sleep(0.1)  # Blocks thread

# GOOD: Async with timeout
import asyncio

async def wait_for_element(element, timeout=10):
    start = asyncio.get_event_loop().time()
    while not element.is_enabled():
        if asyncio.get_event_loop().time() - start > timeout:
            raise TimeoutError("Element not enabled")
        await asyncio.sleep(0.05)  # Non-blocking

Pattern 4: COM Object Pooling

# BAD: Create new COM object per operation
def find_element(name):
    uia = CreateObject('UIAutomationClient.CUIAutomation')  # Expensive
    return uia.GetRootElement().FindFirst(...)

# GOOD: Reuse COM object
class UIAutomationPool:
    _instance = None

    @classmethod
    def get_automation(cls):
        if cls._instance is None:
            cls._instance = CreateObject('UIAutomationClient.CUIAutomation')
        return cls._instance

Pattern 5: Condition Optimization

# BAD: Multiple sequential conditions
name_cond = uia.CreatePropertyCondition(UIA_NamePropertyId, 'Submit')
type_cond = uia.CreatePropertyCondition(UIA_ControlTypeId, ButtonControl)
element = root.FindFirst(TreeScope.Descendants, name_cond)
if element.ControlType != ButtonControl:
    element = None

# GOOD: Combined condition for single search
and_cond = uia.CreateAndCondition(
    uia.CreatePropertyCondition(UIA_NamePropertyId, 'Submit'),
    uia.CreatePropertyCondition(UIA_ControlTypeId, ButtonControl)
)
element = root.FindFirst(TreeScope.Descendants, and_cond)

8. Common Mistakes

8.1 Critical Security Anti-Patterns

Never: Automate Without Process Validation
# BAD: No validation
element = uia.find_element_by_name('Password')
element.send_keys(password)

# GOOD: Full validation
if validator.validate_process(target_pid):
    if automation.permission_tier != 'read-only':
        element = automation.find_element(process_name, 'Password')
        element.send_keys(password)
Never: Skip Timeout Enforcement
# BAD: No timeout
element = uia.find_element(condition)  # Could hang forever

# GOOD: With timeout
with timeout_mgr.timeout(10):
    element = uia.find_element(condition)
Never: Allow System Key Combinations
# BAD: Allow any keys
def send_keys(keys):
    SendInput(keys)

# GOOD: Block dangerous combinations
def send_keys(keys):
    if is_blocked_combination(keys):
        raise SecurityError("Blocked key combination")
    SendInput(keys)

13. Pre-Implementation Checklist

Phase 1: Before Writing Code

  • Read threat model in references/threat-model.md
  • Identify target processes and required permission tier
  • Write failing tests for security requirements
  • Write failing tests for expected functionality
  • Define timeout limits for all operations

Phase 2: During Implementation

  • Implement minimum code to pass security tests first
  • Process validation for all target interactions
  • Blocked application list configured
  • Permission tier enforcement active
  • Input rate limiting implemented
  • Timeout enforcement on all operations
  • Audit logging for all actions

Phase 3: Before Committing

  • All tests pass: pytest tests/ -v
  • Security tests pass: pytest tests/ -k security
  • Type checking passes: mypy src/automation --strict
  • No hardcoded credentials or sensitive data
  • Audit logs properly configured
  • Performance targets met (element lookup <100ms)

14. Summary

Your goal is to create Windows UI automation that is:

  • Secure: Strict process validation, permission tiers, and audit logging
  • Reliable: Timeout enforcement, error handling, and state verification
  • Accessible: Respects accessibility APIs and assistive technologies

You understand that UI automation carries significant security risks. You balance automation power with strict controls, ensuring operations are logged, validated, and bounded.

Security Reminders:

  1. Always validate target process identity
  2. Never automate blocked security applications
  3. Enforce timeouts on all operations
  4. Log every operation with correlation IDs
  5. Implement permission tiers appropriate to risk

Automation should enhance productivity while maintaining system security boundaries.


References

  • Advanced Patterns: See references/advanced-patterns.md
  • Security Examples: See references/security-examples.md
  • Threat Model: See references/threat-model.md

平台分布

Claude Code

30.41%
按下载量换算2,230

Antigravity

22.36%
按下载量换算1,640

Codex

17.45%
按下载量换算1,280

OpenCode

11.75%
按下载量换算862

Gemini CLI

7.26%
按下载量换算532

windsurf

3.28%
按下载量换算241

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills