nocobase-app-plugin-scheduler
Skill này làm gì
Skill này hướng dẫn lập trình viên xây dựng tác vụ định kỳ trong ứng dụng NocoBase 3, với trạng thái hiển thị cho quản trị viên nghiệp vụ. Skill dành cho các nhóm cần theo dõi công việc lặp lại.
Khi nào nên dùng
- ✓Khi quản trị viên nghiệp vụ cần xem và theo dõi các tác vụ lặp lại trong ứng dụng.
- ✓Khi bạn muốn định nghĩa lịch trong mã với trạng thái hiển thị trong giao diện.
- ✓Khi một tác vụ nền không cần hiển thị trên giao diện, và bạn cần chọn cơ chế công việc khác.
Liên kết skill
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-scheduler/skills/nocobase-app-plugin-scheduler/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể thêm một tác vụ chạy hằng đêm để lưu trữ các đơn hàng cũ, và cho quản trị viên xem các lần chạy và tắt nó đi không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
AI định nghĩa lịch và logic thực thi trong mã, đăng ký mục tiêu và báo cáo trạng thái cuối cùng. Scheduler giữ lịch sử kích hoạt để quản trị viên theo dõi từng lần chạy.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Develop Scheduled Tasks in an Application
Use the installed version's public exports, without importing plugin internals. The application owns business logic, schedule declarations, Providers, permissions, and deployment timing. Scheduler owns scheduling projections, trigger history, and execution state. The plugin's skills/ directory is the source of truth; do not edit the synchronized application copy under .agents/skills/.
Decide Whether to Use Scheduler
The primary reason to define tasks through Scheduler is UI observability for business administrators. Developers define schedules and execution logic in code. Business administrators use the task list and detail pages the application builds on the Scheduler API to view schedules, track individual executions, and enable or disable tasks when authorized.
Tasks that do not need to be viewed and tracked through the UI must not be managed by the Scheduler plugin. Give recurring ones a ScheduleExecutor of their own from the application's jobs service (jobExecutorServiceToken in @nocobase/app-server/jobs), and one-off background work a JobExecutor; the application development Skill describes both. For administrator-visible tasks, deliver Client registration, access permissions, meaningful task names, and accurate final execution status together; successful server-side dispatch alone is incomplete.
Then Choose the Execution Model
After deciding to use Scheduler, choose according to business complexity:
| Scenario | Choice | Implementation boundary |
|---|---|---|
| Periodic cleanup, cache refresh, a single report, or one business Service call | Own target type | Short operations may complete directly; hand lengthy work to a JobExecutor |
| A simple operation that happens hourly | Own target type | Cron alone is not a reason to introduce a heavier execution system |
| Immediate asynchronous execution | JobExecutor |
No Cron Schedule is needed |
| A one-time delay, such as ten minutes after a request | Queue delay |
No Cron Schedule is needed; JobExecutor has no delay |
| Another execution system with its own references, status queries, and completion protocol | Own target type | The same registerTarget() call, with inspect() and completion reporting for work that finishes later |
Every schedule points at a registered target; registerTarget() is the target extension surface, and there is no built-in target type. A target does not guarantee exactly-once external business effects; design business idempotency.
Read by Task
- To create or change a schedule, read Definitions, Registration, and Synchronization.
- To register or review a target, hand its work to a
JobExecutor, report completion, or diagnose a historical occurrence after retargeting, read Target Extensions and Execution Protocol. - To integrate or review the UI/API and permissions, interpret status, or diagnose missing definitions, read Operations and Verification, including the complete management route table, separate status dimensions, and application identity checks.
Development Loop
- Establish which tasks and execution records administrators need to see. Check Server/Client/CLI registration, page permissions, the application's
jobsconfiguration (aredisadapter for more than one instance;memoryserves one process) andJobExecutorServiceProvidercomposition and target availability, then choose or register the target type. - Implement business logic and Providers in application source, and call
schedulerServiceToken.defineSchedule(definition)with an application-wide stable key from that Provider'sregister()/boot(). - Validate payload/inpu
Câu hỏi thường gặp
Mọi công việc nền có nên dùng Scheduler không?
Không. Skill nói rằng các tác vụ không cần hiển thị trên giao diện thì không nên dùng nó.
Ai có thể bật hoặc tắt một tác vụ?
Quản trị viên nghiệp vụ được ủy quyền, thông qua giao diện.
Scheduler có chứa logic nghiệp vụ không?
Không. Ứng dụng sở hữu logic, còn Scheduler xử lý lịch và trạng thái.
Chi tiết
Mô tả gốc của tác giả
Develop scheduled tasks in NocoBase 3 that business administrators need to view and track through the application UI. Define schedules in code, register the target a schedule points at, integrate execution status, and report completion. Do not use Scheduler to manage tasks that do not need UI visibility.
repo: nocobase/nocobase
Độ phổ biến
- Sao GitHub
- 25k
- Vị trí xếp hạng
- #10105
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
nocobase-app-development
25kGiúp agent của bạn xây dựng trang, tuyến, dữ liệu, quyền và kiểm thử cho một ứng dụng kinh doanh NocoBase 3 hoàn chỉnh.
shadcn
25kGiúp agent của bạn tìm, thêm, sửa và tạo kiểu cho các thành phần shadcn/ui trong dự án web, dùng tài liệu chính thức và registry của chúng.
nocobase-app-plugin-development
25kGiúp agent của bạn tạo và duy trì plugin NocoBase 3 trong một ứng dụng có sẵn, gồm phần server, client, cơ sở dữ liệu và đăng ký.
nocobase-app-upgrade
25kGiúp agent của bạn nâng cấp ứng dụng NocoBase lên bản mẫu mới hơn, mang các thay đổi của mẫu vào mà vẫn giữ công việc riêng của bạn.
Skill tương tự
knowledge-automation
394kGiúp agent của bạn thiết lập tác vụ định kỳ đưa nội dung mới vào kho Knowledge theo lịch, rồi kiểm tra tác vụ có chạy không.
knowledge-source-ingest
394kGiúp agent của bạn cập nhật Knowledge vault với các mục mới từ kênh chat, nguồn tin hoặc hộp thư, mà không thêm lại những gì đã có.
benchmark
280kGiúp agent của bạn đo tốc độ và hiệu suất của code, hữu ích để đảm bảo mọi thứ nhanh và tìm ra những chỗ chậm.