create-bkn
Skill26 starsChanged 4 months agoApache-2.0View on GitHub
Guides creation of BKN (Business Knowledge Network) definition files in either spec version: BKN 3.0 (default) or BKN 2.x. Covers network, value_type, object_type, relation_type, action_type, concept_group, including property declarations (semantic, required, constraints), value types and enums, aliases, relation declarations (reverse name, cardinality, constraints, relation properties), lifecycle and fallback paths. Use when creating knowledge networks, BKN files, object types, relation types, action types, value types, concept groups, or when user asks to model business knowledge in BKN format. When the openbkn skill is also loaded, use it to run the openbkn CLI (auth, bkn push) after files exist.
- Installs packages
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- create-skillSkill
- referencesSkill
- openbknSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
Never mix the two: 2.x readers (no bkn_spec, or a 0.2.0 platform) import 3.0 content without an error, but ### Property Constraints and ### …
- Very specific: line 43
Do not hand-write a CHECKSUM, and delete it when you copy the example and change its files: a stale one only makes push warn, but a package …
- Distinctive: line 157
Keep heading order and column names per spec
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create BKN
Generate well-formed BKN directories (Markdown + YAML frontmatter) in either spec version: BKN 3.0 (default) or BKN 2.x.
Works with the openbkn skill
create-bkn authors the .bkn tree; the openbkn skill runs openbkn auth login and openbkn bkn push / pull after files exist.
What is BKN
BKN is Markdown + YAML frontmatter for schema; one file per definition under typed subfolders. Details (sections, required tables, types, every declaration) live in references/SPECIFICATION.llm.md.
Spec version: 3.0 or 2.x
Pick the spec version before writing anything:
| Write | When | network.bkn | Example |
| BKN 3.0 (default) | Target platform 0.2.1 or later | bkn_spec: "3.0" | references/examples/clinic-lab/ |
| BKN 2.x | The user asks for 2.x, or the target platform only reads 2.x (0.2.0) | no bkn_spec | references/examples/clinic-lab-2.x/ |
- Find the target platform with
openbkn --version: the CLI only talks to a platform of its own version. If the user names a version, use that; if neither the spec nor the platform is known, ask. - A 2.x package is the 3.0 writing minus the 3.0 additions (value types, declarations, aliases, lifecycle, fallback paths); what they would say goes into descriptions. Every platform reads it the same way, including 0.2.1 and later. The rules are in references/SPECIFICATION.llm.md.
- Never mix the two: 2.x readers (no
bkn_spec, or a 0.2.0 platform) import 3.0 content without an error, but### Property Constraintsand### Relation Constraintsbecome description text, value types and aliases are dropped, and fallback paths and deprecated relations become ordinary relations. - 3.0 accepts one way to write each thing. Unknown frontmatter fields, unknown
###sections, unknown or legacy columns and wrappers are rejected on push with the file and position. Write only what the spec lists. - The templates are 3.0; for 2.x drop the 3.0 parts the spec lists.
Directory layout
Do not hand-write a CHECKSUM, and delete it when you copy the example and change its files: a stale one only makes push warn, but a package with object metrics is refused. openbkn bkn pull writes a fresh one.
{network_dir}/
├── SKILL.md
├── network.bkn
├── CHECKSUM # optional; generated on export — do not write or copy one
├── value_types/ # 3.0 only: enums, formats, ranges reused by properties
├── object_types/
├── relation_types/
├── action_types/
├── risk_types/
└── concept_groups/Workflow
- Spec version — 3.0 or 2.x (see Spec version)
- Gather requirements — objects and their key properties, relations (and which ones are reliable), actions, code tables / dictionaries, optional concept groups
- Read spec — references/SPECIFICATION.llm.md (format rules, sections, declarations)
- Pick templates — copy/adapt from assets/templates/
- Create
network.bkn— root file;bkn_spec: "3.0"for 3.0, none for 2.x; title and network description only - Create
value_types/*.bkn(3.0 only) — one per code table (enum), fixed format (pattern / length) or bounded number (range / unit) that properties share - Create
object_types/*.bkn— one file per object,{id}.bkn; for 3.0 declare semantic, required, aliases and constraints - Create
relation_types/*.bkn— one file per relation; for 3.0 declare reverse name, cardinality, constraints; mark helper relationssecondaryand link fallback paths withfallback_for - Create
action_types/*.bkn— one file per action - Create
concept_groups/*.bkn— optional - Add root
SKILL.mdin the BKN directory — same folder asnetwork.bkn(this is not the create-bkn skill file); agent-facing guide for that network (see Delivered BKN: root SKILL.md) - Review (MUST) — cross-check Validation checklist and Business rules placement; fix IDs, cross-refs, headings
- Validate (MUST) —
openbkn bkn validate <dir>(see Validation) - Import (optional) —
openbkn bkn push <dir>
Import (openbkn CLI)
Requires the openbkn CLI from @openbkn/bkn-sdk (npm install -g @openbkn/bkn-sdk; Node.js 22.19.0+). push uses tar; on macOS COPYFILE_DISABLE=1 is set by the tool.
- Platform auth — Don't pre-check with
openbkn auth status; runopenbkn bkn pushdirectly (validateis offline and needs no login). Only when it fails with 401 / not authorized, runopenbkn auth login <platform-url>and retry. - BKN validation — If workflow step 13 (
openbkn bkn validate <dir>) already succeeded for this directory, do not repeat validate beforepushunless you changed.bknfiles. If you have not validated yet, runvalidatebeforepush. - 3.0 rules — a 0.2.1+ platform checks the 3.0 rules on push and names the file, section and field of each problem. Fix the file and push again. A 2.x package is read with the 2.x rules on every platform.
- Tools — every toolbox or MCP tool an action or logic property references must exist on the target platform, or push fails listing the missing tools. To import the model without them, push with
--binding-policy detachand bind the tools on the platform afterwards.
openbkn bkn push <dir> [--branch main] [--binding-policy detach]Export: openbkn bkn pull <kn-id> [<dir>]. More subcommands: openbkn bkn --help (see the openbkn skill if loaded).
Validation
openbkn bkn validate <dir> — must pass before delivery or upload. It is an offline structural check: it loads network.bkn and sibling .bkn files, checks frontmatter, ids, table shape and relation endpoints, and prints counts (object types, relation types, concept groups, value types). The 3.0 declaration rules are checked by the platform on push; follow the spec to get them right the first time.
A capabilities: section in network.bkn never fails validation. Read capabilities.skipped and the warnings instead: an entry listed there binds on no platform. After push, the answer's capabilities.skipped names what this platform could not resolve.
Per-type reference
| Kind | Template | Example (clinic-lab, 3.0) |
| Network | network_type.bkn.template | network.bkn |
| Value type | value_type.bkn.template | lis_apply_status.bkn (enum), cn_id_card.bkn (format), amount_cny.bkn (range) |
| Object | object_type.bkn.template | lab_order.bkn, patient.bkn |
| Relation (direct) | relation_type.bkn.template | order_for_patient.bkn, department_under.bkn (self, transitive) |
| Relation (indirect, with properties) | relation_type_indirect.bkn.template | doctor_in_department.bkn |
| Fallback path / lifecycle | — | order_for_patient_by_id_card.bkn, order_by_legacy_doctor.bkn |
| Action | action_type.bkn.template | revoke_lab_order.bkn |
| Concept group | concept_group.bkn.template | lab.bkn |
Templates are complete 3.0 files: replace every {placeholder}, and delete rows, columns, keys or sections you do not need (a column no property uses, such as Semantic or Aliases, is left out whole). Full rules and optional sections: references/SPECIFICATION.llm.md.
Declarations: when to use what
- Code table / dictionary (status codes, department codes) → enum value type, referenced with
value_type. Keep retired codes withdeprecated: true: stored data still holds them. - Shared format or range (ID card number, amount ≥ 0) → format / range value type. A property that references a value type writes no
range/length/pattern/unitof its own. - One-off constraint → inline in
### Property Constraints. - Time and place →
Semantic(event_time,end_time,valid_from,valid_to,location,latitude/longitude), plustimezone/crswhen known. - Other names users call it →
aliases(definitions) and theAliasescolumn (properties). - Relations →
reverse_namewhen the reverse reads differently;Cardinalitywhenever known;requiredfor "every X has a Y";verification: unconfirmedfor inferred links;importance: secondary+fallback_forfor a path that fills gaps of a primary relation. - Retiring a definition →
lifecycle: { status: deprecated, reason, replaced_by }, never a name prefix like "【废弃】". - BKN 2.x → none of the above exists; write what they would say in the descriptions (codes and meanings, units, time zone, "also called …", matching rules), leave out fallback-path and deprecated definitions. The table is in the spec.
Naming conventions
- ID: lowercase, digits, underscores; file:
{id}.bknunder the matching folder - Headings:
#network title,##definition (## ObjectType: {name},## ValueType: {name}, …),###section,####logic property - Frontmatter:
type,id,name, plus only the fields the spec lists for that type
Business rules placement
Rules must sit in spec-defined places so import persists them. Full wording: references/SPECIFICATION.llm.md.
- Network-level — prose in
network.bknright after# {title} - Type-level — prose in each type file after
## ObjectType:/## RelationType:/ … and before the first###; never in frontmatter - Property-level — what a declaration can say (semantic, required, unit, enum, format, range) goes in the declaration; the Description column keeps only business meaning, calculation and caveats
- No extra sections — 3.0 rejects unknown
###sections and frontmatter fields
Validation checklist
- Spec version chosen; 3.0:
network.bknhasbkn_spec: "3.0"; 2.x: nobkn_spec, novalue_types/, no 3.0 fields, columns or sections network.bknat root; body is only the title and description- Every
.bknhas valid YAML frontmatter (type,id,name) and no fields outside the spec - Files live under folders matching
type(value_types/,object_types/, …); filename ={id}.bkn;## {Prefix}: {name}matchesname - Relations, actions, concept groups,
value_type,fallback_forandreplaced_byreference ids defined in the package Semanticvalues fit the propertyTypeand appear at most once per definition;end_timehas anevent_time;latitude/longitudecome in pairs- Primary keys leave
Requiredempty; noRequired: false,importance: primaryorlifecycle.status: activewritten out - A property with
value_typehas norange/length/pattern/unit - Parameter tables put
property|input|constinValueFrom, the property name or constant inValue, and the request position (Query/Body/ …) inSource - Condition YAML is written directly (no
condition:wrapper); every YAML block parses - Heading hierarchy has no skipped levels; no HTML comments or notes left inside sections
- Business rules only in allowed places (see Business rules placement)
Output rules
- Emit raw
.bkncontent — do not wrap the whole file in a fencedmarkdownblock - Reuse IDs consistently across relations/actions/value types
- IDs: lowercase + underscores; display text Chinese unless asked otherwise
- Keep heading order and column names per spec
Examples
- references/examples/clinic-lab/ — BKN 3.0: value types, property declarations, aliases, relation declarations and properties, lifecycle, fallback path, action, concept group
- references/examples/clinic-lab-2.x/ — the same network in BKN 2.x: no 3.0 declarations, their content in descriptions
Delivered BKN: root SKILL.md
When you build a knowledge network directory {network_dir}/, add {network_dir}/SKILL.md at the root (alongside network.bkn). Short overview + index tables with file paths (value type | object | relation | action | path) so agents route to the right .bkn without scanning, and how to use the declarations (enum codes, fallback paths, deprecated definitions). Example: references/examples/clinic-lab/SKILL.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

