All skills
skilld-dev avatar

/formkit-core-skilld

@b9c39cb

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.

Use this Skill: https://skilld.dev/gh/skilld-dev/vue-ecosystem-skills/formkit-core-skilld

This session only. Nothing lands on disk.

referencesregistry-helpers.md

≈960 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Registry and id-based helpers

Registry

Only root nodes, or nodes with an explicit props.alias, are registered — register() is idempotent otherwise (dist/index.d.mts:2220-2228).

Export Purpose
register(node) / deregister(node) add/remove from the registry
getNode<T>(id): FormKitNode<T> | undefined lookup by id (dist/index.d.mts:2246)
watchRegistry(id, callback): string fire when the id registers/unregisters; returns a receipt (dist/index.d.mts:2254-2261)
stopWatch(receipt) remove a registry watcher (dist/index.d.mts:2263-2266)
resetRegistry() deregister everything, drop watchers (dist/index.d.mts:2248-2252)

Registration events are emitted on the registry's own emitter (dist/index.mjs:460-481); watchRegistry is how you catch nodes created later (SSR, lazy mounts). v2.1.2 fixed registry cleanup for parentless nodes (GitHub release v2.1.2, core: "Remove parentless nodes").

Test hygiene: call resetRegistry() (and resetCount() for deterministic names) between test cases.

setErrors / clearErrors

Module-level helpers operate by node id:

setErrors('myForm', 'Wrong', { email: ['Taken'] })  // local + child errors
clearErrors('myForm', true)                         // clear children too

ErrorMessages = string | string[] | Record<string, string | string[]> (dist/index.d.mts:177). Child errors route through store.apply() child addressing, buffering until the target child exists. Node-level equivalents: node.setErrors(local, child?), node.clearErrors(clearChildren?, sourceKey?) (dist/index.d.mts:1855,1760).

reset

reset('myForm')               // back to props.initial
reset('myForm', { email: '' }) // explicit value becomes the new initial
reset(nodeOrId, resetTo?)

reset() accepts an id or a node (dist/index.d.mts:2300-2311). It pauses the node's event emitter while restoring (dist/index.mjs:580), deep-applies object reset values to children by address (dist/index.mjs:583-594), clears error / incomplete ui messages, and recomputes failing state (dist/index.mjs:541-560). v2.1.0 fixed: explicit reset values now apply to all node types, buffered reset events survive, reset input hooks do not double-fire, and reset preserves invalid state (GitHub release v2.1.0, core fixes).

submitForm

submitForm('myForm')            // document context
submitForm('myForm', shadowRoot) // custom root

Looks up #myForm; if it is an HTMLFormElement, dispatches a cancelable, bubbling submit Event; otherwise warns code 151 (dist/index.mjs:532-540). It triggers the DOM event — the framework adapter's submit handler does the rest.

Errors, warnings, codes

import { error, warn, errorHandler, warningHandler } from '@formkit/core'
  • warn(code, data?) dispatches through warningHandler; default middleware logs via console.warn (dist/index.mjs:137-147).
  • error(code, data?) throws (dist/index.mjs:148-150) — its return type is never.
  • Both handlers are FormKitDispatcher<FormKitHandlerPayload>; register middleware to customize reporting (dist/index.d.mts:2141-2175).

Documented core codes seen in source: 103/104 (compiler syntax, dist/index.mjs:1714-1719), 107 (group value not an object, dist/index.mjs:751), 108 (list value not an array, dist/index.mjs:754), 151 (submitForm target missing, dist/index.mjs:539).

Class utilities

createClasses(propertyKey, node, sectionClassList?) normalizes a section's class input (string, record, or FormKitClasses function) to Record<string, boolean>; generateClassList(node, property, ...lists) combines lists into a string or null (dist/index.d.mts:445-471). These power the classes config/prop pipeline consumed by styling layers.

Source: SKILL.md on GitHub

1 warning9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The skill is a legitimate documentation and API reference for the FormKit form-building library. Security analysis found no malicious patterns, unauthorized capabilities, or valid threats.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: MEDIUM · 1 issue

Signed by skilld at b9c39cb. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated last week

README badge

README badge for skilld-dev/vue-ecosystem-skills/formkit-core-skilld