Knap skill for Claude

Render Markdown from templates and structured data using Knap CLI.

When Claude uses it

Use when the user asks to apply a Knap template, turn JSON or CSV data into notes, batch-generate Markdown files, or format Defuddle output into a note.

Knap SKILL.md

The full skill file from obsidianmd/obsidian-skills (MIT).

Knap

Use Knap CLI to render Markdown templates with variables, filters, and logic.

Check availability with knap --help. If it is missing, explain that Knap requires Node.js 20 or later and offer installation with npm install -g knap or execution with npx knap. Do not claim a template was rendered if the tool is unavailable or returns an error.

Run knap --help for available commands and options. Discover the language through the CLI's offline reference:

knap help syntax
knap help filters
knap help filter date
knap help tags
knap help tag for

Use the lists to find names, then request individual help for syntax, parameters, and examples with expected output.

Usage

Render a template with JSON variables:

knap render template.md --data article.json -o note.md

Supply a template and data inline:

knap render -t '# {{ title | trim }}' --data-json '{"title":"Hello"}'

Override a variable or pipe JSON data:

knap render template.md --data article.json --set 'title=Custom title'
cat article.json | knap render template.md --data -

Data must be a JSON object; its properties become template variables. --set overrides literal top-level keys with strings. Use JSON for nested objects, arrays, numbers, and booleans.

Choose one template source (file, -t, or stdin) and one data source (--data or --data-json). Only one input can read stdin. Without a template file or -t, Knap reads the template from stdin.

Output defaults to stdout. -o creates parent directories and overwrites the destination after rendering succeeds. Errors exit with status 1; diagnostics go to stderr. Warnings can accompany successful output.

Templates

Use {{ variable }} for values, | for filters, and {% ... %} for logic. For example, save this as template.md:

---
{{ title | yaml_property:"title" }}
{{ tags | yaml_property:"tags" }}
---
# {{ title | trim }}
{% if author %}
By {{ author }}
{% endif %}

{{ content }}

Use yaml_property for complete frontmatter properties so values are quoted and indented correctly. The CLI includes standard filters, but does not supply Web Clipper browser variables, selectors, prompts, or DOM-dependent HTML filters. Supply variables through JSON.

Check a template before rendering:

knap validate template.md

Validation checks syntax, filter names, and static filter arguments without data or file output. It does not check variable existence, runtime values, or dynamic arguments; render with real data to check runtime behavior. Diagnostics go to stderr and include relevant help commands.

Defuddle pipeline

Extract a web page as JSON with Markdown content, then render it into a note:

defuddle parse https://example.com/article --md --json \
  | knap render template.md --data - -o note.md

Defuddle's JSON properties, such as title and content, become template variables directly.

Batch rendering

Create one file per CSV row, JSON array object, or JSON file in a folder:

knap batch template.md --data articles.csv --output-dir notes \
  --filename '{{ title | safe_name }}.md'

Use --data articles.json for an array or --data ./articles for a folder of JSON objects. CSV headers become variable names and values remain strings. Piped data defaults to JSON; add --format csv for piped CSV.

Use --dry-run to validate and list output paths without writing files. Existing files require --overwrite, including during a dry run. Duplicate output names within a batch are errors even with --overwrite.

Filename templates must produce a single filename with its extension, without directories. Use safe_name for data-derived names. Without --filename, Knap preserves source JSON basenames or numbers CSV rows and array items as 1.md, 2.md, and so on.

How to install Knap

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit obsidianmd/obsidian-skills/plugins/obsidian/skills/knap#main ~/.claude/skills/knap

Codex

npx degit obsidianmd/obsidian-skills/plugins/obsidian/skills/knap#main ~/.codex/skills/knap

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+What does the Knap skill do?

Render Markdown from templates and structured data using Knap CLI. Use when the user asks to apply a Knap template, turn JSON or CSV data into notes, batch-generate Markdown files, or format Defuddle output into a note.

+How do I install Knap in Claude Code?

Copy the skill folder into ~/.claude/skills/knap, for example with "npx degit obsidianmd/obsidian-skills/plugins/obsidian/skills/knap#main ~/.claude/skills/knap". Claude Code loads it automatically and uses it when a task matches.

+Does Knap work with ChatGPT or Codex?

Yes. Knap uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/knap. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is Knap free?

Knap is published on GitHub by obsidianmd under the MIT license, which allows free use.

Related productivity skills

  1. Handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    mattpocock/skills★ 327k
  2. Notebooklm

    Use for anything in Google NotebookLM: querying notebooks, adding sources, generating Audio or Video Overviews, reports, flashcards or…

    alirezarezvani/claude-skills★ 30k
  3. Teach

    Teach the user a new skill or concept, within this workspace.

    mattpocock/skills★ 327k
  4. Obsidian Headless

    Sync and publish Obsidian vaults from the command line with Obsidian Headless (`ob`), without the desktop app.

    obsidianmd/obsidian-skills★ 53k
  5. Grpo Rlvr Training

    Train reasoning and verifiable-task behavior with GRPO and reinforcement learning from verifiable rewards (RLVR).

    wshobson/agents★ 43k
  6. Session Guard

    Use when working on complex multi-step tasks, when a session is getting long (40+ tool calls), when the agent starts ignoring rules it…

    wshobson/agents★ 43k
  7. Task Coordination Strategies

    Decompose complex tasks, design dependency graphs, and coordinate multi-agent work with proper task descriptions and workload balancing.

    wshobson/agents★ 43k
  8. Agent Harness

    Use when an agent should drive a goal in one of this repo's domains to a verified close, before starting the work.

    alirezarezvani/claude-skills★ 30k
  9. Andreessen

    Blunt market-first verdict on an idea, venture or career bet, leading with the strongest counterargument, or a 3x5-card daily plan.

    alirezarezvani/claude-skills★ 30k

See all productivity skills →

More skills from obsidianmd

  1. Obsidian Cli

    Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more.

    obsidianmd/obsidian-skills★ 53k
  2. Obsidian Markdown

    Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax.

    obsidianmd/obsidian-skills★ 53k

All skills by obsidianmd →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.