Logo Okf Producer Generator

Okf Producer Generator

Cộng đồng
xSAVIKx
okf-producer-generator

Guidance and the bundled OKF specification for building a new Open Knowledge Format (OKF) producer/connector skill in this project — the architectural principles, the okf-go library contract, the produce/ingest/schema command surface, the secret-handling and sync conventions, and the exact registration steps. Use when creating a new OKF connector or producer for a data source the project does not yet cover (e.g. MongoDB, Redis, Kafka, CSV, an HTTP API), scaffolding an okf-* skill, or extending the project to a new source. Instructions-only; no binary required.

Tổng quan

Nhà phát hànhxSAVIKx
Kho mãokf-skills
Tên kỹ năngokf-producer-generator
Sao
38
Bản fork
2
Tệp đi kèm
3
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được xSAVIKx công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Okf Producer Generator trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/xSAVIKx/okf-skills/tree/master/skills/okf-producer-generator
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/xSAVIKx/okf-skills.git /tmp/okf-skills
mkdir -p .claude/skills
cp -r /tmp/okf-skills/skills/okf-producer-generator .claude/skills/okf-producer-generator
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Okf Producer Generator trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Okf Producer Generator ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Okf Producer Generator với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

OKF Producer Skill Generator

This skill teaches a coding agent (Claude Code, Cursor, Gemini CLI, Copilot, …) how to author a new producer for this project: a standalone CLI skill that extracts metadata from a data source into an Open Knowledge Format (OKF) bundle, and ingests/syncs descriptions back. It ships the OKF spec it must conform to, the conventions every existing connector follows, and the exact wiring steps so the new skill builds, tests, and is auto-discovered over MCP.

Google introduced OKF and invited the community to "write a producer, write a consumer." This skill is how you write a producer here — one that matches the six that already exist (okf-sqlite, okf-mysql, okf-postgresql, okf-bigquery, okf-fs, okf-git) instead of reverse-engineering them.

When to Use

Load this skill when asked to:

  • Add a new data source — "make an OKF connector for MongoDB / Redis / Kafka / CSV / an API".
  • Scaffold an okf-* producer skill, or extend the project to a source it doesn't cover.

Do not use it for: reading a bundle (use okf-reader), enriching descriptions (use okf-enrich), or building a consumer that only reads OKF (the spec in okf-SPEC.md is enough for that).

Read the spec first

The format your producer must emit is defined in okf-SPEC.md (bundled here; canonical source is okf-go/okf-SPEC.md). The library API you build against is in okf-go-api.md. Skim both before designing concept types. The rules you will lean on most:

  • A bundle is a directory tree of markdown files with YAML frontmatter.
  • The only required frontmatter field is type; everything else is optional.
  • index.md files carry no frontmatter, except the bundle-root index.md, which may declare only okf_version: "0.2".
  • Consumers are permissive: unknown type values, extra keys, and broken links are all tolerated. Conformance is just "every concept has parseable frontmatter with a non-empty type."

The five principles that define a producer

