跳到正文
cccskills
免费在 GitHub 公开

cloud-files

Use when modifying anything under features/files/, app/(core)/files/, app/(public)/share/, or any caller that uploads, downloads, lists, moves, renames, shares, or previews user files.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(200)

  • SKILL.md6.1 KB
  • __tests__/the-file-editor-opens-in-the-canvas.test.tsx4.3 KB
  • agent-context/buildFilesContextData.test.ts1.8 KB
  • agent-context/buildFilesContextData.ts13.8 KB
  • agent-context/FilesSurfaceScopeContext.tsx5.8 KB
  • api/__tests__/per-file-requests-carry-the-files-organization.organization-context.test.ts3.9 KB
  • api/assets.ts492 B
  • api/direct.ts492 B
  • api/document-lookup.ts8.1 KB
  • api/fileOrganization.ts512 B
  • api/files.force-copy.test.ts1.1 KB
  • api/files.ts490 B
  • api/folders.test.ts1.2 KB
  • api/folders.ts494 B
  • api/office.ts492 B
  • api/pdf-pages.ts1.1 KB
  • api/permissions.ts502 B
  • api/resource-family.test.ts2.4 KB
  • api/resource-family.ts3.9 KB
  • api/versions.ts496 B
  • blocks/actions.ts1.4 KB
  • blocks/adapters/from-cx-av-part.ts233 B
  • blocks/adapters/from-media-block.ts319 B
  • blocks/adapters/from-media-ref.ts335 B
  • blocks/BlockSharePopover.tsx7.4 KB
  • blocks/guards.ts393 B
  • blocks/image/adapters/__tests__/from-image-output-data.test.ts1.2 KB
  • blocks/image/adapters/__tests__/to-cx-media-part.test.ts2.1 KB
  • blocks/image/adapters/from-cld-files-row.ts3.3 KB
  • blocks/image/adapters/from-cx-media-part.ts214 B
  • blocks/image/adapters/from-image-output-data.ts218 B
  • blocks/image/adapters/from-partial-image-data.ts219 B
  • blocks/image/adapters/from-render-block.ts214 B
  • blocks/image/adapters/to-cx-media-part.ts212 B
  • blocks/image/guards.ts263 B
  • blocks/image/helpers/derive-viewer-url.ts214 B
  • blocks/image/helpers/extract-file-id-from-url.ts219 B
  • blocks/image/helpers/parse-filename-from-url.ts219 B
  • blocks/image/types.ts1.1 KB
  • blocks/image/UNIFIED_IMAGE_BLOCK.md21.3 KB
  • blocks/image/UnifiedImageBlockRenderer.tsx35.6 KB
  • blocks/image/useImageActions.ts13.7 KB
  • blocks/image/utils/print-image.ts5.5 KB
  • blocks/image/utils/render-image-variant.ts6.3 KB
  • blocks/image/utils/save-image-file.ts5.4 KB
  • blocks/types.ts677 B
  • blocks/useBlockMediaSource.test.tsx4.0 KB
  • blocks/useBlockMediaSource.ts7.9 KB
  • blocks/video/UnifiedVideoBlockRenderer.tsx23.1 KB
  • blocks/video/useVideoActions.test.tsx3.7 KB
  • blocks/video/useVideoActions.ts4.7 KB
  • blocks/video/VideoPublishDate.tsx215 B
  • blocks/youtube/YouTubeEmbed.tsx4.4 KB
  • BRANDING_FILE_ID_PATTERN.md1.8 KB
  • cache/admin/BlobCacheInspector.tsx18.1 KB
  • cache/idb-store.ts371 B
  • cache/policy.ts365 B
  • cache/register-service-worker.ts399 B
  • cache/registerOnFirstFileFetch.ts1.8 KB
  • cache/service-worker/build-sw.ts2.6 KB
  • cache/service-worker/src/__tests__/capture-offline.test.ts3.0 KB
  • cache/service-worker/src/__tests__/offline-routing.test.ts4.1 KB
  • cache/service-worker/src/offline-routing.ts5.8 KB
  • cache/service-worker/src/sw.ts38.9 KB
  • canvas/CloudFileEditorCanvasView.tsx658 B
  • canvas/cloudFileEditorKind.ts3.4 KB
  • CLOUD_FILES_RPC_DISPOSITIONS.md2.7 KB
  • components/core/__tests__/a-failed-read-is-never-an-empty-folder.test.tsx3.2 KB
  • components/core/DuplicateUploadDialog/DuplicateUploadDialog.test.ts530 B
  • components/core/DuplicateUploadDialog/DuplicateUploadDialog.tsx17.6 KB
  • components/core/FileAcquisition/DropzoneAcquisitionActions.test.tsx1.7 KB
  • components/core/FileAcquisition/DropzoneAcquisitionActions.tsx2.4 KB
  • components/core/FileAcquisition/FileAcquisitionActions.google-terminal.test.tsx8.9 KB
  • components/core/FileAcquisition/FileAcquisitionActions.test.tsx7.5 KB
  • components/core/FileAcquisition/FileAcquisitionActions.tsx15.0 KB
  • components/core/FileActions/__tests__/useFileActions.share-url.test.tsx4.0 KB
  • components/core/FileActions/useFileActions.ts10.9 KB
  • components/core/FileActions/useFolderActions.ts6.2 KB
  • components/core/FileBadges/FileDuplicateOfBadge.tsx2.7 KB
  • components/core/FileBadges/FileRagBadge.tsx4.0 KB
  • components/core/FileBreadcrumbs/FileBreadcrumbs.tsx3.2 KB
  • components/core/FileChip/FileChip.tsx6.2 KB
  • components/core/FileContextMenu/FileContextMenu.responsive-contract.test.ts1.1 KB
  • components/core/FileContextMenu/FileContextMenu.tsx31.9 KB
  • components/core/FileContextMenu/FilePageReferenceMenuSub.tsx1.6 KB
  • components/core/FileContextMenu/FileRightClickMenu.tsx5.8 KB
  • components/core/FileContextMenu/useFileMenuActions.ts3.7 KB
  • components/core/FileEditor/__tests__/CloudFileInlineEditor.working-copy.test.tsx13.6 KB
  • components/core/FileEditor/CloudFileInlineEditor.tsx9.9 KB
  • components/core/FileInfo/FileInfoDialog.tsx2.3 KB
  • components/core/FileList/FileList.tsx10.9 KB
  • components/core/FileList/FileListGridCell.tsx4.5 KB
  • components/core/FileList/FileListRow.tsx5.1 KB
  • components/core/FileMeta/FileMeta.tsx2.5 KB
  • components/core/FilePreview/edit-handoff.test.ts1.2 KB
  • components/core/FilePreview/edit-handoff.ts1.3 KB
  • components/core/FilePreview/FileFetchProgress.tsx3.1 KB
  • components/core/FilePreview/FilePreview.hydration.test.tsx2.7 KB
  • components/core/FilePreview/FilePreview.tsx11.9 KB
  • components/core/FilePreview/preview-actions.test.ts1.2 KB
  • components/core/FilePreview/preview-actions.ts6.0 KB
  • components/core/FilePreview/PreviewerActionBar/PreviewerActionBar.tsx4.5 KB
  • components/core/FilePreview/previewers/AudioPreview.test.tsx3.8 KB
  • components/core/FilePreview/previewers/AudioPreview.tsx15.5 KB
  • components/core/FilePreview/previewers/CodeHighlighter.tsx824 B
  • components/core/FilePreview/previewers/DataPreview.tsx18.2 KB
  • components/core/FilePreview/previewers/ImagePreview.tsx5.8 KB
  • components/core/FilePreview/previewers/MarkdownPreview.tsx6.3 KB
  • components/core/FilePreview/previewers/OfficePreview.tsx22.0 KB
  • components/core/FilePreview/previewers/PdfDocumentRenderer.tsx252 B
  • components/core/FilePreview/previewers/PdfPreview.tsx234 B
  • components/core/FilePreview/previewers/VideoPreview.tsx3.3 KB
  • components/core/FilePreview/PreviewerSwitch.tsx11.5 KB
  • components/core/FilePreview/PreviewHostToolbar.tsx831 B
  • components/core/FilePreview/usePreviewActions.ts7.1 KB
  • components/core/FileTree/FileTree.tsx10.8 KB
  • components/core/FileTree/FileTreeRow.tsx6.0 KB
  • components/core/FileTree/useTreeExpansion.ts6.5 KB
  • components/core/FileVersions/FileVersionsList.tsx13.3 KB
  • components/core/FolderContextMenu/FolderContextMenu.tsx12.3 KB
  • components/core/PdfAnnotationLayer/index.ts181 B
  • components/core/PermissionsDialog/PermissionsDialog.tsx11.7 KB
  • components/core/RenameDialog/RenameDialog.tsx14.4 KB
  • components/core/RenameDialog/RenameHost.tsx1.9 KB
  • components/core/RowContextMenu/RowContextMenu.tsx21.2 KB
  • components/core/ShareLinkDialog/ShareLinkDialog.tsx14.7 KB
  • components/core/ShowSystemFilesToggle.tsx2.0 KB
  • components/core/Tooltip/TooltipIcon.tsx808 B
  • components/FileContextSection.tsx5.2 KB
  • components/FileReferenceCopyButton.tsx1.9 KB
  • components/inline/MediaAttachmentThumbnail.test.tsx2.1 KB
  • components/inline/MediaAttachmentThumbnail.tsx4.7 KB
  • components/multi-view/grid-layout.ts2.3 KB
  • components/multi-view/MultiFileGridViewer.tsx9.0 KB
  • components/pickers/CloudFilesPickerHost.tsx930 B
  • components/pickers/CloudFilesPickerHostBody.tsx8.0 KB
  • components/pickers/cloudFilesPickerOpeners.ts5.4 KB
  • components/pickers/FolderPicker.tsx3.3 KB
  • components/pickers/SaveAsDialog.tsx12.2 KB
  • components/preview/FileResourceChip.test.tsx1.9 KB
  • components/preview/FileResourceChip.tsx7.7 KB
  • components/preview/openFilePreview.ts1.7 KB
  • components/preview/SelectableFileThumbnail.test.tsx2.8 KB
  • components/preview/SelectableFileThumbnail.tsx4.6 KB
  • components/surfaces/desktop/__tests__/a-context-cell-says-a-refused-read.test.tsx2.9 KB
  • components/surfaces/desktop/__tests__/file-table-rows-hold-still.test.tsx8.0 KB
  • components/surfaces/desktop/AccessBadge.tsx3.6 KB
  • components/surfaces/desktop/AccessCell.tsx1.7 KB
  • components/surfaces/desktop/ActiveColumnFilters.tsx5.9 KB
  • components/surfaces/desktop/BulkActionsBar.tsx11.0 KB
  • components/surfaces/desktop/columns.ts5.1 KB
  • components/surfaces/desktop/ContentHeader.tsx10.1 KB
  • components/surfaces/desktop/EmptyState.tsx1.6 KB
  • components/surfaces/desktop/FileContextCell.tsx1.9 KB
  • components/surfaces/desktop/FileGridCell.tsx12.4 KB
  • components/surfaces/desktop/FileTable.tsx32.2 KB
  • components/surfaces/desktop/FileTableRow.responsive-contract.test.ts1.5 KB
  • components/surfaces/desktop/FileTableRow.tsx19.5 KB
  • components/surfaces/desktop/FileTypeBadge.tsx2.5 KB
  • components/surfaces/desktop/FilterChips.tsx2.3 KB
  • components/surfaces/desktop/FolderIconWithMembers.tsx1.3 KB
  • components/surfaces/desktop/IconRail.tsx3.3 KB
  • components/surfaces/desktop/KindFilter.tsx2.4 KB
  • components/surfaces/desktop/NavSidebar.tsx9.1 KB
  • components/surfaces/desktop/NavSidebarFlatFolders.tsx7.2 KB
  • components/surfaces/desktop/NewMenu.tsx10.4 KB
  • components/surfaces/desktop/OwnerCell.tsx2.7 KB
  • components/surfaces/desktop/RagStatusCell.tsx2.5 KB
  • components/surfaces/desktop/row-data.ts14.4 KB
  • components/surfaces/desktop/section.ts1.3 KB
  • components/surfaces/desktop/SharedAvatarStack.tsx2.5 KB
  • components/surfaces/desktop/sidebarModeCookie.ts145 B
  • components/surfaces/desktop/SidebarModeToggle.tsx4.1 KB
  • components/surfaces/desktop/StorageQuotaChip.tsx9.3 KB
  • components/surfaces/desktop/TopBar.tsx1.6 KB
  • components/surfaces/desktop/ViewModeToggle.tsx2.7 KB
  • components/surfaces/DocumentTab.tsx15.7 KB
  • components/surfaces/EmbeddedShell.tsx7.1 KB
  • components/surfaces/file-one-frame.test.ts7.5 KB
  • components/surfaces/FileInfoTab.tsx19.9 KB
  • components/surfaces/FileLineageChip.tsx3.8 KB
  • components/surfaces/FileShareTab.tsx11.3 KB
  • components/surfaces/FilesQueryHydrator.tsx1.2 KB
  • components/surfaces/FilesRouteSelectionSync.tsx5.1 KB
  • components/surfaces/FilesTreeState.tsx2.6 KB
  • components/surfaces/FilesUrlSync.tsx6.4 KB
  • components/surfaces/FileTabsBody.tsx24.7 KB
  • components/surfaces/FileViewerControlsContext.tsx7.1 KB
  • components/surfaces/MobileStack.tsx22.0 KB
  • components/surfaces/OnboardingEmptyState.tsx4.6 KB
  • components/surfaces/PageShell.mobile-rename-contract.test.ts817 B
  • components/surfaces/PageShell.tsx48.5 KB
  • components/surfaces/PickerShell.responsive-contract.test.ts429 B
  • components/surfaces/PickerShell.tsx12.9 KB
  • components/surfaces/PreviewErrorBoundary.tsx5.9 KB
  • components/surfaces/PreviewPane.tsx16.9 KB
  • components/surfaces/single-file/EditControls.tsx2.4 KB
  • components/surfaces/single-file/FileViewerControlRail.tsx5.1 KB
  • components/surfaces/single-file/HtmlPreviewControls.tsx2.4 KB
  • components/surfaces/single-file/ImageEditTab.tsx9.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Cloud Files — Skill

