Kordoc detect format
Use when identifying whether a Korean document file is HWP, HWPX, PDF, or unknown with `npx` and kordoc. Trigger for triage requests such as checking file type before parsing, validating uploads, routing mixed office files, or using `kordoc:detect_format` on local documents.From its SKILL.md
npx -y skills add composite/korean-skills --skill kordoc-detect-formatAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 1 command, including `npm exec --yes --package=kordoc --package=pdfjs-dist -- node`.
SKILL.md
1.9 KB, 425 tokens by cl100k_base, as published. Nobody here has run it
kordoc: detect_format
Reproduce the detect_format logic from src/mcp.ts: read only the header, then call detectFormat.
Input Requirements
- Require exactly one target file.
- Require the user to attach the file or provide a concrete local path.
- Prefer supported document candidates:
.hwp,.hwpx,.pdf. - Do not proceed if the file is missing.
Command
npm exec --yes --package=kordoc --package=pdfjs-dist -- node <<'SCRIPT'
const p = require("path"), fs = require("fs");
const nmBin = process.env.PATH.split(p.delimiter).find(d => d.endsWith(".bin"));
const kUrl = "file:///" + p.join(p.resolve(nmBin, ".."), "kordoc", "dist", "index.js").split(p.sep).join("/");
import(kUrl).then(k => {
const filePath = "/abs/path/document.hwpx";
const fd = fs.openSync(filePath, "r");
const header = Buffer.alloc(4);
try { fs.readSync(fd, header, 0, 4, 0); } finally { fs.closeSync(fd); }
const ab = header.buffer.slice(header.byteOffset, header.byteOffset + header.byteLength);
console.log(k.detectFormat(ab));
}).catch(e => { console.error(e); process.exit(1); });
SCRIPT
Workflow
- Resolve the file to an absolute path.
- Read only the first 4 bytes (the magic bytes
detectFormatinspects). - Return only
hwp,hwpx,pdf, orunknown. - If the type is supported, move to the matching kordoc skill.
Guardrails
- Do not infer type from the filename alone.
- If the result is
unknown, stop and report that rather than trying to parse anyway. - Keep the answer short unless the user asked for diagnostics.
- Refuse to continue when no file was provided.
What ships with it: 1 file
226 B alongside SKILL.md
agents/
- openai.yaml226 B