> ## Documentation Index
> Fetch the complete documentation index at: https://harisfazillah.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How-To: Check and Apply OKF Compliance

> This guide explains how to audit, standardise, and auto-correct Markdown files to ensure compliance with the Open Knowledge Format (OKF v0.1).

This guide explains how to audit, standardise, and auto-correct Markdown files to ensure compliance with the **Open Knowledge Format (OKF v0.1)**.

## Prerequisites

* **Python 3.12+** and **`uv`** must be installed on your environment.
* **`pyyaml`** dependency is required.

## Step 1: Scan and standardise directory frontmatter

Run the `apply_okf_frontmatter.py` tool pointing directly to your documentation folder. This script automatically injects the five required frontmatter variables (`okf_version`, `type`, `title`, `timestamp`, `topics`) and strips Byte Order Marks (BOM).

```bash theme={null}
uv run --with pyyaml python tools/apply_okf_frontmatter.py docs/

```

## Step 2: Batch re-order metadata fields

To format skill schemas or re-align metadata ordering (placing `topics` immediately after `description` in skill documents), use the `refactor_okf.py` tool.

### Dry run check

Verify planned modifications without making changes on disk:

```bash theme={null}
uv run --with pyyaml python tools/refactor_okf.py docs/ --dry-run

```

### In-place execution

Apply standard formatting and reordering rules atomically:

```bash theme={null}
uv run --with pyyaml python tools/refactor_okf.py docs/

```

## Step 3: Verify the output

To confirm that the changes were executed successfully and no Byte Order Marks remain, use the standard test suite:

```bash theme={null}
uv run --with pyyaml --with pytest pytest tests/test_okf_frontmatter_bom_reorder.py

```

***

*Deep State of Mind (DSOM) For My AI Protocol | Harisfazillah Jamel (LinuxMalaysia) | 2026-08-14*
*Standard: UK English | DBP-standard Bahasa Melayu Malaysia (Piawai) | GNU General Public License v3.0*


## Related topics

- [How-To Guides Index](/how-to/index.md)
- [Reference: apply_okf_frontmatter.py](/reference/apply_okf_frontmatter.md)
- [🌐 OKF v0.2 Migration & Compliance Standard Skill](/skills/okf-v02-adoption-engineer.md)
- [OpenWiki Knowledge Graph Compiler Skill](/skills/openwiki-compiler.md)
- [okf-frontmatter-injector](/skills/okf-frontmatter-injector.md)