This skill enforces the architecture established in features/files/FEATURE.md. Read it first. This skill is the checklist version.


Non-negotiables

  • Reads: supabase-js (RLS) + RPC cloud_get_user_file_tree. No REST calls for reads unless the endpoint returns bytes.
  • Metadata writes: direct authenticated database calls through the canonical RPCs.
  • File bytes, signing, and processing: the Files service. Always send the caller JWT and request id.
  • Never call an object-store SDK from the client. Use the public surface in features/files/index.ts.
  • All file state in the cloudFiles Redux slice. No local useState for file data. No new Redux slices for files — extend the existing one.
  • All types in features/files/types.ts. Do not declare inline types or per-file type files. Import via features/files/index.ts.
  • Identity is fileId. Never cache by file_path — paths move with renames.
  • Mutations are optimistic + rollback (pattern from features/agents/redux/agent-shortcuts/thunks.ts). No spinner-then-refetch.
  • Realtime is the source of truth for cross-session sync. The middleware dedups echoes of local writes via the request ledger — always register a requestId on every mutation.
  • Mobile rules: Drawer not Dialog; push-nav not tabs; dvh not vh; pb-safe on fixed bottoms; 16px inputs.
  • FieldFlags<K> not Set<K> in Redux state (JSON-serializability).
  • app/(core)/files/ routes follow app/(core)/_read_first_route_rules/RULES.md. SSR-first, zero layout shift; 'use cache' is NOT available (cacheComponents off — see CLAUDE.md).

