Skip to content
Back to skills

Referential Integrity Check

ASecurity

'引用完整性校验工具。读取子表及参考表,检查外键值是否存在于参考键集合中,标记孤立记录行并输出结果文件。

  • 539 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 11, 2026
documentationpythonbash

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 11, 2026

npx -y skills add cas-bigdatalab/piflow --skill referential_integrity_check --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Referential Integrity Check?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Referential Integrity Check
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/cas-bigdatalab-referential-integrity-check/badge)](https://www.skillsdirectory.com/skills/cas-bigdatalab-referential-integrity-check)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: referential_integrity_check
description: '引用完整性校验工具。读取子表及参考表,检查外键值是否存在于参考键集合中,标记孤立记录行并输出结果文件。

  当用户提到外键检查、引用完整性、孤立记录、父子表引用等需求时使用此skill。

  即使用户没有明确说出“引用完整性”,只要任务涉及检查字段值是否能在参考表中找到,就应该使用此skill。

  不负责重复行、空值、列存在性、字段格式等其他校验任务。

  '
name_zh: 引用完整性校验算子
input_params:
- name: input_path
  type: string
  required: true
  description: 子表文件路径
- name: output_path
  type: string
  required: true
  description: 输出文件路径
- name: check_field
  type: string
  required: true
  description: 子表检查字段
- name: reference_path
  type: string
  required: false
  description: 外部参考表路径;不指定则使用同表中的 reference_column
- name: reference_column
  type: string
  required: true
  description: 参考列名
- name: qc_mark
  type: string
  required: true
  description: 质控标识
- name: mark_field_name
  type: string
  required: false
  default: QC0000
  description: 质控标识字段名
output_params:
- name: output_path
  type: csv_file
  description: 带质控标识的输出文件
tag: 数据校验
publisher: COMMUNITY
---

# Referential Integrity Check 引用完整性校验 Skill

## 功能概述

外键约束检查。两类模式:(1) 同表引用 — check_field 的值必须在同表的 reference_column 中存在;(2) 跨表引用 — check_field 的值必须在外部 reference_path 文件的 reference_column 中存在。标记在参考集中找不到匹配值的孤立行。

## 触发条件

当用户提到以下任务时,应使用此 skill:
- 外键检查
- 引用完整性
- 孤立记录
- 父子表引用

## 使用方法

```bash
python scripts/referential_integrity_check.py --input_path <输入文件> --output_path <输出文件> --check_field <检查字段> --reference_path <参考表文件> --reference_column <参考列> --qc_mark <质控标识> --mark_field_name <标识字段名>
```

## 核心参数说明

### 必需参数
| 参数 | 说明 |
|------|------|
| `--input_path` | 输入文件路径 |
| `--output_path` | 输出文件路径 |
| `--check_field` | 检查字段(外键) |
| `--reference_column` | 参考列(主键) |
| `--qc_mark` | 质控标识 |

### 可选参数
| 参数 | 说明 | 默认值 |
|------|------|--------|
| `--reference_path` | 外部参考表(不指定则同表) | 同表 |
| `--mark_field_name` | 质控标识字段名 | `QC0000` |

## 注意事项

1. 空值不标记为孤立值(仅标记有值但不在参考集中的行)
2. 参考值取自 reference_column 的去重集合
3. 列不存在时直接报错退出

Files in this skill

  • SKILL.md2.8 KB
  • scripts/data_io.py3.5 KB
  • scripts/referential_integrity_check.py2.1 KB
  • skill.json2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in documentation →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.