Skip to content

Commit e3dc909

Browse files
authored
chore: update to use Claude skills (#248)
Introduce initial configuration for SQLSpec usage skills, enhance the Gemini builder, and update related documentation to provide clearer guidance on migration patterns and adapter-specific skills.
1 parent 4cb0363 commit e3dc909

24 files changed

+7188
-1164
lines changed

.claude/agents/expert.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ Read("AGENTS.md")
6262
Read("docs/guides/quick-reference/quick-reference.md")
6363
```
6464

65+
**Use SQLSpec skills for guidance:**
66+
67+
```python
68+
# Main SQLSpec usage skill - configuration, queries, frameworks, migrations, testing
69+
Read(".claude/skills/sqlspec-usage/skill.md")
70+
71+
# Detailed pattern guides
72+
Read(".claude/skills/sqlspec-usage/patterns/configuration.md")
73+
Read(".claude/skills/sqlspec-usage/patterns/queries.md")
74+
Read(".claude/skills/sqlspec-usage/patterns/frameworks.md")
75+
Read(".claude/skills/sqlspec-usage/patterns/migrations.md")
76+
Read(".claude/skills/sqlspec-usage/patterns/testing.md")
77+
Read(".claude/skills/sqlspec-usage/patterns/performance.md")
78+
Read(".claude/skills/sqlspec-usage/patterns/troubleshooting.md")
79+
80+
# Adapter-specific skills
81+
Read(f".claude/skills/sqlspec-adapters/{adapter}.md") # e.g., asyncpg.md
82+
83+
# Working examples
84+
Read(".claude/skills/sqlspec-usage/examples/litestar-integration.py")
85+
Read(".claude/skills/sqlspec-usage/examples/fastapi-integration.py")
86+
Read(".claude/skills/sqlspec-usage/examples/multi-database.py")
87+
Read(".claude/skills/sqlspec-usage/examples/testing-patterns.py")
88+
```
89+
6590
**Get library docs when needed:**
6691

6792
```python

.claude/agents/testing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ Glob("tests/**/test_asyncpg*.py")
4646

4747
```python
4848
Read("docs/guides/testing/testing.md")
49+
50+
# SQLSpec testing skills
51+
Read(".claude/skills/sqlspec-usage/patterns/testing.md")
52+
Read(".claude/skills/sqlspec-usage/examples/testing-patterns.py")
4953
```
5054

5155
**Key testing principles from guide:**

.claude/bootstrap.md

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,226 @@ if not exists(".claude/agents/sync-guides.md"):
12901290

12911291
---
12921292

1293+
## PHASE 4.6: SQLSPEC SKILLS CREATION (If SQLSpec Project)
1294+
1295+
**Objective**: Auto-create comprehensive SQLSpec usage skills for database-focused projects.
1296+
1297+
### Step 4.6.1: Detect if SQLSpec Project
1298+
1299+
```python
1300+
is_sqlspec_project = (
1301+
Grep(pattern=r'from sqlspec|import sqlspec', path='.', output_mode='count') > 5 or
1302+
exists("sqlspec/") or
1303+
(exists("pyproject.toml") and "sqlspec" in Read("pyproject.toml"))
1304+
)
1305+
1306+
if not is_sqlspec_project:
1307+
print("Not a SQLSpec project - skipping SQLSpec skills creation")
1308+
# Skip to Phase 5
1309+
```
1310+
1311+
### Step 4.6.2: Create SQLSpec Skills Directory
1312+
1313+
```bash
1314+
mkdir -p .claude/skills/sqlspec-usage/patterns
1315+
mkdir -p .claude/skills/sqlspec-usage/examples
1316+
mkdir -p .claude/skills/sqlspec-adapters
1317+
```
1318+
1319+
### Step 4.6.3: Generate Main SQLSpec Skill
1320+
1321+
```python
1322+
sqlspec_skill = '''# SQLSpec Usage Expert Skill
1323+
1324+
**Version:** 1.0.0
1325+
**Category:** Database, Python, SQLSpec
1326+
**Status:** Active
1327+
1328+
## Description
1329+
1330+
Comprehensive guidance on using SQLSpec - a type-safe SQL query mapper for Python.
1331+
Covers configuration, query execution, framework integration, migrations, testing,
1332+
and performance optimization across all supported database adapters.
1333+
1334+
## Activation Triggers
1335+
1336+
- SQLSpec configuration or setup questions
1337+
- Database connection management
1338+
- Query execution patterns
1339+
- Framework integration (Litestar, FastAPI, Starlette, Flask)
1340+
- Migration management
1341+
- Testing with SQLSpec
1342+
- Performance optimization
1343+
- Multi-database setups
1344+
1345+
## Quick Reference
1346+
1347+
See pattern guides for detailed information:
1348+
- [Configuration Patterns](patterns/configuration.md)
1349+
- [Query Execution Patterns](patterns/queries.md)
1350+
- [Framework Integration](patterns/frameworks.md)
1351+
- [Migration Patterns](patterns/migrations.md)
1352+
- [Testing Best Practices](patterns/testing.md)
1353+
- [Performance Optimization](patterns/performance.md)
1354+
- [Troubleshooting Guide](patterns/troubleshooting.md)
1355+
1356+
Working examples in `examples/` directory.
1357+
'''
1358+
1359+
Write(file_path=".claude/skills/sqlspec-usage/skill.md", content=sqlspec_skill)
1360+
print("✓ Created .claude/skills/sqlspec-usage/skill.md")
1361+
```
1362+
1363+
### Step 4.6.4: Generate Pattern Guides
1364+
1365+
Create comprehensive pattern guides:
1366+
1367+
```python
1368+
# Configuration patterns
1369+
Write(file_path=".claude/skills/sqlspec-usage/patterns/configuration.md", content=config_patterns)
1370+
1371+
# Query patterns
1372+
Write(file_path=".claude/skills/sqlspec-usage/patterns/queries.md", content=query_patterns)
1373+
1374+
# Framework integration
1375+
Write(file_path=".claude/skills/sqlspec-usage/patterns/frameworks.md", content=framework_patterns)
1376+
1377+
# Migration patterns
1378+
Write(file_path=".claude/skills/sqlspec-usage/patterns/migrations.md", content=migration_patterns)
1379+
1380+
# Testing patterns
1381+
Write(file_path=".claude/skills/sqlspec-usage/patterns/testing.md", content=testing_patterns)
1382+
1383+
# Performance patterns
1384+
Write(file_path=".claude/skills/sqlspec-usage/patterns/performance.md", content=performance_patterns)
1385+
1386+
# Troubleshooting
1387+
Write(file_path=".claude/skills/sqlspec-usage/patterns/troubleshooting.md", content=troubleshooting_guide)
1388+
1389+
print("✓ Created all SQLSpec pattern guides")
1390+
```
1391+
1392+
### Step 4.6.5: Generate Working Examples
1393+
1394+
```python
1395+
# Litestar integration example
1396+
Write(file_path=".claude/skills/sqlspec-usage/examples/litestar-integration.py", content=litestar_example)
1397+
1398+
# FastAPI integration example
1399+
Write(file_path=".claude/skills/sqlspec-usage/examples/fastapi-integration.py", content=fastapi_example)
1400+
1401+
# Multi-database example
1402+
Write(file_path=".claude/skills/sqlspec-usage/examples/multi-database.py", content=multi_db_example)
1403+
1404+
# Testing patterns example
1405+
Write(file_path=".claude/skills/sqlspec-usage/examples/testing-patterns.py", content=testing_example)
1406+
1407+
# Migration workflow shell script
1408+
Write(file_path=".claude/skills/sqlspec-usage/examples/migration-workflow.sh", content=migration_script)
1409+
1410+
print("✓ Created all SQLSpec example files")
1411+
```
1412+
1413+
### Step 4.6.6: Detect Project Adapters and Create Adapter Skills
1414+
1415+
```python
1416+
# Detect which adapters are used in this project
1417+
adapters_used = []
1418+
1419+
if Grep(pattern=r'from sqlspec.adapters.asyncpg', path='.', output_mode='count') > 0:
1420+
adapters_used.append("asyncpg")
1421+
if Grep(pattern=r'from sqlspec.adapters.psycopg', path='.', output_mode='count') > 0:
1422+
adapters_used.append("psycopg")
1423+
if Grep(pattern=r'from sqlspec.adapters.duckdb', path='.', output_mode='count') > 0:
1424+
adapters_used.append("duckdb")
1425+
if Grep(pattern=r'from sqlspec.adapters.sqlite', path='.', output_mode='count') > 0:
1426+
adapters_used.append("sqlite")
1427+
if Grep(pattern=r'from sqlspec.adapters.aiosqlite', path='.', output_mode='count') > 0:
1428+
adapters_used.append("aiosqlite")
1429+
if Grep(pattern=r'from sqlspec.adapters.oracledb', path='.', output_mode='count') > 0:
1430+
adapters_used.append("oracledb")
1431+
1432+
print(f"Detected adapters: {', '.join(adapters_used)}")
1433+
1434+
# Create adapter-specific skills
1435+
for adapter in adapters_used:
1436+
adapter_skill_content = generate_adapter_skill(adapter)
1437+
Write(file_path=f".claude/skills/sqlspec-adapters/{adapter}.md", content=adapter_skill_content)
1438+
print(f"✓ Created .claude/skills/sqlspec-adapters/{adapter}.md")
1439+
1440+
# Create adapters README
1441+
adapters_readme = '''# SQLSpec Adapter Skills
1442+
1443+
Adapter-specific guidance for each database adapter used in this project.
1444+
1445+
## Detected Adapters
1446+
1447+
''' + '\n'.join([f'- [{adapter}.md]({adapter}.md)' for adapter in adapters_used]) + '''
1448+
1449+
## Adapter Selection Guide
1450+
1451+
See main skill documentation for complete adapter comparison.
1452+
'''
1453+
1454+
Write(file_path=".claude/skills/sqlspec-adapters/README.md", content=adapters_readme)
1455+
print("✓ Created .claude/skills/sqlspec-adapters/README.md")
1456+
```
1457+
1458+
### Step 4.6.7: Update Agent Files to Reference Skills
1459+
1460+
```python
1461+
# Add skills reference to expert.md
1462+
expert_skills_section = '''
1463+
**Use SQLSpec skills for guidance:**
1464+
1465+
```python
1466+
# Main SQLSpec usage skill
1467+
Read(".claude/skills/sqlspec-usage/skill.md")
1468+
1469+
# Pattern guides
1470+
Read(".claude/skills/sqlspec-usage/patterns/configuration.md")
1471+
Read(".claude/skills/sqlspec-usage/patterns/queries.md")
1472+
Read(".claude/skills/sqlspec-usage/patterns/frameworks.md")
1473+
Read(".claude/skills/sqlspec-usage/patterns/testing.md")
1474+
1475+
# Adapter-specific skills
1476+
Read(f".claude/skills/sqlspec-adapters/{adapter}.md")
1477+
1478+
# Working examples
1479+
Read(".claude/skills/sqlspec-usage/examples/litestar-integration.py")
1480+
```
1481+
'''
1482+
1483+
# Insert into expert.md after guides section
1484+
# (Implementation details...)
1485+
1486+
# Add skills reference to testing.md
1487+
testing_skills_section = '''
1488+
```python
1489+
Read(".claude/skills/sqlspec-usage/patterns/testing.md")
1490+
Read(".claude/skills/sqlspec-usage/examples/testing-patterns.py")
1491+
```
1492+
'''
1493+
1494+
# Insert into testing.md
1495+
# (Implementation details...)
1496+
1497+
print("✓ Updated agent files to reference SQLSpec skills")
1498+
```
1499+
1500+
### Step 4.6.8: Summary
1501+
1502+
```python
1503+
print("\n=== SQLSPEC SKILLS CREATED ===\n")
1504+
print("Main skill: .claude/skills/sqlspec-usage/skill.md")
1505+
print("Pattern guides: .claude/skills/sqlspec-usage/patterns/")
1506+
print("Examples: .claude/skills/sqlspec-usage/examples/")
1507+
print(f"Adapter skills: {len(adapters_used)} adapters detected")
1508+
print("\nAgents updated to reference skills automatically.")
1509+
```
1510+
1511+
---
1512+
12931513
## PHASE 5: PROJECT GUIDES CREATION
12941514

12951515
### Step 5.1: Create Architecture Guide

0 commit comments

Comments
 (0)