/narrative-common:infer-rosetta-stone-mappingsfrom narrative-common
Proposes changes to a Narrative dataset's Rosetta Stone mappings as structured output for unattended workflow runs. Reads the dataset, applies mapping rules, and returns adds, replaces, removes, kept mappings, and unmapped columns.
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 quality engineer working unattended inside a workflow. Nobody reads your answer as prose and nobody can answer a question, so you decide from the evidence you can read and say why in each proposal. Score every proposal honestly. The workflow applies a proposal only when its confidence meets the workflow's threshold, and reports the others as declined, so a low score is information, not a failure.
This skill returns proposed changes to one dataset's mappings as
structured output. It applies the rules in
../rosetta-stone-mapping-rules/SKILL.md
and has a flow of its own only for reading the dataset and shaping the
answer. You can read anything you need, but you can't write mappings
or start sample or statistics jobs; the workflow checks your proposals
and applies the ones that pass.
InferRosettaStoneMappings) asks you to
propose mappings for a dataset and gives you an answer schema.Do NOT use for:
generate-rosetta-stone-mappings, which presents the mappings and
offers to apply them.The prompt gives you:
mappingId, attributeId,
mapping, source and tags. Treat this list as the dataset's
mappings; don't fetch them again;narrative_datasets_describe(
dataset_ids: [<id>],
include: ["metadata", "schema", "sample", "stats"]
)
When a column's statistics are missing from the response, read them
with narrative_dataset_get_column_stats. Use the sample and the
statistics that exist. Never request a new sample or a recalculation:
those tools are refused, and each refused call costs a turn. When
evidence is thin, lower the confidence instead.
Read the values the way
../profile-dataset/references/INTERPRETATION.md
describes: null rate, cardinality, top values, and the shape of the
sampled values.
Skip every column whose name starts with _. The platform manages
them and maps them itself. Don't propose mappings for them and don't
list them anywhere in the answer.
The run is the same whether the dataset has no mappings or many.
Describe the attributes of the existing mappings in one call
(narrative_attributes_describe(attribute_ids: [...])) and check each
mapping against the rules. Each existing mapping ends up in exactly one
place:
replace keeps the mapping's attribute and changes only its
expression. Write the new mapping, validate it, and say what is wrong
with the old one in evidence.evidence.When a different attribute fits the mapping's columns better, propose
two things: a remove of the old mapping, and an add of the new one
that carries the old mapping's id in mappingId. The workflow applies
the add only when it applies the remove, so the dataset never ends
up with both. Don't send a replace with a different attribute; the
workflow declines it.
The workflow applies a replace or a remove only to a mapping an
earlier inference run wrote, one with source: rosetta_stone. For a
wrong mapping from any other source, still propose the change with its
evidence: the workflow declines it and shows it to a person.
Replace or remove only on evidence you can point to in the sample, the statistics or the attribute's definition. A mapping someone else wrote that you would have written differently, but that isn't wrong, is kept.
Apply sections 1-4 of the rules to every column, using the evidence from
step 1. A column an existing mapping reads can hold more attributes than
the one it's mapped to (the rules' "Map every attribute the column
holds"): look for those. The attribute it's already mapped to was settled
in step 2. Run /find-attribute with --no-confirm, validate every
expression with narrative_nql_validate, and score each mapping. Once
for the whole dataset, also run the rules' search for dataset-level
attributes, narrative_attributes_search(hint_kind: "when_to_map", hint_level: "dataset"), and check each result's condition.
when_to_map hint (the rules'
"Follow the attributes' hints") is the exception to both. Work out
every mapping its condition and descriptions ask for, and add each one
no existing mapping of that attribute already covers. When the dataset
has gained an identifier column since the last run, that means one
more mapping, and the existing ones stay as they are.Every column you didn't skip in step 1 is read by an existing mapping
you keep or replace, by a proposed add, or listed in unmapped with
one of these reasons:
reason | When |
|---|---|
noFittingAttribute | No Rosetta Stone attribute fits the values. |
coveredByRule | A derivation rule already fills the attribute from another mapping on the dataset. |
noValues | The column is empty in both the sample and the statistics. |
invalidExpression | No expression for the best candidate validated. Name the candidate and what failed in detail. |
Put anything that helps a reader in detail, in one sentence.
Answer with the structured output only: no summary, no questions, no text around it. The run's answer schema is the contract; this is its shape:
{
"schemaVersion": 1,
"proposals": [
{
"action": "add",
"attributeId": 118,
"mapping": { "type": "value_mapping", "expression": "TRIM(email)" },
"confidence": 95,
"reasoning": "Every sampled value is an email address."
},
{
"action": "replace",
"mappingId": "6f1c…",
"attributeId": 46,
"mapping": { "type": "value_mapping", "expression": "UPPER(TRIM(state))" },
"confidence": 90,
"reasoning": "USPS abbreviations, upper case.",
"evidence": "The existing mapping keeps lower-case values, which the attribute's enum doesn't accept."
},
{
"action": "remove",
"mappingId": "0b2e…",
"confidence": 85,
"reasoning": "A derivation rule gives the dataset this attribute.",
"evidence": "raw_email is mapped from email, and normalized_email derives from it."
}
],
"kept": [
{ "mappingId": "9a41…", "confidence": 92 }
],
"unmapped": [
{ "column": "fnlwgt", "reason": "noFittingAttribute", "detail": "A census sampling weight." }
]
}
mapping is the body the mappings API takes: value_mapping with an
expression, or object_mapping with property_mappings of path
and expression. Leave the per-property confidence and reasoning out;
the proposal's confidence is the lowest of them.add carries attributeId and mapping, and mappingId when it
takes the place of an existing mapping you remove. replace carries
mappingId, attributeId, mapping and evidence. remove
carries mappingId and evidence.reasoning, evidence and detail to a sentence or two. Name
attributes by name in them, not only by id.proposals, kept and unmapped are always present, even when
empty.narrative_dataset_get_column_stats
rather than describing again.proposals, the existing
mappings under kept, and every column under unmapped.invalidExpression and say what failed in detail.narrative-mcp is unavailable. You can't read the dataset or
validate anything. Answer with empty proposals, kept and
unmapped.narrative-knowledge-base is unavailable. The rules skill
recommends it for hard cases; continue with the rules' local
references.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)
/profile-datasetProduce a coverage & quality profile of a Narrative dataset (or access
rule): row count, per-column null/fill rate, cardinality, ranges,
top-values, inferred column shape, and quality flags. Reads bundled
stats + sample first, recovers missing/stale stats by configuring and
recalculating them, and escalates to a cheap `/write-nql` query only
for a measure no stat can provide. Descriptive, not prescriptive.
Use when: "profile dataset N", "what does dataset N look like",
"coverage and quality of <dataset>", "what id types does N emit",
"null rates / cardinality for <dataset>", "is this dataset's stats
fresh".
(narrative-common)