mcpField
S
sql-writing-style

sql-writing-style

github.com/efoo-teamData & databases052 installsUpdated 1w ago
Repository

About sql-writing-style

A skill that guides agents in writing readable SQL using a structured rule format and bad/good examples. It focuses on reducing the effort required to understand queries.

Key features

  1. 01Readable table aliases
  2. 02Consistent rule-and-example structure
  3. 03Bad/good SQL comparisons

Use cases

  1. 01Reviewing SQL for readability
  2. 02Writing queries for maintainable codebases

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/efoo-team/skills --skill sql-writing-style

After installing, type/sql-writing-stylein Claude Code to confirm it loaded.

Details

From the project README

SQL Writing Style

SQLは実行回数より読まれる回数のほうが多い。読み手の認知負荷を最小にする。

各ルールは「見出し(### 採番. ルールの要旨)+1行の理由+bad / good の対比例」で書く。ルールを追加するときはこの節構造を踏襲する。

ルール

1. テーブルエイリアスは全文を使う。無意味な短縮をしない

FROM stores s のような1文字エイリアスで読み手に逆引きを強いるのは避ける。ただし自己結合や、極端に長いテーブル名で全文表記がかえって読みにくくなる場合は、意味が伝わる短縮エイリアスを許す。

-- bad
FROM stores s
JOIN users u ON u.store_id = s.id

-- good
FROM stores
JOIN users ON users.store_id = stores.id

Comments

Markdown supported