搜索

PythonReactSEOPDF
OpenClaw

sql-assistant

Comprehensive SQL query assistant for database operations, optimization, and troubleshooting. Use when Codex needs to write, debug, optimize, or explain SQL queries; analyze database schemas; or help with SQL-related tasks including joins, subqueries, aggregations, and performance tuning. Supports MySQL, PostgreSQL, SQLite, and other SQL dialects.

hhhh124hhhh0 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install hhhh124hhhh/sql-assistant

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

SQL Assistant

Overview

This skill provides Codex with deep SQL expertise to help users with all database-related tasks: writing efficient queries, debugging errors, optimizing performance, explaining complex queries, and designing database schemas. Based on best practices from database administrators and SQL optimization experts.

Core Capabilities

1. Query Writing

Write clean, efficient SQL queries based on user requirements:

Basic Query Construction:

User: "Show me all users who signed up in the last 7 days"
Codex: SELECT * FROM users WHERE created_at >= DATE('now', '-7 days');

Complex Queries:

  • Joins: Inner, left, right, full outer joins
  • Subqueries: Nested queries, correlated subqueries
  • Aggregations: GROUP BY, HAVING, window functions
  • CTEs: Common Table Expressions for complex logic
  • Unions: Combining results from multiple queries

Example Multi-Join Query:

SELECT
    u.name,
    COUNT(o.id) AS order_count,
    SUM(o.total) AS total_spent
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.created_at >= '2024-01-01'
GROUP BY u.id, u.name
HAVING COUNT(o.id) > 0
ORDER BY total_spent DESC
LIMIT 10;
2. Query Debugging

Identify and fix common SQL errors:

Common Errors to Fix:

  • Syntax errors (missing commas, unbalanced parentheses)
  • Column/table name typos
  • Invalid data type usage
  • Missing FROM clauses
  • Incorrect GROUP BY usage
  • Unquoted string literals

Debugging Process:

  1. Analyze the error message
  2. Identify the root cause
  3. Explain why the error occurred
  4. Provide the corrected query
  5. Explain the fix to help the user learn

Example:

User: SELECT * FROM users WHERE created_at = '2024-01-01' AND status = active
Error: column "active" does not exist

Codex: The issue is that 'active' should be quoted as a string literal:

SELECT * FROM users WHERE created_at = '2024-01-01' AND status = 'active';

Without quotes, SQL treats 'active' as a column name r...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/hhhh124hhhh/sql-assistant
Version
—
Commit
caee5c4cf14e5067244bc71866427f1a5316c91a
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# SQL Assistant

## Overview

This skill provides Codex with deep SQL expertise to help users with all database-related tasks: writing efficient queries, debugging errors, optimizing performance, explaining complex queries, and designing database schemas. Based on best practices from database administrators and SQL optimization experts.

## Core Capabilities

### 1. Query Writing

Write clean, efficient SQL queries based on user requirements:

**Basic Query Construction:**
```
User: "Show me all users who signed up in the last 7 days"
Codex: SELECT * FROM users WHERE created_at >= DATE('now', '-7 days');
```

**Complex Queries:**
- **Joins**: Inner, left, right, full outer joins
- **Subqueries**: Nested queries, correlated subqueries
- **Aggregations**: GROUP BY, HAVING, window functions
- **CTEs**: Common Table Expressions for complex logic
- **Unions**: Combining results from multiple queries

**Example Multi-Join Query:**
```sql
SELECT
    u.name,
    COUNT(o.id) AS order_count,
    SUM(o.total) AS total_spent
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.created_at >= '2024-01-01'
GROUP BY u.id, u.name
HAVING COUNT(o.id) > 0
ORDER BY total_spent DESC
LIMIT 10;
```

### 2. Query Debugging

Identify and fix common SQL errors:

**Common Errors to Fix:**
- Syntax errors (missing commas, unbalanced parentheses)
- Column/table name typos
- Invalid data type usage
- Missing FROM clauses
- Incorrect GROUP BY usage
- Unquoted string literals

**Debugging Process:**
1. Analyze the error message
2. Identify the root cause
3. Explain why the error occurred
4. Provide the corrected query
5. Explain the fix to help the user learn

**Example:**
```
User: SELECT * FROM users WHERE created_at = '2024-01-01' AND status = active
Error: column "active" does not exist

Codex: The issue is that 'active' should be quoted as a string literal:

SELECT * FROM users WHERE created_at = '2024-01-01' AND status = 'active';

Without quotes, SQL treats 'active' as a column name r...

相关技能

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.