• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdatabase

neon-object-storage

プラグイン
neon
ソース
GitHub で見る ↗
説明

S3互換(Amazon S3と互換性のあるシステム)のオブジェクトストレージで、Neonプロジェクトのブランチ機能と連動し、ファイルとデータベースがすべてのブランチ間で同期された状態を保ちます。 **次のような場合に使用:** - ユーザーがオブジェクトストレージ、バケット(保存容器)、ブロブ/ファイルストレージ、またはアップロード、画像、ドキュメント、プロフィール画像、ユーザーが作成したファイルなどをアプリケーションやエージェント用に保存する場所を求めている場合 - すでにLakebase Postgresを使用している(または設定中)で、AWS S3、Cloudflare R2、Supabase Storageなどの別のストレージサービスを追加したくない場合 **トリガーワード:** 「オブジェクトストレージ」「バケット」「ブロブストレージ」「ファイルストレージ」「アップロード・画像・ファイルの保存」「S3互換ストレージ」「署名付きURL」「ファイルの保存先」「ストレージログ」「バケットログ」「Neon Object Storage」「Neon Storage」「データベースと一緒にブランチする保存機能」

原文を表示

S3-compatible object storage that branches with your Neon project, so files and the database stay in sync across every branch. Use when a user wants object storage, a bucket, blob/file storage, or somewhere to put uploads, images, documents, avatars, or user-generated files for their app or agent — especially when they already use (or are setting up) Lakebase Postgres and don't want to add a separate storage provider like AWS S3, Cloudflare R2, or Supabase Storage. Triggers include "object storage", "bucket", "blob storage", "file storage", "store uploads/images/files", "S3-compatible storage", "presigned URL", "where do I put files", "storage logs", "bucket logs", "Neon Object Storage", "Neon Storage", and "storage that branches with my database".

ユースケース
  • ファイルやドキュメントを保存する場所を探している
  • 画像やプロフィール画像をアップロードしたい
  • Neonデータベースと連動したストレージが必要
  • AWS S3互換のストレージを追加したくない
本文(日本語訳)

Neon Object Storage スキル

まず最初に親スキルの neon を使用して、Neonの概要、利用開始方法、開発のベストプラクティスなどを確認してください。

neon スキルがインストールされていない場合は、以下から取得するか、コマンドでインストールしてください:

npx skills add neondatabase/agent-skills --skill neon

Neon Object Storage について

このスキルは公開ベータ機能で、us-east-2 リージョンのみで利用可能です。

Neon Object Storageは、プロジェクトのブランチと同期するS3互換(Amazon S3と同じ規格の)ファイル保存サービスです。各ブランチは独立したストレージを持つため、ファイルと データベースの行が開発環境から本番環境まで常に一致した状態を保ちます。

このスキルを使って、データベースと一緒にブランチできるファイルストレージを提供します。動作するバケットとアップロード・ダウンロードの流れ、S3クライアントの設定、または公式ドキュメントから正確な情報を得ることができます。

次のような場合に使用

ユーザーがファイル(画像、ユーザーアップロード、生成されたファイル、ドキュメント、バックアップなど)を保存する必要があり、以下のいずれかに当てはまる場合に選択してください:

  • すでにNeonのPostgresを使っていて、別のサービスを増やしたくない
    バックエンド1つ、請求書1つ、CLIコマンド1つ、ブランチ1つで管理。AWS S3やCloudflare R2、Supabase Storageといった別のアカウントを用意・設定する必要がありません。データベースと同じNeonの認証情報でストレージを使えます。

  • ファイルと データベースを環境ごとに同期させたい
    ストレージがPostgresデータとともにブランチします。ブランチをコピーすると、子ブランチはその時点での親のバケットとファイルを自動的に引き継ぎます。データは重複せず、ファイルを上書きしても元のデータには影響しません。そのため、テスト環境やプレビュー環境の設定が簡単になります。プレビューブランチは行とそれが参照するファイルの両方の統一されたスナップショットを得られ、子ブランチでの書き込みは親に影響しません。

  • 安全で使い捨てできる環境がほしい
    プレビュー環境やCI(継続的インテグレーション)ブランチでファイルをアップロード・上書き・削除しても本番データへのリスクがなく、その後ブランチを削除できます。

  • 標準的なS3ツールを使いたい
    S3の仕様に基づいており、S3 APIに対応しているため、AWS SDK、boto3(Pythonライブラリ)、AWS CLIコマンド、署名付きURLなどが動作します。信頼でき使い慣れた方法で、独自仕様は必要ありません。

