writing-examples

$npx mdskill add supabase/supabase-go/writing-examples

The following documents will be helpful:

SKILL.md

.github/skills/writing-examplesView on GitHub ↗
---
name: writing-examples
description: Guides the creation, update, merging and deletion of examples - the runnable Example functions that render on pkg.go.dev, the code snippets inside doc comments and the example programs under examples/. Use when adding an example, reworking one or deciding whether an existing example is replaced, upgraded, folded into a sibling or removed outright. Covers the removal test and when an example earns its place.
---

The following documents will be helpful:

| Document | For |
| -------- | --- |
| [`standard.md`](../../../standard.md) | The coverage requirement: runnable Example functions accompany doc comments where apt, compiled and verified by go test. |
| [`DEVELOPMENT.md`](../../../DEVELOPMENT.md) | The Commentary section's exception letting a runnable example frame a convention that signatures cannot show. |
| [`decisions.md`](../../../decisions.md) | The records "Placeholder credentials in rendered examples name the real key type" and "Example programs are non-published modules run by the integration tier". |

The doc comment on an example is a comment like any other, owned by the [`writing-commentary`](../writing-commentary/SKILL.md) skill.

## The Removal Test

An example is removed, as the codebase evolves and other examples come in, when it does one of these:

- **Scaffolding**: It shows only that construction succeeds, which every other example in its package does as its first line.
- **Test-shaped**: It asserts behavior that the doc comment already states and a unit test already covers, and nothing in it shows a caller what to do.
- **Superseded**: A later, more mature example shows the same thing better.
- **Near-duplicate**: Its code matches a neighbor's except for one call.

An example stays when it shows a distinct decision, a convention that signatures cannot show or the basic read on one of the two entry routes.

## Replacing and Upgrading

- Fold a near-duplicate into the sibling a reader reaches first, which keeps that sibling's name.
- When a removal leaves one suffixed example standing alone, the suffix distinguishes nothing and the survivor takes the plain name.
- go vet requires an example's name to map to a declared identifier, and an example's explanation sits in its doc comment rather than its body, because pkg.go.dev renders the doc comment as prose above the code.

More from supabase/supabase-go

SkillDescription
auditing-tool-currencyGuides auditing the repository's externally sourced, version-pinned tooling against canonical origins - the GitHub Actions pins, the Go tool module under tools/go, the npm tool module under tools/node, the pinned Supabase CLI and the Go consumer floor. Use when asked which tools could be upgraded, whether pins are stale or to prepare an upgrade report or plan. Audit and report only: applying a bump is the changing-build-and-continuous-integration skill's territory.
changing-build-and-continuous-integrationGuides changes to this repository's build, module and CI machinery rather than the SDK's own code. Use when touching any go.mod, the go.work workspace, the scripts folder, GitHub Actions workflows, the pinned tool modules under tools or the spell-check configuration - including adding a new module, taking on a new dependency or bumping a Go or tool version. Covers workspace wiring for unpublished sibling modules, the published Go version floor versus the CI toolchain, digest pinning, the first-party-actions-only policy and the rule that CI jobs run the same scripts developers run locally.
designing-internal-boundariesGuides the design of internal type contracts in respect of immutability and encapsulation. Enhances codebase maintainability by separating concerns in a manner that is compiler-enforced, both for internal state as well as immutable values returned to callers alike. Use when creating or reworking types, when adding machinery (e.g. parsing, caching, transport, crypto), when naming or splitting an internal package, when writing constructors or defensive copies and when deciding whether a test is external or in-package.
designing-public-interfacesGuides design of this SDK's public API surface. Use when adding, renaming, removing or reshaping any exported identifier in any module published as end-user, consumer-facing interface - whether that module be existing or new to the published surface area. Includes functional options, domain client accessors, error model, sentinel errors, error struct types, exported fields, the accessor pattern, constructor signatures and naming policy.
recording-decisionsGuides when a development decision earns a decisions.md entry and how entries are proposed and written. Use when a design choice is made, changed or reverted during any task. Never write decisions.md unprompted - a candidate entry is proposed in chat through the three-part falsification test (maintainer question, answer-from-source attempt, why the answer fails) and only a commissioned entry is written. Covers the false-trigger list and the What/Why authoring rules.
writing-changelogsGuides the writing and editing of changelog entries in the per-module CHANGELOG.md files. Use when a user-facing change needs an entry, when drafting or reshaping an Unreleased section, or when reviewing entries at release time. Covers the type headings, the entry shape and the succinctness bar - what an entry says and what it leaves to the docs.
writing-commentaryGuides the content and style of all comments - Go doc comments on exported or internal identifiers, package overviews in doc.go, inline comments and comments in scripts, workflows, SQL and configuration files. Use when writing, editing or reviewing any comment on any surface, including comments authored in passing while implementing something else. Covers audience focus (API consumer versus codebase maintainer), contract-first phrasing and where rationale, history and cross-component notes belong instead.