Skip to content

docs(develop-app): workflow-first analysis pattern + clearer layer z-order#46

Merged
srtena merged 1 commit into
masterfrom
docs/develop-app-workflows-and-zorder
Jun 9, 2026
Merged

docs(develop-app): workflow-first analysis pattern + clearer layer z-order#46
srtena merged 1 commit into
masterfrom
docs/develop-app-workflows-and-zorder

Conversation

@srtena

@srtena srtena commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Two improvements to the carto-develop-app skill.

1. Complex analysis → Workflow, called from the app

Previously workflows-and-sql.md framed a workflow as just "one of two ways to run SQL" and led with ad-hoc query(). The skill is now explicit that non-trivial analysis belongs in a workflow, not inlined as app SQL:

  • New decision rule at the top of workflows-and-sql.md (with a why: one source of truth, public-token apps leak SQL to the browser, perf) plus a situation → action table.
  • Two app-side call paths documented accurately: read the output table (static/scheduled) vs. CALL the compiled procedure via the Workflows API (on-demand/parameterized).
  • Agent path: a new "Workflow as an MCP tool" section — when an embedded agent drives the analysis, publish the workflow as an MCP tool rather than handing it raw SQL.
  • Corrected a factual error: the old text guessed the procedure name as wf_<workflow_id>; it's a hash-based FQN in the connection's workspace dataset. Doc now says get it from carto workflows mcp describe, and notes the token must grant the procedure and the tables it reads.
  • Surfaced as an always-on bullet in SKILL.md so it's reached at decision time.

2. Clearer layer z-order — anchored on the layers themselves

The real confusion is the deck.gl layers array, not the basemap:

  • Rewrote the "Layer order" section in layers.md: z-order is the array (last = top); CSS z-index does nothing to layer stacking; rebuild the array, don't mutate it; "won't restack" is usually a stale array reference. Plus polygonOffset / depthCompare: 'always' (v9 spelling — old depthTest: false is gone) and the 3D depth-test caveat.
  • Replaced the basemap-and-view.md "out of scope for v1" punt with the validated overlaid-vs-interleaved fix: a *_NOLABELS basemap, or MapboxOverlay + interleaved: true + beforeId: 'watername_ocean'.
  • Added an always-on z-order bullet to SKILL.md.

Validation of the z-order facts (done against primary sources, not asserted)

  • Fetched the live CARTO Positron style JSON: 93 layers; watername_ocean (index 67) is the first label layer, so it's the right beforeId to slip fills under all labels; waterway_label (index 13) is a trap that sits below roads. Same IDs across Positron / Dark Matter / Voyager.
  • Confirmed against deck.gl's official MapLibre docs that beforeId: 'watername_ocean' is the exact value their own example uses, and that interleaved requires maplibre-gl@>3 (WebGL2).

Notes

  • No new files, no catalog.json change → make sync not required.
  • make validate passes (validate_skills: OK (23 skills), validate_snippets: OK (520 snippets)).

🤖 Generated with Claude Code

…order

Two improvements to carto-develop-app.

1. Complex analysis → Workflow, called from the app.
   - Lead workflows-and-sql.md with a decision rule: non-trivial analysis
     (revenue prediction, composite scores, segmentation, multi-step joins)
     belongs in a workflow built with carto-create-workflow, not inlined as
     app SQL. App reads the output table or CALLs the compiled procedure via
     the Workflows API.
   - Add the agent path: publish the workflow as an MCP tool when an embedded
     agent drives the analysis.
   - Fix procedure-naming guidance (hash-based FQN from `mcp describe`, not a
     guessed wf_<title>); note token must grant the procedure + its tables.
   - Surface the pattern as an always-on bullet in SKILL.md.

2. Clearer layer z-order, anchored on the layers themselves.
   - Rewrite layers.md "Layer order": z-order is the `layers` array (last =
     top), CSS z-index does nothing to stacking, rebuild the array don't
     mutate, plus polygonOffset / depthCompare:'always' (v9 spelling) and the
     3D depth-test caveat.
   - Replace the basemap-and-view.md "out of scope" punt with the validated
     overlaid-vs-interleaved fix: *_NOLABELS basemap or MapboxOverlay +
     beforeId:'watername_ocean' (verified against the live CARTO styles;
     needs maplibre-gl@>3).
   - Add an always-on z-order bullet to SKILL.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@srtena
srtena merged commit 0ac23d3 into master Jun 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants