Convert an Agent Skill into a formatted document (PDF, DOCX, or HTML). Use this skill when the user wants to generate a document from a specific Agent Skill's content, including its SKILL.md and referenced markdown files. Triggers on keywords: "skill to document", "スキルをドキュメント化", "ドキュメント生成", "スキルからPDF", "スキルからWord", "スキルからHTML", "generate document from skill", "convert skill to PDF", "convert skill to DOCX", "convert skill to HTML". Supports PDF (via fpdf2), DOCX (via python-docx), and HTML (built-in). All formats are always available. Defaults to HTML when no format is specified.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Convert an Agent Skill into a formatted document (PDF, DOCX, or HTML). Use this skill when the user wants to generate a document from a specific Agent Skill's content, including its SKILL.md and referenced markdown files. Triggers on keywords: "skill to document", "スキルをドキュメント化", "ドキュメント生成", "スキルからPDF", "スキルからWord", "スキルからHTML", "generate document from skill", "convert skill to PDF", "convert skill to DOCX", "convert skill to HTML". Supports PDF (via fpdf2), DOCX (via python-docx), and HTML (built-in). All formats are always available. Defaults to HTML when no format is specified.
license
MIT No Attribution
metadata
{"author":"aws-jp-fsi-sa","version":"2.0"}
Skill to Document
Convert an Agent Skill package into a professionally formatted PDF, DOCX, or HTML document.
Read the skill's SKILL.md and all referenced markdown files, build a logical table of
contents, and output a complete document in Japanese.
OS: macOS or Windows (Japanese system fonts are auto-detected)
The bundled Python scripts (scripts/) handle PDF and DOCX generation using fpdf2 and
python-docx respectively. Dependencies are managed via scripts/pyproject.toml and
automatically installed on first run by uv.
Execution Guidelines
Execute this skill as a subagent when possible to avoid consuming the caller's context.
Use extended thinking (ultrathink / super think) for all processing steps due to complexity.
Supported Output Formats
All three output formats are always available — no external skill dependencies required:
HTML — Built-in, no additional tools required. Uses bundled assets/style-template.css.
PDF — Generated by scripts/generate_pdf.py using fpdf2 with OS-native Japanese fonts.
DOCX — Generated by scripts/generate_docx.py using python-docx with book-quality styling.
Architecture
This skill uses an HTML-centric approach:
Agent (Steps 1-7)
│
▼ Always generates HTML first (Step 7)
├── HTML format requested → output .html + style.css directly
├── PDF format requested → pass HTML to scripts/generate_pdf.py → .pdf
└── DOCX format requested → pass HTML to scripts/generate_docx.py → .docx
The agent always produces HTML as the intermediate representation. For PDF and DOCX,
the generated HTML file is passed to the corresponding Python script for conversion.
Workflow
Execute these steps in order. Stop and return control on any fatal error.
Step 1: Determine Output Format
User explicitly specified format?
├─ Yes (pdf) → use PDF
├─ Yes (docx) → use DOCX
├─ Yes (html) → use HTML
└─ No → use HTML (default)
All formats are always available. No availability check is needed.
Step 2: Locate the Target Skill
Identify the skill to document:
Local skill: Resolve the SKILL.md path from the skill name and known skill directories.
Remote skill (URI): Fetch the SKILL.md content from the given URI. If fetch fails, output the error and stop:
Optionally, pass --template <path> to use a custom DOCX template from assets/.
Important: The --project <scripts-dir> option tells uv run to resolve dependencies from the pyproject.toml in that directory.
Do not use shell-specific syntax (e.g., bash). The commands must work on both macOS and Windows.
If the final format is PDF or DOCX, the intermediate HTML file and style.css may be
retained or removed based on user preference.
Output Location
All output files are placed in a subdirectory named after the target skill:
<output-base>/<skill-name>/
├── <skill-name>.pdf # if PDF format
├── <skill-name>.docx # if DOCX format
├── <skill-name>.html # if HTML format (or retained as intermediate)
├── style.css # if HTML format
└── images/ # if HTML format and images exist
└── ...
If the user specified an output directory, use it as the base. The skill-name subdirectory is created within it.
Otherwise, determine an appropriate writable directory from the current context (e.g., ~/work/ or the project's output directory) as the base.
Step 9: Verify Output
Confirm the generated file(s):
Output subdirectory <skill-name>/ exists at the expected path.
Main file exists and file size is greater than 0 bytes.
For PDF: verify it starts with %PDF header bytes.
For DOCX: verify the file is a valid ZIP archive (DOCX is ZIP-based).
For HTML: verify both <skill-name>.html and style.css exist and are non-empty.
Step 10: Report Completion
On success, return the following to the caller:
ドキュメント生成が完了しました。
ファイル名: <filename>
パス: <absolute path to output subdirectory>
ファイルサイズ: <size in human-readable format>
Clean up any remaining temporary files before returning.