Before writing code

Read, in this order:

  1. /Users/armanisadeghi/code/common-docs/systems/files/file-service/WIRE_CONTRACT.md — the backend contract (routes, shapes, quotas, TUS, share tokens).
  2. features/files/FEATURE.md — current FE architecture.
  3. features/agents/redux/agent-shortcuts/slice.ts — the record + dirty-tracking pattern you're copying.

For route work under app/(core)/files/, additionally run these skills before writing code:

  • .claude/skills/ssr-zero-layout-shift/SKILL.md
  • .claude/skills/ios-mobile-first/SKILL.md (for any mobile branch)

Common tasks

Upload files

import { useAppDispatch } from '@/lib/redux/hooks';
import { uploadFiles } from '@/features/files/redux/thunks';

const dispatch = useAppDispatch();
await dispatch(
  uploadFiles({ files: [file], parentFolderId, visibility: 'private' })
).unwrap();

Render a file as <img> / <video>

import { useMediaResolution } from "@ai-matrx/media/core";

// Prefer <InlineMediaRef ref={{ file_id }} /> from @ai-matrx/media/react.
const src = useMediaResolution(fileId).resolution?.src ?? null;
return <img src={src ?? undefined} />;

Pick a file for "attach"

import { openFilePicker } from '@/features/files/components/pickers/FilePicker';

