Sqlite state
Skill baronguyen001/ai-automation-skills/skills/sqlite-state
8 production-tested Claude skills: automation, Gemini cost/structured output, OSS bounty scouting, ML validation.
npx -y skills add baronguyen001/ai-automation-skills --skill sqlite-stateAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Give scheduled scripts memory between runs with one SQLite file - a seen-set for dedup, a key/value cursor to resume where you left off, and order-preserving new-item filtering. Use for dedup across runs, don't re-alert the same item, remember the last id, resume a scraper, or persist state between cron runs.
SKILL.md
2.2 KB, 453 tokens by cl100k_base, as published. Nobody here has run it
SQLite State
Use this skill when a recurring job must remember what it already did - which items it has alerted on, the last cursor it processed - so it does not re-notify or re-scrape on the next tick. One stdlib SQLite file gives durable, file-locked state with no server and no extra dependency.
When to invoke
- User says: "don't alert the same thing twice", "dedup across runs", "remember the last id", "resume where it left off".
- Code in the conversation is a cron/scheduled script that currently re-processes everything each run.
When NOT to invoke
- State is tiny and ephemeral within a single run - a plain set/dict is enough.
- Multiple machines must share state concurrently; reach for a real server DB instead of a single file.
Concrete example
User input:
My news scraper re-sends the same headlines every hour. Make it only send new ones.
Output:
from state import filter_new, mark_seen
db = "news.db"
fresh = filter_new(db, [a["url"] for a in articles]) # only unseen URLs
for url in fresh:
send_alert(url)
mark_seen(db, *fresh) # remember them for next run
Pattern to apply
- Key each item by something stable and unique (URL, id, content hash), not by array position.
- Use
filter_newto decide what to act on, thenmark_seenonly after the action succeeds. - Store progress as a named cursor (
set_cursor/get_cursor) so a resumable scraper restarts mid-stream. - Enable WAL mode for durable writes with concurrent readers; keep a single writer.
- Back up or version the one
.dbfile - it is the whole memory of the job.
Reference: assets/state.py.
Source
Distilled from production use across the author's automation projects. v1.0.0. See also: [[pipeline-orchestrator]], [[cron-dispatch]], [[webhook-receiver]].
→ Build the full runnable bot with Trawlkit.
What ships with it: 1 file
3.0 KB alongside SKILL.md, 1 of them executable
assets/
- state.pyruns3.0 KB
Gives 0 of the 12 instructions most databases sql skills give in 453 tokens
Counted across 589 of the 662 authors here whose files we hold, read 2026-08-07
- Use parameterized queriesin 37 of 589, across 34 files
- Use timestamptz for timestampsin 30 of 589, across 14 files
- Index foreign keysin 29 of 589, across 18 files
- Create indexes concurrentlyin 29 of 589, across 24 files
- Use numeric type for moneyin 25 of 589, across 8 files
- Use cursor pagination instead of offsetin 24 of 589, across 17 files
- Select only required columnsin 24 of 589, across 20 files
- Add indexes manually on foreign key columnsin 22 of 589, across 12 files
- Normalize to third normal formin 19 of 589, across 10 files
- Configure connection poolingin 19 of 589, across 17 files
- Put equality columns before range columns in indexesin 18 of 589, across 10 files
- Read individual rule files for detailed explanationsin 18 of 589, across 4 files
Said here and by no other author read
- key each item by something stable and unique
- use filter_new to decide what to act on
- use mark_seen only after action succeeds
- store progress as a named cursor
- keep a single writer
- back up or version the database file
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.