协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
custom-actions【开发与工程】Guides MaaNTE Python CustomAction and CustomRecognition development, MaaFramework binding usage, registration, logging, maafocus, controllers, and registry checks.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill for work under agent/custom/action/, agent/utils/, or agent/main.py, especially when adding or debugging MaaFramework Python custom actions/recognitions.
Typical prompts:
custom_action or missing registration.Context, direct recognition, controller APIs, logging, or maafocus messages.utils.logger, maafocus.PrintT, and why print() is usually wrong in actions.__all__ exports.Pipeline owns flow control. Python owns the hard parts: image algorithms, state machines, audio/MIDI processing, path navigation, network/route services, and cross-node data persistence. Do not move ordinary screen transitions into Python unless Pipeline cannot express the logic.
Decorate with exactly the name used by Pipeline:
@AgentServer.custom_action("my_action")
class MyAction(CustomAction): ...
For recognitions:
@AgentServer.custom_recognition("my_recognition")
class MyRecognition(CustomRecognition): ...
Import the module in agent/custom/action/__init__.py and add public classes to __all__ when they are part of the registry surface.
Ensure a Pipeline node calls the same custom_action or custom_recognition string.
argv.custom_action_param as None, dict, or JSON string; reject invalid types gracefully.context.tasker.controller.post_screencap().wait() or .wait().get() consistently, then read the cached/current image shape before indexing.context.tasker.stopping in long loops and release held keys/buttons in finally.CustomAction.RunResult(success=True/False); do not leak uncaught tracebacks to users.context.run_recognition or run_recognition_direct when Python must reuse Pipeline recognizers.auto_piano/maa_keyboard.py imports ctypes.windll.user32 at module import time; it is Windows-only.SoundTrigger/SoundListener.py imports soundcard, which may fail on headless Linux without an audio service..pyd and capture backend; import/runtime errors need clear messages.ctypes.windll.user32.GetAsyncKeyState and writes image sequences; it is not a harmless import-only workflow on non-Windows.Use safe checks first:
python sub-skills/custom-actions/scripts/check_custom_action_registry.py --repo-root .
python -m py_compile agent/custom/action/**/*.py
A successful import or compile does not prove a live game action works. For actual task verification, use the relevant gameplay/navigation/media sub-skill and a Windows MaaFramework runtime.