Skip to main content
skill CX Codex

encore-bucket — Claude Code skill for Encore.ts object storage

Teaches the agent to handle Encore.ts object storage: upload, download, list and delete files through Bucket.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add encoredev/skills --skill encore-bucket -a claude-code
npx skills add encoredev/skills --skill bucket -a claude-code
Open on GitHub

What encore-bucket does

The skill covers declaring buckets in Encore.ts with Bucket from encore.dev/storage/objects. Buckets are declared at package level, and Encore provisions the storage behind them: S3 on AWS, GCS on GCP, in-memory locally. A bucket is private by default; public: true opens it up.

Inside you get working examples of upload(), download(), exists(), attrs(), remove() and list(). There is a separate section on signed URLs — signedUploadUrl() and signedDownloadUrl() with a ttl — so browsers talk to storage directly instead of streaming through your service. Bucket references carry a permission set (Uploader, Downloader, Lister, Attrser, Remover and more), which is handy when you pass access into helpers, since the contract lives in the type.

Named errors are documented too: ObjectNotFound, PreconditionFailed, ObjectsError. The guidance is to declare buckets at package level and keep them private unless assets really need unauthenticated download. Worth knowing before you install: every example assumes an Encore.ts project, because the runtime and provisioning are what make the code work.

What it helps with

  • store a user avatar in object storage
  • hand the browser a temporary download link
  • list objects in a bucket with their sizes
  • delete a file and confirm it is gone
  • pass bucket access to a helper with limited permissions

Example prompts for the agent

  • Create a user-uploads bucket for avatars and wire up uploads with upload()
  • I need a signed download URL for documents/report.pdf with ttl 7200
  • Declare a public public-assets bucket and return publicUrl() for an image

How to install encore-bucket

1Skills CLI (Vercel)

npx skills add encoredev/skills --skill encore-bucket -a claude-code
npx skills add encoredev/skills --skill bucket -a claude-code

2Manually: put the files in place

~/.claude/skills/bucket/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/bucket/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about encore-bucket

How do I install encore-bucket in Claude?

Run npx skills add encoredev/skills --skill encore-bucket -a claude-code.

What does encore-bucket do?

It gives the agent code patterns for Encore.ts object storage: declaring buckets, uploading and downloading files, signed URLs, and bucket references with a permission set.

What storage does Encore use behind a bucket?

Encore provisions it for you: S3 on AWS, GCS on GCP, and in-memory when running locally.

Source text

SKILL.md · Apache-2.0
---
name: encore-bucket
description: Store unstructured files in Encore.ts using `Bucket` from `encore.dev/storage/objects` — uploads, images, documents, blobs.
when_to_use: >-
  User wants to upload, download, list, or delete files — profile pictures, avatars, document uploads, image storage, media assets, generated reports, blob data. Covers public vs private buckets, signed upload/download URLs, bucket references with permission types (Uploader, Downloader, Lister, Attrser, Remover), and operations like `upload()`, `download()`, `list()`, `signedUploadUrl()`. Trigger phrases: "object storage", "bucket", "S3", "GCS", "blob", "user uploads", "profile picture", "image upload", "store a file", "file storage".
---

# Encore Object Storage

## Instructions

A `Bucket` is a logical store for files. Encore provisions the underlying object storage (S3 on AWS, GCS on GCP, in-memory locally). Declare buckets at package level.

```typescript
import { Bucket } from "encore.dev/storage/objects";

// Private bucket (default)
export const uploads = new Bucket("user-uploads", {
  versioned: false,  // Set to true to keep multiple versions
});

// Public bucket — files accessible via public URL
export const publicAssets = new Bucket("public-assets", {
  public: true,
  versioned: false,
});
```

## Operations

```typescript
// Upload
const attrs = await uploads.upload("path/to/file.jpg", buffer, {
  contentType: "image/jpeg",
});

// Download
const data = await uploads.download("path/to/file.jpg");

// Existence check
const exists = await uploads.exists("path/to/file.jpg");

// Attributes (size, content type, ETag)
const meta = await uploads.attrs("path/to/file.jpg");

// Delete
await uploads.remove("path/to/file.jpg");

// List
for await (const entry of uploads.list({})) {
  console.log(entry.key, entry.size);
}

// Public URL (only for public buckets)
const url = publicAssets.publicUrl("image.jpg");
```

## Signed URLs

Generate temporary URLs so clients can upload/download directly without going through your service:

```typescript
const uploadUrl = await uploads.signedUploadUrl("user-uploads/avatar.jpg", { ttl: 7200 });
const downloadUrl = await uploads.signedDownloadUrl("documents/report.pdf", { ttl: 7200 });
```

## Bucket References

Pass bucket access to other code with a specific permission set:

```typescript
import { Uploader, Downloader } from "encore.dev/storage/objects";

const uploaderRef = uploads.ref<Uploader>();
const downloaderRef = uploads.ref<Downloader>();

// Permission types: Downloader, Uploader, Lister, Attrser, Remover,
// SignedDownloader, SignedUploader, ReadWriter
```

## Errors

- `ObjectNotFound` — object doesn't exist
- `PreconditionFailed` — upload preconditions not met (e.g. `setIfNotExists`)
- `ObjectsError` — base error type

## Guidelines

- Declare buckets at package level.
- Default to private buckets; opt into `public: true` only for assets meant for unauthenticated download.
- Use signed URLs for browser uploads/downloads instead of streaming through your service.
- Use bucket references when passing access to helpers — they encode the permission contract in the type system.

© encoredev · Apache-2.0 · encoredev/skills

Similar skills

All skills for Backend and APIs →

From the same set10

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor