learn-next-sql — community learn-next-sql, next-sql, shirakawayohane, community, ai agent skill, ide skills, agent automation, AI agent skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Data Analysis Agents needing efficient query crafting with NextSQL's type safety This skill should be used when the user asks to write NextSQL code, generate .nsql files, create NextSQL queries, convert SQL to NextSQL, or learn NextSQL syntax. Use this to understand the NextSQL DS

shirakawayohane shirakawayohane
[0]
[1]
Updated: 3/16/2026

Quality Score

Top 5%
30
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
> npx killer-skills add shirakawayohane/next-sql/learn-next-sql
Supports 19+ Platforms
Cursor
Windsurf
VS Code
Trae
Claude
OpenClaw
+12 more

Agent Capability Analysis

The learn-next-sql skill by shirakawayohane is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Data Analysis Agents needing efficient query crafting with NextSQL's type safety

Core Value

Empowers agents to generate efficient queries using NextSQL, a modern SQL-compatible DSL, with features like method-chained clauses and type safety, enabling seamless interaction with NextSQL databases via protocols like query syntax and clauses

Capabilities Granted for learn-next-sql

Crafting efficient queries with NextSQL's query syntax
Generating type-safe queries for data analysis
Optimizing database interactions using NextSQL's method-chained clauses

! Prerequisites & Limits

  • Requires knowledge of NextSQL language reference
  • NextSQL compatibility required
Project
SKILL.md
7.3 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
SKILL.md
Readonly

NextSQL Language Reference

NextSQL is a modern SQL-compatible DSL with type safety. This reference covers all current features. Always refer to nextsql-core/src/nextsql.pest as the authoritative grammar source.

Query Syntax

Queries are declared with query and use method-chained clauses starting from from().

nsql
1query findUsers($minAge: i32, $limit: i32?) { 2 from(users) 3 .where(users.age >= $minAge) 4 .select(users.id, users.name, users.email) 5}

Clauses (chained with .)

  • from(table) - FROM clause (required). Supports explicit joins via method calls on the table.
  • .where(condition) - WHERE filter.
  • .select(expr, ...) - SELECT columns. Supports alias: expr for aliased columns and table.* for all columns.
  • .distinct() - SELECT DISTINCT.
  • .groupBy(expr, ...) - GROUP BY.
  • .having(condition) - HAVING (used after groupBy).
  • .aggregate(alias: expr, ...) - Named aggregation columns.
  • .orderBy(col.asc(), col.desc()) - ORDER BY with direction methods.
  • .limit(n) - LIMIT.
  • .offset(n) - OFFSET.
  • .when(condition, clause) - Conditional clause application (dynamic queries).
  • .union(from(...).select(...)) - UNION.
  • .unionAll(from(...).select(...)) - UNION ALL.
  • .forUpdate() - SELECT FOR UPDATE.

Explicit JOINs

JOINs are expressed as method calls on tables inside from():

nsql
1from(table1 2 .innerJoin(table2, table1.id == table2.table1_id) 3 .leftJoin(table3, table2.id == table3.table2_id) 4 .rightJoin(table4, table3.id == table4.table3_id) 5 .fullOuterJoin(table5, table4.id == table5.table4_id) 6 .crossJoin(table6))

WITH (CTE)

Common Table Expressions are defined with with before the main query body:

nsql
1query example() { 2 with activePosts = { 3 from(posts).where(posts.is_active == true).select(posts.*) 4 } 5 from(activePosts) 6 .select(activePosts.title) 7}

Mutation Syntax

Mutations are declared with mutation and support INSERT, UPDATE, and DELETE.

INSERT

nsql
1mutation createUser($name: string, $email: string) { 2 insert(users) 3 .value({ 4 name: $name, 5 email: $email, 6 }) 7 .returning(users.*) 8}

Multi-row insert with .values():

nsql
1mutation createUsers($records: [Insertable<users>]) { 2 insert(users) 3 .values($records) 4 .returning(users.*) 5}

UPDATE

nsql
1mutation updateUser($id: uuid, $name: string) { 2 update(users) 3 .where(users.id == $id) 4 .set({ 5 name: $name, 6 }) 7 .returning(users.*) 8}

Use Updatable<T> for partial updates with a variable:

nsql
1mutation updateUser($id: uuid, $data: Updatable<users>) { 2 update(users) 3 .where(users.id == $id) 4 .set($data) 5 .returning(users.*) 6}

DELETE

nsql
1mutation deleteUser($id: uuid) { 2 delete(users) 3 .where(users.id == $id) 4 .returning(users.*) 5}

onConflict (UPSERT)

nsql
1mutation upsertUser($email: string, $name: string) { 2 insert(users) 3 .value({ 4 email: $email, 5 name: $name, 6 }) 7 .onConflict(email).doUpdate({ 8 name: excluded(name), 9 }) 10 .returning(users.*) 11}

Use .doNothing() to ignore conflicts:

nsql
1.onConflict(email).doNothing()

RETURNING

All mutation types support .returning(table.*, col1, col2).

Type System

Built-in Types

i16, i32, i64, f32, f64, string, bool, uuid, timestamp, timestamptz, date

Modifiers

  • Optional: type? (e.g., string?) - parameter may be null
  • Array: [type] (e.g., [uuid]) - array of values

