yaklang-database

Persist and query data in Yaklang scripts using SQLite, key-value storage, and payload dictionaries.

10|1|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/yaklang/yak-skills --skill yaklang-database-yaklang
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: yaklang-database
Source: https://github.com/yaklang/yak-skills/tree/main/skills/yaklang-database
Command: npx skills add https://github.com/yaklang/yak-skills --skill yaklang-database-yaklang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Yaklang scripts and plugins often need to persist structured results, share state across runs, or manage brute-force dictionaries, but the db library's real API shapes (error fields vs functions, tuple returns, iterator outputs) are easy to get wrong. This Skill documents the correct patterns with runnable, self-testing examples. ## Core Features & Use Cases - Temporary SQLite CRUD: Create tables, insert, and query with db.OpenTempSqliteDatabase, Exec, and db.ScanResult returning []map rows. - Key-Value & Project Config: Share state across scripts with db.SetKey/GetKey/SetKeyWithTTL and project-scoped db.SetProjectKey/GetProjectKey. - Payload Dictionary Management: Save and iterate brute-force dictionaries with db.SavePayload and db.YieldPayload, including cleanup conventions. - Use Case: A scanning plugin stores intermediate results in a temp SQLite table, queries them with SQL aggregation, and reads a shared config key set by another plugin. ## Quick Start Ask the AI to write a Yaklang script that creates a temporary SQLite table, inserts rows, queries them with db.ScanResult, and stores a config value with db.SetKey.

Frequently Asked Questions about yaklang-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use SQLite in a Yaklang script?▼

Open a temporary database with db.OpenTempSqliteDatabase()~, create tables and insert rows with tempDB.Exec(sql, args...), and query with db.ScanResult which returns rows as a slice of maps. Use parameterized ? placeholders to prevent injection.

How to share state between Yaklang scripts or plugins?▼

Use the key-value store: db.SetKey writes a persistent value, db.GetKey reads it, and db.SetKeyWithTTL adds expiration in seconds. For project-scoped config that switches with the Yakit project, use db.SetProjectKey and db.GetProjectKey instead.

How do I manage brute-force dictionaries in Yakit?▼

Save a dictionary group with db.SavePayload(name, list), then iterate entries with for content in db.YieldPayload(name). List groups with db.GetAllPayloadGroupsName and remove one with db.DeletePayloadByGroup.

Why does tempDB.Exec(sql).Error~ fail in Yaklang?▼

Exec(...).Error is a field, not a function, so the ~ error-handling operator cannot be applied to it. Assign it first: err = tempDB.Exec(sql).Error, then assert err == nil.

What does db.GetKey return when the key does not exist?▼

db.GetKey returns an empty string, not nil, when the key is missing. Check with if db.GetKey(k) == "" rather than comparing against nil.