# 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.

- **Type:** Skill
- **Install:** `agentstack add skill-composite-korean-skills-kordoc-detect-format`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [composite](https://agentstack.voostack.com/s/composite)
- **Installs:** 0
- **Category:** [Content & Media](https://agentstack.voostack.com/c/content-and-media)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [composite](https://github.com/composite)
- **Source:** https://github.com/composite/korean-skills/tree/jumo/skills/kordoc-detect-format

## Install

```sh
agentstack add skill-composite-korean-skills-kordoc-detect-format
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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

```bash
npm exec --yes --package=kordoc --package=pdfjs-dist -- node  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

1. Resolve the file to an absolute path.
2. Read only the first 4 bytes (the magic bytes `detectFormat` inspects).
3. Return only `hwp`, `hwpx`, `pdf`, or `unknown`.
4. 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.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [composite](https://github.com/composite)
- **Source:** [composite/korean-skills](https://github.com/composite/korean-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-composite-korean-skills-kordoc-detect-format
- Seller: https://agentstack.voostack.com/s/composite
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
