# PasteCode > Prompts, rules, checklists, and context packs for AI coding agents. A static library of copy-paste prompts, rules, checklists, and context packs for AI coding agents like Cursor, Claude Code, Codex, and Windsurf. ## Prompts - [向 Next.js 与 PostgreSQL 添加 Better Auth 的提示](https://pastecode-71y.pages.dev/zh/prompts/add-better-auth-to-nextjs.md): 一个可复制粘贴的提示,用于为 Next.js App Router 项目添加 Better Auth 和 PostgreSQL 会话处理。 - [添加Cloudflare R2文件上传的提示](https://pastecode-71y.pages.dev/zh/prompts/add-cloudflare-r2-file-upload.md): 复制粘贴AI提示,为Next.js App Router项目添加Cloudflare R2预签名上传URL,并包含服务器端验证。 - [添加 Tailwind CSS v4 暗色模式的提示](https://pastecode-71y.pages.dev/zh/prompts/add-dark-mode-with-tailwind.md): AI 代理提示:使用 Tailwind CSS v4 CSS 变量和 next-themes 为 Next.js 应用添加系统感知的暗色模式,加载时无闪烁。 - [添加 PostgreSQL 全文搜索的提示](https://pastecode-71y.pages.dev/zh/prompts/add-postgres-full-text-search.md): 复制粘贴 AI 提示,为现有 Next.js 应用添加原生 PostgreSQL 全文搜索,使用 tsvector、GIN 索引和排序结果。 - [添加站点地图和robots.txt的提示词](https://pastecode-71y.pages.dev/zh/prompts/add-sitemap-and-robots-txt.md): AI代理提示词:为Next.js或Astro项目动态生成sitemap.xml和正确的robots.txt以改善搜索引擎索引。 - [在 Next.js 应用中添加 Stripe Checkout 的提示](https://pastecode-71y.pages.dev/zh/prompts/add-stripe-checkout-to-nextjs.md): AI 代理提示:为 Next.js App Router 项目添加 Stripe Checkout,包括 webhook 处理、客户门户和订阅状态。 - [构建 Cloudflare Worker API 代理的提示](https://pastecode-71y.pages.dev/zh/prompts/build-a-cloudflare-worker-api-proxy.md): 复制粘贴 AI 提示,构建一个 Cloudflare Worker,用于代理外部 API 调用并限速、添加认证头以及缓存响应。 - [构建Next.js AI工具目录的提示词](https://pastecode-71y.pages.dev/zh/prompts/build-a-nextjs-ai-tool-directory.md): 用于构建可搜索的Next.js AI工具目录的AI智能体提示词,支持MDX数据文件、分类筛选和静态生成。 - [使用 Next.js 构建 SaaS 定价页面的提示](https://pastecode-71y.pages.dev/zh/prompts/build-a-saas-pricing-page.md): 复制粘贴 AI 提示,使用 Next.js 与 Tailwind 构建 SaaS 定价页面,包含账单切换和 Stripe 就绪的计划数据。 - [构建 Astro 静态 SEO 站点的提示](https://pastecode-71y.pages.dev/zh/prompts/build-an-astro-static-seo-site.md): 用于搭建一个完全优化的 Astro 静态站点的复制粘贴提示,包含内容集合、站点地图、og-images 和 TypeScript。 - [创建GitHub Actions部署工作流的提示词](https://pastecode-71y.pages.dev/zh/prompts/create-a-github-actions-deploy-workflow.md): AI代理提示词,用于生成一个包含类型检查、测试、构建和部署步骤的Next.js生产级GitHub Actions CI/CD工作流。 - [在 Next.js 中创建管理后台的提示词](https://pastecode-71y.pages.dev/zh/prompts/create-an-admin-dashboard.md): AI 代理提示词,用于构建受保护的 Next.js 管理后台,包含数据表格、服务端认证守卫和使用 Tailwind 的侧边栏布局。 - [构建时生成 OG 图像的提示](https://pastecode-71y.pages.dev/zh/prompts/generate-og-images-at-build-time.md): AI 代理提示:在 Astro 或 Next.js 中使用 Satori 和 sharp 在构建时为每个页面生成 Open Graph 图像,无需外部服务。 - [将 Next.js 14 应用迁移到 Next.js 16 的提示](https://pastecode-71y.pages.dev/zh/prompts/migrate-nextjs-14-to-16.md): 结构化 AI 代理提示,用于将 Next.js 14 App Router 项目迁移到 Next.js 16,处理破坏性变更并分步进行。 - [安全重构 React 组件的提示词](https://pastecode-71y.pages.dev/zh/prompts/refactor-a-react-component-safely.md): 结构化 AI 代理提示词,用于通过阅读-审计-重构-验证循环安全地重构复杂 React 组件,防止回归问题。 ## Rules - [AGENTS.md:Astro静态站点规则](https://pastecode-71y.pages.dev/zh/rules/agents-md-for-astro-static-site.md): 一份即插即用的AGENTS.md文件,用于Astro静态站点,确保AI代理在栈内运行,防止SSR漂移,并强制执行内容集合约定。 - [Next.js SaaS 应用的 AGENTS.md 规则](https://pastecode-71y.pages.dev/zh/rules/agents-md-nextjs-saas.md): 一个即插即用的 AGENTS.md,让 AI 编码代理在 Next.js SaaS 代码库中保持栈和约定。 - [身份验证与安全的人工智能编码规则](https://pastecode-71y.pages.dev/zh/rules/ai-rules-for-auth-and-security.md): AGENTS.md 中关于身份验证和安全的规则,可防止智能体使用自定义加密、泄露秘密或绕过授权检查。 - [PostgreSQL应用的AI编码规则](https://pastecode-71y.pages.dev/zh/rules/ai-rules-for-postgresql-apps.md): AGENTS.md规则,适用于PostgreSQL后端应用,涵盖查询安全、迁移规范、索引约定,以及防止代理编写N+1查询。 - [AI编码规则针对SEO内容网站](https://pastecode-71y.pages.dev/zh/rules/ai-rules-for-seo-content-sites.md): AGENTS.md规则针对以SEO为重点的内容网站,防止重复元数据,强制执行结构化数据,并防止代理破坏可爬取性。 - [静态网站性能的AI编码规则](https://pastecode-71y.pages.dev/zh/rules/ai-rules-for-static-site-performance.md): 用于静态网站性能的AGENTS.md规则,强制执行核心网页指标、图片优化、字体加载,并防止代理发送阻塞渲染的资源。 - [TypeScript严格模式项目的AI编码规则](https://pastecode-71y.pages.dev/zh/rules/ai-rules-for-typescript-strict-projects.md): 适用于TypeScript严格模式项目的AGENTS.md规则,用于消除any类型、强制窄化模式,并防止代理生成编译通过但语义错误的代码。 - [Prisma 项目的 Claude Code 规则](https://pastecode-71y.pages.dev/zh/rules/claude-code-rules-for-prisma-projects.md): 适用于 Prisma ORM 项目的 Claude Code 规则,涵盖迁移安全性、查询模式、关联加载以及防止智能体破坏模式。 - [Cloudflare Workers 的 Codex 规则](https://pastecode-71y.pages.dev/zh/rules/codex-rules-for-cloudflare-workers.md): 针对 Cloudflare Workers 项目的 Codex 规则,防止使用 Node.js API,强制执行绑定模式,并将代理限制在 Workers 运行时约束内。 - [Tailwind CSS 和 shadcn/ui 的 Cursor 规则](https://pastecode-71y.pages.dev/zh/rules/cursor-rules-for-tailwind-shadcn.md): 强制遵循 Tailwind v4 约定和 shadcn/ui 组件模式的 Cursor 规则,防止代理重复发明已有的基础组件。 ## Playbooks - [Prompt-to-PR: 添加定价页面](https://pastecode-71y.pages.dev/zh/playbooks/add-a-pricing-page.md): 在Next.js Tailwind项目中生成包含月/年切换、功能矩阵和Stripe Checkout链接的生产级定价页面的标准操作流程。 - [Prompt-to-PR:为网站添加站点地图和robots.txt](https://pastecode-71y.pages.dev/zh/playbooks/add-a-sitemap-and-robots.md): 为Next.js或Astro项目添加动态XML站点地图和robots.txt的标准操作流程——确保正确的lastmod、优先级以及生产环境SEO的爬取规则。 - [Prompt-to-PR:添加管理数据表](https://pastecode-71y.pages.dev/zh/playbooks/add-an-admin-table.md): 用于在Next.js中使用TanStack Table和PostgreSQL查询添加服务器端分页、可排序、可搜索的管理数据表的SOP——无ORM魔术。 - [Prompt-to-PR:为 Next.js 应用添加 Better Auth](https://pastecode-71y.pages.dev/zh/playbooks/add-better-auth-to-a-nextjs-app.md): 完整的 SOP,用于将 Better Auth 接入 Next.js App Router 项目——一次性完成会话、邮箱/密码登录、OAuth 和中间件保护。 - [Prompt-to-PR: 添加Cloudflare R2文件上传](https://pastecode-71y.pages.dev/zh/playbooks/add-cloudflare-r2-upload.md): 将预签名R2上传集成到Next.js或Cloudflare Workers应用中的端到端标准操作程序——存储桶绑定、预签名URL和客户端上传流程。 - [Prompt-to-PR: 添加深色模式](https://pastecode-71y.pages.dev/zh/playbooks/add-dark-mode.md): 端到端标准操作流程,使用 next-themes 在 Next.js Tailwind 应用中实现无闪烁深色模式——采用 class 策略、系统偏好和持久化切换。 - [Prompt-to-PR:为Astro站点添加Pagefind搜索](https://pastecode-71y.pages.dev/zh/playbooks/add-pagefind-search-to-astro.md): 完整的标准操作流程——从首次提示到PR描述,为Astro站点添加静态、无后端搜索功能。 - [Prompt-to-PR:添加 PostgreSQL 全文搜索](https://pastecode-71y.pages.dev/zh/playbooks/add-postgres-full-text-search.md): SOP 用于添加原生 PostgreSQL 全文搜索,使用 tsvector、GIN 索引、ts_rank 和 Next.js 搜索 API — 无需第三方搜索服务。 - [Prompt-to-PR:使用 Astro 构建静态 SEO 网站](https://pastecode-71y.pages.dev/zh/playbooks/build-a-static-seo-site-with-astro.md): 从零开始使用 Astro、Tailwind、MDX 内容集合、站点地图和规范标签搭建内容驱动的静态 SEO 网站的完整 SOP。 - [Prompt-to-PR:将 Next.js 14 迁移至 16](https://pastecode-71y.pages.dev/zh/playbooks/migrate-nextjs-14-to-16.md): 分步 SOP,用于将 Next.js 14 App Router 项目迁移至 Next.js 16 — 涵盖 Turbopack、React 19、异步 API 和缓存变更。 ## Checklists - [审查AI生成的API路由清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-api-routes.md): 一份关于AI编码助手编写的REST和RPC API路由的人工审查清单——包括认证、输入验证、速率限制和错误处理。 - [AI生成认证代码审查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-auth-code.md): 针对AI编码代理编写的认证代码的人工审查清单——涵盖会话、JWT、OAuth流程以及Web应用的授权逻辑。 - [审查AI生成的Cloudflare Workers的检查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-cloudflare-workers.md): 针对AI编码代理编写的Cloudflare Workers代码的人工审查检查清单——运行时限制、KV、D1、绑定以及边缘安全。 - [审查AI生成的GitHub Actions的检查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-github-actions.md): 由AI编码代理编写的GitHub Actions工作流的人工审查清单——秘密泄露、供应链攻击、权限和部署安全性。 - [审查AI生成的Next.js代码的检查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-nextjs-code.md): 针对AI编码代理编写的Next.js代码的人工审查清单 — App Router、Server Components、数据获取和部署正确性。 - [AI生成的Prisma迁移审查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-prisma-migrations.md): 供人类审查AI编码代理编写的Prisma模式变更和迁移的清单——数据丢失、锁定和不可逆操作。 - [审查AI生成的SEO页面的清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-seo-pages.md): 针对由AI编码代理编写的SEO目标页面的人工审查清单——包括元数据、结构化数据、规范URL以及Astro和Next.js的核心网页指标。 - [审查AI生成的SQL查询的检查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-sql.md): 针对AI编程代理编写的SQL的人工审查检查清单——正确性、注入、性能和迁移。 - [AI生成的Stripe代码审核清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-stripe-code.md): 针对AI编程助手所编写的Stripe集成代码的人工审核清单——涵盖webhook安全、幂等性、竞态条件和支付流程。 - [AI生成的Tailwind UI审查清单](https://pastecode-71y.pages.dev/zh/checklists/review-ai-generated-tailwind-ui.md): 由AI编程工具生成的Tailwind CSS UI组件的人工审查清单——包括无障碍、响应式、深色模式和清除安全。 ## Failures - [如何修复AI破坏Cloudflare Workers运行时的问题](https://pastecode-71y.pages.dev/zh/failures/ai-breaks-cloudflare-workers-runtime.md): AI代理将Node.js内置模块(如fs、crypto和path)导入Cloudflare Workers,导致运行时错误,因为Workers运行时不是Node.js。 - [如何修复AI导致的React水合不匹配](https://pastecode-71y.pages.dev/zh/failures/ai-creates-hydration-mismatches.md): AI代理生成的React组件在服务器端和客户端渲染出不同的HTML,导致首次加载时出现水合错误和界面损坏。 - [如何修复AI忘记环境变量验证](https://pastecode-71y.pages.dev/zh/failures/ai-forgets-env-validation.md): AI代理直接读取process.env值而不进行验证,在环境变量缺失时导致静默的undefined错误,并且缺少启动时的错误提示。 - [如何修复AI生成的无效Prisma关系](https://pastecode-71y.pages.dev/zh/failures/ai-generates-invalid-prisma-relations.md): AI代理生成的Prisma schema关系缺少反向关系、错误的引用操作或字段类型不匹配,导致prisma validate和prisma migrate失败。 - [如何修复AI忽略SEO元数据](https://pastecode-71y.pages.dev/zh/failures/ai-ignores-seo-metadata.md): AI代理在构建Next.js和Astro页面时,缺少标题标签、Open Graph元数据或规范URL,导致页面在搜索引擎和社交爬虫中不可见。 - [如何修复AI编码代理虚构不存在的npm包](https://pastecode-71y.pages.dev/zh/failures/ai-invents-fake-npm-packages.md): AI代理为何会臆想不存在的npm包、如何识别以及如何阻止。 - [如何修复AI过度使用useEffect的问题](https://pastecode-71y.pages.dev/zh/failures/ai-overuses-useeffect.md): AI代理经常使用useEffect来处理派生状态、事件转换和数据获取,而这些本应使用useMemo、事件处理器或Server Components。 - [如何修复AI将服务器代码放入客户端组件](https://pastecode-71y.pages.dev/zh/failures/ai-puts-server-code-in-client-components.md): AI代理将数据库查询、秘密环境变量和Node.js API泄露到'use client'组件中,将仅服务器端逻辑暴露给浏览器包。 - [如何修复 AI 编码代理使用过时的 Next.js API](https://pastecode-71y.pages.dev/zh/failures/ai-uses-outdated-nextjs-apis.md): AI 代理经常生成使用已弃用的 Pages Router 模式、getServerSideProps 和已在 App Router 项目中删除的 API 的 Next.js 代码。 - [如何修复AI编写的不安全SQL](https://pastecode-71y.pages.dev/zh/failures/ai-writes-insecure-sql.md): AI代理使用字符串插值而不是参数化语句构建SQL查询,从而将SQL注入漏洞引入生产数据库代码中。 ## Context Packs - [AI 工具目录 — 上下文包](https://pastecode-71y.pages.dev/zh/context/ai-tool-directory.md): 可复制的上下文包,用于基于 Astro 和 PostgreSQL 构建的 AI 工具目录站点,使智能体从第一个提示开始就能理解提交流程、标签系统和内容模型。 - [Astro 静态 SEO 站点 — 上下文包](https://pastecode-71y.pages.dev/zh/context/astro-static-seo-site.md): 一个可复制的上下文包,描述了 Astro 静态 SEO 站点,以便 AI 代理从第一个提示开始就能正确地在其中工作。 - [Cloudflare Workers 应用 — 上下文包](https://pastecode-71y.pages.dev/zh/context/cloudflare-workers-app.md): 可复制的上下文包,用于包含 D1、KV、R2 和 Hono 的 Cloudflare Workers 应用,让你的 AI 代理从第一个提示开始就了解边缘运行时约束。 - [Next.js SaaS 启动器 — 上下文包](https://pastecode-71y.pages.dev/zh/context/nextjs-saas-starter.md): 可复制的上下文包,适用于使用 App Router、Better Auth、Stripe 计费和 Postgres 的 Next.js SaaS 应用,确保你的 AI 代理从第一个提示开始就能正确工作。 - [PostgreSQL 搜索应用 — 上下文包](https://pastecode-71y.pages.dev/zh/context/postgres-search-app.md): 可复制的上下文包,用于基于 PostgreSQL 和 pgvector 的全文与向量搜索应用,让您的 AI 代理从一开始就能编写正确的 SQL 和迁移代码。