Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

knap — Claude Code skill: what it does, how to install

The skill teaches the agent to call the Knap CLI and render Markdown templates from JSON or CSV, including batch note generation.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add kepano/obsidian-skills --skill knap -a claude-code
Open on GitHub

What knap does

Knap is a CLI tool the skill wires into the agent for rendering Markdown templates with variables, filters and logic inside {{ }} and {% %}. The agent takes JSON or CSV, fills in values with knap render template.md --data article.json -o note.md, and gets a finished file. A template can be checked for syntax errors without writing output using knap validate template.md.

Batch work goes through knap batch: CSV rows, items of a JSON array, or a folder of JSON files each become a separate Markdown file, with filenames set by a pattern such as {{ title | safe_name }}.md. A separate pipeline covers Defuddle: output from defuddle parse, with its title and content fields, feeds straight into knap render.

The CLI itself has to be installed first: npm install -g knap, which needs Node.js 20 or later, or it can run without installing via npx knap.

What it helps with

  • turn JSON or CSV data into Markdown notes from a template
  • batch-generate files from CSV rows or a JSON array in one command
  • format Defuddle output into a finished note
  • validate a template's syntax before rendering
  • control output filenames when batch-generating notes

Example prompts for the agent

  • Render template.md with data from article.json into note.md
  • Batch-generate Markdown notes from articles.csv into the notes folder
  • Validate template.md for errors before rendering

How to install knap

1Skills CLI (Vercel)

npx skills add kepano/obsidian-skills --skill knap -a claude-code

2Manually: put the files in place

~/.claude/skills/knap/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/knap/

From the same set2

The whole set →

Similar

bmad-agent-architect bmad-code-org This skill turns ticket requirements into technical architecture with explicit trade-offs. Use it when you want to work with Winston as the architect. Claude Code CX Codex Cursor +1 11,800installs bmad-brainstorming bmad-code-org The skill runs a brainstorming session: the agent asks one question at a time, rotates creative techniques and logs ideas to a memlog. Useful when you want more options than you'd get alone. Claude Code CX Codex Cursor +1 11,800installs discord openclaw A skill that runs Discord messaging through OpenClaw's message tool: send, edit, delete, pin, react, plus interactive buttons. Useful when your agent needs Discord as a channel for replies and notifications. Claude Code CX Codex Cursor +1 3,000installs bmad-agent-analyst bmad-code-org Turns your agent into Mary, a business analyst who handles market research, competitor breakdowns and requirements, and turns vague asks into specs. Claude Code CX Codex Cursor +1 11,700installs bmad-product-brief bmad-code-org Talks you through your product idea and helps shape a brief: what it is, who it's for, what's still unknown. Useful at idea stage or when an old brief needs a second look. Claude Code CX Codex Cursor +1 11,600installs bmad-prd bmad-code-org Creates, updates, or validates a PRD at the level of detail the work needs. Use it when product requirements need a structured working document. Claude Code CX Codex Cursor +1 11,600installs find-skills vercel-labs Discovers and installs agent skills from skills.sh directly inside your coding assistant. Handy when you need domain-specific workflows for a project. Claude Code CX Codex Cursor +1 4,000,000installs grill-me Matt Pocock grill-me interviews you about a plan or design to expose gaps and sharpen decisions. Use it before implementation starts. Claude Code 1,424,476installs

Questions about knap

How do I install knap in Claude Code?

Run npx skills add kepano/obsidian-skills --skill knap -a claude-code. The skill then shows up at ~/.claude/skills/knap/SKILL.md.

What does knap do?

The skill plugs in the Knap CLI, which renders Markdown templates with variables and filters from JSON or CSV, batch-generates files, and formats Defuddle output into notes.

What's required to run knap?

It needs the CLI installed globally with npm install -g knap and Node.js 20 or later, or it can run without installing via npx knap.

Source text

SKILL.md · MIT
---
name: knap
description: 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.
---

# Knap

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

If not installed: `npm install -g knap` (requires Node.js 20 or later). Alternatively, use `npx knap`.

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

```bash
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:

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

Supply a template and data inline:

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

Override a variable or pipe JSON data:

```bash
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`:

```knap
---
{{ 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:

```bash
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:

```bash
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:

```bash
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.

© kepano · MIT · kepano/obsidian-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor