pm-sql

Generate traceable SQL queries from PMContext metric definitions and natural language questions.

1|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/Wcof/PMSkill --skill pm-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pm-sql
Source: https://github.com/Wcof/PMSkill/tree/main/skills/delivery/pm-sql
Command: npx skills add https://github.com/Wcof/PMSkill --skill pm-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps turn a product or business question into production-ready SQL that matches the metric definitions in PMContext instead of guessing the logic. It reduces the common risk of writing a query that runs successfully but answers the wrong business question because the retention, user segment, or KPI definition is inconsistent.

Core Features & Use Cases

  • PMContext-aligned SQL generation: Reads metric definitions, user scenarios, and global constraints from PMContext so queries follow the agreed business logic.
  • Natural language to SQL workflow: Explains the query logic in plain language before generating SQL, making it easier for PMs and stakeholders to validate the approach.
  • Multi-dialect support with safeguards: Adapts output for BigQuery, PostgreSQL, MySQL, Snowflake, and similar SQL environments, while flagging missing schema, dialect ambiguity, or metric conflicts.
  • Performance and validation guidance: Adds optimization suggestions such as indexes, partitions, or materialized views, and includes validation queries for result checking.
  • Use cases: Suitable for retention analysis, KPI reporting, cohort support queries, experiment data pulls, and translating natural-language analytics requests into traceable SQL artifacts.

Quick Start

Ask the pm-sql skill to read PMContext and your schema, explain the query logic for your business question, then generate the correct SQL with performance notes and validation checks for your target database dialect.

Frequently Asked Questions about pm-sql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate SQL queries from natural language business questions?

To generate SQL from natural language, the Skill translates business questions into plain-language logic, aligns it with PMContext metric definitions, and then constructs schema-aware SQL. This ensures queries match agreed business logic before execution.

Does this SQL generation approach support BigQuery, PostgreSQL, and Snowflake dialects?

Yes, this approach supports BigQuery, PostgreSQL, MySQL, and Snowflake dialects. It adapts the SQL output to the specific target database while flagging dialect ambiguities or missing schema information during generation.

How do I ensure my KPI computation SQL matches the agreed business metric definitions?

Ensure KPI computation SQL matches business definitions by reading metric definitions and global constraints from PMContext. The Skill traces generated queries back to these explicit metric sources to prevent inconsistent reporting.

What is the best way to write retention analysis SQL without guessing the cohort logic?

The best way to write retention analysis SQL is to validate the query logic in natural language first. The Skill explains cohort and user segment logic before generating SQL, ensuring stakeholders verify the approach.

Can I get performance optimization and validation guidance for my analytics SQL queries?

Yes, you can get performance optimization and validation guidance. The Skill suggests indexes, partitions, or materialized views and includes validation scripts to check query results against the target database.

Why does my generated SQL run successfully but return the wrong business metrics?

SQL returns wrong metrics when retention, user segment, or KPI definitions are inconsistent. This Skill solves that by applying schema-aware query construction and explicit metric-source traceability from PMContext.