Aller au contenu
Skillpedia
API et serveurs (backend)7.6k · #13184

sharing

Ce qu’il fait

Cette compétence explique comment des éléments comme les tableaux de bord, les documents et les formulaires restent privés pour leur créateur jusqu'à ce qu'ils soient partagés volontairement. Elle s'adresse aux développeurs qui ajoutent le partage ou les contrôles d'accès à une application.

Quand l’utiliser

  • ✓Quand vous ajoutez un nouveau type d'élément que les utilisateurs créent, comme un document ou un formulaire.
  • ✓Quand vous devez contrôler qui peut voir ou modifier un élément créé par un utilisateur.
  • ✓Quand vous ajoutez la fenêtre de partage standard à une application.

Lien du skill

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

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/sharing/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Permets aux gens de créer des documents qui restent privés, mais laisse-moi partager un document avec des collègues précis.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Les nouveaux éléments sont privés pour leur créateur. Le créateur peut partager avec des personnes nommées, ou définir la visibilité pour l'organisation ou pour toute personne disposant du lien, et chaque liste et lecture est vérifiée selon ces règles.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

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
Questions fréquentes

Qui peut voir un nouveau document par défaut ?

Seulement son créateur, sauf s'il est explicitement partagé.

Quels sont les niveaux de visibilité ?

Privé, organisation et public, où public signifie toute personne disposant du lien.

Les éléments publics apparaissent-ils dans les listes des autres ?

Non. On y accède par lien, mais ils sont exclus des listes et de la recherche par défaut.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
7.6k
Position au classement
#13184
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires