跳到正文
Skillpedia
API 与服务器(后端)25k · #10101

nocobase-app-plugin-notification-in-app

它能做什么

这项技能在 NocoBase 3 应用中设置站内通知收件箱。每位用户只能看到自己的通知,收件箱会实时刷新。适合希望在应用内设置收件箱的开发者。

适用场景

  • ✓当你希望用户在应用内的收件箱中看到通知时。
  • ✓当通知保存后,你需要收件箱实时刷新时。
  • ✓当收件箱项目缺失或显示给了错误的用户,需要诊断时。

技能链接

https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-notification-in-app/skills/nocobase-app-plugin-notification-in-app/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-notification-in-app/skills/nocobase-app-plugin-notification-in-app/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我为 NocoBase 应用添加站内通知收件箱,当任务分配给某位用户时实时刷新。”

每周 5 个新技能,1 分钟读完。

工作原理

AI 会注册客户端和服务器端的插件入口,把收件箱组件放在应用自己管理的页面上,并连接实时更新主题。已保存的通知仍是唯一的依据。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Goal

Integrate and maintain the authenticated, user-isolated in-app inbox while keeping durable HTTP state authoritative and realtime events limited to invalidation.

Ownership and Placement

This Skill is published with @nocobase/app-plugin-notification-in-app. The plugin owns its Server runtime, persistence, APIs, realtime contract, and Client inbox components. The target application owns whether both Client and Server entries are registered.

Scope

  • Register the Client and Server plugin entries and the core notification dependency.
  • Render the exported inbox components in an application-owned page.
  • Consume the public realtime topic and event types from the /realtime package entry.
  • Verify or diagnose inbox HTTP access, mutations, user isolation, and reconnect refresh.

Non-Goals

  • Do not replace durable notifications with transient browser toasts.
  • Do not edit inbox tables directly or publish forged realtime events as notification state.
  • Do not expect the plugin to contribute an inbox page; the application owns the route.

Input Contract

Input Required Default Validation Clarification Question
action yes verify for existing code; register for a new target register/verify/diagnose "Should I register, verify, or diagnose the inbox?"
application yes infer from one unambiguous workspace application application root with Server and Client configuration "Which application should register the inbox plugin?"
apiConfig no the target application's injected ApiClient and RealtimeClient authenticated client with the intended baseURL/realtimeURL "Should this application use its default or a custom API host?"

Rules:

  • Resolve package versions and enabled plugins from the target application before changing source.
  • Register the package's public /client and /server entries; do not import implementation files.
  • If the target application is ambiguous, stop mutation and ask.

Mandatory Clarification Gate

  • Max clarification rounds: 2.
  • Max questions per round: 3.
  • Read-only inspection and diagnosis may proceed when the application is unambiguous.
  • Missing required input blocks mutation; report the missing contract instead of guessing.

Workflow

  1. Read Inbox Integration Contract for package requirements, public surfaces, and runtime semantics.
  2. Inspect the target application's Server plugin list, Client composition, authentication setup, api.baseURL, api.realtimeURL, and installed package versions.
  3. Register @nocobase/app-plugin-notification before @nocobase/app-plugin-notification-in-app/server when the application needs the in-app Channel contribution.
  4. Register @nocobase/app-plugin-notification-in-app/client in the Client composition root. The plugin contributes no pages: render NotificationInAppInbox inside NotificationInAppProvider in a page the application declares among its own routes.
  5. In React components and custom Hooks, use useApiClient() from @nocobase/app-client for inbox reads and mutations, and useService(realtimeClientToken) for subscriptions. Outside React, resolve the corresponding tokens from the application's services or receive the clients explicitly. Do not reconstruct /api from the browser location or Portal base.
  6. Keep HTTP state authoritative. On a validated inbox.changed event, realtime connection open, or window focus, trigger a bounded HTTP refetch.
  7. Use the public @nocobase/app-plugin-notification-in-app/realtime entry for shared topic or event types; do not import Server internals.
  8. Test allowed and denied users, mutations without a CSRF token, cross-site cookie writes rejected with INVALID_CSRF_ORIGIN, pagination, custom API hosts, realtime invalidation, and reconnect recovery.
  9. Run lint, typecheck, tests, and build for the plugin and affected application.

Reference Loading Map

| Reference

常见问题

实时更新就是真实的通知吗?

不是。实时事件只是提示,已保存的收件箱才是权威记录。

插件会添加收件箱页面吗?

不会。路由由应用自己拥有,并由应用放置页面。

临时弹出的提示可以代替收件箱吗?

不可以。技能说明,持久通知不得被临时的浏览器提示取代。

详情

作者的原始描述

Use when agents need to register, verify, or diagnose the NocoBase durable in-app inbox, its development-only Client page, or realtime refresh behavior.

repo: nocobase/nocobase

热度

GitHub 星标
25k
排名
#10101
许可证
—
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能