Utility Types

  • Insertable<TableName> - represents a full row for insertion
  • Updatable<TableName> - represents a partial row for updates

Value Types (valtype)

Define named type aliases:

nsql
1// With column binding 2valtype UserId = uuid for users.id 3valtype Email = string for users.email 4 5// Standalone named type 6valtype Amount = f64

Use valtypes as parameter types:

nsql
1query findUser($id: UserId) { 2 from(users).where(users.id == $id).select(users.*) 3}

The types.nsql Convention

Projects should place shared type definitions (valtypes, relations, aggregations) in a types.nsql file to centralize reusable definitions across query/mutation files.

Expressions

Variables

Prefixed with $: $id, $name, $values

Operators

  • Logical: && (AND), || (OR)
  • Equality: ==, !=
  • Comparison: <, <=, >, >=
  • Arithmetic: +, -, *, /, %
  • Unary: ! (NOT)

Method Expressions

Called on columns or expressions with dot notation:

  • col.isNull() - IS NULL
  • col.isNotNull() - IS NOT NULL
  • col.like(pattern) - LIKE pattern matching
  • col.ilike(pattern) - Case-insensitive LIKE
  • col.between(from, to) - BETWEEN range
  • col.eqAny($arr) - = ANY (array contains)
  • col.neAny($arr) - != ANY (array not contains)
  • col.in([val1, val2]) - IN values list
  • col.asc() - ORDER BY ascending (inside .orderBy())
  • col.desc() - ORDER BY descending (inside .orderBy())

Aggregate Functions

SUM(expr), COUNT(expr), AVG(expr), MIN(expr), MAX(expr)

Subqueries

Subqueries are wrapped in $():

nsql
1.where(users.id.in($(from(active_users).select(active_users.id))))

EXISTS

nsql
1.where(exists($(from(orders).where(orders.user_id == users.id).select(orders.id))))

Conditional Expressions

when - conditional clause application:

nsql
1.when($name != null, .where(users.name == $name))

switch/case - pattern matching in select:

nsql
1switch(users.status) { 2 case "active": "Active User" 3 case "inactive": "Inactive User" 4 default: "Unknown" 5}

cast()

Type casting:

nsql
1cast(expr, typename)

Relations (Auto-JOIN)

Relations define table connections and enable automatic JOIN generation via dot-access syntax.

Defining Relations

nsql
1// Basic relation (INNER JOIN) 2relation author for posts returning users { 3 users.id == posts.author_id 4} 5 6// Optional relation (LEFT JOIN, values may be null) 7optional relation profile for users returning user_profiles { 8 user_profiles.user_id == users.id 9} 10 11// Public relation (accessible from other modules) 12public relation category for products returning categories { 13 categories.id == products.category_id 14} 15 16// Public optional relation 17public optional relation metadata for posts returning post_metadata { 18 post_metadata.post_id == posts.id 19}

Using Relations (auto-JOIN via dot access)

Access related columns through the relation name as a property of the source table:

nsql
1query getPostWithAuthor($postId: uuid) { 2 from(posts) 3 .where(posts.id == $postId) 4 .select(posts.title, posts.author.name, posts.author.email) 5 // posts.author.name auto-joins users via the "author" relation 6}

Nested Relation Access

Relations chain for multi-level navigation:

nsql
1// posts -> author (users) -> organization -> parent_org 2.select(posts.author.organization.parent_org.name)

Aggregation Relations

Define computed aggregate values as virtual columns:

nsql
1aggregation post_count for users returning i32 { 2 count(posts.id) 3} 4 5public aggregation avg_rating for products returning f64 { 6 avg(reviews.rating) 7}

Use like regular columns:

nsql
1.select(users.name, users.post_count)

References

See the following for the full grammar and comprehensive examples:

  • Grammar and AST: @references/grammar.md
  • Example files: @references/examples.md

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is learn-next-sql?

Perfect for Data Analysis Agents needing efficient query crafting with NextSQL's type safety This skill should be used when the user asks to write NextSQL code, generate .nsql files, create NextSQL queries, convert SQL to NextSQL, or learn NextSQL syntax. Use this to understand the NextSQL DS

How do I install learn-next-sql?

Run the command: npx killer-skills add shirakawayohane/next-sql/learn-next-sql. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for learn-next-sql?

Key use cases include: Crafting efficient queries with NextSQL's query syntax, Generating type-safe queries for data analysis, Optimizing database interactions using NextSQL's method-chained clauses.

Which IDEs are compatible with learn-next-sql?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for learn-next-sql?

Requires knowledge of NextSQL language reference. NextSQL compatibility required.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add shirakawayohane/next-sql/learn-next-sql. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use learn-next-sql immediately in the current project.

Related Skills

Looking for an alternative to learn-next-sql or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

Generate customizable widget plugins for the prompts.chat feed system

149.6k
0
Design

flags

Logo of vercel
vercel

The React Framework

138.4k
0
Browser

pr-review

Logo of pytorch
pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration

98.6k
0
AI

antd-commit-msg

Logo of ant-design
ant-design

Generate a single-line commit message for ant-design by reading the projects git staged area and recent commit style. Use when the user asks for a commit message, says msg, commit msg, 写提交信息, or wants

97.8k
0
Design