agentleFS
VercelKnown publishervercel-labs/vercel-blob-ai-sdk/AGENTS.md

vercel-blob-ai-sdk

AGENTS.md1 starsChanged 9 months agoMITView on GitHub

Guidelines for AI coding agents working in this repository. TypeScript library providing AI SDK tools for Vercel Blob storage. Exports: uploadAsset, listAssets, deleteAsset, deleteAssets, copyAsset, getAssetInfo, downloadAsset, createBlobTools. Package manager: pnpm (v10.32.1) CI pipeline: pnpm type-check && pnpm check && pnpm build && pnpm test Organized automatically by Biome. Use import type for type-only imports: Factory-created tools accept an optional overrides?: ToolOverrides parameter spread at the end of the tool() call. Singleton tools (URL-based) are conditionally spread in the createBlobTools…

  • Reads credentials
  • Installs packages
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,337 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Arrow parens: Always (x) => x

    line 33
  2. Very specific:

    Use const over let, arrow functions over function expressions

    line 50
  3. Very specific:

    Use optional chaining (?.) and nullish coalescing (??)

    line 51
  4. Very specific:

    Avoid any (use unknown), avoid non-null assertions (!)

    line 52
  5. Very specific:

    Use interface over type for object shapes

    line 53
  6. Distinctive:

    No enums, no namespaces

    line 54
  7. Distinctive:

    Use try-catch in async functions

    line 107
  8. Very specific:

    No forEach: - Use for...of or array methods like map/filter

    line 126
  9. Very specific:

    No any: - Use unknown or proper types (noExplicitAny)

    line 127
  10. Distinctive:

    Arrow functions: - Prefer over function expressions

    line 130
  11. Very specific:

    Optional chaining: - Use ?. instead of manual checks

    line 131
  12. Very specific:

    Consistent interfaces: - Use interface over type for objects

    line 133
  13. Very specific:

    File naming: - Must be kebab-case (useFilenamingConvention)

    line 134
  14. Very specific:

    Run pnpm fix to auto-fix most issues.

    line 136

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Guidelines for AI coding agents working in this repository.

Project Overview

TypeScript library providing AI SDK tools for Vercel Blob storage. Exports: uploadAsset, listAssets, deleteAsset, deleteAssets, copyAsset, getAssetInfo, downloadAsset, createBlobTools.

Commands

Package manager: pnpm (v10.32.1)

pnpm install          # Install dependencies
pnpm build            # Build (tsup -> dist/)
pnpm type-check       # TypeScript checking (tsc --noEmit)
pnpm check            # Lint/format check (Ultracite/Biome)
pnpm fix              # Auto-fix lint/format issues
pnpm test             # Run tests (requires BLOB_READ_WRITE_TOKEN in .env)

CI pipeline: pnpm type-check && pnpm check && pnpm build && pnpm test

Code Style

Formatting (Biome/Ultracite)

  • Indentation: 2 spaces
  • Line width: 80 characters
  • Semicolons: Always
  • Quotes: Double for JSX
  • Trailing commas: ES5 style
  • Arrow parens: Always (x) => x
  • Line endings: LF

Imports

Organized automatically by Biome. Use import type for type-only imports:

import { copy, del, head, list, put } from "@vercel/blob";
import { tool } from "ai";
import { z } from "zod";
import type { SomeType } from "some-package";

TypeScript

  • Target: ES2022, Module: NodeNext, Strict: enabled
  • Use const over let, arrow functions over function expressions
  • Use optional chaining (?.) and nullish coalescing (??)
  • Avoid any (use unknown), avoid non-null assertions (!)
  • Use interface over type for object shapes
  • No enums, no namespaces

Naming

  • Files: kebab-case (my-tool.ts)
  • Variables/Functions: camelCase
  • Types/Interfaces: PascalCase
  • Constants: camelCase (not SCREAMING_SNAKE_CASE)

Zod Schemas

const MySchema = z.object({
  field: z.string().describe("Description of the field"),
  optionalField: z.string().optional().describe("Optional description"),
});

AI SDK Tool Pattern

export const myTool = tool({
  description: "Clear description of what the tool does and when to use it.",
  inputSchema: z.object({
    param: z.string().describe("What this parameter is for"),
  }),
  inputExamples: [{ input: { param: "example" } }],
  outputSchema: MyOutputSchema,
  strict: true,
  needsApproval: false,
  execute: async ({ param }) => {
    try {
      const result = await someOperation();
      return { success: true, data: result };
    } catch (error) {
      console.error("Error in myTool:", error);
      return {
        success: false,
        error: error instanceof Error ? error.message : "Unknown error",
      };
    }
  },
});

Tool Overrides Pattern

Factory-created tools accept an optional overrides?: ToolOverrides parameter spread at the end of the tool() call. Singleton tools (URL-based) are conditionally spread in the createBlobTools factory when overrides are present.

ToolOverrides is defined as Partial<Pick<Tool, ...>> using the Tool type from "ai" (defaults to Tool<any, any>). It includes: description, title, strict, needsApproval, providerOptions, onInputStart, onInputDelta, onInputAvailable, toModelOutput. Core properties (execute, inputSchema, outputSchema) are excluded.

Error Handling

  • Use try-catch in async functions
  • Return structured error responses (don't throw)
  • Pattern: error instanceof Error ? error.message : "Fallback"
  • Log errors with console.error() before returning

Project Structure

src/index.ts                # Main entry, exports all tools
dist/                       # Build output (ESM)
tests/index.test.ts         # Unit tests (mocked @vercel/blob)
tests/ai-sdk.test.ts        # AI SDK integration tests (MockLanguageModelV3)
tests/integration.test.ts   # Live integration tests (requires BLOB_READ_WRITE_TOKEN)

Key Linting Rules

The project uses Ultracite (Biome wrapper) with strict rules:

  • No forEach - Use for...of or array methods like map/filter
  • No any - Use unknown or proper types (noExplicitAny)
  • No unused variables/imports - Will fail CI
  • No non-null assertions - Handle null cases explicitly
  • Arrow functions - Prefer over function expressions
  • Optional chaining - Use ?. instead of manual checks
  • Import type - Required for type-only imports (useImportType)
  • Consistent interfaces - Use interface over type for objects
  • File naming - Must be kebab-case (useFilenamingConvention)

Run pnpm fix to auto-fix most issues.

Commits

Use Conventional Commits:

  • feat: - New features (triggers release)
  • fix: - Bug fixes (triggers release)
  • chore:, docs:, refactor: - Other changes (no release)

Examples: feat: add downloadAsset tool, fix: handle missing contentType

Dependencies

  • @vercel/blob - Vercel Blob SDK
  • ai - Vercel AI SDK (peer)
  • zod - Schema validation (peer)

Environment

  • BLOB_READ_WRITE_TOKEN - Required for Vercel Blob operations

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.