formkit-core-skilld

在编写、调试或审查导入 @formkit/core 的代码时使用,针对 FormKit 的框架无关核心(节点树、值、事件、钩子、消息存储、账本、配置、模式类型、表达式编译器)。提供正确的 2.1.x API 签名、常见任务示例、行为规则和版本限制。

仓库最近推送
GitHub Stars
187
Forks
10
Issues / PRs
2

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "formkit-core-skilld":https://skillpi.com/zh/skills/deepskill-cd8da1d05a244d1b57e4b0fda87d8145499d11d32dc5c90d9ca24ab4cf79a1a0。安装前核对上游来源和版本:https://github.com/skilld-dev/vue-ecosystem-skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

在编写、调试或审查导入 @formkit/core 的代码时使用,针对 FormKit 的框架无关核心(节点树、值、事件、钩子、消息存储、账本、配置、模式类型、表达式编译器)。提供正确的 2.1.x API 签名、常见任务示例、行为规则和版本限制。

0 下载

介绍来源: third_party · skilld-dev · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: formkit-core-skilld
description: Use whenever writing, debugging, or reviewing code that imports @formkit/core — FormKit's framework-agnostic core (node trees, values, events, hooks, message stores, ledgers, config, schema types, expression compiler). Provides correct 2.1.x API signatures, common-task examples, behavioral rules, and version limits.
license: MIT

@formkit/core 2.1.2

Framework-agnostic core of FormKit. Every input, group, list, and form is a FormKitNode in a tree. Vue and React adapters (@formkit/vue, @formkit/react) render these nodes; input types, validation, and i18n live in sibling packages, not here. Scope this Skill to @formkit/core imports only.

When to use another package

Need Package
<FormKit> components, defaultConfig, createInput @formkit/vue / @formkit/react
Input type definitions (text, select…) @formkit/inputs
Validation rules @formkit/validation
Locale messages @formkit/i18n
Schema rendering @formkit/vue (types + compiler are here)

Public API

Runtime exports (dist/index.mjs:1919): bfs, clearErrors, compile, createClasses, createConfig, createMessage, createNode, createPlaceholder, createValue, deregister, error, errorHandler, generateClassList, getNode, isComponent, isConditional, isDOM, isList, isNode, isPlaceholder, isSugar, names, register, reset, resetCount, resetRegistry, setErrors, stopWatch, submitForm, sugar, use, useIndex, valueInserted, valueMoved, valueRemoved, warn, warningHandler, watchRegistry, FORMKIT_VERSION — plus ~70 public types (dist/index.d.mts:2329).

Common tasks

Create a node tree

import { createNode } from '@formkit/core'

const email = createNode({ name: 'email' })
const form = createNode({
  type: 'group',            // 'input' (default) | 'group' | 'list'
  children: [email, createNode({ name: 'password' })],
})
form.at('email')            // → the email node

Group values are objects keyed by child name; list values are arrays keyed by child index (dist/index.mjs:714-723). Full option table: node API.

Set a value and await settlement

await email.input('sam@example.com')  // debounced, async commit
email.value                            // committed value

Never assign node.value = x directly. input() debounces (default 20 ms on input nodes, dist/index.mjs:1255-1267), then commits through the commit hook (dist/index.mjs:759-765). await node.settled resolves when the whole subtree finished committing (dist/index.d.mts:1856-1860).

Listen to events (and clean up)

const receipt = form.on('commit.deep', ({ payload }) => { ... })
// later:
form.off(receipt)

.deep catches events bubbling from descendants (dist/index.mjs:47-53). on() returns a receipt; always pass it to off(). Core event table: events and hooks.

Register hook middleware

node.hook.commit((value, next) => next(transform(value)))

Middleware signature is (payload, next) => next(payload); hooks: classes, commit, error, setErrors, init, input, message, prop, text, schema (dist/index.d.mts:579-600). Register inside plugins for reuse.

Write a plugin

