Create the instructions and script
OpenClaw uses skills (plugins) to extend functionality. Create a SearXNG skill:
Create the skill file:
~/.openclaw/skills/searxng/SKILL.md
---
name: searxng
description: Search the web through the configured self-hosted SearXNG instance.
---
# SearXNG Search Skill
Self-hosted private search via SearXNG.
## Usage
```bash
# Basic search
~/.openclaw/skills/searxng/search.sh "your query"
# With result limit
~/.openclaw/skills/searxng/search.sh "your query" 10
```
## Configuration
Set `SEARXNG_URL` environment variable to override default:
```bash
export SEARXNG_URL="http://localhost:8080"
```
## When to Use
Use this skill for web searches when privacy is important or
when you want to avoid Brave API costs.
Create the search script:
~/.openclaw/skills/searxng/search.sh
#!/bin/bash
# SearXNG search skill for OpenClaw
# Usage: ./search.sh "query" [limit]
set -e
QUERY="$1"
LIMIT=${2:-5}
SEARXNG_URL=${SEARXNG_URL:-"http://localhost:8080"}
if [ -z "$QUERY" ]; then
echo "Usage: $0 <query> [limit]"
echo "Example: $0 'kubernetes best practices' 5"
exit 1
fi
# Query SearXNG
RESULTS=$(curl -fsS "$SEARXNG_URL/search" \
-G --data-urlencode "q=$QUERY" \
--data "format=json" 2>/dev/null)
# Check if we got results
if [ -z "$RESULTS" ] || [ "$RESULTS" = "null" ]; then
echo "No results or SearXNG unavailable"
exit 1
fi
# Format output for agent consumption
printf '%s' "$RESULTS" | jq -r --argjson limit "$LIMIT" \
'.results[:$limit][] | .title, .url, (.content // "No snippet"), "---"'
Make it executable:
bash
chmod +x ~/.openclaw/skills/searxng/search.shIt’s working if
The skill directory contains SKILL.md and an executable search.sh. The next lesson exercises it directly.
