Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)7.6k · #13184

sharing

Skill này làm gì

Skill này giải thích cách các mục như bảng điều khiển, tài liệu và biểu mẫu được giữ riêng tư với người tạo cho đến khi được chia sẻ có chủ đích. Skill dành cho lập trình viên thêm chia sẻ hoặc kiểm tra truy cập vào ứng dụng.

Khi nào nên dùng

  • ✓Khi bạn thêm một loại mục mới mà người dùng tạo, chẳng hạn tài liệu hoặc biểu mẫu.
  • ✓Khi bạn cần kiểm soát ai có thể xem hoặc chỉnh sửa thứ mà người dùng đã tạo.
  • ✓Khi bạn thêm hộp thoại chia sẻ tiêu chuẩn vào ứng dụng.

Liên kết skill

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/sharing/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/sharing/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Cho phép mọi người tạo tài liệu và giữ chúng riêng tư, nhưng cho tôi chia sẻ một tài liệu với đồng đội cụ thể.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Mục mới mặc định riêng tư với người tạo. Người tạo có thể chia sẻ với những người được nêu tên, hoặc đặt khả năng hiển thị cho tổ chức hoặc cho bất kỳ ai có liên kết, và mọi danh sách hay lần đọc đều được kiểm tra theo các quy tắc đó.

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.

Sharing — Private by Default, Explicit Share

Rule

Any resource a user creates (dashboards, documents, forms, decks, compositions, booking links, issues, analyses) is private to the creator by default and visible to others only when they have been explicitly shared with or when the creator changes visibility to org or public.

This is the framework-level primitive. Every ownable resource gets it for free — same API, same UI, same skill.

Workspace apps are the intentional organization-scoped exception: their default visibility is org, configurable by an organization owner/admin. The creator is stored as the app owner, and the creator or an organization owner/admin can change the app's visibility or manage its share grants.

Concepts

Three visibility levels

  • private — owner + explicit share grants only. Default.
  • org — owner + explicit grants + anyone in the same org (read-only).
  • public — owner + explicit grants + anyone with the link (read-only). Public docs do NOT appear in other users' list/sidebar/search results — accessFilter omits them by default. They're reachable by id (resolveAccess admits them) so direct links and SSR routes like /p/:id keep working. If a list endpoint legitimately needs cross-user public discovery (a template gallery, etc.), pass accessFilter(table, shares, ctx, minRole, { includePublic: true }).

Visibility is coarse. Explicit share grants are fine-grained (per user, reusable organization group, or per org).

Roles on a share grant

  • viewer — read only.
  • commenter — read + add comments, but cannot edit the resource or manage shares.
  • editor — read + write.
  • admin — read + write + manage shares. Does NOT replace the single owner_email on the resource.

Share roles apply to one resource; organization roles apply to a team; app roles apply within one app. These are separate permissions. For role setup, use agent-native-docs to find the current organization and app-role guide.

Before adding an admin gate, identify which role system protects that operation and use its existing role descriptor and permission checks. Do not replace role checks with an email comparison or a custom isAdmin column.

Anonymous public URLs stay separate

Form "publish" slugs, booking-link slugs, any feature that exposes a URL to unauthenticated users — these are a different axis and are NOT controlled by the sharing system. Keep them alongside it.

Make a resource ownable

In your template's server/db/schema.ts:

import { sql } from "drizzle-orm";
import { pgTable, text } from "drizzle-orm/pg-core";
import {
  createSharesTable,
  ownableColumns,
} from "@agent-native/core/db/schema";

export const decks = pgTable("decks", {
  id: text("id").primaryKey(),
  title: text("title").notNull(),
  data: text("data").notNull(),
  createdAt: text("created_at").notNull().default(sql`now()`),
  updatedAt: text("updated_at").notNull().default(sql`now()`),
  ...ownableColumns(), // adds owner_email, org_id, visibility
});

export const deckShares = createSharesTable("deck_shares");

Then register it in server/db/index.ts (not the schema file — keeps the schema file free of the getDb closure and avoids circular imports):

// server/db/index.ts
import * as schema from "./schema.js";
import { createGetDb } from "@agent-native/core/db";
import { registerShareableResource } from "@agent-native/core/sharing";

export const getDb = createGetDb(schema);
export { schema };

registerShareableResource({
  type: "deck",
  resourceTable: schema.decks,
  sharesTable: schema.deckShares,
  displayName: "Deck",
  titleColumn: "title",
  getResourcePath: (deck) => `/deck/${deck.id}`,
  getDb,
});

Add agentRead: { actions: ["get-deck"] } naming the MCP tool that reads one resource, so the share panel can send it to Claude, Claude Code and Codex.

The type string is the stable id the UI and actions use. getDb is required — the framework-level share actions use it to reach your template's DB.

Restricting public visibility and cross-org user shares

Some resources should NOT be reachable by an arbitrary authenticated user even with the link, and should NOT be shareable to an email outside the org. Two optional registration flags lock these axes down:

registerShareableResource({
  type: "extension",
  // ...
  allowPublic: false, // hides "Public" in the share dialog and rejects it server-side
Câu hỏi thường gặp

Mặc định ai có thể thấy một tài liệu mới?

Chỉ người tạo, trừ khi nó được chia sẻ rõ ràng.

Có những mức hiển thị nào?

Riêng tư, tổ chức và công khai, trong đó công khai nghĩa là bất kỳ ai có liên kết.

Mục công khai có xuất hiện trong danh sách của người khác không?

Không. Chúng có thể truy cập qua liên kết nhưng bị loại khỏi danh sách và tìm kiếm mặc định.

Chi tiết

Mô tả gốc của tác giả

Framework-level sharing and privacy for user-authored resources (dashboards, documents, forms, decks, etc.). Use when making a resource table ownable, wiring list/read/update access checks, or dropping the standard share dialog into a template.

repo: BuilderIO/agent-native

Độ phổ biến

Sao GitHub
7.6k
Vị trí xếp hạng
#13184
Giấy phép
MIT
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự