AgentSkillsCN

ue5-api-expert

验证 UE5 Python 脚本的正确性,检查是否使用了已弃用的 API,并确保参数约束得到满足。

SKILL.md
--- frontmatter
name: ue5-api-expert
description: Validate UE5 Python scripts for correctness, check for deprecated APIs, and verify parameter constraints.

UE5 API Expert

Query class or function definitions from UE5 unreal.py stub files.

Usage

bash
# Fuzzy search (default) - searches names AND signatures
python scripts/api-search.py actor
python scripts/api-search.py inputmapping

# Chained fuzzy search - all terms must match
python scripts/api-search.py actor render
python scripts/api-search.py inputmapping context

# Query a class definition
python scripts/api-search.py unreal.InputMappingContext

# Query a specific member
python scripts/api-search.py unreal.Actor.on_destroyed
python scripts/api-search.py unreal.GameplayTag.import_text

# Wildcard member search
python scripts/api-search.py unreal.Actor.*location*

# Query a module-level function
python scripts/api-search.py unreal.log

# Multiple queries with pipe
python scripts/api-search.py unreal.Actor|Pawn|log

# Fuzzy search with filters
python scripts/api-search.py -c actor          # classes only
python scripts/api-search.py -m location       # methods only
python scripts/api-search.py -e collision      # enum values only

# Specify stub file explicitly
python scripts/api-search.py --input /path/to/unreal.py unreal.Actor

Arguments

ArgumentShortRequiredDescription
queryYesSearch term(s); multiple terms filter progressively
--input-iNoPath to unreal.py stub file. Auto-detects from $CLAUDE_PROJECT_DIR/Intermediate/PythonStub/unreal.py if not provided
--class-only-cNoFuzzy search: only show matching classes
--method-only-mNoFuzzy search: only show matching methods/functions
--enum-only-eNoFuzzy search: only show matching enum values

Output

  • Fuzzy search: Results grouped by type (Classes, Methods, Properties, Enum Values) with class inheritance shown
  • Exact class query: Returns class signature summary with all members
  • Exact member query: Returns full definition of the specific member
  • Wildcard member search: Returns matching member signatures within that class
  • No match: Exits with code 1 and prints error to stderr

Features

  • Signature matching: Search terms match method parameters, return types, and property types
    • Example: inputmapping finds methods with InputMappingContext parameters
  • Word-boundary matching: actor matches Actor, ActorComponent, MyActor but not factory
  • Greedy matching: inputmappingcontext matches InputMappingContext
  • Class inheritance: Results show class Actor(Object): instead of just class Actor:

Examples

Fuzzy search

bash
$ python scripts/api-search.py actor

=== Matching Classes (15) ===

class Actor(Object):
    """Actor is the base class for all objects..."""

class ActorComponent(Object):
    """ActorComponent is the base class..."""

=== Matching Methods (42 in 8 classes) ===

class Actor(Object):
    def get_actor_location(self) -> Vector
    def set_actor_location(self, new_location: Vector, ...) -> bool
...

Chained fuzzy search with signature matching

bash
$ python scripts/api-search.py inputmapping register

=== Matching Methods (5 in 1 classes) ===

class EnhancedInputUserSettings(SaveGame):
    def register_input_mapping_context(self, imc: InputMappingContext) -> bool
    def register_input_mapping_contexts(self, mapping_contexts: Set[InputMappingContext]) -> bool
...

Query a class

bash
$ python scripts/api-search.py unreal.InputMappingContext

class InputMappingContext(DataAsset):
    r"""
    UInputMappingContext : A collection of key to action mappings...
    """
    ...

Query a function

bash
$ python scripts/api-search.py unreal.log

def log(arg: Any) -> None:
    r"""
    log(arg: Any) -> None -- log the given argument as information in the LogPython category
    """
    ...

Requirements

  • ripgrep (rg): Required for fuzzy search. Install via scoop install ripgrep (Windows) or brew install ripgrep (macOS)