Skip to content
Agentmart
Submit a tool

peg-parser-new-statement

Add a new SQL statement type to DuckDB's PEG parser.

Skill by mondaycomOfficial

IndexedMIT★ 4
Write a review

Chalk Labs

Need help deploying peg-parser-new-statement?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mondaycom-peg-parser-new-statement

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Add a new SQL statement type to DuckDB's PEG parser. Use when the user asks to add, implement, or support parsing for a new SQL statement or syntax (e.g. CREATE TRIGGER, DROP TRIGGER, CREATE MATERIALIZED VIEW) in the PEG parser.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/peg-parser-new-statement

What's inside

Skill name
peg-parser-new-statement
Description
Add a new SQL statement type to DuckDB's PEG parser. Use when the user asks to add, implement, or support parsing for a new SQL statement or syntax (e.g. CREATE TRIGGER, DROP TRIGGER, CREATE MATERIALIZED VIEW) in the PEG parser.
License
MIT
Instructions
420 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • files: referenced but missing: scripts/generate_peg_transformer.py

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Add a New Statement to the PEG Parser

Add `$ARGUMENTS` to DuckDB's PEG parser. The PEG parser lives in `extension/autocomplete/` and runs as a parser override extension before the legacy Postgres parser.

**Choose your path** based on the statement form:
- **CREATE-form** (e.g. `CREATE TRIGGER`, `CREATE MATERIALIZED VIEW`) → follow Shared Steps, then Part A
- **DROP-form** (e.g. `DROP TRIGGER`) → follow Shared Steps, then Part B

---

## Shared Step 1 — Add the catalog type

In `src/include/duckdb/common/enums/catalog_type.hpp`, add:

```cpp
XXX_ENTRY = <next available number>,
```

In `src/common/enums/catalog_type.cpp`, add to both `CatalogTypeToString` and `CatalogTypeFromString`.

---

## Shared Step 2 — Add enums (if needed)

Create `src/include/duckdb/common/enums/xxx_type.hpp` for any new enums specific to this statement, then regenerate:

```bash
python3 scripts/generate_enum_util.py
```

---

## Part A: CREATE-form statements

### A1 — Define the grammar

Create `extension/autocomplete/grammar/statements/create_xxx.gram`.

Wire the new statement into `CreateStatementVariation` in `create_table.gram`:

```
CreateStatementVariation <- ... / CreateXxxStmt
```

After any `.gram` edit, regenerate (never edit `inlined_grammar.gram` or `inlined_grammar.hpp` directly):

```bash
python3 extension/autocomplete/inline_grammar.py --grammar-file
python3 extension/autocomplete/inline_grammar.py
```

See the **Grammar reference** section below for syntax rules.

---

### A2 — Create the parsed data struct

**Header**: `src/include/duckdb/parser/parsed_data/create_xxx_info.hpp`

```cpp
#pragma once
#include "duckdb/parser/parsed_data/create_info.hpp"

namespace duckdb {

struct CreateXxxInfo : public CreateInfo {
    CreateXxxInfo();

    string name;
    // ... your fields

    unique_ptr<CreateInfo> Copy() const override;
    string ToString() const override;
    DUCKDB_API void Serialize(Serializer &serializer) const override;
    DUCKDB_API static unique_ptr<CreateInfo> Deserialize(Deserializer &deserializer);
};

} // namespace duckdb
```

**Implementation**: `src/parser/parsed_data/create_xxx_info.cpp`
- Constructor: `CreateXxxInfo() : CreateInfo(CatalogType::XXX_ENTRY, INVALID_SCHEMA) {}`
- `Copy()`: call `CopyProperties(*result)` then copy each field
- `ToString()`: reconstruct the SQL string

If a field is a `unique_ptr<SQLStatement>` (not `SelectStatement`), it cannot be auto-serialized. Store the SQL text alongside it:

```cpp
string sql_body_text;          // serialized
unique_ptr<SQLStatement> sql_body; // runtime only
```

Add to `src/parser/parsed_data/CMakeLists.txt`:
```cmake
create_xxx_info.cpp
```

---

### A3 — Add serialization config

In `src/include/duckdb/storage/serialization/create_info.json`, add:

```json
{
  "class": "CreateXxxInfo",
  "base": "CreateInfo",
  "enum": "XXX_ENTRY",
  "includes": ["duckdb/parser/parsed_data/create_xxx_info.hpp"],
  "members": [
    { "id": 200, "name": "field_name", "type": "string" },
    { "id": 201, "name": "my_enum",    "type": "MyEnumType" },
    { "id": 202, "name": "my_bool",    "type": "bool" }
  ]
}
```

Supported types: `string`, `bool`, `int64_t`, `uint64_t`, `vector<string>`, `unique_ptr<SelectStatement>`, any registered enum. `SQLStatement*` is **not** supported — use `string` instead.

From mondaycom/duckdb-claude, MIT.

Signals

Stars
4
Forks
1
Open issues
0
Last commit (this folder)
Mar 19, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from mondaycom

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get peg-parser-new-statement running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying peg-parser-new-statement?

CallGet help
Cite this page

peg-parser-new-statement skill. Agent Mart. https://agentmart.dev/skills/mondaycom-peg-parser-new-statement (last updated 2026-10-24)