These are not obvious from reading one connector. Internalize them before writing code.

  1. Deterministic extraction — no embedded LLM. produce and ingest are mechanical: read the source, emit/compare markdown. Never call an LLM inside produce to write descriptions. Emit a deterministic placeholder (e.g. fmt.Sprintf("MongoDB collection %s", name)); the meaning is added later by okf-enrich, which uses the agent's own LLM. (This project deliberately deleted an embedded second model — a model calling a tool that calls another model is redundant cost and usually worse output.)

  2. okf-go is the single source of OKF types. Import it; never redefine Frontmatter or ConceptDoc. Its WriteConceptDoc/ReadConceptDoc and section helpers are what keep your output spec-conformant and round-trippable.

  3. schema is the contract. Implement the schema subcommand and okf-mcp auto-discovers your binary and exposes produce/ingest as MCP tools — no okf-mcp changes ever needed. Secret-bearing flags declare an Env binding so okf-mcp passes them via the environment, never argv.

  4. Always three subcommands: produce, ingest, schema. Register flags on a per-subcommand flag.NewFlagSet(...) — never global flag.Bool(...).

  5. Portable, pure Go. Zero CGO — verify any source driver you add is pure Go (e.g. modernc.org/sqlite not mattn/go-sqlite3; MongoDB's go.mongodb.org/mongo-driver is cgo-free). One binary named okf-<name>. Give the module its full publishable path and require okf-go at its published version — no replace; go.work maps it locally (see below).

Anatomy of a producer skill

skills/okf-<name>/
├── SKILL.md        # frontmatter (spec-compliant) + When to Use / Setup / produce / ingest / schema
├── go.mod          # module github.com/xSAVIKx/okf-skills/skills/okf-<name>; go 1.24.0; require okf-go v0.1.0 (no replace; go.work maps it locally)
├── main.go         # main() router + runProduce + runIngest + source-specific helpers
├── schema.go       # buildSchema() okf.SkillSchema
└── *_test.go       # schema_test.go (asserts name + commands) + a pure-function test

The cleanest starting point is to copy skills/okf-sqlite/ (the minimal, dependency-light reference producer) and adapt it. For a live-server source that needs credentials, also look at skills/okf-mysql/ for the env-secret pattern; for a non-tabular / file-like source, look at skills/okf-fs/ and skills/okf-git/.

Build sequence

1. Map the source to OKF concepts

Decide: the concept type string (e.g. "MongoDB Collection"); the bundle layout (a subdirectory like tables/ for SQL or collections/ for Mongo); and the Resource URI scheme that uniquely identifies each asset (sqlite:///…/orders, bigquery://proj/ds/tbl). Strip any credentials from the URI before putting it in Resource — it is written to disk.

2. Scaffold the module

Copy okf-sqlite to skills/okf-<name>/, then set the module path to github.com/xSAVIKx/okf-skills/skills/okf-<name> in go.mod. Keep the toolchain line and the require github.com/xSAVIKx/okf-skills/okf-go v0.1.0 line exactly as the source skill has them (copy go 1.24.0 verbatim — do not invent a version). There is no per-skill replace; instead register the module in the workspace with go work use ./skills/okf-<name>. Add any pure-Go driver you need.

3. Implement produce

For each asset, build one ConceptDoc and write it with okf.WriteConceptDoc:

go
var body bytes.Buffer
body.WriteString("# Columns\n\n")
body.WriteString("| Name | Type | Primary Key | Nullable | Default |\n")
body.WriteString("| --- | --- | --- | --- | --- |\n")
for _, c := range cols {
    fmt.Fprintf(&body, "| %s | %s | %s | %s | %s |\n",
        okf.SanitizeCell(c.Name), okf.SanitizeCell(c.Type), pk(c), null(c), okf.SanitizeCell(c.Default))
}
bodyStr := body.String()
if *profile { bodyStr = okf.UpsertSection(bodyStr, "Data Profile", okf.RenderProfileSection(profiles)) }
if *sample > 0 { bodyStr = okf.UpsertSection(bodyStr, "Sample", okf.RenderSampleSection(headers, rows)) }

doc := okf.ConceptDoc{
    Frontmatter: okf.Frontmatter{
        Type:        "MongoDB Collection",                 // REQUIRED
        Title:       name,
        Description: fmt.Sprintf("MongoDB collection %s", name), // deterministic placeholder
        Resource:    resourceURI,                          // no credentials
        Tags:        []string{"mongodb", "collection"},
        Generated:   &okf.GeneratedInfo{By: "okf-mongodb/v0.2.0", At: timestamp}, // OKF v0.2 producer identity & ISO datetime
        Timestamp:   timestamp,                             // v0.1 legacy fallback
    },
    Body: bodyStr,
}
okf.WriteConceptDoc(filepath.Join(outDir, "collections", name+".md"), doc)

Then write the bundle-root index.md — the only index with frontmatter, and only okf_version:

go
okf.WriteConceptDoc(filepath.Join(outDir, "index.md"), okf.ConceptDoc{
    Frontmatter: okf.Frontmatter{OKFVersion: "0.2"}, // nothing else
    Body:        indexBody.String(),                 // "# …", then "- [name](collections/name.md) - …" lines
})

Schema-table heading & columns. Emit the schema under a level-1 # Columns heading — use # Columns, not the spec's conventional # Schema (§4.2) — because ingest isolates it with okf.GetSectionAny(body, "Columns"), and the helper-written ## Data Profile / ## Sample are level-2 sections beneath it. The columns are source-defined: emit whatever structural attributes are authoritative for the source (SQL: Name | Type | Primary Key | Nullable | Default; a document store: Name | Type | Presence). If the source has native per-item comments (MySQL, PostgreSQL, BigQuery), add a Comment/Description column and leave its cells empty for okf-enrich to fill; if it does not (SQLite, and most schemaless sources), emit structure only.

4. Implement ingest

Read each concept with okf.ReadConceptDoc. Isolate the schema table before parsing rows so profile/sample rows aren't misread as columns:

go
section := doc.Body
if s, ok := okf.GetSectionAny(doc.Body, "Columns"); ok { section = s }
cols := parseColumns(section)

ingest verifies the bundle against the source; --sync then persists the enriched descriptions back to the source. Where they can go depends on the source — pick from the three patterns this project already uses, and do not invent a new mechanism:

Source has…Where --sync persists descriptionsExamples
A native comment/description storewrite comments via the source's API/DDLokf-mysql/okf-postgresql (COMMENT), okf-bigquery (field descriptions)
No comment store, but is file-rooted.okf-metadata.yaml sidecar via okf.ReadFolderMetadata/WriteFolderMetadataokf-fs, okf-git
No comment store and isn't file-rootednowhere — descriptions stay in the bundle; --sync reconciles only structure (or is validate-only)okf-sqlite (its --sync creates missing tables/columns but cannot store descriptions)

So for a comment-less, non-file source (e.g. MongoDB), descriptions stay in the bundle — make --sync validate-only or structure-only rather than inventing a sidecar collection. (For MySQL specifically, DDL has no placeholders — escape ' and \ before formatting comments into ALTER TABLE … COMMENT.)

5. Implement schema

Return an okf.SkillSchema from buildSchema() (see okf-go-api.md). Declare produce, ingest, schema; mark required flags; and set Env on every secret-bearing flag (password, token, connection URI). Resolve that same env var as a fallback in your command code, and never log secrets or place them in argv or Resource.

6. Tests

Mirror the existing skills: a schema_test.go asserting buildSchema() returns the right Name and the three commands, plus at least one pure-function test (e.g. your column-table parser).

okf-go helpers at a glance

Full reference: okf-go-api.md. Most-used: WriteConceptDoc, ReadConceptDoc, GetSectionAny, UpsertSection, RenderProfileSection/RenderSampleSection, SanitizeCell, ReadFolderMetadata/WriteFolderMetadata, SkillSchema+PrintSchema.

Registration checklist (a producer is a binary skill)

Adding the source files is not enough. Wire it in:

  • skills/okf-<name>/ exists with go.mod (full module path, require okf-go v0.1.0, no replace), main.go, schema.go, SKILL.md, tests.
  • go.work — add ./skills/okf-<name> to the use (…) block (keep it alphabetical).
  • Makefile — add okf-<name> to SKILLS :=.
  • install.sh — add okf-<name> to SKILLS=.
  • skills.sh.json — add okf-<name> to the appropriate groupings entry (every skills/ skill must appear in one).
  • README.md — add a row to the "Available Connectors" table (§1) and to the §8 group table.
  • AGENTS.md — list the directory in the §1 tree.
  • tests/ (recommended) — add an integration test; if you want the shared schema-contract check to cover the binary, add "okf-<name>" to the connectors slice in tests/mcp_integration_test.go. DB sources: add a service to docker-compose.yml and guard the test with a port check so it skips when down.
  • okf-mcp — nothing. Auto-discovered once it builds and answers schema.
  • go mod tidy in the new module, then make build and cd tests && go test -v ..
  • skills-ref validate skills/okf-<name> (frontmatter spec compliance).

SKILL.md frontmatter rules: only name, description, license, compatibility, metadata, allowed-tools are permitted at the top level; put version/author/tags under metadata: as strings (a top-level version: or tags: fails skills-ref validate). name must equal the directory name. Set license: Apache-2.0. compatibility, when present, is a free-text string (e.g. compatibility: Requires the Go toolchain (1.24+) to build the connector binary.) — not a structured object; copy the phrasing from an existing connector. Write description as what it does + when to use it with searchable keywords.

Common mistakes

MistakeFix
Calling an LLM in produce to generate descriptionsproduce is deterministic; write a placeholder, let okf-enrich add meaning
Inventing a new --sync store (e.g. a metadata collection)Reuse one of the three patterns; default to validate-only
Credentials in Resource or on the command lineStrip creds from URIs; bind secrets via FlagSchema.Env; never log them
Redefining Frontmatter/ConceptDoc in the skillImport okf-go
Frontmatter in a subdir index.md, or extra keys in the root index.mdSubdir indexes: none. Root index: okf_version only
Emitting the schema under # Schema (the spec's conventional heading)Use # Columns — ingest parses it via GetSectionAny("Columns")
Parsing the whole body for columns (profile/sample rows leak in)okf.GetSectionAny(body, "Columns") first
A structured compatibility: object in SKILL.mdIt's a free-text string; nest only version/author/tags (under metadata)
Global flag.Bool(...)flag.NewFlagSet(<cmd>, …) per subcommand
CGO SQLite driver, or any cgo depPure-Go drivers (modernc.org/sqlite)
Top-level version:/tags: in SKILL.mdNest under metadata:
Forgetting go.work / Makefile / install.sh / skills.sh.jsonFollow the registration checklist

Verify before you call it done

  1. make build succeeds and produces skills/okf-<name>/okf-<name>.
  2. okf-<name> produce … on a real source emits a bundle where every concept has a non-empty type and the root index.md carries only okf_version.
  3. okf-<name> ingest … round-trips (verifies, and --sync writes to the chosen target).
  4. okf-<name> schema prints valid JSON; okf-mcp --skills-dir <dir> lists okf-<name>__produce / okf-<name>__ingest.
  5. skills-ref validate skills/okf-<name> passes.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Okf Producer Generator làm được gì?

Guidance and the bundled OKF specification for building a new Open Knowledge Format (OKF) producer/connector skill in this project — the architectural principles, the okf-go library contract, the produce/ingest/schema command surface, the secret-handling and sync conventions, and the exact registration steps. Use when creating a new OKF connector or producer for a data source the project does not yet cover (e.g. MongoDB, Redis, Kafka, CSV, an HTTP API), scaffolding an okf-* skill, or extending the project to a new source. Instructions-only; no binary required.

Vì sao nên dùng Okf Producer Generator trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Okf Producer Generator là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Okf Producer Generator trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/xSAVIKx/okf-skills/tree/master/skills/okf-producer-generator. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Okf Producer Generator?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Okf Producer Generator với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Okf Producer Generator với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Okf Producer Generator có miễn phí không?

Có. Kỹ năng này được xSAVIKx phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