Skip to main content

ok-script-tasks

Create and modify automation task classes for the ok-script Python library, including BaseTask one-time tasks, TriggerTask background tasks, task config UI metadata, registration in ok-script app config, custom ok_tasks scripts, and bilingual English/Chinese task behavior. Use when Codex needs to implement, refactor, review, or explain ok-script tasks in any project, independent of any particular app.

소스 정보

저장소
ok-oldking/ok-script-app
최근 소스 활동
2026년 6월 2일 12:55
감지된 SKILL.md 언어
영어
스타
220
포크
272

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

파일 탐색기
4 개 파일

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
ok-script-tasks
description
Create and modify automation task classes for the ok-script Python library, including BaseTask one-time tasks, TriggerTask background tasks, task config UI metadata, registration in ok-script app config, custom ok_tasks scripts, and bilingual English/Chinese task behavior. Use when Codex needs to implement, refactor, review, or explain ok-script tasks in any project, independent of any particular app.
# OK Script Tasks ## Overview Use this skill to create or modify tasks built on the PyPI `ok-script` library. Keep guidance generic to `ok-script`; inspect the current project only to discover its local base classes, scene helpers, feature names, and registration style. When more detail is needed, read: - `references/task-api.md` for task lifecycle, config, execution, GUI, and bilingual rules. - `references/templates.md` for reusable one-time task, trigger task, feature/OCR, and registration templates. - Use `$ok-script-i18n` after task creation when gettext catalogs need task strings added, synced, or compiled. ## Workflow 1. Inspect the target project for existing tasks, app config, and any project-specific base class. Prefer existing project helpers over inheriting directly from `BaseTask` when the project already has a base task class. 2. Decide the task type: - Use `BaseTask` or a project one-time base for user-started workflows that should finish and disable themselves. - Use `TriggerTask` for background checks that run repeatedly while enabled. - Mix in feature/OCR/project helpers only when the task actually needs them. 3. Add or update task metadata in `__init__`: `name`, `description`, `default_config`, `config_description`, `config_type`, `supported_languages`, icons, grouping, and scheduling flags. 4. Implement `run()` with small, observable steps. Use `self.log_info`, `self.log_warning`, `self.info_set`, `self.wait_until`, `self.next_frame`, `self.sleep`, `self.click_relative`, `self.find_one`, `self.wait_click_feature`, `self.ocr`, and `self.wait_ocr` instead of ad hoc polling or direct device calls. 5. Register the task according to the project style: built-in config list, `ok_tasks` custom task folder, or imported script package. 6. If the project uses gettext catalogs, sync task translations with `$ok-script-i18n`. 7. Validate with the project test or headless path when available. At minimum, import the task module and instantiate the class if device-dependent execution cannot be run. ## Bilingual Output Support English and Chinese in both code review and generated code. - Answer the user in the language they use. If unclear, use English with concise Chinese labels where useful. - Prefer stable English config keys because config keys become persisted JSON fields. Add Chinese help in `config_description` or through the project's translation system. - Include both English and Chinese OCR match text when the UI may appear in either language. - Use `supported_languages` only to hide a task in unsupported locales. Common locale names are `en_US`, `zh_CN`, `zh_TW`, `ja_JP`, `ko_KR`, and `es_ES`. - Do not hard-code assumptions from the source project used to study `ok-script` unless the target project explicitly uses them. ## Essential Rules - Always call `super().__init__(*args, **kwargs)` before setting task fields. - Do not bypass `Config`: set defaults in `self.default_config`; read values through `self.config.get(...)` after `after_init()` loads config. - For `TriggerTask`, keep `self.default_config['_enabled']` intentional and set `trigger_interval` to avoid excessive polling. - Return truthy from a trigger task only after it handled something meaningful; falsey return lets the executor continue scanning other trigger tasks. - For one-time tasks, allow normal completion; the executor disables the task after `run()` returns. - Keep direct sleeps short and use `wait_until`, `wait_ocr`, or `wait_click_feature` for state-dependent waiting. - Avoid locale-specific config keys unless the project already follows that style.
GitHub에서 보기