fork-first-methodology

fork-first-methodology is a cursor rule for Cursor from TashanGKD/tashan-cursor-skills. It costs 50 tokens per session (1,321 once invoked), scanned A, original, MIT.

A development rule for projects built by copying an existing project, commonly called a fork. It requires running the original project first, defining what will change, and keeping changes as small as possible.

In plain words
What is it for?
Use it when adapting an existing project, especially when changing its front end, back end, data layer, configuration, or API while preserving the rest.
Why use it?
It reduces the risk of rewriting working features, breaking existing interfaces, or discovering too late that the copied project never worked.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: built for openclaw.

Good fit Use it when adapting an existing project, especially when changing its front end, back end, data layer, configuration, or API while preserving the rest.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/tashangkd/tashan-cursor-skills/fork-first-methodology
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/TashanGKD/tashan-cursor-skills

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fork-first-methodology

README.md
[![agentmods](https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/fork-first-methodology.svg)](https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/fork-first-methodology)
Your own site
<a href="https://agentmods.dev/rules/tashangkd/tashan-cursor-skills/fork-first-methodology"><img src="https://agentmods.dev/badge/rules/tashangkd/tashan-cursor-skills/fork-first-methodology.svg" alt="Measured on agentmods" height="20"></a>
Per session 50 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,321 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.01321
Opus 5 $0.00025 $0.00660
Sonnet 5 $0.00010 $0.00264
Haiku 4.5 $0.00005 $0.00132

Measured 8d ago against content hash 5acd71cfef7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

fork-first-methodology scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/fork-first-methodology.mdc · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Fork-First 开发规范(RULE-FORK-FIRST)

触发条件:任何「基于 X 项目」「在 X 的基础上」「fork X 然后」「复用 X 的核心」类描述的开发任务。


核心原则

这不是从头开发。修改量应该最小,已有的东西不要重写。

从头开发和 Fork-First 的本质区别:

维度 从头开发 Fork-First
起点 空项目 已有能跑通的完整系统
目标 实现全部功能 只改需要改的部分
评价标准 功能完整性 Delta(变更量)最小
最大风险 遗漏功能 重写已有的东西

强制执行步骤(不可跳过)

Step 1:先完整跑通基础项目(不改任何东西)

# 正确做法:
cp -r reference/repos/openclaw/ 项目群/my-project/
cd my-project
npm install
# 按原项目文档配置
# 验证:所有原有功能正常工作

禁止:在基础项目跑通之前开始任何改动。

Step 2:理解「改动边界」(前端 vs 后端 vs API)

必须明确回答:

□ 我要修改的是哪一层?(前端 / 后端 / 数据层 / 配置)
□ 我保留不变的是哪一层?
□ 两层之间的接口是什么?(REST API / WebSocket 协议 / 函数签名)
□ 接口规范在哪里有文档?(源码中的哪个文件)

Step 3:做最小侵入修改

原则:
✅ 替换整个前端目录(ui/ → react-ui/),后端一行不改
✅ 新增配置项,保持向后兼容
✅ 在现有扩展点注册新插件/工具

❌ 重写已有的核心模块(「因为想更了解」「想用不同技术栈」)
❌ 自制一套已有功能的替代品(「更简洁」「更符合我们的需求」)
❌ 抛弃已有的 API 层,另起炉灶

Step 4:每一步都有验证

修改前:记录基础项目的行为(截图/测试/API 响应)
修改后:对比验证行为一致
每个 commit:都要能独立跑通,不允许「等后面修复」

诊断清单(开始 fork-based 开发前必做)

在开始任何修改之前,必须回答:

□ 基础项目是否已经在本地跑通?(服务启动 + 核心功能可用)
□ 是否已阅读基础项目的架构文档(README/ARCHITECTURE.md)?
□ 是否已确认改动边界(改哪里 / 不改哪里)?
□ 是否已找到前后端之间的 API 接口定义?
□ 是否评估过「只替换前端」是否足够满足需求?

如果上述任何一项回答「否」,必须先完成该项,再继续。


架构文档要求

所有 Fork-First 项目的技术架构文档必须包含:

## 基础项目信息
- 上游项目:[名称 + URL]
- 基准版本:[commit hash 或版本号]
- 许可证:[MIT/Apache 等]

## 修改边界声明
- 保留不改的部分:[列举]
- 我们替换的部分:[列举]  
- 我们新增的部分:[列举]

## 前后端接口协议
- 协议类型:[WebSocket v3 / REST / gRPC / ...]
- 协议定义文件:[路径]
- 我们的实现需遵循:[链接或说明]

反模式(已发生的教训)

以下是曾经犯过的错误,未来不允许重复:

❌ tashan-forge 案例(2026-03-22):
  - 目标:给 OpenClaw 换一个 React 前端
  - 实际做法:
    × 没有 fork OpenClaw,而是从零建了新项目
    × 自己实现了 Hono Server + Bus + SSE(OpenClaw 已有)
    × 自己实现了 config.ts(OpenClaw 已有完整配置系统)
    × 只使用了 pi-coding-agent 的 5 个导出(完整系统的 ~5%)
  - 结果:用 ~1000 行代码重复实现了 OpenClaw 已有的后端功能
  - 正确做法:
    ✅ fork reference/openclaw-main 整体复制
    ✅ npm install,配 API Key,跑通
    ✅ 只替换 ui/ 目录(Lit → React)
    ✅ 新前端接 OpenClaw 现有的 WebSocket v3 协议

变更记录

2026-03-22 — 初始创建

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 146 lines · 50 tokens per session scan A 5acd71cfef7b

Subscribe to this mod's changes

fork-first-methodology is a cursor rule published in the GitHub repository TashanGKD/tashan-cursor-skills (20 stars, last pushed 5mo ago), licensed MIT. It adds 50 tokens to every session and 1,321 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.