extract-business-rules
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "extract-business-rules":https://skillpi.com/zh/skills/deepskill-39a020634d56134884bfb811fa9b596bda33caae861b8eb9c53a8a9933cab45c。安装前核对上游来源和版本:https://github.com/dykyi-roman/awesome-claude-code。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
从领域代码中提取验证规则、防护措施、业务约束、授权规则和不变量,并将技术实现映射为业务术语以便非技术利益相关者理解。
介绍来源: third_party · dykyi-roman · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 输入和输出
- 减记
- 软件、账号及付费要求
- 翻译待完成,请参阅来源文档。
- 限制与区别
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: extract-business-rules
description: Extracts validation rules, guards, business constraints, authorization rules, and invariants from domain code. Maps technical implementations to business terminology for non-technical stakeholders.Business Rules Extractor
Overview
Identifies and catalogs business rules embedded in code — validation constraints, domain invariants, guards, authorization rules, and business policies. Translates technical implementations into business language.
Rule Categories
| Category | Code Pattern | Business Meaning |
|---|---|---|
| Validation | Assert, validate, check | Input requirements |
| Invariant | Guard clause in constructor/method | Business constraint |
| Authorization | isAllowed, canPerform, Policy | Access control |
| Business Policy | If/match with domain logic | Business decision |
| State Guard | Status check before transition | Workflow rule |
| Limit/Threshold | Comparison with constant/config | Business limit |
Detection Patterns
Validation Rules
# Symfony validation attributes
Grep: "#\\[Assert\\\\" --glob "**/*.php"
Grep: "#\\[(NotBlank|NotNull|Length|Range|Email|Regex|Valid|Choice)" --glob "**/*.php"
# Laravel validation
Grep: "'required|'email|'min:|'max:|'unique:" --glob "**/*.php"
Grep: "\\$rules|->validate\\(" --glob "**/*.php"
# Custom validation
Grep: "function validate|function isValid|function check" --glob "**/Domain/**/*.php"
Grep: "throw.*Invalid|throw.*Validation" --glob "**/*.php"
# Value Object self-validation
Grep: "private function (validate|ensure|assert|guard)" --glob "**/*.php"
Domain Invariants
# Guard clauses in constructors
Grep: "__construct" --glob "**/Domain/**/*.php" -A 20
# Look for: if (...) throw, match with exceptions
# Guard methods
Grep: "private function (ensure|guard|assert|verify)" --glob "**/Domain/**/*.php"
# Invariant enforcement
Grep: "throw new.*Exception" --glob "**/Domain/**/*.php"
# Business constraint patterns
Grep: "if.*<=.*0|if.*<.*0|if.*>.*MAX|if.*>=.*LIMIT" --glob "**/Domain/**/*.php"
Grep: "if.*empty|if.*null|if.*count.*==.*0" --glob "**/Domain/**/*.php"
Authorization Rules
# Symfony voters
Grep: "extends Voter|implements VoterInterface" --glob "**/*.php"
Grep: "function voteOnAttribute" --glob "**/*.php"
# Laravel policies
Grep: "class.*Policy" --glob "**/*.php"
Grep: "function (view|create|update|delete|restore|forceDelete)" --glob "**/Policy/**/*.php"
# Custom authorization
Grep: "->isAllowed|->can\\(|->authorize\\(|->isGranted" --glob "**/*.php"
Grep: "#\\[IsGranted\\(|@IsGranted\\(" --glob "**/*.php"
# Role-based checks
Grep: "hasRole|isAdmin|isModerator|ROLE_" --glob "**/*.php"
Business Policies
# Pricing rules
Grep: "discount|price|tax|fee|commission|markup" --glob "**/Domain/**/*.php"
Grep: "calculatePrice|calculateTotal|applyDiscount" --glob "**/*.php"
# Status/workflow transitions
Grep: "canTransitionTo|allowedTransitions|validTransitions" --glob "**/*.php"
Grep: "function (approve|reject|cancel|complete|archive|activate|deactivate)" --glob "**/Domain/**/*.php"
# Time-based rules
Grep: "isExpired|isActive|isWithin|deadline|expiresAt" --glob "**/*.php"
Grep: "new \\\\DateTimeImmutable|Carbon::" --glob "**/Domain/**/*.php"
# Quantity/limit rules
Grep: "MAX_|MIN_|LIMIT_|THRESHOLD" --glob "**/Domain/**/*.php"
Grep: "maxAttempts|maxRetries|maxItems|minAmount" --glob "**/*.php"
State Guards
# Status checks before operations
Grep: "if.*status.*===|if.*state.*===" --glob "**/Domain/**/*.php"
Grep: "match.*status|match.*state" --glob "**/Domain/**/*.php"
# Enum-based state management
Grep: "enum.*Status|enum.*State" --glob "**/*.php"
Grep: "->status === |->getStatus\\(\\) ===" --glob "**/*.php"
Analysis Process
- Scan — Find all business rule patterns in code
- Extract — Read each rule's implementation details
- Classify — Categorize by type (validation, invariant, auth, policy)
- Translate — Convert technical code to business language
- Map — Connect rules to business entities/processes
Translation Rules
| Technical Pattern | Business Translation |
|---|---|
if ($amount <= 0) throw |
"Order amount must be positive" |
if ($user->getRole() !== 'admin') |
"Only administrators can perform this action" |
if ($order->status !== 'pending') |
"Order can only be modified while pending" |
if (count($items) > 100) |
"Maximum 100 items per order" |
if ($age < 18) |
"Customer must be at least 18 years old" |
Output Format
## Business Rules Catalog
### Summary
| Category | Count | Critical |
|----------|-------|----------|
| Validation Rules | 15 | 3 |
| Domain Invariants | 8 | 5 |
| Authorization Rules | 12 | 4 |
| Business Policies | 6 | 2 |
| State Guards | 4 | 3 |
| **Total** | **45** | **17** |
### Domain Invariants (Business Constraints)
| # | Rule (Business Language) | Location | Enforcement |
|---|--------------------------|----------|-------------|
| INV-1 | Order amount must be positive | Order.php:25 | Constructor guard |
| INV-2 | Order must have at least one item | Order.php:30 | Constructor guard |
| INV-3 | Customer email must be valid format | Email.php:15 | Value Object |
| INV-4 | Payment cannot exceed order total | Payment.php:22 | Method guard |
### Validation Rules (Input Requirements)
| # | Field | Rule | Location |
|---|-------|------|----------|
| VAL-1 | email | Required, valid format | CreateUserRequest.php |
| VAL-2 | name | Required, 2-100 chars | CreateUserRequest.php |
| VAL-3 | amount | Required, positive integer | CreateOrderDTO.php |
### Authorization Rules (Access Control)
| # | Action | Who Can | Where Enforced |
|---|--------|---------|----------------|
| AUTH-1 | View orders | Owner or Admin | OrderPolicy::view |
| AUTH-2 | Cancel order | Owner (if pending) | OrderPolicy::cancel |
| AUTH-3 | Manage users | Admin only | UserVoter |
### Business Policies
| # | Policy | Rule | Location |
|---|--------|------|----------|
| POL-1 | Free shipping | Orders over $100 | ShippingCalculator.php:45 |
| POL-2 | Loyalty discount | 10% for VIP customers | PriceCalculator.php:30 |
| POL-3 | Order expiry | Unpaid orders expire in 24h | OrderExpiryPolicy.php |
### State Transition Rules
| Entity | From State | To State | Condition |
|--------|-----------|----------|-----------|
| Order | pending | confirmed | Payment received |
| Order | confirmed | shipped | Items packed |
| Order | any | cancelled | By owner if not shipped |
Integration
This skill is used by:
business-logic-analyst— catalogs all business rulesexplain-business-process— references rules in process descriptionsextract-domain-concepts— connects rules to domain entities
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 从技术代码中提取业务规则并翻译为业务语言,解决技术与非技术利益相关者之间的理解鸿沟
- 面向开发、产品、业务分析师等多角色,具有广泛实用价值
亮点
- 触发词覆盖全面且边界清晰,包含 validation rules, guards, business constraints 等核心概念
- description 完整且位置正确,便于用户准确理解功能范围
待提升项
-
缺少 When to Use 章节 原报告严重程度:轻微
文档结构完整但缺少明确的使用场景说明章节
改进建议:建议添加 When to Use 章节,说明何时使用此 Skill 最为合适
亮点
- Phase/步骤清晰,包含 Detection Patterns、Analysis Process、Output Format 完整流程
- 提供端到端输出示例,便于用户理解最终产出格式
亮点
- 使用标准 grep 命令,工具来源明确且参数正确
- 覆盖各类业务规则模式(验证、不变量、授权、策略等),异常处理全面
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
翻译待完成,请参阅来源文档。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。