jkf87/hwpx-skill

AI 에이전트용 HWPX(.hwpx) 문서 생성 스킬 - 한컴오피스 한글 문서를 마크다운/텍스트/URL에서 자동 생성

What it solves

Working with Korean HWP (Hangul Word Processor) and HWPX (its XML-based format) files is notoriously hard for software automation because the format is proprietary and layout-heavy. This project gives AI agents like Claude and Codex a reliable set of tools to create brand-new documents, fill in existing forms, clone templates, read text, and convert old HWP files into the more modern HWPX format — without breaking tables, images, or styling. It also handles strict government paperwork by generating documents that follow the official South Korean administrative standards (e.g. the standard official letter form) and even lints them for common writing mistakes.

How it works

The skill is a set of Python scripts plus a decision guide (SKILL.md) that the AI agent follows. For converting HWP to HWPX, it uses a dual-engine approach: on Windows it drives the installed Hancom Office application directly through a PowerShell script (via COM automation) for fast, accurate batch conversion, while on other operating systems it falls back to a fixed Node.js/WASM runtime called rhwp. After any XML editing or text replacement, it runs mandatory post-processing steps: fix_namespaces.py repairs XML namespaces, finalize_hwpx.py removes stale layout caches and flags likely layout risks (like overly long table-cell paragraphs), and validate.py checks structural integrity, with an optional --hancom flag to test whether the file actually opens in Hancom on Windows. For one-shot document creation, it takes a JSON specification (covering types like official letters, brief reports, and plan reports), builds the internal XML, and verifies the output, discarding failed candidate files so only clean results reach the output path. Form filling is done conservatively via fill_hwpx.py, which uses label recognition to patch only the necessary ZIP entries while preserving everything else.

Who it's for

This is for developers, AI automation engineers, and organizations that need to integrate Korean office document workflows into AI agents. It is especially relevant for South Korean public sector institutions that must produce standardized official letters (gonmun), press releases, and business plans, as well as for educational content creators using tools like K-Teacher to convert HTML activity sheets into fully editable HWPX files. If you regularly handle .hwp files and need to extract text, fill application forms, or generate report cards through an AI assistant, this toolkit is designed to make that process safe and deterministic.

Highlights

  • Deterministic one-shot generation: Produces high-quality official letters, brief reports, and plan reports from a versioned JSON spec, ensuring byte-identical outputs for the same environment and inputs, and never exposing failed candidates to the output folder.
  • 100% format preservation on clone: The clone_form.py script copies reference templates (e.g. a real government press release) so that tables, logos, and fonts remain fully intact, while only replacing body text and headers.
  • Government-standard document support: Generates the Ministry of the Interior and Safety standard official letter form (gonmun) with automatic checks for date, time, amount, and other writing conventions based on the 2025 administrative handbook.
  • Privacy-safe form filling: Includes secure_fill.py, which fills forms containing personal information (PII) without the values ever passing through stdout, logs, or the model context — they go straight from a profile file into the document.
  • Dual-path HWP conversion: On Windows it leverages the real Hancom Office storage engine via COM for fast batch conversion; elsewhere it uses a pinned rhwp WASM fallback, with both paths restructured to fix images, margins, and line-layout caches before strict validation.
  • Strict quality gates: The skill enforces mandatory post-processing and validation steps, including a check --strict mode, to prevent corrupted files or awkward layout issues from being delivered to end users.

Related

  • Project
  • Project
  • Project
  • Project