Foreword

When developing risk control strategies, a common approach is to use Python scripts or Excel to manually select features, test thresholds, and combine rules, followed by separate report writing. This process is fragmented, with parameter tuning and comparative combinations requiring repetitive manual operations.

DeepSeek Harness (DSH) decomposes capabilities into registerable plugins. risk-rule-design is a third-party plugin released by community maintainer pypcfx-glitch, operationalizing the methodology from the “100-Day Risk Control Expert” course into an executable pipeline: data quality check → single rule mining → optimal combination of parallel rule sets → HTML analysis report. Strategy personnel only need to prepare a sample containing feature X and target y, then trigger the skill within a DSH conversation.

What is This

risk-rule-design is designed for DSH agents and risk control strategy personnel, performing rule mining on specified datasets and outputting self-contained HTML reports. The plugin is open-sourced on GitHub (MIT license, current npm package version 1.0.2), categorized under admin-security in SkillHub, with approximately 11 stars.

The plugin registers 3 tools and 1 expert skill:

Capability Name Description
Tool rrd_profiling Step 1: X/y confirmation and data quality check (automatically removes ID/serialno/constant/approximately unique/high-missing-value columns)
Tool rrd_mining Step 2: Single rule evaluation + optimal combination of parallel rule sets (traverses rule sequence) + default HTML report generation
Tool rrd_report Step 3: Regenerate/adjust HTML report based on existing mining snapshot
Skill risk-rule-design Expert methodology (roles, process, evaluation criteria, report structure), loadable by models/users

Implemented in pure JavaScript (ESM), with zero build requirements, zero external dependencies, and requires Node.js >= 18.

Core Features

Data Quality Check

rrd_profiling reads samples, confirms the target variable y and feature X list, and performs quality checks: automatically removes ID, serialno, constant, approximately unique, and high-missing-value columns—fields unsuitable for modeling.

Single Rule and Combination Mining

rrd_mining evaluates univariate candidate rules on the confirmed feature set (hit rate, hit bad rate, Lift, IV, etc.), then performs parallel (OR) combination searches on the rules, traverses rule sequences, and selects the optimal combination based on the configured objective (default F1 balance). After mining, it generates an HTML report and snapshot by default.

Report Regeneration

rrd_report regenerates or adjusts the HTML report based on an existing mining snapshot without re-running the complete mining process.

HTML Report Content

The report is self-contained HTML (inline CSS/SVG, no external resources) that can be opened directly in a browser. It primarily includes:

  1. Dataset and quality check: Sample/field/bad rate overview, field list and exclusion decisions, quality check issues, y distribution.
  2. Univariate effect analysis: Candidate rule metrics and bar charts for each feature.
  3. Combination rule effect analysis: Optimal combination overview, rule details and marginal gains, full combination evaluation table, hit rate × Lift scatter plot, precision-recall curve, candidate rule pool and selection status.
  4. Appendix: Analysis configuration and constraint explanations.

Installation and Enabling

The plugin is published as npm package dsh-plugin-risk-rule-design. It is recommended to install via npm. After installation, the bundle will automatically register into the profile; restart to use.

dsh plugin --profile web install dsh-plugin-risk-rule-design

Restart dsh web after installation to take effect. To uninstall:

dsh plugin --profile web remove dsh-plugin-risk-rule-design

An alternative method is direct installation from GitHub:

dsh plugin --profile web add "github:pypcfx-glitch/risk-rule-design"

Direct GitHub installation only adds the package to dependencies and does not automatically register the bundle. You need to manually append the package name to the dsh.profile.bundles array in the profile’s package.json (e.g., append "risk-rule-design"), then restart dsh web. Choose either method; do not install repeatedly.

Note: The plugin runs with the current DSH process permissions. Before installation, please review the source code and MIT license to ensure that the sample path and data access scope meet your security requirements. The README notes that this plugin is still under development.

Typical Usage

Prepare an analysis sample (containing feature X and target variable y), type / in DSH to invoke the skill risk-rule-design (after successful installation, typing risk usually triggers auto-completion), paste the absolute path of the dataset, and specify the y field name.

Below is an example dialogue command template (replace the path and field name with your sample):

/risk-rule-design
D:\...\model_data_v1.0.xlsx
Analyze this dataset, exclude y_label_30 and y_label_7, where y_label_15 is y, and determine X yourself.

The execution flow is as follows:

rrd_profiling(dataset, target)
   ↓ Confirm X list
rrd_mining(dataset, target, features, [objective, hitRateBudget, minBadCoverage, ...])
   ↓ Output optimal combination + HTML report + snapshot
rrd_report(snapshot, [title, note])   # Optional

The skill will automatically chain the above tools according to the rule mining process and provide the HTML report path at the end.

Applicable Scenarios and Considerations

Who is this for: Risk control strategy personnel and data analysts in finance/credit and other scenarios who need to quickly test rules, compare combinations, and generate readable reports on samples without writing scripts from scratch each time.

Not suitable as: An automatic decision engine for online strategies; the plugin is positioned for offline sample rule mining and reporting, not real-time interception services.

Usage considerations:

  • Samples must contain a clear y and usable features; the plugin automatically excludes fields clearly unsuitable for modeling, but manual confirmation of business meaning is still required.
  • GitHub installation requires manual bundle configuration; one-click npm installation is recommended for production environments.
  • The plugin README indicates it is the author’s first DSH plugin, with functionality still under iteration. Report any issues on GitHub.

Summary

risk-rule-design consolidates risk control rule mining from “manual script tuning + report assembly” into a conversation-driven workflow within DSH: 3 tools handle quality check, mining, and report generation, while 1 skill embodies the methodology. If you are extending admin-security capabilities in the DSH ecosystem, you can learn more from the directory page and repository:

  • SkillHub Directory: https://www.skillhub.cn/plugins/pypcfx-glitch/risk-rule-design
  • GitHub Repository: https://github.com/pypcfx-glitch/risk-rule-design