本文へ移動
cccskills
無料GitHub で公開

duckdb

DuckDB is an in-process analytical database that runs embedded inside your application with zero external dependencies. It can query CSV, Parquet, and JSON files directly without loading them into tables first, making it ideal for local data exploration, ETL pipelines, and analytical workloads where spinning up a server is overkill.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md6.8 KB
  • _scores.json1.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

DuckDB

DuckDB is an embeddable SQL OLAP database. Think of it as SQLite for analytics — it runs in your process, needs no server, and is optimized for scanning and aggregating large datasets. It reads Parquet, CSV, and JSON files natively, which means you can query your data lake files with SQL without any import step.

This skill covers the CLI for ad-hoc exploration, the Python API for data science workflows, the Node.js API for application integration, and Parquet as the preferred storage format.

CLI

Install DuckDB as a standalone binary. On macOS and Linux, a single download gives you a full-featured SQL shell.

# install — DuckDB CLI via Homebrew (macOS/Linux)
brew install duckdb
# install — DuckDB CLI via direct download (Linux x64)
wget https://github.com/duckdb/duckdb/releases/latest/download/duckdb_cli-linux-amd64.zip
unzip duckdb_cli-linux-amd64.zip
chmod +x duckdb
sudo mv duckdb /usr/local/bin/

Launch the shell and start querying files directly:

# CLI — query a CSV file without creating a table
duckdb -c "SELECT country, count(*) AS orders
            FROM 'orders.csv'
            GROUP BY country
            ORDER BY orders DESC
            LIMIT 10"

The CLI can also persist data to a file-based database:

# CLI — create a persistent database and import data
duckdb analytics.db <<'SQL'
CREATE TABLE events AS SELECT * FROM 'raw_events.parquet';
SELECT event_name, count(*) FROM events GROUP BY event_name;
SQL

Querying Files Directly

DuckDB's most powerful feature is its ability to query files in place. No CREATE TABLE, no COPY, no ETL — just point SQL at a file path or glob pattern.

-- query — scan all Parquet files in a directory
SELECT
    date_trunc('month', created_at) AS month,
    count(*) AS events
FROM 'data/events/*.parquet'
GROUP BY month
ORDER BY month;
-- query — join a CSV with a Parquet file
SELECT
    u.email,
    count(e.event_id) AS event_count
FROM 'users.csv' u
JOIN 'events.parquet' e ON u.id = e.user_id
GROUP BY u.email
ORDER BY event_count DESC
LIMIT 20;
-- query — read JSON lines (newline-delimited JSON)
SELECT * FROM read_json_auto('logs.jsonl') LIMIT 5;

Python API

DuckDB's Python package integrates tightly with pandas and the broader PyData ecosystem. Install it with pip and start querying DataFrames with SQL.

# duckdb_analysis.py — Python API for analytical queries
# pip install duckdb pandas

import duckdb
import pandas as pd

# DuckDB can query pandas DataFrames directly
df = pd.DataFrame({
    'user_id': [1, 2, 3, 1, 2, 1],
    'event': ['view', 'view', 'signup', 'click', 'click', 'view'],
    'ts': pd.date_range('2025-01-01', periods=6, freq='h')
})

# Query the DataFrame with SQL — no import needed
result = duckdb.sql("""
    SELECT event, count(*) AS total, count(DISTINCT user_id) AS users
    FROM df
    GROUP BY event
    ORDER BY total DESC
""").fetchdf()

print(result)

For persistent databases with the Python API:

# duckdb_persistent.py — persistent database with Python
# pip install duckdb

import duckdb

# Open or create a database file
con = duckdb.connect('analytics.db')

# Create a table from a Parquet file
con.execute("""
    CREATE TABLE IF NOT EXISTS events AS
    SELECT * FROM 'raw_events.parquet'
""")

# Run aggregation
daily_stats = con.execute("""
    SELECT
        date_trunc('day', created_at) AS day,
        count(DISTINCT user_id) AS dau,
        count(*) AS total_events
    FROM events
    WHERE created_at >= current_date - INTERVAL '30 days'
    GROUP BY day
    ORDER BY day
""").fetchdf()

print(daily_stats)
con.close()

Node.js API

The duckdb npm package provides async bindings for embedding DuckDB in Node.js applications.

// duckdb-query.js — Node.js DuckDB client for analytical queries
// npm install duckdb

import duckdb from 'duckdb';

const db = new duckdb.Database(':memory:');
const conn = db.connect();

// Load a Parquet file into a table
conn.run(`CREATE TABLE events AS SELECT * FROM 'events.parquet'`);

// Query with aggregation
conn.all(`
  SELECT
    event_name,
    count(*) AS total,
    count(DISTINCT user_id) AS unique_users
  FROM events
  GROUP BY event_name
  ORDER BY total DESC
`, (err, rows) => {
  if (err) throw err;
  console.table(rows);
  db.close();
});

For a promise-based workflow with the newer duckdb-async wrapper:

// duckdb-async-example.js — promise-based DuckDB queries in Node.js
// npm install duckdb-async

import { Database } from 'duckdb-async';

async function analyze() {
  const db = await Database.create(':memory:');

  // Query CSV directly
  const topPages = await db.all(`
    SELECT page, count(*) AS views
    FROM 'pageviews.csv'
    GROUP BY page
    ORDER BY views DESC
    LIMIT 10
  `);

  console.table(topPages);
  await db.close();
}

analyze();

Parquet Integration

Parquet is a columnar file format that pairs naturally with DuckDB. It compresses well, preserves types, and enables predicate pushdown so DuckDB can skip irrelevant row groups without reading entire files.

Writing Parquet

-- export — write query results to a Parquet file
COPY (
    SELECT user_id, event_name, created_at
    FROM 'raw_events.csv'
    WHERE created_at >= '2025-01-01'
) TO 'filtered_events.parquet' (FORMAT PARQUET, COMPRESSION ZSTD);

Partitioned Parquet

For large datasets, partition your Parquet output by a key column to enable partition pruning:

-- export — write partitioned Parquet files by month
COPY (
    SELECT *, date_trunc('month', created_at) AS month
    FROM events
) TO 'data/events' (FORMAT PARQUET, PARTITION_BY (month), COMPRESSION ZSTD);

This creates a directory structure like data/events/month=2025-01/data_0.parquet that DuckDB can scan with automatic partition filtering.

Inspecting Parquet Metadata

-- metadata — inspect Parquet file schema and row counts
SELECT * FROM parquet_metadata('events.parquet');
SELECT * FROM parquet_schema('events.parquet');

DuckDB's Parquet support makes it an excellent tool for building lightweight data pipelines: ingest raw data from any format, transform it with SQL, and write optimized Parquet files for downstream consumers.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Scripts and configures production rendering in Autodesk 3ds Max with the V-Ray and Corona renderers: output size and files, render elements, denoising, light mix, batch and command-line rendering, and network rendering. Use when a user asks to set up a production render, render several cameras in one batch, render from the command line or on a render farm, add render passes for compositing, or cut render time for archviz and product shots.

日本語の概要は準備中です。原文の説明を表示しています。

TerminalSkills/skills1652026年10月4日 更新

Covers scripting Autodesk 3ds Max, the 3D modeling and rendering application, with MAXScript and Python (pymxs): scene manipulation, object creation, material assignment, camera and light setup, batch operations, and file I/O. Use when tasks involve automating repetitive 3ds Max workflows, batch processing scenes, running scripts headless with 3dsmaxbatch, creating custom tools, or scripting scene setup for archviz, product visualization, or VFX.

日本語の概要は準備中です。原文の説明を表示しています。

TerminalSkills/skills1652026年10月4日 更新

3proxy

無料

3proxy is a small open-source proxy server that runs HTTP/HTTPS, SOCKS4/5, SNI and TCP/UDP port-mapping proxies from one config file. Use when a user asks to set up an HTTP or SOCKS5 proxy, add proxy users and passwords, write 3proxy access rules, chain or rotate upstream (parent) proxies, limit bandwidth, connections or monthly traffic per user, run 3proxy in Docker, or fix a 3proxy.cfg that will not start.

日本語の概要は準備中です。原文の説明を表示しています。

TerminalSkills/skills1652026年10月4日 更新

Builds Agent2Agent (A2A) servers and clients, the open protocol (originally from Google, now under the Linux Foundation) that lets AI agents from different frameworks call each other. Use when the user wants to create an A2A-compliant agent, build an Agent Card, implement task management, connect agents across frameworks, set up agent discovery, handle streaming responses, implement push notifications, or orchestrate multi-agent workflows. Trigger words: a2a, agent to agent, agent2agent, a2a protocol, a2a server, a2a client, agent card, agent interoperability, agent collaboration, multi-agent, agent discovery, a2a sdk, a2a task.

日本語の概要は準備中です。原文の説明を表示しています。

TerminalSkills/skills1652026年10月4日 更新

Plans a controlled experiment (A/B test) so its result can be trusted: writes the hypothesis, picks one primary metric and the guardrails, computes sample size and run time, specifies how visitors are assigned and when exposure is logged, and reads out the result with a confidence interval. Use when someone says "set up an A/B test", "split test this page", "how many visitors do I need", "how long should the experiment run", "is this result significant", "can I stop the test early", or wants to test a headline, price, layout or onboarding change against the current version.

日本語の概要は準備中です。原文の説明を表示しています。

TerminalSkills/skills1652026年10月4日 更新

ably

無料

Ably is a hosted realtime messaging service: clients publish and subscribe to named channels over WebSockets, see who is present, replay message history, and resume after a dropped connection. Use when a user asks to "add realtime updates", "push live notifications to the browser", "show who is online", "add a chat room with typing indicators", "publish from a serverless function", or "authenticate Ably clients without exposing the API key". Covers the ably 2.x JavaScript SDK (Realtime and REST), JWT token authentication, presence, history and rewind, batch publishing, and the @ably/chat 1.x SDK.

日本語の概要は準備中です。原文の説明を表示しています。

TerminalSkills/skills1652026年10月4日 更新

TerminalSkills のスキルをすべて見る

このスキルの問題を報告する