Adventure 1
Adventure 1
monday.txt:
Math: 1 hour
English: 30 minutes
tuesday.txt:
Math: 45 minutes
Coding: 1 hour
wednesday.txt:
English: 20 minutes
History: 40 minutesAdventure 1
Adventure 1
Adventure 1
Adventure 1
Adventure 1
sudo apt install sqlite3 -y
sqlite3 ~/learning.dbsqlite> prompt. Congratulations! You're inside your database.Adventure 1
Adventure 1
CREATE TABLE learning_log (
id INTEGER PRIMARY KEY AUTOINCREMENT,
date TEXT NOT NULL,
subject TEXT NOT NULL,
duration_min INTEGER NOT NULL,
notes TEXT
);Adventure 1
Adventure 1
Adventure 1
INSERT INTO learning_log (date, subject, duration_min, notes)
VALUES ('2025-02-08', 'Math', 60, 'Learned fractions');INSERT INTO learning_log (date, subject, duration_min, notes)
VALUES ('2025-02-08', 'English', 30, 'Vocabulary practice');
INSERT INTO learning_log (date, subject, duration_min, notes)
VALUES ('2025-02-09', 'Math', 45, 'Word problems');
INSERT INTO learning_log (date, subject, duration_min, notes)
VALUES ('2025-02-09', 'Coding', 90, 'Built a calculator');Adventure 1
SELECT * FROM learning_log;SELECT * FROM learning_log
WHERE subject='Math';SELECT * FROM learning_log
ORDER BY duration_min DESC;SELECT SUM(duration_min)
FROM learning_log
WHERE subject='Math';Adventure 1
Adventure 1
SELECT COUNT(*)
FROM learning_log;SELECT AVG(duration_min)
FROM learning_log;SELECT MAX(duration_min), subject
FROM learning_log;Adventure 1
SELECT subject, SUM(duration_min) as total_minutes
FROM learning_log
GROUP BY subject;SELECT subject,
COUNT(*) as sessions,
SUM(duration_min) as total_min,
AVG(duration_min) as avg_min
FROM learning_log
GROUP BY subject
ORDER BY total_min DESC;Adventure 1
Adventure 1
UPDATE learning_log
SET notes = 'Mastered fractions!'
WHERE id = 1;UPDATE learning_log
SET duration_min = 65,
notes = 'Extended study session'
WHERE id = 1;Adventure 1
DELETE FROM learning_log
WHERE id = 5;DELETE FROM learning_log
WHERE date = '2025-02-08';DELETE FROM learning_log;Adventure 1
Adventure 1
SELECT date, SUM(duration_min)
FROM learning_log
GROUP BY date
ORDER BY SUM(duration_min) DESC
LIMIT 1;SELECT subject, AVG(duration_min)
FROM learning_log
GROUP BY subject;SELECT * FROM learning_log
WHERE duration_min >= 45;UPDATE learning_log
SET notes = 'Your new note'
WHERE id = 3;Adventure 1
Adventure 1
mkdir ~/clawd/skills/database
vim ~/clawd/skills/database/SKILL.mdAdventure 1
# Learning Record Database Skill
## Trigger Words
User mentions "record study", "learning stats",
"studied today", "how much studied"
## Database Location
~/learning.db
## Operations
### Record Study Session
sqlite3 ~/learning.db "INSERT INTO learning_log
(date, subject, duration_min, notes)
VALUES ('date', 'subject', minutes, 'notes');"
### View Statistics
sqlite3 ~/learning.db "SELECT subject,
SUM(duration_min) as total
FROM learning_log
GROUP BY subject;"
### Weekly Summary
sqlite3 ~/learning.db "SELECT SUM(duration_min)
FROM learning_log
WHERE date >= date('now', '-7 days');"Adventure 1
openclaw restart
openclaw agent --message "Record that I studied Math for 45 minutes today"Adventure 1
Adventure 1
Adventure 1
pip3 install matplotlibvim ~/visualize-learning.pyAdventure 1
import sqlite3
import matplotlib.pyplot as plt
# Connect to database
conn = sqlite3.connect('/home/user/learning.db')
cursor = conn.cursor()
# Get data
cursor.execute("""
SELECT subject, SUM(duration_min)
FROM learning_log
GROUP BY subject
""")
results = cursor.fetchall()
# Separate into subjects and durations
subjects = [row[0] for row in results]
durations = [row[1] for row in results]
# Create bar chart
plt.figure(figsize=(10, 6))
plt.bar(subjects, durations, color='skyblue')
plt.xlabel('Subject')
plt.ylabel('Total Minutes')
plt.title('Study Time by Subject')
plt.savefig('study-chart.png')
print("Chart saved!")Adventure 1
python3 ~/visualize-learning.pystudy-chart.png in your home directory. Open it to see your beautiful chart!plt.bar() to plt.pie() for a pie chart, or add plt.plot() for a line graph showing trends over time.Adventure 1
### Generate Study Chart
python3 ~/visualize-learning.py
### Response
"I've created a chart of your study statistics.
Check study-chart.png to see your progress!"Adventure 1
Adventure 1
"SELECT * FROM table WHERE user='" + input + "'" is dangerous!conn.close() in Python or .exit in sqlite3 terminal.;Adventure 1
Adventure 1
Adventure 1
Adventure 1
Adventure 1
Adventure 1
Adventure 1