Communitygithub.com

silasroliver-hue/replica-skill-cursor

根據 replica-recon 生成的探查地圖,規劃應用程式克隆的技術棧、資料庫架構與 API。選用無須操心的受管技術,將推導出的資料模型轉為含索引與存取規則的 SQL,列出每個流程的路由,並以垂直切面(vertical slice)為優先建立順序。當使用者說「規劃這個克隆」、「該用什麼技術棧」、「設計資料庫」、「撰寫 Schema」、「規劃 API」、「為我的 X 版本設計架構」或 /replica-recon 完成後使用。

replica-skill-cursor 是什麼?

replica-architect 是一項專為 AI 代理(如 Claude Code、Cursor)設計的技能,旨在根據 replica-recon 產生的探查地圖(recon map)來規劃應用程式克隆的完整架構。它會輸出 replica/architecture.md 檔案以及 SQL Schema,內容涵蓋技術棧選擇、資料庫表設計(含主鍵、外鍵、索引、列級安全策略)、API 路由列表(每個路由的 method、功能、權限、輸入輸出及對應流程),以及常見陷阱(如時區、冪等性、競態條件)的處理建議。該技能強烈建議在執行前先確保有 recon map,否則會自動提示先執行 /replica-recon。預設技術棧使用 Next.js + Postgres (Supabase/Neon) + Drizzle/Prisma + Stripe + Vercel 等受管服務,並支援依使用者偏好替換為 Remix、SvelteKit、Rails 等替代方案。整體建置順序遵循「先完成一個垂直切面(核心循環、醜但可用)→ 必要功能 → 次要功能 → 根據 replica-entrepreneur 回饋修正」的迭代方式,最終指向下一步 /replica-design。

相容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/silasroliver-hue/replica-skill-cursor/tree/HEAD/.cursor/skills/replica-architect

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

replica-architect

讀取 replica/recon.md 與 replica/features.csv,並寫出 replica/architecture.md(範本:此資料夾內的 architecture.md)。

如果沒有探查地圖,請先停止並執行 /replica-recon。憑記憶規劃一個應用程式的克隆往往會遺漏一半的功能。

步驟 1:技術棧

如果使用者已有技術棧,就使用他們熟悉的方案。否則使用以下預設值,因為每個元件都是受管、文件完善且在零使用者時成本低廉:

層預設可替換為
Web 應用Next.js (App Router) + TypeScriptRemix、SvelteKit、Rails
樣式Tailwind,從 replica-design 取得 tokensCSS modules
行動端Expo (React Native)SwiftUI、Kotlin
資料庫Postgres on Supabase 或 NeonPlanetScale、SQLite (Turso)
ORMDrizzle 或 Prisma原生 SQL
認證Supabase Auth 或 Auth.jsClerk
金流Stripe Checkout + BillingLemon Squeezy、Paddle
郵件Resend 或 PostmarkSES
工作排程Vercel Cron、Inngest 或 Trigger.devFly 上的 worker
檔案儲存Supabase Storage 或 Cloudflare R2S3
託管VercelNetlify、Fly、Render

每個選擇用一句話說明原因。只使用一個資料庫。不採用微服務。克隆不需要複製原始應用的架構,只需要實現原始應用的功能。

步驟 2:Schema

將推導出的資料模型轉換為 SQL。每個資料表需包含:

  • id uuid primary key default gen_random_uuid()、created_at、updated_at
  • 一個 owner 欄位(使用者擁有的東西用 user_id,組織擁有的用 org_id)
  • 外鍵需指定 on delete 規則,不得使用預設值
  • 對每個外鍵以及每個用於篩選或排序的欄位建立索引
  • 狀態欄位使用 enum 或 check constraints
  • 時間一律使用 timestamptz,並以 UTC 儲存
  • 金額以整數分加上貨幣欄位
  • 存取規則:Supabase 使用 Postgres Row Level Security,或在資料層中每個查詢加上一次授權檢查。請明確寫出採用哪種方式。

範例:預約應用

