Spec-Driven Development in Practice with GitHub Spec Kit, Expo & SQLite
Exploring the GitHub Spec Kit workflow (specify → plan → tasks → implement) to build an offline-first React Native app with Expo and expo-sqlite.
Jumping straight into code with an AI agent often starts fast and ends up tangled. To test a cleaner process, I built github-speckit-starting (https://github.com/rniguel/github-speckit-starting) around GitHub Spec Kit.
The Spec-Driven Flow
Instead of prompting ad-hoc edits, Spec Kit breaks delivery into four deliberate phases under .specify/:
1. specify: define user behavior and edge cases first.
2. plan: map architecture, schema, and boundaries.
3. tasks: split the plan into focused, testable steps.
4. implement: build against the agreed spec.
Clean SQLite Layer in React Native + Expo
The target project was an offline-first To-Do app using Expo and expo-sqlite. Because architecture was planned upfront, database initialization (src/database/sqlite.ts), migrations, and TaskRepository.ts stayed cleanly decoupled:
export async function getDb(): Promise<SQLite.SQLiteDatabase> {
if (!dbPromise) {
dbPromise = SQLite.openDatabaseAsync(DATABASE_NAME);
}
return dbPromise;
}export const taskRepository = {
async list(filter: TaskFilter, order: SortOrder): Promise<Task[]> {
await runMigrations();
const db = await getDb();
const { clause, params } = whereForFilter(filter);
const query = `SELECT * FROM ${TASKS_TABLE} ${clause} ORDER BY created_at ${orderToSql(order)}`;
const rows = await db.getAllAsync<TaskRow>(query, params);
return rows.map(mapRowToTask);
},
async create(input: CreateTaskInput): Promise<Task> {
await runMigrations();
const error = validateTitle(input.title);
if (error) {
throw new Error(error);
}
const db = await getDb();
const task: Task = {
id: createId(),
title: normalizeTitle(input.title),
description: input.description?.trim() || null,
status: "pending",
createdAt: new Date().toISOString(),
};
await db.runAsync(
`INSERT INTO ${TASKS_TABLE} (id, title, description, status, created_at) VALUES (?, ?, ?, ?, ?)`,
[task.id, task.title, task.description, task.status, task.createdAt]
);
return task;
},
};Final Thoughts
Writing specs before code keeps both developers and coding agents aligned on clean boundaries—especially around data validation and offline persistence.
Miguel Riquelme
Front-end Engineer. Software Engineering MBA student at USP/Esalq.