const [file] = await openFilePicker({ multi: false });

List contents of a folder

import { useFolderContents } from '@/features/files/hooks/useFolderContents';

const { files, folders, loading } = useFolderContents(folderId);

Create a share link

import { useSharing } from '@/features/files/hooks/useSharing';

const { createShareLink } = useSharing();
const link = await createShareLink(fileId, {
  permission_level: 'read',
  expires_at: '2026-12-31T23:59:59Z',
  max_uses: 50,
});
// link.share_token → https://app.aidream.com/share/${link.share_token}

Forbidden

  • Direct object-store SDK calls.
  • New Redux slices for files. Extend cloudFiles.
  • Local types declarations for CloudFile, CloudFolder, etc. Import from features/files/index.ts.
  • window.alert / confirm / prompt. Use components/ui/alert-dialog.
  • Dialog on mobile. Branch via useIsMobile() to Drawer.
  • h-screen / vh under app/(core)/files/ — use dvh, --header-height, pb-safe.
  • Hardcoded paths. Use features/files/utils/path.ts.
  • Set in Redux state. Use FieldFlags<K> from @ai-matrx/agents/field-flags.
  • Directly importing core components from components/core/FileTree/internal/*. Consume from the barrel.
  • Calling the REST API without a requestId. The realtime middleware will not be able to dedup, and you will see visual flicker.

When something breaks

SymptomLikely cause
Optimistic update flickers/reverts after a secondMissing requestId on the REST write. Realtime echo is overwriting state.
Uploads succeed but don't appear in treeRealtime middleware not attached. Check <CloudFilesRealtimeProvider> is mounted under the user-scoped layout.
Signed URL returns 403Expired. Use useFileSrc (the handler's expiry-wheel auto-refreshes). Never cache raw signed URLs across mounts.
Tree shows stale state after reconnectreconcileTree() dispatch missing from the realtime middleware's SUBSCRIBED-after-error handler.
Type error on CloudFile.metadataYou're using an inline type somewhere. Delete it and import from types.ts.
413 on uploadFile >tier cap (or >100MB free). For >100MB uploads, use the TUS endpoint at /files/upload/tus (transport is chosen in upload/cloudUpload.ts).

Change-log expectations

After any non-trivial change:

  1. Update FEATURE.md — architecture sections, invariants, status.
  2. Append to the bottom of FEATURE.md change log with date + one-line summary.
  3. If you need something new from the file service, add it to /Users/armanisadeghi/code/common-docs/systems/files/file-service/HANDOFF.md.

Treat docs as weight-equal to code. Stale docs cascade across every future agent touching this system.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Admin debug system wiring for the floating AdminIndicator's live debug data and Copy Full Context. Use when adding debug visibility to a route or feature, wiring useDebugContext or the debug panel, capturing console errors, or enabling the copy-context workflow for a page.

中文简介正在准备中。当前显示原文说明。

armanisadeghi/ai-matrx32026年10月21日 更新

Compact two-icon Copy / Copy-for-AI controls (components/agent-copy). Use when adding copy buttons to a row, card, list, or record; merging duplicate Copy/JSON/AI controls; continuing the copy rollout; or writing a Copy-for-AI payload. NOT for markdown content actions (use rich-document-actions).

中文简介正在准备中。当前显示原文说明。

armanisadeghi/ai-matrx32026年10月21日 更新

Disclosing a surface's existing fixed AI jobs in the shell's top Agents menu. Use when a page, panel, overlay, or window already runs a mandate behind a button, assist, automatic action, or mode; when the agent-disclosure guard names a file; or during a surface check.

中文简介正在准备中。当前显示原文说明。

armanisadeghi/ai-matrx32026年10月21日 更新

The watch-fix-rerun method for making an existing platform agent or automated process efficient and correct: baseline its ledger, run one unit yourself, fix the class behind every wasted call, rerun, record. Use when asked to improve, optimize, watch, or 'make efficient' an agent, a sandbox session, a sync job, or any recurring automated process.

中文简介正在准备中。当前显示原文说明。

armanisadeghi/ai-matrx32026年10月21日 更新

Redux state for agent execution and firing agent shortcuts. Use when editing features/agents/redux/, building agent UI, creating a conversation, touching assembleRequest or NDJSON stream state, wiring agent-state selectors, adding a per-conversation capability, or triggering a shortcut from a button, menu, or code (useShortcutTrigger, launchAgentExecution).

中文简介正在准备中。当前显示原文说明。

armanisadeghi/ai-matrx32026年10月21日 更新

The provision for a call site: the exhaustive menu of values that place in the code can realistically produce. Use before creating or fixing a mandate or agent that reasons about more than its own input, when deciding whether an agent can answer at all with what it is sent, or when its output 'looks right' but nobody checked it could be. NOT for building the agent (use create-agent).

中文简介正在准备中。当前显示原文说明。

armanisadeghi/ai-matrx32026年10月21日 更新

查看 armanisadeghi 的全部技能

报告此技能的问题