pfw-structured-queries

Build type-safe SQL queries for SQLite using StructuredQueries.

16|2|Updated Mar 29, 2018
One-click install
npx skills add https://github.com/khoi/dotfiles --skill pfw-structured-queries-khoi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pfw-structured-queries
Source: https://github.com/khoi/dotfiles/tree/main/chezmoi/dot_pfw/skills/structured-queries
Command: npx skills add https://github.com/khoi/dotfiles --skill pfw-structured-queries-khoi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Swift developers often write SQL with string interpolation or ad-hoc builders that lead to runtime errors and security risks. This skill provides a type-safe, schema-aware DSL via the StructuredQueries library, enabling compile-time checks and safer query construction.

Core Features & Use Cases

  • Type-safe query construction with StructuredQueries: define Reminders, RemindersList, and relationships using Swift types.
  • Schema-driven conventions and integrated SQLite support to simplify query writing and maintenance.
  • Use Case: build complex selects, joins, and aggregates for a local SQLite store with confidence in type safety and readability.

Quick Start

Add the StructuredQueries dependency to your project and begin building type-safe queries with the DSL.

Frequently Asked Questions about pfw-structured-queries

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

FAQPage Schema
How do I build type-safe SQL queries in Swift to avoid runtime errors?

Type-safe SQL queries in Swift are built using the StructuredQueries DSL, which provides schema-aware query construction to catch mistakes at compile time. By defining Swift types like Reminders, you avoid string interpolation risks.

What is the best way to define a SQLite schema in Swift for structured queries?

Defining a SQLite schema in Swift involves creating Swift types that map to your database tables and relationships. The StructuredQueries library uses these schema-driven conventions to simplify writing and maintaining complex selects and joins safely.

Does StructuredQueries work with SQLite for local storage in Swift apps?

StructuredQueries works with SQLite for local storage by providing integrated support and schema-aware DSL conventions. It allows Swift developers to build complex selects, joins, and aggregates for a local SQLite store with compile-time type safety.

How do I add StructuredQueries to my Swift project?

To add StructuredQueries, include the package as a dependency in your Swift project. Once added, you can begin building type-safe queries by following its API conventions to safely compose complex SQL statements.

Why should I use a DSL for SQLite query construction instead of string interpolation?

A DSL for SQLite query construction prevents runtime errors and security risks associated with string interpolation. StructuredQueries provides a type-safe environment where query mistakes are caught during compilation, ensuring safer database interactions.

Can I perform joins and aggregates using StructuredQueries in Swift?

You can perform complex selects, joins, and aggregates using StructuredQueries in Swift. The DSL allows you to safely compose these operations against your local SQLite store, ensuring type safety and readability throughout your query logic.