wps-mail-merge

wps-mail-merge is a skill for Claude Code from Bwkyd/wps-skills. It costs 100 tokens per session (2,029 once invoked), scanned A, original, MIT.

A document mail-merge tool that combines a Word template with an Excel or CSV list to create a separate personalized document for each row.

In plain words
What is it for?
Use it to create batches of notices, invitations, certificates, contracts, payslips, envelopes, or labels from one template and a data list.
Why use it?
It removes the need to copy names, dates, salaries, or other details into documents one by one, reducing repetitive work and typing mistakes.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is output_dir: 输出目录(默认 ./merged_output/).

Good fit Use it to create batches of notices, invitations, certificates, contracts, payslips, envelopes, or labels from one template and a data list.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/Bwkyd/wps-skills
agentmods
npx agentmods add skills/bwkyd/wps-skills/wps-mail-merge

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wps-mail-merge

README.md
[![agentmods](https://agentmods.dev/badge/skills/bwkyd/wps-skills/wps-mail-merge/github.svg)](https://agentmods.dev/skills/bwkyd/wps-skills/wps-mail-merge)
Your own site
<a href="https://agentmods.dev/skills/bwkyd/wps-skills/wps-mail-merge"><img src="https://agentmods.dev/badge/skills/bwkyd/wps-skills/wps-mail-merge/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for wps-mail-merge

Your own site · 80×15
<a href="https://agentmods.dev/skills/bwkyd/wps-skills/wps-mail-merge"><img src="https://agentmods.dev/badge/skills/bwkyd/wps-skills/wps-mail-merge.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,029 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00100 $0.02029
Opus 5 $0.00050 $0.01014
Sonnet 5 $0.00020 $0.00406
Haiku 4.5 $0.00010 $0.00203

Measured 12d ago against content hash 4f3622bf95a0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

wps-mail-merge scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/wps-mail-merge/SKILL.md · 255 lines

How it starts

The opening of the file, as written. The whole thing — 255 lines — stays where its author put it; the contents beside it link to each section on GitHub.

智能邮件合并

Excel 数据源 + Word 模板 → 批量生成几百份个性化文档。

When to Use

  • 从名单批量生成通知/邀请函/证书
  • 合同模板批量填充甲乙方信息
  • 工资条/薪资通知单批量生成
  • 录取通知书/入职通知批量生成
  • 信封/标签批量打印
  • 用户说"帮我批量生成""邮件合并"

When NOT to Use

  • 只生成单份文档 → 使用 wps-docx-writer
  • 需要创建模板本身 → 使用 wps-template-engine
  • 需要批量处理表格数据 → 使用 wps-data-clean

工作流程

Step 1: 准备数据源和模板

数据源(Excel/.xlsx/.csv):

| 姓名   | 部门   | 职位     | 入职日期     | 薪资    |
|--------|--------|---------|-------------|---------|
| 张三   | 技术部  | 工程师   | 2026-04-01  | 15000   |
| 李四   | 市场部  | 经理    | 2026-04-01  | 20000   |

模板(Word/.docx)——用 {{变量名}} 标记:

                    入职通知书

{{姓名}} 先生/女士:

  恭喜您通过面试!现通知您于 {{入职日期}} 到 {{部门}} 报到,
担任 {{职位}} 一职,试用期月薪为人民币 {{薪资}} 元。

  请携带以下材料:...

                                    XX公司人力资源部
                                    {{日期}}

Step 2: 匹配变量

自动扫描模板中的 {{变量名}},与数据源列名匹配:

📋 变量匹配结果
═════════════════════════════
模板变量        数据源列      状态
──────────────────────────────
{{姓名}}    →   姓名列       ✅ 匹配
{{部门}}    →   部门列       ✅ 匹配
{{职位}}    →   职位列       ✅ 匹配
{{入职日期}} →   入职日期列    ✅ 匹配
{{薪资}}    →   薪资列       ✅ 匹配
{{日期}}    →   (无匹配)     ⚠️ 将使用当前日期
══════════════════════════════
数据行数:50 行
将生成:50 份文档

Step 3: 批量生成

pip install python-docx openpyxl 2>/dev/null || pip3 install python-docx openpyxl 2>/dev/null
from docx import Document
from openpyxl import load_workbook
from datetime import datetime
import os
import re
import csv

def mail_merge(template_path, data_path, output_dir=None,
               filename_pattern='{{姓名}}', date_str=None):
    """
    邮件合并:模板 + 数据源 → 批量文档

    参数:
        template_path: Word模板路径(含{{变量}}标记)
        data_path: 数据源路径(.xlsx 或 .csv)
        output_dir: 输出目录(默认 ./merged_output/)
        filename_pattern: 输出文件名模式(可含变量)
        date_str: 日期字符串(用于{{日期}}变量)
    """
    if not output_dir:
        output_dir = './merged_output'
    os.makedirs(output_dir, exist_ok=True)

    if not date_str:
        date_str = datetime.now().strftime('%Y年%m月%d日')

    # 读取数据源
    records = []
    if data_path.endswith('.csv'):
        with open(data_path, 'r', encoding='utf-8-sig') as f:
            reader = csv.DictReader(f)
            records = list(reader)
    else:
        wb = load_workbook(data_path)
        ws = wb.active
        headers = [cell.value for cell in ws[1]]
        for row in ws.iter_rows(min_row=2, values_only=True):
            if any(v is not None for v in row):
                record = {}
                for h, v in zip(headers, row):
                    if h:
                        record[h] = str(v) if v is not None else ''
                records.append(record)

    # 扫描模板变量
    template_doc = Document(template_path)
    template_vars = set()
    for para in template_doc.paragraphs:
        template_vars.update(re.findall(r'\{\{(.+?)\}\}', para.text))
    for table in template_doc.tables:
        for row in table.rows:
            for cell in row.cells:
                template_vars.update(re.findall(r'\{\{(.+?)\}\}', cell.text))

    generated = []
    for i, record in enumerate(records):
        doc = Document(template_path)

        # 添加内置变量
        record.setdefault('日期', date_str)
        record.setdefault('序号', str(i + 1))

        # 替换段落中的变量
        for para in doc.paragraphs:
            for var_name in template_vars:
                placeholder = '{{' + var_name + '}}'
                if placeholder in para.text:
                    # 保持格式的替换
                    for run in para.runs:
                        if placeholder in run.text:
                            run.text = run.text.replace(
                                placeholder,
                                record.get(var_name, '')
                            )

        # 替换表格中的变量
        for table in doc.tables:
            for row in table.rows:
                for cell in row.cells:
                    for para in cell.paragraphs:
                        for var_name in template_vars:
                            placeholder = '{{' + var_name + '}}'
                            if placeholder in para.text:
                                for run in para.runs:
                                    if placeholder in run.text:
                                        run.text = run.text.replace(
                                            placeholder,
                                            record.get(var_name, '')
                                        )

        # 生成文件名
        fname = filename_pattern
        for var_name in template_vars:
            fname = fname.replace(
                '{{' + var_name + '}}',
                record.get(var_name, '')
            )
        fname = re.sub(r'[\\/:*?"<>|]', '_', fname)
        output_path = os.path.join(output_dir, f'{fname}.docx')

        doc.save(output_path)
        generated.append(output_path)

    return generated

# 使用示例
# files = mail_merge('template.docx', 'data.xlsx',
#                    filename_pattern='入职通知_{{姓名}}')

Read the full file on GitHub · 255 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 255 lines · 100 tokens per session scan A 4f3622bf95a0

Subscribe to this mod's changes

wps-mail-merge is a skill published in the GitHub repository Bwkyd/wps-skills (8 stars, last pushed 4mo ago), licensed MIT. It adds 100 tokens to every session and 2,029 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

xlsx

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or…

lingxling/awesome-skills-cn · 201 tokens

xlsx

Create, edit, analyze, or convert Excel spreadsheets (.xlsx, .xlsm, .xltx) where the workbook file is the primary deliverable. Use for formulas, formatting, financial models, multi-sheet workbooks, and tabular cleanup exported to Excel. Also applies to .csv/.tsv when the user wants spreadsheet output. Do NOT use for…

K-Dense-AI/scientific-agent-skills · 94 tokens

document-generation

Generate Word (.docx), Excel (.xlsx) and PowerPoint (.pptx) documents and fill existing PDF forms, from real NetClaw data, with per-element provenance and no fabrication. Use when someone needs a deliverable rather than an answer — a change record to attach to a CR, an audit workbook for a compliance reviewer, a…

automateyournetwork/netclaw · 91 tokens

google-sheets

Read and write Google Sheets spreadsheets - get content, update cells, append rows, fetch specific ranges, search for spreadsheets, and view metadata. Use when user asks to: read a spreadsheet, update cells, add data to Google Sheets, find a spreadsheet, check sheet contents, export spreadsheet data, or get cell…

sanjay3290/ai-skills · 81 tokens

ifc-to-excel

Convert IFC files (2x3, 4x1, 4x3) to Excel databases using IfcExporter CLI. Extract BIM data, properties, and geometry without proprietary software.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 45 tokens

dgn-to-excel

Convert DGN files (v7-v8) to Excel databases. Extract elements, levels, and properties from infrastructure CAD files.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 32 tokens