tableau-data-app-authoring
Skill51 starsChanged 33 days agoMIT-0View on GitHub
Build and publish a Tableau data app, a custom viz-extension web app that queries a published datasource live, or a data file embedded in the workbook. Scaffolds the app with the scaffold-data-app MCP tool, writes its query and visualization from the user's criteria or vibe, then packages it as a .twbx for the user to upload to Tableau. Requires scaffold-data-app, which may be unavailable depending on the user's site role, site settings, or Tableau Server version; don't invoke this skill unless it is available. Use to create, build, vibe-code, or publish a data app. Not for native workbooks or dashboards built from marks, Show Me, or the chart catalog (tableau-workbook-authoring), or for opening existing content, including published data apps (tableau-content-viewer).
In this repository170 other files it gives its agents.
- reinvent-all-about-rivSkill
- reinvent-daily-briefSkill
- reinvent-event-catalogSkill
- reinvent-new-launchesSkill
- reinvent-personalized-pathwaySkill
- reinvent-trip-reportSkill
- admin-onboarding-buddySkill
- agent-to-quick-skillSkill
- aws-quick-communitySkill
- personal-agent-architectSkill
- skill-architectSkill
- customer-health-scorerSkill
- support-ticket-triagerSkill
- ecommerce-conversion-insightsSkill
- informatica-catalog-data-discoverySkill
- retail-analytics-conciergeSkill
- retail-merchant-briefingSkill
- tableau-aboutSkill
- tableau-content-viewerSkill
- tableau-dashboard-advisorSkill
- tableau-data-quality-sentinelSkill
- tableau-viz-critiqueSkill
- tableau-workbook-authoringSkill
- html-deck-builderSkill
- presentation-theme-creatorSkill
- slide-deck-from-docSkill
- template-enforcerSkill
- automated-log-analysisSkill
- battery-storage-analystSkill
- carbon-footprint-calculatorSkill
- drilling-operations-analystSkill
- energy-market-intelligenceSkill
- ev-fleet-planningSkill
- exit-zone-geosteeringSkill
- grid-capacity-planningSkill
- microgrid-designSkill
- nerc-gads-reportingSkill
- power-plant-performanceSkill
- production-surveillanceSkill
- renewable-energy-assessmentSkill
- well-completion-optimizationSkill
- bill-pay-optimizerSkill
- business-pulseSkill
- deposit-collectionSkill
- fpa-budget-reconciliationSkill
- fpa-forecast-coachSkill
- fpa-metrics-deck-app-builderSkill
- fpa-purchase-invoice-reviewSkill
- fpa-scenario-analysisSkill
- fpa-spreadsheet-evaluatorSkill
- fpa-trend-anomaly-detectionSkill
- fpa-variance-commentarySkill
- fsi-product-managementSkill
- invoice-chaserSkill
- iso-premium-audit-advisory-getSkill
- job-to-invoiceSkill
- month-end-close-orchestratorSkill
- payroll-forecastSkill
- browser-data-scraperSkill
- click-through-demoSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
32 rules. About 0 are common, 12 are distinctive, and 20 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
20
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 35
Modifying an existing app?: Read every file in its Resources/.agents/ first (unzip a .twbx to reach it).
- Distinctive: line 48
External APIs can come up at any point: If the user asks for a third-party API, remote images, or any other outside host, whether at the …
- Very specific: line 62
Run the scripts in Code Execution,: not Run python on device, which can't import them.
- Distinctive: line 96
Do not treat a generic Explorer license as sufficient: the user must have the Explorer (can publish) site role or equivalent publishing …
- Distinctive: line 99
Use Tableau metadata or permission information already available in the task when it conclusively establishes publishing access.
- Distinctive: line 105
Do not begin substantive data-app work while this prerequisite remains unconfirmed.
- Distinctive: line 110
Before beginning substantive work, verify that all of the following are callable:
- Distinctive: line 123
When the app will use a published datasource, also verify that the tools needed to resolve that datasource and inspect its metadata are …
- Very specific: line 130
If scaffold-data-app is unavailable, stop and report the missing capability.
- Distinctive: line 131
Do not hand-build or substitute for its scaffold.
- Distinctive: line 133
If any other required capability is unavailable, stop before scaffolding or authoring and tell the user exactly which capability is missing …
- Very specific: line 139
Call the scaffold-data-app MCP tool with the app name:
- Distinctive: line 267
Do this once the user has told you what to connect to.
- Distinctive: line 282
Do not hand-edit the XML — the anchors must be filled atomically with a matching join key across multiple coordinated locations, or the app …
- Very specific: line 374
Embedded file datasource: use this when the user hands you a data file instead of naming a published datasource.
- Very specific: line 414
Check the matched entry's datasourceType:
- Very specific: line 438
Read Design a data app (what to build) and Build a data app (how — introspect the datasource, design the chart, edit content/src/app.js, …
- Very specific: line 445
Record context in
Resources/.agents/: when it would help whoever edits the app next: spec.md (what it does, for whom), design.md … - Very specific: line 448
Update them when you change the app.
- Very specific: line 452
Exception — the human wants to write
app.jsthemselves: only skip authoring if the human explicitly says they want to write app.js … - Very specific: line 463
Run this whenever the app needs to reach a host outside its package: the user asks for an external API (at the start of the session or …
- Very specific: line 469
Get a fresh site allow-list: Call scaffold-data-app again with the app's name and use only its allowedOrigins.
- Distinctive: line 485
Check every origin you need is on it: If one isn't, stop and tell the user: a site admin has to add it under Settings > Extensions > …
- Very specific: line 601
If move-workbook isn't available, tell the user.
- Distinctive: line 632
Read Calling external APIs before building anything that leaves the package: it covers what the sandbox blocks no matter what, …
- Very specific: line 661
Don't zip the .twbx freehand.
- Very specific: line 664
Don't apply a postUnzip plan freehand.
- Very specific: line 667
Don't hand-edit the <datasources/> wiring.
- Very specific: line 670
Don't hand-edit manifest.json to allow external origins.
- Very specific: line 673
Don't assume the scaffold result's zip is already substituted, or skip unzip.
- Very specific: line 677
Don't guess repositoryId. It's the datasource's contentUrl from list-datasources, not its name or LUID.
- Very specific: line 679
Don't hand off app.js to the human unprompted.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Tableau Data App Authoring
Builds a Tableau data app from nothing to a packaged .twbx that the user
uploads to Tableau; see Running in Amazon Quick.
Walk the stages top to bottom — every request follows all five, in order.
Scaffold + finalize → Wire datasource* → Author (you) → Package → Hand off* Wiring is a prerequisite to a working app: the name-only scaffold-data-app
ships an empty <datasources/>, so a scaffolded app reaches no datasource at
runtime and renders "no data source found." Wire a datasource into the
.twb before authoring against it — see Wire a datasource in below. (Packaging the
starter as-is to prove packaging works does not need it.)
Already have a built app locally? Skip straight to whichever applies:
Package into a .twbx (unpacked <App Name>/ folder) or Hand off the file
(already a .twbx) — but first confirm the .twb's <datasources> is
actually wired (not empty) and the package layout is correct, since none of
this skill's tooling has run against it.
Modifying an existing app? Read every file in its Resources/.agents/
first (unzip a .twbx to reach it). Those docs hold the app's spec, design,
and past decisions; if README.md is the only file, none have been written yet.
Division of labor: you write ALL the code, every stage, always — including
app.js. The human "vibe codes" by describing what they want (criteria,
theme, vibe, target insights) — they do not write app.js themselves. Read
the two bundled guides before authoring: Design a data app
(what to build) and Build a data app (how, using this
skill's local tools). Only skip authoring app.js if the human explicitly says
they want to write it themselves for this app (rare) — see the exception at
the end of Author app.js below.
External APIs can come up at any point. If the user asks for a third-party API, remote images, or any other outside host, whether at the start or after the app is already published, run Add external origins below, then re-package and hand it off again. Read Security best practices first.
There's no separate validation stage — Tableau checks the workbook when it's published. Get package layout right (see Package into a .twbx) or the workbook won't open at all.
Running in Amazon Quick
Quick has no shell, so every step below runs as Python in Code Execution, where the skill's scripts are importable by name.
- Run the scripts in Code Execution, not Run python on device, which can't
import them. Code Execution blocks
subprocess,inspect, and changes tosys.path. Import the script by name and pass its command-line arguments tomain()as a list of strings; settingsys.argvdoesn't reach the script. A script that fails prints a✗message and raisesSystemExit, so catch it. Each step below gives the exact call. - Keep the work in the Code Execution workspace, under
os.path.join(WORKSPACE_DIR, "dataapp"). Write JSON files such asplan.jsonwithjson.dump. Quick saves each Tableau tool result as a JSON file underWORKSPACE_DIR/tools/, one folder per tool, so you can load a result from there instead of retyping it. - Download links with Quick's Download file tool. Code Execution and Run
python on device can't reach the internet, so
curl,urllib, andrequestsfail in both. Download file saves intoWORKSPACE_DIR/downloads/. - Quick can't publish the app. The hosted Tableau MCP server accepts a
workbook only as a staged upload, an HTTP PUT of the file to the link
request-workbook-uploadreturns, and nothing in Quick can send one: Download file only downloads. So don't callrequest-workbook-uploadorpublish-workbook. Build the app all the way through packaging, then hand the.twbxto the user to upload (see Hand off the file). Don't mention publishing or uploading before then.
Preflight requirements
Complete this preflight before designing, scaffolding, coding, or creating application files.
Publishing access
This workflow requires the connected Tableau user to have:
- a Creator or Explorer (can publish) site role; and
- permission to publish to the target project.
Do not treat a generic Explorer license as sufficient: the user must have the Explorer (can publish) site role or equivalent publishing capability.
Use Tableau metadata or permission information already available in the task when it conclusively establishes publishing access. If the user's site role or publishing access cannot be determined through the available Tableau tools, ask the user to confirm that they have Creator or Explorer (can publish) and permission to publish to the target project.
Do not begin substantive data-app work while this prerequisite remains unconfirmed.
Required Tableau MCP capabilities
Before beginning substantive work, verify that all of the following are callable:
scaffold-data-app.
The publishing tools aren't needed: in Amazon Quick this workflow ends with the
packaged .twbx for the user to upload (see Hand off the file).
Interactive rendering is not required. It's the recommended way to verify the published app with the user, but never block on it: when it isn't available, open the published app in an embedded browser if you have one available or encourage the user to open and verify it in their own browser instead.
When the app will use a published datasource, also verify that the tools needed to resolve that datasource and inspect its metadata are callable.
A capability is not unavailable merely because it has not yet been loaded. Perform one focused availability lookup for a missing capability when necessary.
If scaffold-data-app is unavailable, stop and report the missing capability.
Do not hand-build or substitute for its scaffold.
If any other required capability is unavailable, stop before scaffolding or authoring and tell the user exactly which capability is missing and why it prevents completion. Don't present the packaged, unpublished app as published.
Scaffold and finalize the workspace
Call the scaffold-data-app MCP tool with the app name:
scaffold-data-app({ datappName: "Sales Demo" })
The preflight must establish that scaffold-data-app is callable. If the tool
is present but the scaffold call fails, report the error and stop. Do not
hand-build the template or substitute another scaffold.
The result carries an un-substituted template zip plus a postUnzip plan.
The zip arrives as a short-lived link, in whichever of these fields is present;
past the fetch step the steps are identical:
downloadUrl— a short-lived blob-storage link (newer servers).s3URL— the same thing on older servers.
A downloadUrl/s3URL link expires about 60 seconds after the call, so
download it immediately, before doing anything else. If the download fails
with an expired-link error, call scaffold-data-app again for a fresh link.
The result also carries:
allowedOrigins: string[]— the external origins the site lets data apps reach. May be empty, in which case the app can't fetch any external origin.requestedOrigins— which file declares the origins the app requests (file) and how to write them (instructions). Every origin you put there must also appear inallowedOrigins; see External origins below.
Apply the plan deterministically with the bundled script — applying it freehand
leaves half-replaced TODO-MANIFEST-ID / TODO App Name / TODO Sheet Name tokens or interleaves
edits and renames in the wrong order.
Finalize the plan (fetch, save, apply). Fetch first — the link expires. The
scripts referenced below live under scripts/ and run in Code Execution, as
Running in Amazon Quick describes:
Fetch the template. With
downloadUrl(ors3URLon older servers), download it right away with Quick's Download file tool, namedtemplate.zip. Then unzip it in Code Execution:import os import zipfile WORK = os.path.join(WORKSPACE_DIR, "dataapp") template = os.path.join( WORKSPACE_DIR, "downloads", "template.zip" ) # where Download file saved it os.makedirs(os.path.join(WORK, "unzipped"), exist_ok=True) zipfile.ZipFile(template).extractall(os.path.join(WORK, "unzipped")) print(os.listdir(os.path.join(WORK, "unzipped")))Save the plan: write the result's
postUnzipobject toplan.jsonunchanged. Load it from the scaffold result Quick saved underWORKSPACE_DIR/tools/rather than retyping it; thefindtokens must match byte-for-byte.import json import os WORK = os.path.join(WORKSPACE_DIR, "dataapp") post_unzip = {} # the scaffold result's postUnzip object, unchanged with open(os.path.join(WORK, "plan.json"), "w", encoding="utf-8") as f: json.dump(post_unzip, f)Apply the plan (edits first, then renames; verifies no placeholders survive):
import os import apply_plan WORK = os.path.join(WORKSPACE_DIR, "dataapp") try: apply_plan.main([os.path.join(WORK, "unzipped"), os.path.join(WORK, "plan.json")]) rc = 0 except SystemExit as exc: rc = exc.code print("exit code", rc)apply_plan.main()prints the finalized workspace root. See its header comment for the full contract; it hard-fails if afindtoken is missing (the zip is stale / out of sync with the plan) rather than emitting a broken workspace.
At the end of this stage you have a finalized workspace directory:
<App Name>/
<App Name>.twb
Packages/com.tableau.mcp.<slug>/
manifest.json ← requestedOrigins lives here
extensions/data-app.trex
content/index.html
content/src/app.js ← the authoring surface
content/src/styles.css
content/src/tableau.extensions.1.latest.min.js
Data/.gitkeep ← placeholder; embedded datasource files go here
Resources/.agents/README.md ← which agent docs travel with the workbookSheet name: the worksheet is named after the app's display name. It's a
plain string with no hash/join-key involved, so it's freely hand-editable at
any point before packaging — edit all 3 matching locations in the .twb to
the same new value: the <worksheet name='...'> tag, the <window class='worksheet'
name='...'> tag, and <referenced-view ... viewId='...' />.
External origins
The extension sandbox blocks every external origin the package doesn't
declare. To let the app reach one (an API, an image host), run Add external
origins below: declare_origins.py writes it to the file named by the scaffold
result's requestedOrigins.file (the package's manifest.json), in the format
its requestedOrigins.instructions gives, and fails unless the origin is in the
result's allowedOrigins. If allowedOrigins is empty, the app can't fetch any
external origin: tell the user the site admin must allow the origin first, or
design the app without it. Don't request origins the app doesn't use.
Wire a datasource in
The scaffolded .twb ships an empty <datasources/> (both at the workbook
root and inside the worksheet <view>). At runtime the app calls
getAllDataSourcesAsync() and finds nothing → it renders "no data source found
in the workbook." To query live data the workbook must have a real datasource
wired in — this stage is a prerequisite for a working app.
Do this once the user has told you what to connect to; it is skippable if the user only wants to publish the starter to prove packaging. Only add, remove, or swap datasources the user asked for; if you think a different or extra datasource would help, ask first.
The app queries either kind of datasource, in any mix:
- Published: a datasource that already exists on the server (a
sqlproxyconnection, resolved live by VDS). Its identity can come straight from the user, or be reused from a datasource already wired into some other existing workbook (see Reuse an existing workbook's datasource below). - Embedded file: a data file the user supplies, copied into
the workspace's
Data/folder and packed into the.twbx(see Embedded file datasource below).
Do not hand-edit the XML — the anchors must be filled atomically with a matching join key across multiple coordinated locations, or the app silently reaches no data. Use the bundled wiring script.
Published datasource: the wiring spans four coordinated locations (root
datasource name, root relation connection, view datasource name,
datasource-dependencies datasource) that must all carry the identical
sqlproxy.<hash> join key. Use scripts/wire_datasource.py, which does all
four edits atomically and hard-fails rather than emitting a half-wired workbook.
More than one datasource: wire them all in one run — the script fills
the empty anchors once, so it can't add another datasource to an already-wired
.twb (re-scaffold instead). It lists every datasource on the app's sheet,
which is required: the server only connects datasources listed there, so a
datasource placed only on some other sheet fails at query time. Don't move
datasources onto separate sheets afterward.
- Get the datasource's identity with
list-datasources(LUID, name/caption, contentUrl) andget-datasource-metadata({ datasourceLuid })(field names + datatypes). The published DS contentUrl is therepositoryId. (To reuse an existing workbook's datasource instead, see Reuse an existing workbook's datasource below — it gets you here, then continues at step 2.) Write a descriptor listing only the fields the app will query (name + datatype + role), saved as
descriptor.jsonin the work folder. One datasource:import json import os WORK = os.path.join(WORKSPACE_DIR, "dataapp") descriptor = { "caption": "<Friendly Name>", "repositoryId": "<published DS contentUrl>", "fields": [ {"name": "Profit", "datatype": "real", "role": "measure"}, {"name": "Region", "datatype": "string", "role": "dimension"}, ], } with open(os.path.join(WORK, "descriptor.json"), "w", encoding="utf-8") as f: json.dump(descriptor, f)Several datasources (any number) go in a
datasourcesarray, primary first, with nothing else at the top level; each entry has the same shape as the single-datasource object:{ "datasources": [ { "caption": "Orders", "...": "..." }, { "caption": "People", "...": "..." } ] }The primary is the sheet's main datasource. The app reaches every one by caption via
getAllDataSourcesAsync()— look each up byname, never by position (the list isn't returned in wiring order).Captions must be distinct. A caption is only this workbook's display name; the server matches the published datasource by
repositoryId, so if two published datasources share a name, give them different captions here (e.g. "Sales Orders" / "Finance Orders") rather than renaming them on the server.Run the wiring script (it prints the wired
.twbpath, and generates a consistentsqlproxy.<hash>unless you supplyconnectionName). The.twbis in the folderapply_plan.main()printed:import os import wire_datasource WORK = os.path.join(WORKSPACE_DIR, "dataapp") twb = os.path.join( WORK, "unzipped", "Sales Demo", "Sales Demo.twb" ) # <App Name>/<App Name>.twb try: wire_datasource.main([twb, os.path.join(WORK, "descriptor.json")]) rc = 0 except SystemExit as exc: rc = exc.code print("exit code", rc)
The script hard-fails if the .twb is already wired (re-scaffold, keep your app.js),
if an anchor is missing (template drifted),
if any empty <datasources /> survives, if a join key is missing from where the server
reads it (including the host sheet's view listing every datasource), or
if a repositoryId, caption, or connectionName repeats across datasources.
Trust that failure over patching the XML by hand. datatype maps to the column
type (real/integer → quantitative, date/datetime → ordinal, else
nominal); role: "measure" gets a Sum aggregation, dimension a Count.
Embedded file datasource: use this when the user hands you a data file
instead of naming a published datasource. The same script wires it (and rejects
file types it can't); the descriptor just has "type": "file".
- Copy the file into the workspace under
Data/, conventionallyData/Datasources/<file>. The script fails if the file isn't there, or if its path is outsideData/. Write a descriptor.
fileis the path relative to the.twb.tablepicks the table in a file that holds several (an Excel sheet); the script says when it's needed. Field names must match the column names Tableau reads from the file, usually its header row. NorepositoryId. Save it asdescriptor.jsonthe same way:{ "type": "file", "caption": "Sample - Superstore", "file": "Data/Datasources/Sample - Superstore.xls", "table": "Orders", "fields": [ { "name": "Sales", "datatype": "real", "role": "measure" }, { "name": "Region", "datatype": "string", "role": "dimension" } ] }To mix it with published datasources, put every entry in one
datasourcesarray (primary first) as above.- Run the wiring script the same way as for a published datasource.
Reuse an existing workbook's datasource: point the Published path above at a datasource already wired into some other already-published workbook, instead of a fresh published DS. Only applies when that datasource actually resolves as published — resolve it, then continue in Published datasource above, picking up at its step 2 (you already have what its own step 1 would have produced).
- Find the workbook (
list-workbooks/search-content; ask the user which if ambiguous), then callget-workbook({ workbookId })and readupstreamDatasources[]— ask which entry if it lists more than one. - Check the matched entry's
datasourceType:"embedded": its data lives inside that workbook, so it can't be reused by reference. Ask the user for either a published datasource or the source data file, and wire the file as an Embedded file datasource above."published"— still run the rest of Published datasource step 1 (list-datasourcesfiltered by this LUID, forcontentUrl, plusget-datasource-metadata({ datasourceLuid })for fields, whose top-leveldatasourceTypeshould also read"published"when present), then continue at step 2. Filter candidate fields tocolumnClass: "COLUMN"(dropCALCULATION/TABLE_CALCULATION/BIN/GROUP— those are Tableau-computed groupings with no matching raw column). This metadata response often includes an explicitrole("DIMENSION"/"MEASURE") per field — when present, lowercase and use it directly instead of inferring fromdefaultAggregation; fall back to that heuristic whenroleis absent.
Author app.js
Always author app.js yourself — this is the fixed default, not a
fallback. The human vibe-codes: they describe what they want (criteria,
theme, target insights, audience) and you turn that into the actual
ds.queryAsync(...) → chart implementation.
Read Design a data app (what to build) and
Build a data app (how — introspect the
datasource, design the chart, edit content/src/app.js, follow the sandbox
rules in its AUTHOR YOUR APP HERE comment) and follow that workflow; it is
not restated here. There is no local preview — the visual review happens live
in Tableau, once the app is published.
Record context in Resources/.agents/ when it would help whoever edits the
app next: spec.md (what it does, for whom), design.md (datasources, queries,
chart choices), memories.md (decisions, gotchas, the user's preferences).
Update them when you change the app. Follow the folder's README.md: no
secrets, tokens, or personal data (anyone who can download the workbook can
read them), and never put these docs under Packages/<id>/content/.
Exception — the human wants to write app.js themselves: only skip
authoring if the human explicitly says they want to write app.js themselves
for this app — an override of the default, not the norm. Stop and hand off:
tell them the workspace path
(Packages/com.tableau.mcp.<slug>/content/src/app.js) and point them at
Design a data app and
Build a data app as their own reference.
Resume at Package into a .twbx once they say it's authored.
Add external origins (any time)
Run this whenever the app needs to reach a host outside its package: the user
asks for an external API (at the start of the session or after the app is
published), or app.js calls one. The rules behind these steps (two-part
allowlisting, origin format, CORS) live in
Calling external APIs.
Get a fresh site allow-list. Call
scaffold-data-appagain with the app's name and use only itsallowedOrigins; ignore the zip and plan. The list from the start of the session may be stale. Save it asallowed.jsonin the work folder, loading the array from the result Quick saved underWORKSPACE_DIR/tools/:import json import os WORK = os.path.join(WORKSPACE_DIR, "dataapp") allowed_origins = [] # the new scaffold result's allowedOrigins array with open(os.path.join(WORK, "allowed.json"), "w", encoding="utf-8") as f: json.dump(allowed_origins, f)- Check every origin you need is on it. If one isn't, stop and tell the user: a site admin has to add it under Settings > Extensions > Extension Package Allowed Origins. Don't work around it.
Declare the origins in the package:
import os import declare_origins WORK = os.path.join(WORKSPACE_DIR, "dataapp") app_dir = os.path.join( WORK, "unzipped", "Sales Demo" ) # the <App Name> workspace folder try: declare_origins.main( [ app_dir, "--allowed", os.path.join(WORK, "allowed.json"), "--add", "https://api.example.com", "https://auth.example.com", ] ) rc = 0 except SystemExit as exc: rc = exc.code print("exit code", rc)It writes
requestedOriginsintoPackages/<package id>/manifest.json, merges with origins already declared, and fails if an origin isn't on the allow-list or isn't a plainhttpsorigin. Use--listto see what's declared and--removeto drop an origin the app no longer uses.- Re-package and hand it off again (Package into a .twbx, then Hand off the file). The new policy takes effect only after the new file is published over the old one.
Package into a .twbx
A .twbx is a zip of the workspace contents with the .twb and Packages/
at the archive root — never nested inside the <App Name>/ folder. Nesting
is the #1 cause of NativeException: An unexpected error occurred opening the
packaged workbook and PackageValidationException: Package directory contains no
extension .trex files under extensions/.
Package with scripts/package_twbx.py. It hard-fails with a ✗ message if
the workspace isn't packageable; fix what it reports rather than zipping by
hand:
import os
import package_twbx
WORK = os.path.join(WORKSPACE_DIR, "dataapp")
app_dir = os.path.join(
WORK, "unzipped", "Sales Demo"
) # the finalized <App Name> workspace folder
try:
package_twbx.main([app_dir])
rc = 0
except SystemExit as exc:
rc = exc.code
print("exit code", rc)It also packs Data/ and Resources/.agents/ at the archive root. Under
Data/, only the files the .twb references are packed. Hidden files are
never packed.
It writes <App Name>.twbx next to the workspace dir (pass a second arg to
override), overwriting any existing file, and prints the path for Hand off the file.
It also prints ⚠ warnings for problems that only show up at runtime:
undeclared external origins, package-relative fetch(), and secret-looking
keys. They don't stop packaging, but fix them or tell the user
about them before handing it off.
The template these workspaces come from is already publish-valid (
.twbextension wired into a pane,.trexwithauthor email,<resources>block,<icon>,min-api-version). Packaging is the only structural step you own.
Hand off the file
In Amazon Quick the skill ends here, with the packaged .twbx for the user to
upload. Don't call request-workbook-upload or publish-workbook.
- Copy the
.twbxto the user's computer. Copy it from the workspace into the user's Documents folder with Quick's file copy tool (its step shows as "Copying file"). Give it the pathpackage_twbx.main()printed. - Tell the user the app is built and packaged but not published, and why:
the hosted Tableau MCP server accepts a workbook only as a staged upload,
which Quick can't send. Say where the
.twbxis. Tell them how to publish it, with these steps as written:
- Go to Home or Explore in Tableau Cloud. Personal Space's New menu has no upload option.
- Choose New > Workbook Upload and pick the file.
- Set Project in the dialog to the project they named, or to Personal Space if it's listed. Otherwise pick any project, then move the workbook to Personal Space with its Actions > Move.
Suggest a name no workbook there has yet, unless they mean to replace one. The upload is where Tableau validates the workbook; if it reports an error, ask for its text. Common causes trace back to
.twb/.trexwiring, not packaging. If the app goes in a shared project, viewers need View, Full Data Query, and API Access on the workbook.Offer to check it once they've uploaded it: find its view with
search-content, callget-viewwith the view's LUID for its URL, and give the user that link. Don't callget-view-image: for a data app, Tableau returns an image of its sign-in page instead of the app. Ask the user to open the link and tell you what they see. Tableau may ask them to allow the extension the first time it opens. To move the app into a shared project afterwards:move-workbook({ workbookId: "<the workbook's LUID>", projectId: "
<LUID>" }) → { id, name, projectId }If
move-workbookisn't available, tell the user.
Limitations and gotchas
Multiple datasources
wire_datasource.py wires any number of published datasources, with these
constraints:
- One run, all at once. List every datasource in the descriptor's
datasourcesarray, primary first. The script refuses an already-wired.twb, so adding a datasource later means re-scaffolding, copyingcontent/src/app.jsinto the new workspace, and wiring the full set again. - What gets wired. Each datasource gets its own root
<datasource>and its ownsqlproxy.<hash>join key (unique across the set), and all of them are listed on the host sheet's<view>— the server only connects datasources listed there. Only the primary getsdatasource-dependencies; the others are reached throughgetAllDataSourcesAsync(). - Distinct identities.
caption,repositoryId, andconnectionNamemust each be unique across the set, or the script hard-fails. Captions matter most: they are howapp.jsfinds each datasource. - Find by name in
app.js, never by position.getAllDataSourcesAsync()doesn't return datasources in wiring order. The starter'spickDataSource()takeslist[0], so a multi-datasource app must replace it with a lookup byds.name(the caption). - No blending or joins. Query each datasource separately with its own
queryAsync()and combine the rows inapp.js. Don't add blend or relationship XML.
External origins and package hosting
Read Calling external APIs before building
anything that leaves the package: it covers what the sandbox blocks no matter
what, allowlisting, CORS, and how to debug a blocked call. What the package
host serves is in Build a data app, Sandbox and
lifecycle rules. package_twbx.py warns about undeclared origins and
package-relative fetch().
Security best practices
- Prefer network-isolated apps. Build the app so it talks only to Tableau through the Extensions API. Every external origin needs a site admin's approval and gives data a path out of Tableau. Before adding one, ask whether the feature needs it, and tell the user what data would leave Tableau.
- Keep secrets and credentials out of the package. Anything in
content/(API keys, client secrets, refresh tokens) can be read by anyone who can open or download the workbook. If the user still wants one embedded (e.g. a personal demo), tell them that first, keep the workbook out of shared projects, and keep the secret out of git. Expect the agent's safety checks to ask for explicit approval before publishing or downloading a workbook that contains credentials.package_twbx.pywarns about secret-looking keys. - Avoid hardcoding data where possible. Query the datasource live with
queryAsync()instead of copying rows intoapp.jsor a bundled file. If data must be hardcoded, tell the user the implications first: it's a snapshot that won't refresh, and Tableau's query-time protections, such as row-level security policies and user filters, don't apply to it, so every viewer sees all of it.
Non-negotiable limits
- Don't zip the
.twbxfreehand. Usescripts/package_twbx.py— it keeps.twb,Packages/, and anyData//Resources/.agents/at the archive root, never nested under<App Name>/. - Don't apply a postUnzip plan freehand. Use
scripts/apply_plan.py— edits before renames, renames deepest-first, verified; see its header comment for the full contract. - Don't hand-edit the
<datasources/>wiring. Usescripts/wire_datasource.py— freehand edits mismatch the join key across its coordinated locations or leave an empty<datasources />anchor, and the app silently reaches no data. - Don't hand-edit
manifest.jsonto allow external origins. Usescripts/declare_origins.py— Tableau ignores an array or anallowedOriginskey without any error, and the app stays blocked. - Don't assume the scaffold result's zip is already substituted, or skip
unzip. Whether it arrives as
downloadUrlors3URL, it's the same static, un-substituted template zip — unzip it and apply the plan before authoring. - Don't guess
repositoryId. It's the datasource'scontentUrlfromlist-datasources, not its name or LUID; a wrong one fails at publish. - Don't hand off
app.jsto the human unprompted. Authoringapp.jsyourself is the fixed default — always write it from the human's stated criteria/vibe. Only hand off when the human explicitly says they want to write it themselves.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

