business-logic-extraction

仓库创建 2026年4月30日最近提交 22 天前SkillHot 收录 22 天前
▸ 精选理由

适合大文件重构,提升可读性与测试性

这个 Skill 做什么

将隐含的业务决策提取为具名、可测试的策略/服务,保持行为不变

把藏在大控制器、请求处理器、GraphQL resolver 或前端组件里的业务决策抽出来,变成有名字、可测试的 policy/service/hook 或 query helper,让入口点只剩下适配器的职责。通常在要做大规模重构、拆分巨型 handler、把验证/授权/状态转换或副作用从入口移走时用。特别之处是强调行为不变并推荐用结构化搜索(如 ast-grep)做安全的批量 codemod,便于定位决策分支并自动化重构。

▸ 展开 SKILL.md 英文原文

Use when refactoring large controllers, request handlers, GraphQL resolvers, Action API endpoints, services, or frontend components so business decisions are extracted into named policies, services, query helpers, lifecycle helpers, hooks, or route-local models. Trigger when the user asks to extract business logic, thin adapters, split giant handlers, move validation/authorization/state transitions/side-effect orchestration out of entrypoints, or execute a multi-batch refactor plan with verification. Use the ast-grep skill for structural pattern search and safe codemods when locating decision branches across large handlers or many files.

开发编程代码重构业务逻辑可测试化架构通用
0
Stars
0
Forks
16
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/Eotel/skills/main/business-logic-extraction/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/Eotel/skills/main/business-logic-extraction/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Business Logic Extraction

Use this skill to turn hidden business decisions into named, testable homes
without changing observable behavior. The goal is not smaller files by itself;
the goal is entrypoints that read like adapters.

> **Finding the branches at scale:** to locate the decision points below across a
> big handler or many files, prefer structural search over text grep — invoke the
> **`ast-grep`** skill to match by AST shape, and to apply mechanical codemods once
> a pattern is confirmed. Text search misses overloads, reformatting, and aliases.

## Core Rule

Extract a branch when it decides business meaning:

- authorization or scoped access
- validation, normalization, defaul
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有