Interactive wizard to extract business rules from source code. Guides through scope selection, category filtering, and output preferences before running extraction.
From cortexnpx claudepluginhub jsvitolo/cortex-plugins --plugin cortexThis skill is limited to using the following tools:
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
This skill provides an interactive setup wizard that guides you through extracting business rules from source code using LSP navigation and pattern detection.
$ARGUMENTS
If no path is provided, the current working directory is used.
If $ARGUMENTS contains a path, use it. Otherwise, ask the user:
What directory or file would you like to extract business rules from? (Default: current project root)
Ask the user the following questions one at a time, providing sensible defaults:
Scope: "What scope should I use?"
file - Extract from a single filemodule - Extract from a directory/moduleproject - Extract from the entire projectCategories: "Which rule categories are you interested in?"
validation - Input validation, data checkscalculation - Formulas, computations, transformationsflow - Workflow, state machines, process logicpermission - Authorization, access controlall - All categories (default)Detail level: "How detailed should the output be?"
summary - Quick overview with counts and key findingsdetailed - Full code chunks with pattern analysis (default)Include tests: "Should I also analyze test files for corroborating evidence?"
yes (default) / noCross-reference: "Should I cross-reference test evidence with production code?"
yes (default if tests included) / noOutput format: "Where should I save the extracted rules?"
memory - Save as Cortex memories for semantic search (default)markdown - Generate a Markdown catalog in docs/business-rules/both - Save to bothTask link (optional): "Link extracted rules to a task? (e.g., CX-15)"
Call the rules_extract MCP tool with the configured options:
mcp__cortex__business_rule(
action="rules_extract",
path="<path>",
scope="<scope>",
categories=["<cat1>", "<cat2>"],
detail_level="<level>",
include_tests=<bool>,
cross_reference=<bool>,
output_memory=<bool>,
output_markdown=<bool>,
output_dir="docs/business-rules",
task_id="<task_id>",
max_chunks=50,
strategy="smart"
)
The extraction returns structured code chunks with pattern hints. For each chunk:
business_rule save:mcp__cortex__business_rule(
action="save",
title="<descriptive title>",
description="<what the rule enforces>",
category="<validation|calculation|flow|permission|constraint|state_transition|integration>",
importance="<critical|high|medium|low>",
confidence=<0.0-1.0>,
source_file="<file path>",
source_func="<function name>",
source_start_line=<line>,
source_end_line=<line>,
code_snippet="<relevant excerpt>",
domain="<package/module name>",
tags=["<tag1>", "<tag2>"],
extracted_by="lsp+llm",
task_id="<task_id if provided>"
)
If the user chose markdown or both output:
mcp__cortex__business_rule(
action="catalog",
output_dir="docs/business-rules",
min_confidence=0
)
Present a summary to the user:
cx catalog generate to regenerate the catalog later")User: /rules ./internal/payment/
Claude: I'll help you extract business rules from ./internal/payment/.
Let me walk through a few preferences first.
What scope should I use?
- module (recommended for a directory)
- file
- project
User: module is fine
Claude: Which rule categories are you interested in?
- all (default)
- validation, calculation, flow, permission
User: all
Claude: Should I include test file analysis for corroborating evidence? (yes/no, default: yes)
User: yes
Claude: Where should I save the extracted rules?
- memory (default) - for semantic search
- markdown - generate docs/business-rules/
- both
User: both
Claude: [Runs extraction, analyzes 23 chunks, identifies 8 business rules]
Extraction complete!
- Chunks analyzed: 23
- Rules identified: 8
- validation: 3 (2 high, 1 medium)
- calculation: 2 (1 critical, 1 high)
- flow: 2 (2 medium)
- permission: 1 (1 high)
- Catalog written to: docs/business-rules/
- All rules saved to Cortex memory for semantic search
Next steps:
- View rules: cx catalog generate
- Search rules: cx rules search "payment"
- Link to task: business_rule_save with task_id
/rules . for a full project scan (may take longer)