Communitygithub.com

silasroliver-hue/replica-skill-cursor

为应用克隆项目规划技术栈、数据库模式和API,基于 replica-recon 生成的侦查图谱。选用运维简单的托管技术,将推理出的数据模型转化为带索引和访问控制的真实SQL,按流程列出所有路由,并以薄垂直切片优先安排构建顺序。

replica-skill-cursor 是什么?

replica-architect 技能专为应用程序克隆场景设计,它读取 `replica/recon.md` 和 `replica/features.csv`,输出完整的架构文档 `replica/architecture.md`。该技能的核心价值在于:它并不试图复刻原始应用的架构,而是基于侦查阶段提取的需求图谱,重新设计一套更适合快速构建、运维简单的技术方案。技能默认推荐全托管服务(如 Supabase、Vercel),并清晰给出合理性解释和数据层选择。它自动将推断的数据模型转化为 Postgres SQL,涵盖主键、外键、索引、约束和行级安全策略,并按用户流程生成完整的 API 路由表。最终会输出一份按优先级排序的构建计划,从垂直切片开始,确保核心闭环尽早打通。该技能可集成到 Cursor、Claude Code 等支持自定义命令的 AI 助手中,当用户提出“规划克隆”、“设计数据库”、“写模式”等请求时自动触发。

兼容平台~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 的设计令牌CSS 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:数据库模式

将推理出的数据模型转化为 SQL。对于每个表:

  • id uuid primary key default gen_random_uuid(), created_at, updated_at
  • 用户拥有的每个对象都有一个所有者字段(user_id 或 org_id)
  • 外键要明确指定 on delete 规则,不采用默认值
  • 为每个外键以及每个你过滤或排序的列创建索引
  • 状态字段使用枚举或检查约束
  • 时间一律使用 timestamptz,以 UTC 存储
  • 金额存储为整数分,并附带货币列
  • 访问规则:Supabase 上使用 Postgres 行级安全策略,或在数据层为每个查询添加一个授权检查。请注明选择。

示例,用于预约应用:

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

根据侦查图谱中的用户流程,每个流程对应一个表。对于每个路由或服务器操作:

方法 路径 | 功能 | 调用者 | 输入 | 输出 | 流程

另外,需要包含 Webhook 入站(Stripe、日历提供商)和出站,以及后台任务(提醒、同步、清理)及其调度计划。

仅使用官方的、公开的 API,搭配用户自己的密钥。绝不能使用原始应用的私有端点,即使它们在浏览器中可见。

步骤 4:容易出问题的部分

针对每个适用项写一行说明:时区和夏令时、幂等性(Webhook 可能收到两次)、竞态条件、速率限制、文件大小限制、搜索、实时功能、离线、邮件送达率、多租户、GDPR 删除。

步骤 5:构建顺序

  1. 垂直切片。 端到端的核心闭环,允许粗糙:注册、完成一项核心操作、查看结果。用于验证技术栈。
  2. 必须实现的功能(来自 features.csv),按领域划分。
  3. 应该实现的功能,然后是可以考虑的功能。
  4. 修复事项,由 replica-entrepreneur 在运行后发现的。

每个里程碑列出涉及的屏幕(S-ID)、表和路由。

输出

replica/architecture.md、replica/schema.sql 中的 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.

相关技能