Checks & Shortcuts
Validate posts with npx garden check, install the VS Code and Typora plugins, and set up the Git pre-commit hook and Agent skills.
To catch YAML indentation mistakes, missing required fields, or broken local file paths before publishing, Garden ships a CLI validator, a Git pre-commit hook, snippet templates, and bundled Agent skills.
1.Validation Commands
Three commands check your content at different scopes:
- Check one or more posts (
npx garden check):npx garden check content/posts/my-post.md # Or pass multiple Markdown files at once npx garden check content/posts/*.md - Check interactive blocks and component syntax (
npx garden ui check):npx garden ui check content/posts/my-post.md # Check staged Markdown files in Git npx garden ui check --staged # Check all Markdown files in the repository npx garden ui check --all - Sync and build the entire site (
make check):In the sitemake checkMakefile,make checkrunsnpx garden sync && npx garden buildto execute full content synchronization, component validation, and the production build.
2.npx garden check Diagnostic Codes
npx garden check (backed by scripts/check-post.mjs, ui/garden/check.mjs, and ui/garden/file-paths.mjs) reports exact line numbers, diagnostic codes, and fix suggestions:
| Code | Severity | Cause and Fix |
|---|---|---|
missing-title / missing-description | Error | Front Matter is missing a non-empty title or description |
unexpected-slug | Error | Front Matter includes a manual slug field (remove slug; the filename is the slug) |
date-format | Error | date is not a valid YYYY-MM-DD, YYYY-MM-DD HH:mm:ss, or ISO timestamp with timezone |
missing-cover / missing-asset | Error | A local file referenced by cover, a Markdown image, or garden file does not exist |
heading-h1 / heading-skip | Error | The post body uses an # H1 heading or skips a heading level (such as jumping from ## to ####) |
reference-heading | Error | The post body contains a references section heading (move references to the references Front Matter list) |
callout-type | Error | > [!TYPE] uses an unsupported callout type |
title-split | Warning | The title contains a split delimiter with an empty left or right side |
diff-orphan | Error | A diff code fence is not immediately preceded by a complete code block |
legacy-fence | Error | Uses a legacy fence name (such as garden:stat, widget, embed, or html garden); replace with garden <name> |
garden-idea | Error | A non-draft post still contains an uncompiled garden idea fence |
compose-uncompiled | Error | A non-draft garden compose fence is still prose, not a YAML tree |
compose-invalid | Error | A garden compose YAML tree is invalid: unknown node, a for that matches nothing, or a repeated id |
garden-name | Error | Unknown garden component name (card, stat, compare, timeline, chart, compose, html, interactive, file, relations, list, choice, or deprecated figure) |
garden-yaml | Error | Invalid YAML syntax, wrong top-level shape, or unsupported keys inside a garden fence |
garden-relations | Error | garden relations has fewer than 3 or more than 6 elements, or invalid links entries (use a mermaid flowchart for larger or branching diagrams, or garden list for one-pass steps) |
garden-file / file-outside | Error | garden file manually sets resolved, is missing a valid src / files, or points outside content/ |
file-large | Warning | A local file referenced by garden file exceeds 5 MB |
compare-long | Error | A single side-by-side cell in garden compare exceeds roughly 60 characters (does not apply when verdict is used) |
interactive-trivial / steps-prose | Error | garden interactive only computes a single multiplication, or <Steps> contains only prose without state changes |
3.Git Pre-commit Hook and Component Catalog
- Install the pre-commit hook: Run
npx garden hooksto write.git/hooks/pre-commit, which runsnpx --no-install garden ui check --staged --quieton everygit commit:npx garden hooks - Generate the local component catalog: Run
npx garden ui catalogto write a static preview page of all built-in components to.garden/ui-catalog.html:npx garden ui catalog
4.Component Templates, Snippets, and Agent Skills
Garden provides three ways to insert or generate components quickly:
- Draft cheat sheet comment: Running
make new SLUG=xxx TITLE="..."appends an HTML comment to the bottom of the new.mdfile with examples for idea fences and the built-in components. HTML comments are hidden from the rendered page and can be deleted when finished. - Snippet template files: The
templates/directory insidehd-gardenincludes two template files:templates/garden-blocks.md: Copyable Markdown templates for idea fences and the built-in components.templates/garden-snippets.plist: macOS text replacements (drag into System Settings → Keyboard → Text Replacements) with triggers;gidea,;gcard,;gstat,;gcompare,;gtimeline,;gchart,;gcompose,;gfigure,;ghtml,;ginteractive,;gfile,;grel,;glist, and;gchoice.;gcomposeexpands to agarden composefence with one sentence. The others expand to their fences.
- Install AI Agent skills (
npx garden skill): Runningnpx garden skillin a site repository (also run automatically duringnpx hd-garden init) copies three skills into.agents/skills/:garden-ui: Compiles natural-languagegardenidea fences into concrete component blocks.garden-interactive-chart: Authorsinteractive,chart,compose, andhtmlcomponents from article data.figureis deprecated.garden-post-review: Reviews an entire post against layout and component rules.
5.VS Code, Cursor, and Typora Plugins
The Intelligent UI plugins are the editor entry point for interactive components: insert a one-sentence idea, preview it, open the catalog, then hand compilation to the garden-ui skill. They ship inside hd-garden. A site does not compile editors/vscode or editors/typora from source.
Install
npx hd-garden init copies the files to .garden/editors/ (a VSIX for VS Code / Cursor, and the Typora plugin). An interactive terminal asks whether to install VS Code / Cursor, then whether to install Typora. The first npx garden sync or npx garden dev asks again when that prompt has not happened yet. y installs; Enter skips.
With no TTY, when CI is 1, or when GARDEN_SKIP_EDITORS is set, Garden does not wait for input and only prints how to install later. GARDEN_SKIP_EDITORS skips that automatic prompt. The commands below still install, and they are safe to run again:
npx garden editors install
npx garden editors install --yes
npx garden editors install --vscode
npx garden editors install --typora
garden help lists editors install.
VS Code / Cursor. When code or cursor is on PATH, install adds the VSIX to that editor. If both commands exist, it installs into both. Without a CLI, open the Extensions view, choose the ... menu, then Install from VSIX, and select the file under .garden/editors/vscode/.
Typora. Typora has no official plugin API. Install typora-community-plugin first. The install command checks the usual locations. If the framework is missing, it still copies the plugin to ~/.typora/community-plugins/plugins/hedon954.garden-intelligent-ui/ and prints that prerequisite. On macOS it also copies to ~/Library/Application Support/abnerworks.Typora/plugins/plugins/hedon954.garden-intelligent-ui/. Open Typora and enable Garden Intelligent UI under Settings, Installed plugins. A Typora upgrade overwrites the community framework inside the app. Reinstall typora-community-plugin, then enable this plugin again. The fences stay in the Markdown.
The Obsidian plugin is not installed by this command.
Use the plugins while writing
-
Insert an idea. In VS Code / Cursor, use
Cmd+Alt+Ion macOS orCtrl+Alt+Ion Windows and Linux, or the Garden insert command. In Typora, type/and choose/garden(the next list has a small preview image on each row), or use the insert command to open the component list directly; Windows and Linux default toCtrl+Alt+I. On macOS, record a shortcut under Settings, Keyboard Shortcuts, because Option rewrites the key. The insertion is a plaingardenfence: a short brief naming the component and the facts to mention, which thegarden-uiskill compiles later. -
Preview. Open the Markdown preview. In Typora, move the cursor out of the fence. A
uiblock renders the same component as the blog. Anintentblock renders as an idea card. Clicks on sliders and buttons stay in the preview. -
Open the catalog. In VS Code / Cursor, the catalog command inserts a recipe at the cursor. The terminal builds the same page:
npx garden ui catalogThat writes
.garden/ui-catalog.html. -
Compile with the skill. Copy compile prompt. On an English site (
locale: en_US) the clipboard text isCompile this post:plus the post path. Paste it to an Agent that has thegarden-uiskill. The skill runsnpx garden ui scan, readsnpx garden ui prompt, and replaces only that fence withnpx garden ui apply. The plugin does not call a model. Check the result withnpx garden ui checkor the pre-commit hook.