mcpbeat Sign in

Planetscale Codebase Sqlcommenter Instrumentation Agent Skill

Inspect an application repository connected to PlanetScale and recommend SQLCommenter-compatible query tagging packages and conventions.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
103
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/planetscale/skills --skill planetscale-codebase-sqlcommenter-instrumentation

The instruction itself

15 sections, as written by the author

Codebase SQLCommenter instrumentation

Purpose

Inspect the application repository connected to PlanetScale and recommend the correct SQLCommenter-style instrumentation so PlanetScale Insights and Postgres Traffic Control can attribute queries to application code paths. Do not edit files or install dependencies without approval.

Repository inspection

Identify:

  • Language and framework.
  • ORM or query builder.
  • Database adapter.
  • Migration tool.
  • Background job system.
  • Routing framework.
  • Deployment metadata source, such as git SHA or release ID.
  • Existing SQL comments, query tags, tracing, OpenTelemetry, or database middleware.
  • PlanetScale connection configuration.
  • Whether the repository connects to Vitess, Postgres, or both.

Use the most native maintained option for the detected stack.

Ruby on Rails / ActiveRecord

Preferred for PlanetScale tag compatibility:

  • activerecord-sql_commenter from PlanetScale when Rails query comments need SQLCommenter format for PlanetScale Query Insights.

Other options:

  • Rails built-in query logs when sufficient and compatible with the target database/Insights behavior.
  • marginalia for older Rails or when Basecamp-style ActiveRecord query attribution is already in use.
  • sqlcommenter_rails where the project already uses the OpenTelemetry SQLCommenter ecosystem.

Recommend tags:

  • application
  • controller
  • action
  • job
  • route
  • release_sha

Laravel / PHP

Preferred:

  • spatie/laravel-sql-commenter for SQLCommenter-format comments compatible with PlanetScale Query Insights.

Recommend tags:

  • application
  • route
  • controller
  • action
  • job
  • queue
  • release_sha

Prisma / TypeScript / JavaScript

Preferred:

  • Prisma’s first-party SQL comments packages when Prisma is detected:
  • @prisma/sqlcommenter
  • @prisma/sqlcommenter-query-tags
  • @prisma/sqlcommenter-trace-context

Note: PlanetScale’s Postgres query-tag docs may list Prisma as lacking official SQLCommenter support, but Prisma’s own current docs provide first-party SQLCommenter packages. Prefer current Prisma docs when Prisma is detected.

Recommend tags:

  • application
  • service
  • route
  • operation
  • feature
  • release_sha

Knex / Sequelize / Express / Node

Use SQLCommenter-compatible middleware or instrumentation from the OpenTelemetry SQLCommenter ecosystem where maintained and compatible.

Recommend tags:

  • application
  • service
  • route
  • controller
  • action
  • feature
  • release_sha

Kysely / Drizzle / Bun / custom query builders

If there is no maintained SQLCommenter package, recommend manual tagging at the database client boundary or query builder extension layer.

Requirements:

  • Tags must be structured SQL comments.
  • Tags must be inserted before the statement terminator.
  • Tags must survive ORM, proxy, and pooler behavior.
  • Values must be URL encoded and safe for SQL comments.
  • Tags must be low-cardinality.

Django / SQLAlchemy / psycopg2 / Flask / Python

Use SQLCommenter instrumentation from the OpenTelemetry SQLCommenter ecosystem where compatible.

Recommend tags:

  • application
  • framework
  • route
  • view
  • job
  • release_sha

Java / Hibernate / Spring

Use SQLCommenter-compatible instrumentation for Hibernate/Spring where compatible.

Recommend tags:

  • application
  • service
  • controller
  • action
  • route
  • release_sha

Go / database/sql / net/http / gorilla/mux

Use SQLCommenter-compatible instrumentation or a database wrapper at the query boundary.

Recommend tags:

  • application
  • service
  • handler
  • route
  • job
  • release_sha

Standard tag policy

Recommend this baseline across all frameworks:

  • Stable, bounded values only.
  • Normalize routes before tagging.
  • Include app/service/job attribution.
  • Include deploy SHA.
  • Include source type for agents, scripts, BI, workers, and integrations.
  • Do not include secrets, PII, user IDs, request IDs, raw tenant IDs, or raw URLs.

Validation plan

Before recommending merge:

  • Confirm generated SQL comments appear in local/staging query logs.
  • Confirm comments survive the ORM, driver, pooler, and PlanetScale connection path.
  • Confirm Insights displays tags.
  • Confirm tag cardinality is bounded.
  • Confirm Traffic Control can match the intended tags for Postgres.
  • Confirm no sensitive data is present.

Output

Return:

  • Detected stack.
  • Current query tagging state.
  • Recommended package or manual instrumentation path.
  • Proposed tag schema.
  • Files likely to change.
  • Validation steps.
  • Risks.
  • Proposed changes requiring approval.

End with:

“No repository files or dependencies have been changed.”

Other skills for the same job

different authors, same section of the catalogue
MCP Builder
by anthropics
vendor ×13

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

30k tokens scripts
Changelog Generator
by frostant
×9

Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.

774 tokens
Finishing A Development Branch
by ZhanlinCui
×7

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup

1k tokens
MCP Builder
by JayZeeDesign
×7

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

37k tokens scripts
Vercel React Native Skills
by vercel-labs
vendor ×6

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

39k tokens
Vercel React Best Practices
by ratacat
×5

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

34k tokens
Next Best Practices
by vercel-labs
vendor ×4

Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling

20k tokens
Using Git Worktrees
by ZhanlinCui
×4

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification

1k tokens

How to use it

Copy the folder

Take planetscale/planetscale-codebase-sqlcommenter-instrumentation from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.