home / skills / aaaaqwq / agi-super-skills / docx-perfect

docx-perfect skill

/skills/documents/docx-perfect

This skill converts Word document content into professional, stylized tables with versioned iterations and consistent headers, zebra rows, and borders.

npx playbooks add skill aaaaqwq/agi-super-skills --skill docx-perfect

Review the files below or copy the command above to add this skill to your agents.

Files (5)
SKILL.md
2.1 KB
---
name: docx-perfect
description: Word文档美化与格式化专家。专门用于将Word文档中的文本内容转换为专业表格格式,应用一致的样式(深蓝色表头、斑马纹数据行、边框),支持版本化迭代管理。当用户需要美化Word文档、创建专业表格、或递增式优化文档章节时使用此技能。
---

# DOCX文档美化专家

将Word文档中的内容转换为专业表格格式,支持版本化迭代优化。

## 快速开始

文档美化采用递增式版本管理(v0.1, v0.2, ..., v1.0),每次优化一个章节后生成新版本。

## 工作流程

### 1. 分析源文档

```bash
python -c "import sys; sys.stdout.reconfigure(encoding='utf-8'); from docx import Document; doc = Document('source.docx'); [print(p.text.strip()) for p in doc.paragraphs if p.text.strip()]"
```

### 2. 确定本次优化的章节

识别需要美化的章节标题,如:
- `3.1  实体识别` → 创建实体属性表格
- `3.2  实体间联系` → 创建联系关系表格
- `5.2  索引优化设计` → 创建索引汇总表格

### 3. 创建表格

使用 `scripts/create_table.py` 创建表格,参考下方脚本模板。

### 4. 应用样式

使用统一样式:
- **表头**: 深蓝色背景 (#4472C4) + 白色粗体文字
- **数据行**: 白色/浅灰色隔行变色
- **边框**: 黑色单线边框

### 5. 版本号管理

自动递增版本号,保存为新文件:`文档名-v0.X.docx`

## 脚本模板

详见 `scripts/README.md`

## 常见表格模式

### 实体属性表格

```
| 属性名 | 类型/约束 | 说明 |
|--------|-----------|------|
| field1 | INT, PK   | 主键   |
```

### 联系关系表格

```
| 联系 | 实体A | 实体B | 说明 |
|------|-------|-------|------|
```

### 索引汇总表格

```
| 表名 | 索引名 | 字段 | 类型 | 说明 |
```

## 样式规范

- **表头背景**: `#4472C4` (深蓝)
- **表头文字**: 白色、粗体、11号
- **奇数行**: 白色 `#FFFFFF`
- **偶数行**: 浅灰 `#E7E6E6`
- **数据行文字**: 宋体、10号
- **边框**: 黑色单线,4磅

Overview

This skill converts Word document content into professional, consistently styled tables and manages incremental versioned improvements. It focuses on transforming selected sections into formatted tables with a deep-blue header, zebra-striped rows, and clear borders. Versioning is automatic so each iterative beautification produces a new file like filename-v0.X.docx.

How this skill works

The skill analyzes the source .docx to extract paragraphs and identify target section headings for conversion. It maps section types (entity attributes, relationships, index summaries) to table templates and populates table rows from the section content. Styling rules are applied programmatically: deep-blue header, white/gray zebra rows, font sizing, and black borders. After each pass the version number is incremented and a new file is saved.

When to use it

  • You need to convert narrative or list-style sections into structured tables for readability.
  • You want consistent, publication-ready table styles across a Word document.
  • You plan to iteratively improve a document and need each change tracked as a new version.
  • You must create standard tables for entities, relationships, or index summaries.
  • You need automated table creation from multiple similar sections.

Best practices

  • Identify one section per iteration to keep version increments small and reviewable.
  • Standardize source headings (e.g., “3.1 Entity Name”) so the skill reliably maps to table templates.
  • Keep source text simple: one attribute or relationship per line for accurate parsing.
  • Validate a generated table visually before proceeding to the next version.
  • Store generated versions in a predictable naming pattern (document-v0.1.docx) and keep a changelog note in the document.

Example use cases

  • Convert a data model chapter into an entity attribute table with clear columns for name, type/constraints, and description.
  • Turn relationship descriptions into a contact matrix table listing entity A, entity B, relationship type, and notes.
  • Extract index design paragraphs and produce an index summary table for quick review by DBAs.
  • Run an iterative beautification cycle: refine section 3.1, save as v0.2, then refine 3.2 and save v0.3 for traceable improvements.
  • Apply a corporate table style across an inherited document to meet formatting standards before publication.

FAQ

Can the skill modify the entire document at once?

Yes, but recommended workflow is one section per iteration to preserve clear version history and reduce errors.

How are version numbers determined?

Version numbers increment automatically after each successful beautification pass, following v0.1, v0.2, … until v1.0.