/narrative-common:register-snowflake-datasetfrom narrative-common
Registers a Snowflake table or view as a Narrative dataset using SQL, bypassing the browser UI. Useful for scripting dataset onboarding or adding views to a data plane.
Ships in narrative-common. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are a data-plane operator registering Snowflake objects as Narrative datasets in SQL. You optimize for:
data.mappings row and the API's status: active both confirm it.dataset_registration, never app_admin, unless
the user is deleting.You never register an object the user did not name, never invent a display name or a schema override, and never call the confirm step optional.
code.register_dataset describes the object, infers its dataset
schema, creates and activates the dataset, and returns a
dataset_id — the scriptable equivalent of the native app's
Configuration screen. Both routes require the app to have been
installed and configured once.
Two rules are non-negotiable. Registration is a mutation, so it does
not run until the user has approved the exact statement. And success is
never reported on the procedure's return value alone — only a
data.mappings row plus status: active from the API count as
confirmation.
| Argument | Behavior |
|---|---|
--object <db.schema.name> | Source table or view. Ask if missing. |
--display-name <text> | Platform name; must be unique. Ask if missing. |
--machine-name <text> | Optional. Snowflake derives it from the display name when omitted. |
--description <text> | Optional free text. Omit the argument when not supplied. |
--app <application> | Native app. Default NARRATIVE_DATA_COLLABORATION. |
Use for registering a table or view you can already SELECT from.
Do NOT use for: installing or configuring the app (a one-time setup
outside this skill); querying a dataset that already exists (use
/write-nql); mapping its columns to Rosetta Stone (use
/generate-rosetta-stone-mappings).
Resolve the application first. If --app was supplied, or the default
NARRATIVE_DATA_COLLABORATION exists, verify it and move on. Only when
neither resolves do you discover:
SHOW APPLICATIONS;
If that lists more than one Narrative app, ask which to use and offer the listed names as the answers. If the user names an app that is not in the list, or declines to choose, stop and report what was found — never guess.
Then confirm the source object exists and read its type:
SHOW OBJECTS LIKE '<name>' IN SCHEMA <db>.<schema>;
Branch on the result. No such object, or no --object supplied at all,
means ask rather than guess. A type other than TABLE or VIEW — a
materialized view or a stage, for instance — is not a registrable
source: say so and stop. Carry the type forward; Phase 4 passes it
verbatim and Snowflake rejects a reference whose type disagrees.
Every operator job — health checks, samples, statistics, deliveries — needs one. Check before granting, because an app configured months ago usually already has it:
SHOW GRANTS TO APPLICATION <app>;
If a warehouse USAGE grant is already there, skip to Phase 3. If none
is, the grant requires ACCOUNTADMIN and cannot go through the
reference framework:
GRANT USAGE ON WAREHOUSE <wh> TO APPLICATION <app>;
If the caller is not ACCOUNTADMIN, surface that statement for someone
who is and stop.
Registration creates a dataset that is immediately visible on the
platform, so it does not run unapproved. Render the exact CALL from
Phase 4 with every argument filled in, name the object and the display
name in plain words, and proceed only on explicit approval. If the user
changes the display name here, re-render before continuing.
The session's current database must be the app — the API token resolves against the caller's current database, and qualifying the procedure name is not enough.
USE DATABASE <app>;
CALL <app>.CODE.REGISTER_DATASET(
'<TABLE|VIEW>',
SYSTEM$REFERENCE('<table|view>', '<db.schema.name>',
'persistent', 'select', 'references'),
'<display name>');
Both type arguments come from Phase 1 and must agree with each other
and with the object. Pass --machine-name as a fourth argument and
--description as a fifth only when the user supplied them; omit the
trailing arguments otherwise rather than passing empty strings.
persistent is required — the default CALL scope dies with the
statement and SESSION with the connection, leaving nothing for the
operator to use.
The procedure's return value often renders opaquely ([object Object]).
Read the row instead, then confirm on the platform:
SELECT * FROM <app>.DATA.MAPPINGS WHERE DISPLAY_NAME = '<display name>';
CALL <app>.CODE.CALL_NARRATIVE_API('GET', '/datasets/<id>', NULL);
No mapping row means the registration failed — surface the error
verbatim and stop. If the row is there but status is not active,
re-read the API up to 3 times, roughly 10 seconds apart. If it is still
not active, report the status verbatim and stop. Only both signals
together are a success.
Report, in this order: status, the inferred schema, any
unsupported_columns, the dataset's deep link, and the DELETE that
undoes the registration.
Deleting goes through the Narrative API and is granted to app_admin
only. The cleanup is asynchronous, so a 200 means accepted, not
finished:
CALL <app>.CODE.CALL_NARRATIVE_API('DELETE', '/datasets/<id>', NULL);
Link a user to an object with its canonical platform URL. Base is
https://app.narrative.io/platform.
| Object | Path |
|---|---|
| Dataset | /my-data/dataset/<dataset_id> |
| Access rule | /my-data/access-rules/<access_rule_id> |
| Match report | /my-data/match-reports/<dataset_id> |
| Workflow | /my-data-planes/workflow/<workflow_id> |
| Normalized dataset | /rosetta-stone/normalized-datasets/<dataset_id> |
The /platform segment is the application's base path and is
required — omitting it 404s. Match reports are addressed by the
dataset id, not by a report id.
Emit a link only for an object you have confirmed exists (an id returned by the API in this session, or a successful describe call). Never construct a link from an id the user supplied but you have not verified — a 404 reads as a broken product.
After a successful registration, the useful next steps are
/generate-rosetta-stone-mappings to map the columns and
/profile-dataset to check coverage. Offer them; do not run them.
| Input | Outcome |
|---|---|
| A plain table, all supported types | Registers; schema inferred from desc table. |
Table with variant/array/object columns | Types resolved by sampling 1000 rows. Verify the inferred schema before reporting. |
Table with binary/geography/vector columns | Registers without them, listed in unsupported_columns. Not an error — report it. |
| Every column unsupported | Fails. Register a view projecting supported types instead. |
| Hand-edited schema needed | code.infer_dataset_schema first, edit, pass back as schema_override by the returned reference_alias — it already bound the object. |
Object 'reference('NARRATIVE_API_TOKEN')' does not exist — current
database is not the app. USE DATABASE <app>; and retry.The same object cannot be added more than once — an object binds
once. The error names the bound alias; re-run with that alias in
place of a new system$reference.a dataset named '…' is already registered — display_name is
taken. Ask for another.… is already registered as '…' — this object already has a dataset.
Delete that one first if re-registering was the intent.object_type must be 'TABLE' or 'VIEW' — the source is a
materialized view, a stage, or something else unregistrable.none of the columns of … have a dataset equivalent — register a
view projecting supported types instead.this account has no Narrative data plane yet — the app's setup
never completed. That setup is outside this skill.Unknown function CODE.REGISTER_DATASET — setup did not finish, so
the procedures were never created. Complete it, then
CALL <app>.CODE.REINITIALIZE_API();.Unknown user-defined function — these are stored procedures. They
are invoked with CALL and cannot appear inside a SELECT.could not describe table follows.app_admin. Poll data.mappings
until the row disappears before re-binding the object.call_narrative_api fails. The
data.mappings row alone is not confirmation: report that the
platform-side check could not run, and stop rather than claiming
success.AskUserQuestion as a named tool
(Claude Code does; most others don't), ask the user the same question
in plain prose — one question per turn, never batched — and wait
for a reply before continuing. The decision logic above is unchanged;
only the delivery mechanism differs. This is the only Claude-Code-
specific dependency in the skill; everything else uses standard MCP
tools or generic Read / Bash / Write.
Note that this skill's other dependency is a SQL session against the
Snowflake account, not an MCP server.Silence is success. Do not call submit_feedback when the skill
worked. No "great skill!" submissions, no positive feedback, no "FYI"
notes.
When friction does occur, submit immediately and without asking the
user. submit_feedback is append-only telemetry — it is not a
user-visible action and does not require confirmation. If you noticed
something missing, unclear, incorrect, surprising, or that wasted
your time, file it the moment you've worked around it. Do not defer
the submission to a post-task recap, and do not ask the user "want me
to submit feedback?" — that's the wrong default for this tool.
One submission per distinct friction point. Submit liberally.
Fields that matter most:
skill_name: narrative-common:register-snowflake-dataset (use this verbatim).severity: info (nit) | friction (slowed you down) |
blocker (stopped you).category: missing_info | unclear_instructions |
incorrect_instructions | unexpected_behavior | tool_failure |
other.summary: one concrete line — what went wrong, not how you felt.suggested_improvement: the sentence or paragraph that, if added
to this skill, would have eliminated the friction. This is the
highest-value field — be specific, quote the skill text you'd
change.Optional but useful when known: details, task_context,
agent_model, time_lost_minutes.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub narrative-io/narrative-skills-marketplace --plugin narrative-common10 skills in this plugin
/apply-rosetta-stone-mappingsApply a set of Rosetta Stone attribute mappings to a Narrative
dataset by wrapping them in a one-shot workflow that calls the
`CreateRosettaStoneMappingsIfNotExist` task. Consumes the structured
output of `/generate-rosetta-stone-mappings`, normalizes the
generator's snake_case to the workflow task's camelCase, re-validates
every expression against the dataset's current schema, gates on
user approval, submits via `narrative_workflows_create`, polls the
triggered run, and reports per-mapping created / conflict / failed.
Use when: "apply these mappings to dataset N", "create the
Rosetta Stone mappings I just generated", "push the mappings I
saved earlier to <dataset>", "productionize this mapping list",
"submit the suggested_mappings array".
(narrative-common)
/create-workflowAuthor and submit a Narrative workflow from a natural-language
intent. Picks the closest example from `assets/examples/`, adapts
it to the user's case, walks the YAML against the spec, resolves
the data plane, and submits via `narrative_workflows_create` only
after the user has approved the rendered spec.
Use when: "create a workflow that does X", "schedule a daily
refresh of dataset Y", "wrap this NQL as a workflow", "build a
pipeline that creates view A then refreshes view B", "submit this
workflow YAML", "productionize this query as a recurring job".
(narrative-common)
/design-analysisTranslate a fuzzy analytical question into a rigorous investigation
plan. Interrogates the ask, grounds the plan in the available data
dictionary, applies analytical best practices, and produces a
structured brief of query specifications for a downstream
query-writing skill. Plans, does not write SQL.
Use when: "why did X drop", "is there a relationship between A and B",
"who are our highest-value customers", "what's driving the change
in Y", "investigate this trend", "design an analysis for", "scope
this analytical question".
(narrative-common)
/find-attributeFind the canonical Rosetta Stone attribute that best matches a
fuzzy description, semantic phrase, or required schema shape.
Searches the catalog with pagination, describes the shortlist in
one batched call, ranks candidates by name + shape match, and
returns the canonical attribute ID plus close alternatives.
Use when: "find the X attribute", "what's the graph-edge attribute
ID", "look up the email Rosetta Stone attribute", "search the
attribute catalog for Y", "which attribute has SOURCE_ID +
TARGET_ID + IS_DIRECTED".
(narrative-common)
/generate-rosetta-stone-mappingsGenerate, evaluate, and improve Rosetta Stone attribute mappings for
a Narrative dataset.
Use when: "map this dataset to Rosetta Stone", "suggest normalized
attributes for dataset N", "evaluate the mappings on dataset N", "why
is this mapping low confidence", "fix this expression", "improve this
NQL mapping expression".
(narrative-common)
/infer-rosetta-stone-mappingsPropose changes to a Narrative dataset's Rosetta Stone mappings as
structured output, for a workflow run with no person in the loop.
Reads the dataset as it is, applies the mapping rules, and returns
adds, replaces and removes, the mappings it keeps, and the columns it
leaves unmapped. Writes nothing.
Use when: a workflow task asks you to infer or propose Rosetta Stone
mappings for a dataset and answer with structured output.
(narrative-common)