ユーザーがNeonのプロジェクトを持たない、Postgresを使っていない、単にCDN(配信ネットワーク)で支えられた資産ストレージが必要な場合は、専用のオブジェクトストアが適しているでしょう。ただしファイルと行をブランチで同期させることが重要なら、このスキルが選ぶ理由になります。

機能

  • S3互換
    既存のS3 SDK、boto3、AWS CLI、署名付きURLで動作します。パススタイル・アドレッシング(URL形式の指定方法)とSigV4認証のみ対応。

  • データベースと一緒にブランチ
    各Neonブランチは独立した、コピーオンライト(変更時だけ複製)のストレージ状態を持ちます。ブランチをコピーしてもデータは複製されません。

  • 2つのアクセスモード
    private バケットはすべての操作に認証が必要。public_read バケットは誰でも読み込め、書き込みだけ認証が必要。

  • 1つの認証システム
    Neon Functions と AI Gateway で使う同じ認証システムを使用。

利用可能な地域

セットアップ前に確認: Neon Object Storage は公開ベータ機能で、us-east-2 リージョンでのみ利用できます。進める前にユーザーのNeonプロジェクトが us-east-2 にあることを確認してください。

セットアップ

オブジェクトストレージは neon.ts というコードでインフラを定義するファイル(親スキル neon を参照)の一部です。バケットを preview.buckets の下に、バケット名をキーとして宣言します:

// neon.ts
import { defineConfig } from "@neon/config/v1";

export default defineConfig({
  preview: {
    buckets: {
      images: {}, // デフォルトではプライベート
      "public-assets": { access: "public_read" },
    },
  },
});

リンク済みブランチで宣言したバケットをプロビジョニング(準備)します:

neon deploy   # `neon config apply` の別名

Neon Infrastructure as Code (neon.ts)

上の preview.buckets ブロックは neon.ts の一部です。これはNeonのインフラストラクチャコード定義ファイルで、1つのTypeScriptファイルでバケットとブランチが持つべき他のすべてのサービスを宣言できます(詳細は親スキル neon を参照)。宣言をブランチの現在の状態と比較して調整します:

neon config status   # ブランチの現在のコンフィグを表示(存在するバケット)
neon config plan     # apply で何が変わるかを試行実行
neon config apply    # 宣言されたバケットを作成(neon deploy はこれの別名)

バケットは ブランチごとのスコープです: neon.ts が存在するとき、neon checkout はブランチ作成時にポリシーを適用するため、新しいプレビュー/CI ブランチはバケットがすでに準備された状態で立ち上がり、親からのコピーオンライトオブジェクトを引き継ぎます。既に存在するブランチをチェックアウトしても調整は行われません。変更を適用するには neon deploy を実行してください。プロビジョニング(config apply / deploy)、link、checkout もブランチのS3認証情報をローカルの .env.local に取り込むため、以下に示す env pull の手順は自動的に実行されます。

環境変数

preview.buckets が宣言されると、Neonは AWS標準 のS3環境変数を注入するため、AWS SDKは追加設定なしで環境から動作します。デプロイ済みのNeon Functions内では自動的に注入されます。ローカルではCLIでディスクに取得したり、実行時に注入したりします:

neon env pull            # ブランチの変数を .env または .env.local に書き込み
# または、ファイルに書き込まず実行時に注入:
neon-env run -- <あなたの開発コマンド>
変数 意味
AWS_ACCESS_KEY_ID S3 アクセスキーID(ブランチ認証情報のトークンID)
AWS_SECRET_ACCESS_KEY S3 シークレットアクセスキー
AWS_ENDPOINT_URL_S3 ブランチのS3エンドポイントURL
AWS_REGION リージョン(例: us-east-2)

名前がAWS標準なので、AWS SDKは自動的に環境から認証情報、エンドポイント、リージョンを読み込みます。認証情報はブランチごとのスコープで、そのブランチとすべての子ブランチで有効です。

process.env を直接読む代わりに、@neon/env の parseEnv に neon.ts コンフィグオブジェクトを渡すことで、型付けと検証を行えます。返される env.storage 名前空間(accessKeyId、secretAccessKey、endpoint、region)はコンフィグから導出されます。親スキル neon を参照してください。