import { createNode } from '@formkit/core'
import type { FormKitPlugin } from '@formkit/core'

const colorize: FormKitPlugin = (node) => {
  node.props.color = node.type === 'group' ? 'yellow' : 'teal'
  // return false to stop inheritance by children
}
createNode({ type: 'group', plugins: [colorize], children: [createNode()] })

Plugins are inherited by descendants and run once per node. Attach plugin.library to define custom input types via node.define().

Store a message; count with the ledger

import { createMessage, createNode } from '@formkit/core'

const node = createNode()
node.store.set(createMessage({ key: 'limit', value: 'Too many!' }))
node.store.limit.value                       // 'Too many!'
node.ledger.count('visible', (m) => m.visible)
node.on('count:visible', ({ payload }) => console.log(payload))

Details: store and ledger.

Reach a node by id

import { createNode, getNode, watchRegistry, stopWatch } from '@formkit/core'

const node = createNode({ props: { id: 'manufacturer' } }) // root nodes register
getNode('manufacturer')                    // FormKitNode | undefined
const receipt = watchRegistry('manufacturer', (e) => { ... })
stopWatch(receipt)

Root nodes (or nodes with props.alias) register automatically (dist/index.d.mts:2220-2228). Details: registry and helpers.

Set errors, reset, submit

import { setErrors, clearErrors, reset, submitForm } from '@formkit/core'

setErrors('myForm', 'Server rejected', { email: ['Already taken'] })
reset('myForm', { email: '' })   // resetTo becomes the new initial value
clearErrors('myForm', true)      // true clears children too
submitForm('myForm')             // dispatches a submit DOM event

Compile a schema expression

import { compile } from '@formkit/core'

const condition = compile("$name == 'bob'").provide((tokens) => {
  return { name: () => nameRef.value }   // each token must return a function
})
condition()  // false

Operators: && || == != === !== > < >= <= + - * / % (dist/index.mjs:1574-1598). Schema node types and guards: schema and compiler.

Behavioral rules that prevent bugs

  • Read config through node.props, not node.config; explicit props and parent config are merged into props (dist/index.d.mts:729-792).
  • Setting a root config property emits config:{prop} on the origin and prop / prop:{prop} on every inheriting node that does not override it (dist/index.mjs:1283-1289).
  • group nodes require object values, list nodes require arrays; violations throw error 107 / 108 (dist/index.mjs:745-757).
  • Messages are immutable (Readonly<FormKitMessageProps>, dist/index.d.mts:70-75); replace via store.set(), never mutate.
  • node.walk() traverses the subtree without the node itself and is expensive; reserve it for rare lifecycle moments (dist/index.d.mts:1885-1890).
  • Avoid two same-name siblings under one parent; if unavoidable, sync them with config.mergeStrategy = { fieldName: 'synced' } (dist/index.d.mts:721-725).
  • node.root traverses on every read; do not call it in hot paths (dist/index.d.mts:1840-1843).
  • Replace core error handling by registering middleware on the exported errorHandler / warningHandler dispatchers (dist/index.d.mts:2151-2157).

Version limits

  • Written against @formkit/core@2.1.2 (published 2026-07-24).
  • 2.x changes since 2.0.0 are bug fixes in reset, registry cleanup, and the compiler; no core API breaks. See API changes.
  • FORMKIT_VERSION is a build-time placeholder ("__FKV__") in the prepared source; do not branch on it (dist/index.d.mts:2321-2327).

References

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 为前端开发者在编写、调试或审查 @formkit/core 代码时提供高价值的 API 参考和最佳实践
触发精准90/100

亮点

  • 触发词精准完整,明确限定于 @formkit/core 导入场景,边界清晰
结构规范95/100

亮点

  • 结构清晰,包含完整的示例、行为规则和版本限制,frontmatter 完整
执行可靠90/100

亮点

  • 工具来源明确,参数正确,覆盖主要异常,并提供防止 bugs 的行为规则
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • formkit.com

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。