Token导航 LogoToken导航

Agent Skill · 研究检索

safety-kb-import(安全知识库导入)

safety-kb-import 用于查找、检索和筛选相关信息,适合在 OpenClaw 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

safety-kb-import 是研究检索类 Agent Skill,可用宿主为 OpenClaw,通过ClawHub获取,权限为需要联网;许可证为 MIT-0,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 36,940。

总安装 1,835周安装 78GitHub Stars 公开资料未说明下载 643核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT-0
版本
1.0.0

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:safety-kb-import(安全知识库导入)
来源仓库:https://github.com/cyz9827/safety-kb-import
安装命令:
openclaw skills install safety-kb-import
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install safety-kb-import

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

安全生产法规标准导入工具。当用户需要导入新法规或标准到知识库、PDF文本提取、条款拆分、批量导入、数据质量验证时使用。触发词:导入法规、添加标准、入库、导入知识库、补充标准、PDF提取文本、拆分条款、KB导入、safety-review import

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 OpenClaw;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 openclaw skills install safety-kb-import;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

safety-kb-import 怎么安装?

在终端执行 openclaw skills install safety-kb-import。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

safety-kb-import 支持哪些 AI 工具?

公开资料标注支持 OpenClaw。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

safety-kb-import 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

safety-kb-import 是免费的吗?

来源标注的许可证是 MIT-0。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

safety-kb-import 用的人多吗?

公开数据是累计安装 1,835 次,近一周安装 78 次,下载 643 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

safety-kb-import 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 专注 OpenClaw 一种宿主,触发方式和使用习惯不用来回切换。
  • 许可证明确为 MIT-0,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 OpenClaw,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
safety-kb-import

安全知识库导入 · 本页

1,835—需要联网MIT-0通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

name
safety-kb-import
description
安全生产法规标准导入工具。当用户需要导入新法规或标准到知识库、PDF文本提取、条款拆分、批量导入、数据质量验证时使用。触发词:导入法规、添加标准、入库、导入知识库、补充标准、PDF提取文本、拆分条款、KB导入、safety-review import
version
1.0.0
author
WorkBuddy Agent
license
MIT
tags

Safety KB Import — 安全生产法规标准导入工具

Overview

This skill provides standardized, safe import workflows for adding regulations, standards, and policy documents into the safety-review knowledge base (SQLite). It handles multi-source text extraction, smart clause splitting, conflict detection, and three-table atomic writes (regulations + clauses + std_registry).

Database location: ~/.openclaw-autoclaw/skills/safety-review/db/knowledge.db

When to Use This Skill

  • User wants to add new standards/regulations to the knowledge base
  • User has PDF files that need text extraction before import
  • User needs to batch-import multiple standards at once
  • User asks about importing courseware-referenced standards that are missing
  • Any write operation on the safety-review database

Trigger phrases (Chinese): 导入法规、入库、添加标准、补充知识库、PDF提取、拆分条款、批量导入

Companion skill: Use safety-kb-query first to check what's already in the database before importing.

Prerequisites

  1. Detect Python command:
   python --version
  1. Required packages for PDF extraction:
   pip install pdfplumber

For OCR of scanned PDFs:

   pip install pdf2image pytesseract
   # Also requires Tesseract OCR engine installed on system

Import Workflow (Complete)

Phase 1: Preparation — Check What's Needed ⭐ Always Do This First

Before importing anything, use safety-kb-query to identify gaps:

python <kb_query_path>/kb_query.py check "GB 16423" "AQ/T 2033" "AQ 2034"

This prevents duplicates and identifies data quality issues.

Phase 2: Text Extraction

Option A: From PDF Files
python scripts/kb_import.py extract-pdf /path/to/document.pdf

Response fields:

  • success: boolean
  • text: extracted full text (empty if scan-only)
  • char_count: number of characters extracted
  • page_count: total pages
  • is_scan_only: true if PDF is image-based (needs OCR)

If is_scan_only is true, the PDF is a scanned/image-based document:

  1. Try installing and using tesseract OCR
  2. If OCR unavailable, extract content from PPT lecture materials or web sources as fallback
  3. Document the source as "PPT整理" or "网络来源" rather than official text
Option B: From Web Sources

Use web_fetch to get full text from government websites, wikisource, etc. Common reliable sources:

  • 维基文库 (wikisource.org) — full text of laws/policies
  • 政府公报 (gov.cn/gongbao) — official gazette versions
  • 部委官网 — original standard publications
Option C: From Existing Documents (.docx, .pptx)

Extract text from these formats using appropriate libraries (python-docx, python-pptx) or the respective skills.

Phase 3: Create Import Manifest

Create a JSON manifest file listing all items to import:

{
  "items": [
    {
      "title": "金属非金属矿山安全规程",
      "document_number": "GB 16423—2020",
      "issuing_authority": "国家市场监督管理总局",
      "authority_level": "national",
      "effective_date": "2021-09-01",
      "status": "current",
      "domains": "矿山安全",
      "category": "国标",
      "full_text": "<complete extracted text here>",
      "source_url": "",
      "page_count": 70,
      "clause_split_pattern": "standard"
    },
    {
      "title": "国务院关于进一步加强企业安全生产工作的通知",
      "document_number": "国发〔2010〕23号",
      "issuing_authority": "国务院",
      "authority_level": "national",
      "effective_date": "2010-07-23",
      "status": "current",
      "domains": "安全生产",
      "category": "政策文件",
      "full_text": "<complete text>",
      "source_url": "https://zh.wikisource.org/...",
      "page_count": 5,
      "clause_split_pattern": "policy"
    }
  ]
}

Manifest Field Reference