オブジェクトの操作: Files SDK(推奨)

ファイルの読み書きの最も簡単で汎用的な方法は、Files SDK とそのNeonアダプター(統合接続機)を使うことです。小規模で統一されたストレージAPI(upload、download、url、list、exists、copy、delete、signedUploadUrl)をウェブ標準の入出力で提供します。内部ではAWS S3クライアントを使い、Neonに合わせて設定され、エラーは Neon error と表示されるため、設定ミスの心配がありません。まずこれを選んでください。

アダプターが内部で使うAWS S3ピア依存パッケージとともにインストール:

npm install files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner

アダプターは注入された AWS_* 環境変数から自動的にエンドポイント、リージョン、認証情報を読み込みます。バケット名だけを渡してください:

import { Files } from "files-sdk";
import { neon } from "files-sdk/neon";

const files = new Files({ adapter: neon({ bucket: "images" }) });

// アップロード — body は Buffer、Uint8Array、Blob、File、ReadableStream、文字列が可能
await files.upload("generated/cat.jpg", fileBuffer, { contentType: "image/jpeg" });

// ダウンロード
const file = await files.download("generated/cat.jpg");
const bytes = new Uint8Array(await file.arrayBuffer());

// 署名付きGET — 認証情報を露出させずに共有(デフォルト有効期限は1時間)
const url = await files.url("generated/cat.jpg", { expiresIn: 3600 });

// その他: files.exists()、files.list({ prefix })、files.copy()、files.delete()、files.signedUploadUrl()

アダプターのインポート(files-sdk/s3、files-sdk/r2、files-sdk/gcs など)を変更すれば、残りのコードは変わりません。

オブジェクトの操作: AWS S3クライアント(代替案)

NeonはS3 APIに直接対応しているため、ネイティブクライアントを好むか既に依存している場合はいつでもAWS SDKを使えます。認証情報、エンドポイント、リージョンはAWS標準チェーンから読み込まれるため、唯一の設定は forcePathStyle: true です。Neonはパススタイル・アドレッシング(URL形式)を必須とするため、S3クライアント 必ず これを設定してください:

import { S3Client } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  forcePathStyle: true, // 必須: Neonはパススタイル・アドレッシングを使用
});

その後、生のコマンドオブジェクトでアップロード、ダウンロード、署名付きURLを生成:

import { PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";

const BUCKET = "images";

// アップロード
await s3.send(
  new PutObjectCommand({
    Bucket: BUCKET,
    Key: "generated/cat.jpg",
    Body: fileBuffer,
    ContentType: "image/jpeg",
  }),
);

// ダウンロード
const res = await s3.send(
  new GetObjectCommand({ Bucket: BUCKET, Key: "generated/cat.jpg" }),
);
const bytes = await res.Body?.transformToByteArray();

// 署名付きGET — 認証情報を露出させずに共有
const url = await getSignedUrl(
  s3,
  new GetObjectCommand({ Bucket: BUCKET, Key: "generated/cat.jpg" }),
  { expiresIn: 3600 },
);

ブランチ上でストレージと データベースを一緒に使う

典型的なパターン: エージェントが画像を生成 → PutObject で images バケットに保存 → Postgresの行に挿入 → 読み込み時に署名付きURLを返す。バケットキー(バイト列ではなく)をPostgresの列に保存し、読み込み時に署名付きURLを生成します。行とオブジェクトが同じブランチにあるため、一緒にブランチし、ずれることはありません。

CLIのバケット・オブジェクトコマンド

neon にはスクリプト処理と単発の操作のためにバケット・オブジェクトコマンド(neon bucket create|list|delete、neon bucket object put|get|list|delete)が装備されています。

原文(English)を表示

FIRST: Use the parent neon skill for a Neon overview, getting started with Neon, Neon development best practices, and more.

If the neon skill is not installed, fetch it from https://neon.com/docs/ai/skills/neon/SKILL.md or install it with:

npx skills add neondatabase/agent-skills --skill neon

Neon Object Storage

This is a public beta feature and only available in us-east-2.

Neon Object Storage is S3-compatible object storage that branches with your projects: every branch gets its own isolated storage state, so files and database rows stay in sync across dev, preview, staging, and production.

Use this skill to help the user store and serve files that branch alongside their database. Deliver a working bucket and upload/download flow, a branch-aware S3 client wired to the injected env vars, or a precise answer from the official Neon docs.

When to Use

Reach for Neon Object Storage when the user needs to store files (images, uploads, generated assets, documents, backups) and any of the following are true:

  • They already use Lakebase Postgres and don't want a second provider. One backend, one bill, one CLI, one set of branches — instead of standing up and wiring a separate AWS S3 / R2 / Supabase Storage account. The same Neon credential that backs the database backs storage.
  • Files must stay in sync with the database across environments. Storage branches together with your Postgres data. Fork a branch and the child instantly inherits the parent's buckets and objects at that point in time — copy-on-write, so no data is duplicated. This is what makes agent, dev, preview, and test environments seamless: a preview branch gets a consistent snapshot of both the rows and the files they reference, and writes on the child never touch the parent.
  • They want safe, throwaway environments. Upload, overwrite, and delete files in a preview/CI branch without any risk to production data, then drop the branch.
  • They want standard S3 tooling. It's built on S3 semantics and speaks the S3 API, so the AWS SDKs, boto3, the AWS CLI, and presigned URLs all work — reliable and familiar, with no proprietary client.

If the user has no Neon project, isn't on Postgres, and just needs a standalone CDN-backed asset store, a dedicated object store may fit better — but the moment branch-consistent files + rows matter, this is the reason to use it.

What It Does

  • S3-compatible — Works with existing S3 SDKs, boto3, the AWS CLI, and presigned URLs. Path-style addressing and SigV4 only.
  • Branches with your database — Every Neon branch gets its own isolated, copy-on-write storage state. Forking copies no data.
  • Two access modes — private buckets require a credential for every operation; public_read buckets allow anonymous reads with authenticated writes.
  • One credential system — The same Neon credential system used by Functions and the AI Gateway.

Availability

Check this precondition before setting anything up: Neon Object Storage is a public beta feature available in the us-east-2 region. Confirm the user's Neon project is in us-east-2 before proceeding.

Setup

Object storage is part of the neon.ts infrastructure-as-code config (see the neon skill for the branch-first workflow, link/checkout, and neon.ts basics). Declare buckets under preview.buckets, keyed by bucket name:

// neon.ts
import { defineConfig } from "@neon/config/v1";

export default defineConfig({
  preview: {
    buckets: {
      images: {}, // private by default
      "public-assets": { access: "public_read" },
    },
  },
});

Provision the declared buckets on the linked branch:

neon deploy   # alias for `neon config apply`

Neon Infrastructure as Code (neon.ts)

The preview.buckets block above is part of neon.ts, Neon's infrastructure-as-code file — one TypeScript file declares your buckets alongside every other service the branch should have (see the neon skill for the full reference). Reconcile the declaration against a branch the Terraform way:

neon config status   # print the branch's live config (which buckets exist)
neon config plan     # dry-run diff of what apply would change
neon config apply    # create the declared buckets  (neon deploy is an alias)

Buckets are branch-scoped: when a neon.ts is present, neon checkout applies the policy as it creates a branch, so a fresh preview/CI branch comes up with its buckets already provisioned (and copy-on-write objects inherited from the parent). Checking out an existing branch doesn't reconcile it — run neon deploy to apply changes. Provisioning (config apply / deploy), link, and checkout also pull the branch's S3 credentials into your local .env.local, so the same env pull step shown below happens for you on those commands.

Environment Variables

When preview.buckets is declared, Neon injects AWS-standard S3 env vars so the AWS SDKs work from the environment with zero extra config. Inside a deployed Neon Function these are injected automatically; locally, pull them onto disk (or inject them at runtime) via the CLI:

neon env pull            # writes the branch's vars into .env (or .env.local)
# or, without writing a file, inject at runtime:
neon-env run -- <your dev command>
Variable Meaning
AWS_ACCESS_KEY_ID S3 Access Key ID (the branch credential's token id)
AWS_SECRET_ACCESS_KEY S3 Secret Access Key
AWS_ENDPOINT_URL_S3 Branch S3 endpoint URL
AWS_REGION Region, e.g. us-east-2

Because the names are AWS-standard, the AWS SDK picks up the credentials, endpoint, and region from the environment automatically. Credentials are branch-scoped and valid for that branch and all its descendants.

For typed, validated access to these credentials instead of reading process.env directly, pass the same neon.ts config object to parseEnv from @neon/env — it returns an env.storage namespace (accessKeyId, secretAccessKey, endpoint, region) derived from your config. See the neon skill.

Working with Objects: the Files SDK (Recommended)

The simplest, most portable way to read and write objects is the Files SDK with its neon adapter — a small, unified storage API (upload, download, url, list, exists, copy, delete, signedUploadUrl) over web-standard I/O. It uses the AWS S3 client under the hood, configured appropriately for Neon, and relabels errors as Neon error — so there's nothing to misconfigure. Reach for this first.

Install it alongside the AWS S3 peer dependencies the adapter uses internally:

npm install files-sdk @aws-sdk/client-s3 @aws-sdk/s3-presigned-post @aws-sdk/s3-request-presigner

The adapter resolves its endpoint, region, and credentials from the same injected AWS_* env vars — pass only the bucket name:

import { Files } from "files-sdk";
import { neon } from "files-sdk/neon";

const files = new Files({ adapter: neon({ bucket: "images" }) });

// Upload — body may be a Buffer, Uint8Array, Blob, File, ReadableStream, or string
await files.upload("generated/cat.jpg", fileBuffer, { contentType: "image/jpeg" });

// Download
const file = await files.download("generated/cat.jpg");
const bytes = new Uint8Array(await file.arrayBuffer());

// Presigned GET — share without exposing credentials (defaults to a 1h expiry)
const url = await files.url("generated/cat.jpg", { expiresIn: 3600 });

// Plus: files.exists(), files.list({ prefix }), files.copy(), files.delete(), files.signedUploadUrl()

Swap the adapter import (files-sdk/s3, files-sdk/r2, files-sdk/gcs, …) and the rest of your code is unchanged.

Working with Objects: the AWS S3 Client (Alternative)

Neon speaks the S3 API directly, so you can drop down to the AWS SDK whenever you prefer the native client or already depend on it. The credentials, endpoint, and region are read from the standard AWS env chain, so the only setting you pass is forcePathStyle: true — Neon requires path-style addressing, so the S3 client must set it:

import { S3Client } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  forcePathStyle: true, // required: Neon uses path-style addressing
});

