Skip to content

Getting started

In this tutorial you create a knowledge base with one kind of note, write a note, search it from the command line, and then serve it to Claude Code over MCP.

You need Nix with flakes enabled, git, and (for the last part) Claude Code.

Terminal window
nix profile install github:Zebradil/sklad
sklad --version

Make a working directory and initialize a knowledge base inside it. sklad init creates a git repository and a .gitignore for the sidecar files sklad writes while saving:

Terminal window
mkdir sklad-tutorial && cd sklad-tutorial
sklad init --path kb
cd kb

sklad learns what your notes look like from .kb/framework.toml. Create it with one kind, note, stored as notes/<slug>.md with a required created date:

Terminal window
mkdir -p .kb/templates
cat > .kb/framework.toml <<'EOF'
version = 1
[kinds.note]
label = "Notes"
description = "Anything worth keeping."
file = "notes/{slug}.md"
template = "note"
[kinds.note.fields]
tags = { type = "tags" }
created = { type = "date", required = true }
EOF

Then give the kind a template. sklad new fills in {{date}} and {{title}}:

Terminal window
cat > .kb/templates/note.md <<'EOF'
---
created: {{date}}
tags: []
---
# {{title}}
EOF

Create a note from the template, add a sentence, and search for it:

Terminal window
sklad new note "Backup plan"
echo "Nightly restic snapshots of the home directory, kept for 30 days." >> notes/backup-plan.md
sklad search restic

sklad new prints the path it wrote, notes/backup-plan.md, and the search finds the new section:

notes/backup-plan.md:6-7 Backup plan Nightly restic snapshots of the home directory, kept for 30 days

Check the knowledge base against its definition, then commit:

Terminal window
sklad check
git add -A && git commit -m "Add first note"

sklad check prints nothing and exits with status 0 when every file is valid.

Go back to the working directory, create a bearer token, and start the server:

Terminal window
cd ..
SKLAD_KB_PATH=kb sklad token create --name laptop --scopes kb:read,kb:write
SKLAD_KB_PATH=kb sklad serve

The token is printed once, as kbsk_…; copy it. The token database is created at state/auth.sqlite under the working directory, and the server listens on http://127.0.0.1:8080.

In another terminal, register the server with Claude Code, replacing the token:

Terminal window
claude mcp add --transport http sklad http://127.0.0.1:8080/mcp \
--header "Authorization: Bearer kbsk_…"

Start Claude Code and ask it to search your knowledge base for “restic”. It answers through the kb_search tool, from the note you wrote.