FieldRequiredDescription
title✅Full title of the regulation/standard
document_number✅Standard number (GB XXXX, AQ/T XXXX, 国发[X]X号)
issuing_authority❌Issuing agency (default: "")
authority_level❌One of: national, ministerial, local
effective_date❌ISO date format YYYY-MM-DD
status❌current (default), superseded, draft, repealed
domains❌Domain category (e.g., "矿山安全")
category❌Type: "国标", "行标", "政策文件", "地方文件"
full_text✅Complete text content for clause splitting
source_url❌Original source URL for attribution
page_count❌Number of pages (for reference)
clause_split_pattern❌standard (default), policy, raw_lines

Clause Splitting Patterns

The tool supports three splitting strategies — choose based on document type:

PatternBest ForHow It Works
standardGB/AQ national/industry standardsRecognizes chapters (第X章), sections (N.N), sub-sections (N.N.N), appendixes
policyGovernment notices, State Council documentsRecognizes Chinese numbering (一、二、(一)、1.)
raw_linesUnstructured text, fallbackSplits by non-empty lines

Test splitting before full import:

python scripts/kb_import.py split-clauses --text "$SAMPLE_TEXT" --pattern standard

Phase 4: Execute Import

python scripts/kb_import.py import --json manifest.json

What happens during import:

  1. For each item in the manifest:

- Searches existing regulations by document_number - If found → UPDATE (overwrite existing data) - If not found → INSERT (create new record)

  1. Clause processing:

- Deletes old clauses (if updating) - Re-splits full_text using specified pattern - Inserts new clause records linked to regulation ID

  1. std_registry registration (automatic):

- If document_number starts with GB/AQ → auto-registers in std_registry table - Skips if already registered

Output includes per-item status:

  • created — New record inserted
  • updated — Existing record overwritten
  • skipped — (reserved for future skip logic)
  • error — Database error with message

Phase 5: Post-Import Validation

Always validate after importing:

# Validate specific imported records
python scripts/kb_import.py validate <regulation_id>

# Check overall data quality
python <kb_query_path>/kb_query.py conflicts

# Verify it's findable
python <kb_query_path>/kb_query.py search "<document_number>"

Handling Special Cases

Scanned/Image-Based PDFs (No Extractable Text)

When extract-pdf returns "is_scan_only": true:

  1. First choice: Install tesseract and run OCR
  2. Second choice: Find text version from web sources (government sites, wikisource)
  3. Third choice: Extract from related PPT/lecture materials (document as "PPT整理")
  4. Last resort: Skip or note as "待补充官方全文"

Important: When using non-official sources (PPT, web scraping), always note this in the source_url field so data provenance is tracked.

Large Standards (e.g., GB 16423 with 80K+ characters)

No special handling needed — the tool processes them normally. Clause count may be high (2000+). Consider using --pattern standard for best results.

Batch Imports (10+ Items)

Split manifests into batches of 5-10 items each. Run sequentially. This makes error isolation easier.

Conflict: Existing Record Has Wrong Data

The tool will overwrite any existing record matching the document_number. Before overwriting:

  1. Use safety-kb-query info <id> to check current data
  2. If current data looks correct (different standard sharing similar number?), abort and investigate
  3. The conflicts command in safety-kb-query can help identify mismatched records proactively

Complete Example: Importing Courseware-Referenced Standards

This is the canonical workflow when a user says "the standards referenced in my training material aren't in the database":

Step 1: Extract references from user's document
        → List: [GB 16423-2020, AQ/T 2033-2023, AQ 2034, 国发[2010]23号]

Step 2: Gap analysis
        $ python kb_query.py check GB16423 AQ2033 AQ2034 "国发[2010]23号"
        → Found: 1, Missing: 3, Issues: 1 (ID:94 has wrong data)

Step 3: Extract text for missing items
        $ python kb_import.py extract-pdf GB16423-2020.pdf
        → { success: true, text: "...", char_count: 80357 }

Step 4: Create manifest.json with all items

Step 5: Execute import
        $ python kb_import.py import --json manifest.json
        → { imported: 3, updated: 2, skipped: 0 }

Step 6: Validate
        $ python kb_import.py validate 94
        → { is_valid: true, issues: [] }

Step 7: Verify
        $ python kb_query.py check GB16423 AQ2033 AQ2034 "国发[2010]23号"
        → All found ✓

Relationship with Other Skills

SkillRole
safety-kb-queryQuery/read operations; must use BEFORE import for gap detection
safety-kb-import (this one)Import/write operations into the database
pdfAdvanced PDF handling (merge, split, watermark) — use for complex PDF prep work
standard-update-coursewareUpdate courseware after standards change — uses both query & import

Known Limitations

  • No rollback: Import commits immediately. Validate before importing bulk data.
  • OCR dependency: Scanned PDF handling requires external tesseract installation.
  • Clause granularity: Split patterns are heuristic-based; review output for edge cases.
  • Single-user: No locking mechanism for concurrent access.

Troubleshooting

ErrorCauseSolution
Database not foundWrong pathSet KB_PATH env var or update DEFAULT_DB_PATH
no such column: XSchema changedRun schema command to verify columns
UNIQUE constraint failedDuplicate insert attemptTool should handle updates; check manifest has unique doc numbers
clause_count: 0 after importText empty or pattern mismatchedTry different clause_split_pattern; verify full_text field isn't empty
Garbled Chinese in outputEncoding issueEnsure script runs with UTF-8 locale; Windows: chcp 65001

Version History

  • 1.0.0 (2026-04-25): Initial release with import, extract-pdf, split-clauses, validate, schema commands

平台分布

OpenClaw

79.22%
按下载量换算509

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills