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 checking a change actually works.
Of the AGENTS.md files we read, the 11,773 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.
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
- Very specific: line 33
Arrow parens: Always (x) => x
- Very specific: line 50
Use const over let, arrow functions over function expressions
- Very specific: line 51
Use optional chaining (?.) and nullish coalescing (??)
- Very specific: line 52
Avoid any (use unknown), avoid non-null assertions (!)
- Very specific: line 53
Use interface over type for object shapes
- Distinctive: line 54
No enums, no namespaces
- Distinctive: line 107
Use try-catch in async functions
- Very specific: line 126
No forEach: - Use for...of or array methods like map/filter
- Very specific: line 127
No any: - Use unknown or proper types (noExplicitAny)
- Distinctive: line 130
Arrow functions: - Prefer over function expressions
- Very specific: line 131
Optional chaining: - Use ?. instead of manual checks
- Very specific: line 133
Consistent interfaces: - Use interface over type for objects
- Very specific: line 134
File naming: - Must be kebab-case (useFilenamingConvention)
- Very specific: line 136
Run pnpm fix to auto-fix most issues.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 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.
Files
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
constoverlet, arrow functions over function expressions - Use optional chaining (
?.) and nullish coalescing (??) - Avoid
any(useunknown), avoid non-null assertions (!) - Use
interfaceovertypefor 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...ofor array methods likemap/filter - No any - Use
unknownor 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
interfaceovertypefor 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 SDKai- Vercel AI SDK (peer)zod- Schema validation (peer)
Environment
BLOB_READ_WRITE_TOKEN- Required for Vercel Blob operations
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
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.