create table bookings (
  id uuid primary key default gen_random_uuid(),
  event_type_id uuid not null references event_types(id) on delete cascade,
  host_id uuid not null references users(id) on delete cascade,
  start_at timestamptz not null,
  end_at timestamptz not null,
  guest_name text not null,
  guest_email text not null,
  guest_timezone text not null,
  status text not null default 'confirmed'
    check (status in ('confirmed','cancelled','rescheduled')),
  answers jsonb not null default '{}',
  created_at timestamptz not null default now(),
  constraint no_zero_length check (end_at > start_at)
);
create index on bookings (host_id, start_at);

接著處理探查中發現的嚴格約束。兩位訪客預約同一個時段是資料庫問題(需要排他約束或唯一索引),而非 UI 問題。

步驟 3:API

對應探查地圖中的每個流程建立一個資料表。每個路由或伺服器動作(Server Action)記錄:

method path | 功能 | 誰能呼叫 | 輸入 | 輸出 | 流程

此外需包含 Webhook 進站(Stripe、日曆供應商)與出站,以及背景工作(提醒、同步、清理)及其排程。

只使用官方、公開的 API,且需使用者自備金鑰。即使原始應用程式的私有端點在瀏覽器中可見,也絕不使用。

步驟 4:容易踩雷的部分

針對以下每個適用項目,寫一句說明:時區與日光節約時間、冪等性(Webhook 可能會送達兩次)、競態條件、速率限制、檔案大小限制、搜尋、即時功能、離線支援、郵件送達率、多租戶架構、GDPR 刪除要求。

步驟 5:建置順序

  1. 垂直切面。 先實現核心循環的端到端功能,外表醜陋也可以:註冊、執行主要操作、看到結果。這能驗證技術棧的可行性。
  2. 必要功能 根據 features.csv 按領域實作。
  3. 次要功能 再來是「應該有」的功能。
  4. 修復 等 replica-entrepreneur 執行後,根據其發現的問題進行修正。

每個里程碑需列出其畫面(S-ID)、資料表與路由。

輸出

replica/architecture.md、replica/schema.sql 或作為第一個遷移(migration)的 SQL,以及一個摘要:一行說明技術棧、資料表數量、路由數量、三個風險最高的部分,以及下一步:/replica-design。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

silasroliver-hue/replica-skill-cursor

>- Builds the backend of an app clone: auth, database migrations and access rules, payments with Stripe, email, background jobs and third-party integrations through official APIs only, plus a security checklist. Use when the user says "add login", "set up auth", "wire up the database", "add payments", "connect Stripe", "add Google Calendar", "send emails", "backend for my clone", or when /replica-build is running on fake data.

silasroliver-hue/replica-skill-cursor

>- Names and rebrands an app clone so it is the user's own: name candidates with the trademark, domain, store and handle checks to run, a new palette checked for contrast, a logo brief, a voice guide, and a sweep tool that finds anything of the original left in the codebase. Use when the user says "name my app", "rebrand the clone", "make it mine", "pick a name and colours", "logo brief", "brand voice", "check for leftovers", or after /replica-entrepreneur. Always runs before /replica-launch.

silasroliver-hue/replica-skill-cursor

>- Rebuilds an app screen by screen from the recon map: app shell first, then the core flow as a vertical slice, then every screen with all its states, ticking off the feature matrix as it goes. Writes every line fresh, never the original's code, assets or copy. Use when the user says "build the clone", "build screen S07", "start building", "rebuild this screen", "implement the booking page", or after /replica-design.

silasroliver-hue/replica-skill-cursor

>- Ships an app clone live on the user's own domain: a preflight gate (tests green, parity must-haves done, rebrand sweep clean, listing linted, legal pages up), production database and env vars, the host, DNS records for the domain and for email, Stripe live mode, OAuth redirects, monitoring, and mobile builds to TestFlight and Play. Use when the user says "deploy it", "ship it", "put it live", "connect my domain", "go to production", "publish the app", or after /replica-launch.

相關技能