返回 Skill 列表
extension
分类: AI Agent 能力无需 API Key

emergency-disposal-card-generator

Enterprise-grade Emergency Disposal Card Generator (应急处置卡生成器). Use when the user asks to generate, create, or batch-produce emergency disposal cards from safety manuals, emergency plans, standard operating procedures (SOPs), hazard identification reports, or any industrial/occupational safety documents. Triggers: "生成应急处置卡", "制作应急卡", "create emergency card", "generate disposal card", "安全应急处置卡", "batch produce EDC cards", "safety card generation". Supports single-document processing and batch processing (multiple scenarios → multiple cards).

person作者: xxh0808hubModelScope

Emergency Disposal Card Generator (应急处置卡生成器)

Enterprise tool for automatically extracting emergency scenarios from safety documents and generating standardized emergency disposal cards conforming to GB/T 29639-2020 and industry best practices.

Overview

This skill transforms unstructured safety documentation into structured, actionable emergency disposal cards. Each card contains:

  • Scenario identification and risk classification
  • Pre-incident preventive measures
  • Step-by-step emergency response procedures
  • Personnel roles and contact escalation
  • Required emergency equipment and supplies
  • Post-incident recovery guidance

Workflow

Phase 1: Load and Parse Input

  1. Accept input as:
    • Plain text pasted by the user
    • .pdf files
    • .docx files (use python-docx to extract)
    • .txt or .md files
    • Multiple documents for batch processing
  2. Extract text with the following priority:
    • MinerU first for PDF: prefer MinerU-generated markdown/text when available
    • Fallback to PyPDF2 / fitz / pdfplumber / pdfminer / OCR
  3. Clean before chunking:
    • Remove page numbers, empty noise lines, duplicate short fragments, control characters, and layout residue
    • Normalize whitespace and paragraph boundaries
  4. Split long documents into chunks after cleaning
  5. Identify emergency scenarios present in the document or chunk

Phase 2: Read Reference Materials

Before generating cards, read the following reference files in order:

  1. prompt.md — System prompt template for the LLM
  2. schema.json — Output JSON Schema for card validation
  3. examples/output.json — Reference output example

Phase 3: Generate Cards via LLM

Use the following approach to generate cards:

  1. For short documents: Compose the full prompt.md with the cleaned text and call the LLM
  2. For long documents: Chunk only after cleaning; run one LLM pass per cleaned chunk
  3. For batch generation: For each scenario identified, generate a card separately or merge chunk-level results
  4. Aggregation: Merge duplicate scenario cards across chunks instead of simply dropping duplicates
  5. Validation: Validate each card output against schema.json

LLM Call Configuration

Recommended model parameters:

  • Model: qwen-plus or gpt-4o (or user's available model)
  • Temperature: 0.1 (for consistency)
  • Streaming: false
  • Response format: JSON object

Prompt Assembly

system_prompt = read_file("prompt.md")
cleaned_text = clean_document_text(extracted_text)
chunks = split_text_into_chunks(cleaned_text)
human_prompt = f"""请根据以下【源文档内容】生成应急处置卡。

【源文档内容】:
{chunks[0]}

严格按照 schema.json 定义的 JSON Schema 格式返回。直接输出 JSON,不要包含任何 Markdown 标记。"""

Phase 4: Post-process and Deliver

  1. Parse LLM JSON response
  2. Validate against schema.json
  3. Present cards to user in readable format (markdown tables or formatted cards)
  4. Optionally export as .docx (requested by user)

Quality Standards

  • Strict source grounding: Every procedure, hazard, and measure must be traceable to the source document
  • Zero hallucination: Do not invent procedures, chemical names, or safety protocols not present in the source
  • Completeness: Each card should have all fields populated; if source lacks information, mark as "源文档未提供" (not provided in source)

Batch Processing

For large documents containing multiple scenarios:

  1. First pass: extract raw text
  2. Clean text before any chunking
  3. Split the cleaned text into chunks
  4. Generate chunk-level cards
  5. Merge duplicate scenarios across chunks
  6. Combine into a single output array

Example

See examples/output.json for a complete reference output.

Bundled Resources

Scripts (scripts/)

  • generate_cards.py — Standalone CLI tool for batch generating emergency disposal cards from text documents.
    • Usage: python scripts/generate_cards.py --input <document.txt> --output <cards.json>
    • Supports configurable model, temperature, API key, chunk size, and chunk overlap
    • Supports MinerU-first PDF ingestion through MINERU_MARKDOWN_PATH, sibling MinerU markdown files, or MINERU_CMD
    • Reads prompt.md for system prompt

Examples (examples/)

  • input.docx — Sample safety document excerpt (chemical spill + fall from height)
  • input.txt — Same content in plain text for quick testing
  • output.json — Generated cards for the sample input, for reference validation