Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

ai-generation-persistence

Skill by openai

Teaches an AI assistant patterns for saving LLM generations: unique IDs, addressable URLs, database storage, image saving and cost tracking. Aimed at developers building chat or generation features in Next.js.

  • Score 87
  • 8.6k stars
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install ai-generation-persistence

Built from the published package, never by AI.

git clone --depth 1 https://github.com/openai/plugins /tmp/plugins && mkdir -p ~/.claude/skills && cp -r /tmp/plugins/plugins/vercel/skills/ai-generation-persistence ~/.claude/skills/ai-generation-persistence

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install ai-generation-persistence in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

This skill gives an AI assistant patterns for saving LLM generations so they can be revisited later. It covers generating a unique ID before each LLM call, storing text and metadata in a database, saving generated images to Vercel Blob, and giving each generation a URL such as /chat/[id]. It also covers recording token usage and estimated cost, plus a Redis-based prompt cache.

The source shows a Next.js app router example with a Drizzle schema on Neon Postgres, a generate-then-redirect flow, and a list of anti-patterns such as streaming without saving or keeping data only in client state. It is aimed at developers building chat or generation features who want generations to survive page refreshes, devices and sessions.

Written from the project's SKILL.md and checked against it.

What it can do

  • Unique IDs before generationGenerates an ID with nanoid or createId from @paralleldrive/cuid2 before the LLM call.
  • Generate-then-redirect patternCreates a pending record first, then redirects to a page that handles streaming.
  • Persistence schemaProvides a Drizzle Postgres table for ID, user, model, prompt, result, token usage and cost.
  • Image persistenceSaves generated images to Vercel Blob and stores the permanent URLs on the record.
  • Cost trackingStores token usage and estimated cost in cents for each generation.
  • Prompt dedup cacheCaches results by a SHA-256 hash of model and prompt in Upstash Redis with a one-hour TTL.

What you need

  • Next.js app router project
  • Postgres database (Neon shown in the source)
  • Drizzle ORM
  • Vercel Blob for image storage
  • Upstash Redis for prompt caching

Try asking

  • Save every generation I make to Postgres with a unique ID and token usage.
  • Set up a /chat/[id] page that reloads a saved generation.
  • Store generated images in Vercel Blob and keep their permanent URLs.

Good to know

  • Code is example patterns, not a packaged library.
  • The estimateCost helper is called but not defined in the source.
  • The cache example expires entries after one hour.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: plugins/vercel/skills/ai-generation-persistence/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • SKILL.md8 KB
  • agents/openai.yaml190 B

Alternatives to ai-generation-persistence

All alternatives →

Compare with agent-reproduce-align, google_contacts or m06-error-handling

ai-generation-persistence: common questions

Does this skill store generations for me?

It describes patterns and example code for storing generations in a database, Vercel Blob and Redis. The source does not describe a ready-made storage service.

Which databases and storage does it use?

The storage table names Neon Postgres via Drizzle for text and metadata, Vercel Blob for images and files, and Upstash Redis for prompt dedup caching.

Why give each generation its own URL?

The source says addressable URLs such as /chat/[id] give shareable links, back-button support, multi-tab sessions and generation history.

How do I install ai-generation-persistence?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is ai-generation-persistence free?

The code is public, but no licence file was found, so check the repository before commercial use.

Is ai-generation-persistence safe to use?

It scores 87 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to ai-generation-persistence?

Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.

ai-generation-persistence Install

Add to stack

Loading.