Then upload, download, and presign with the raw command objects:

import { PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";

const BUCKET = "images";

// Upload
await s3.send(
  new PutObjectCommand({
    Bucket: BUCKET,
    Key: "generated/cat.jpg",
    Body: fileBuffer,
    ContentType: "image/jpeg",
  }),
);

// Download
const res = await s3.send(
  new GetObjectCommand({ Bucket: BUCKET, Key: "generated/cat.jpg" }),
);
const bytes = await res.Body?.transformToByteArray();

// Presigned GET — share without exposing credentials
const url = await getSignedUrl(
  s3,
  new GetObjectCommand({ Bucket: BUCKET, Key: "generated/cat.jpg" }),
  { expiresIn: 3600 },
);

Pairing Storage with the Database on a Branch

The canonical pattern: an agent generates an image → PutObject into the images bucket → a row is inserted in Postgres → a presigned URL is returned on read. Store the bucket key (not the bytes) in a Postgres column, and presign on read. Because both the row and the object live on the same branch, they branch together and never drift.

CLI Bucket and Object Commands

neon also has first-class bucket/object commands (neon bucket create|list|delete, neon bucket object put|get|list|delete) for scripting and one-off operations.

Built-in Branch Logs

neon logs query --branch production --source storage --since 1h

Storage is one of the two sources branch logs cover today, alongside Neon Functions. Logs are scoped to a single branch, so pass --branch when the bucket you're debugging isn't on the branch you're checked out on. Everything else about logs — the required CLI version, filters, the SDK, and the Loki-compatible read API — is in the parent neon skill's Observability section.

Neon Documentation

The Neon documentation is the source of truth and Object Storage is evolving rapidly, so always verify against the official docs. Any doc page can be fetched as markdown by appending .md to the URL or by requesting Accept: text/markdown. Find the right page from the docs index (https://neon.com/docs/llms.txt) and the changelog announcements.

Further Reading

  • https://neon.com/docs/storage/overview.md
  • https://neon.com/docs/storage/get-started.md
  • https://neon.com/docs/storage/buckets.md
  • https://neon.com/docs/storage/objects.md
  • https://neon.com/docs/storage/authentication.md
  • https://neon.com/docs/storage/s3-compatibility.md
  • https://neon.com/docs/storage/troubleshooting.md
  • https://files-sdk.dev — Files SDK docs (the neon adapter)

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。