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.
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-persistenceRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install ai-generation-persistence in Claude Code
git clone --depth 1 https://github.com/openai/plugins /tmp/plugins && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/plugins/plugins/vercel/skills/ai-generation-persistence ~/.gemini/antigravity-cli/skills/ai-generation-persistenceAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install ai-generation-persistence in Antigravity CLI
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
ANo 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 →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
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.
