arcgis-coding-components
Skill1 starsChanged 6 months agoMITView on GitHub
Embed an Arcade expression editor with the ArcGIS Maps SDK for JavaScript 5.1 coding components: arcgis-arcade-editor with a profile (validation and autocomplete against real fields), diagnostics events, test data, the 5.1 debugger and the Arcade assistant switch. Use this skill whenever the user builds an in-app editor for Arcade expressions (popups, labels, renderers).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- GeoDaoyu/arcgis-maps-sdk-js-ai-contexttheir own version, first seen Nov 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- GeoDaoyu/arcgis-maps-sdk-js-ai-context★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository73 other files it gives its agents.
- skills/arcgis-3d-layers/AGENTS.mdAGENTS.md
- skills/arcgis-advanced-layers/AGENTS.mdAGENTS.md
- skills/arcgis-ai-components/AGENTS.mdAGENTS.md
- skills/arcgis-arcade/AGENTS.mdAGENTS.md
- skills/arcgis-authentication/AGENTS.mdAGENTS.md
- skills/arcgis-charts/AGENTS.mdAGENTS.md
- skills/arcgis-cim-symbols/AGENTS.mdAGENTS.md
- skills/arcgis-coding-components/AGENTS.mdAGENTS.md
- skills/arcgis-coordinates-projection/AGENTS.mdAGENTS.md
- skills/arcgis-core-maps/AGENTS.mdAGENTS.md
- skills/arcgis-core-utilities/AGENTS.mdAGENTS.md
- skills/arcgis-custom-rendering/AGENTS.mdAGENTS.md
- skills/arcgis-editing/AGENTS.mdAGENTS.md
- skills/arcgis-embeddable-maps/AGENTS.mdAGENTS.md
- skills/arcgis-feature-effects/AGENTS.mdAGENTS.md
- skills/arcgis-geometry-operations/AGENTS.mdAGENTS.md
- skills/arcgis-imagery/AGENTS.mdAGENTS.md
- skills/arcgis-interaction/AGENTS.mdAGENTS.md
- skills/arcgis-knowledge-graphs/AGENTS.mdAGENTS.md
- skills/arcgis-layers/AGENTS.mdAGENTS.md
- skills/arcgis-map-tools/AGENTS.mdAGENTS.md
- skills/arcgis-parquet/AGENTS.mdAGENTS.md
- skills/arcgis-performance/AGENTS.mdAGENTS.md
- skills/arcgis-popup-templates/AGENTS.mdAGENTS.md
- skills/arcgis-portal-content/AGENTS.mdAGENTS.md
- skills/arcgis-rest-services/AGENTS.mdAGENTS.md
- skills/arcgis-scene-environment/AGENTS.mdAGENTS.md
- skills/arcgis-smart-mapping/AGENTS.mdAGENTS.md
- skills/arcgis-spatial-analysis/AGENTS.mdAGENTS.md
- skills/arcgis-starter-app/AGENTS.mdAGENTS.md
- skills/arcgis-tables-forms/AGENTS.mdAGENTS.md
- skills/arcgis-time-animation/AGENTS.mdAGENTS.md
- skills/arcgis-utility-networks/AGENTS.mdAGENTS.md
- skills/arcgis-visualization/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-advanced/AGENTS.mdAGENTS.md
- skills/arcgis-widgets-ui/AGENTS.mdAGENTS.md
- skills/hello-world/AGENTS.mdAGENTS.md
- arcgis-3d-layersSkill
- arcgis-advanced-layersSkill
- arcgis-ai-componentsSkill
- arcgis-arcadeSkill
- arcgis-authenticationSkill
- arcgis-chartsSkill
- arcgis-cim-symbolsSkill
- arcgis-coordinates-projectionSkill
- arcgis-core-mapsSkill
- arcgis-core-utilitiesSkill
- arcgis-custom-renderingSkill
- arcgis-editingSkill
- arcgis-embeddable-mapsSkill
- arcgis-feature-effectsSkill
- arcgis-geometry-operationsSkill
- arcgis-imagerySkill
- arcgis-interactionSkill
- arcgis-knowledge-graphsSkill
- arcgis-layersSkill
- arcgis-map-toolsSkill
- arcgis-parquetSkill
- arcgis-performanceSkill
- arcgis-popup-templatesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 190
Impact: every keystroke pushes a half-written expression into the map.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Coding Components
When to use: Activate this skill whenever the user builds an in-app editor for Arcade expressions (popups, labels, renderers, field calculation) with validation and autocomplete.
Overview
arcgis-arcade-editor is a full Arcade editor: syntax highlighting, completion from a profile,
diagnostics, a test run against sample data, a debugger (5.1) and an AI assistant (beta).
- Problem it solves: letting users write Arcade in your app without breaking the map.
- Who it serves: developers building expression builders, admin tools and configurators.
- Pattern it teaches: editor
profile= runtime profile; readarcgisDiagnosticsChangebefore applyingarcgisScriptChange. - What it does NOT cover: running Arcade (see
arcgis-arcade) or SQLwhereclauses: the SQL editors of this package are internal (see Concept 4).
Quick Start
import "@arcgis/coding-components/components/arcgis-arcade-editor";
import type FeatureLayer from "@arcgis/core/layers/FeatureLayer.js";
import type Graphic from "@arcgis/core/Graphic.js";
declare const layer: FeatureLayer; // loaded, so the editor knows its fields
declare const sample: Graphic; // one feature to run the script against
const editor = document.querySelector("arcgis-arcade-editor")!;
editor.profile = { id: "popup", definitions: { $feature: layer } }; // same profile you run with
editor.testData = { profileVariableInstances: { $feature: sample } }; // shows the Run button
editor.script = "$feature.state_name";
let errores = 0;
editor.addEventListener("arcgisDiagnosticsChange", (e) => { errores = e.detail.length; });
editor.addEventListener("arcgisScriptChange", (e) => {
if (errores === 0) saveExpression(e.detail); // only apply a script that validates
});
declare function saveExpression(script: string): void;Decision Tree
- Users write Arcade?
- Yes →
arcgis-arcade-editorwith the profile you will execute in.
- Yes →
- Users write a SQL
whereclause?- The package's
arcgis-sql-expression-editorandarcgis-sql-layer-editorare marked@internalin 5.1.27: not public API. Build the clause with your own UI and validate it with aqueryFeatureCounton the layer.
- The package's
- Generic code (JSON, CSS…)?
arcgis-code-editoris also@internal; use Monaco or CodeMirror directly.
Default: arcgis-arcade-editor, always with a profile.
Import Patterns
Direct ESM (recommended for npm/Vite/Webpack)
import "@arcgis/coding-components/components/arcgis-arcade-editor";Dynamic Imports (CDN)
<!-- The core module script already registers the coding components (and charts, map, AI):
a classic <script> without type="module" registers nothing -->
<script type="module" src="https://js.arcgis.com/5.1/"></script>
<arcgis-arcade-editor></arcgis-arcade-editor>Map Components (recommended for new projects)
import "@arcgis/map-components/components/arcgis-map";
import "@arcgis/coding-components/components/arcgis-arcade-editor";Key Concepts
Concept 1: The profile decides what is valid
profile is a predefined profile ({ id: "popup" | "labeling" | "visualization" |
"field-calculation" | …, definitions: { $feature: layer } }) or your own definition
({ variables: [...], bundles: [...] }). With it, the editor knows the variables, the functions
and the layer's fields: measured with 5.1.27, $feature.NO_EXISTE is flagged with the list of real
field names. Without a profile, even $feature is "not defined".
Concept 2: Diagnostics are the validation
arcgisDiagnosticsChange sends the current list of diagnostics (empty when the script is valid);
arcgisScriptChange sends the text. There is no isValid property: keep the last diagnostics and
check them before applying the script. Syntax errors ("Unexpected end of Arcade expression"),
unknown fields and variables that the profile does not have all arrive this way.
Concept 3: Test data, debugger and assistant
testData = { profileVariableInstances: { $feature: graphic } } shows the Run button; without
testData the run UX is hidden. enableDebugger (5.1) adds breakpoints and a console. The Arcade
assistant (beta) is on by default in 5.1 when the user is signed in to an ArcGIS Online org that
allows AI: set disableAssistant = true if your app must not offer it. arcadeAssistant is
deprecated in 5.1.
Concept 4: Only the Arcade editor is public
In 5.1.27 the declarations mark arcgis-sql-expression-editor, arcgis-sql-layer-editor,
arcgis-code-editor and arcgis-code-viewer as @internal: they register and run, but they are
not documented API and can change in any release. The 5.1 I* type names (IPredefinedProfile,
IEditorProfileDefinition…) are deprecated in favour of the names without I.
Common Pitfalls (Top 3)
Pitfall 1: No profile
// ❌ Anti-pattern
editor.script = "$feature.state_name"; // no profile set// ✅ Correct
editor.profile = { id: "popup", definitions: { $feature: layer } };
editor.script = "$feature.state_name";Impact: measured with 5.1.27: without a profile a correct script gets "'$feature' is not defined", and a wrong field name gets the same message: users cannot tell real errors apart.
Pitfall 2: Editing with one profile, running with another
// ❌ Anti-pattern: authored as a label, used in a popup (or the other way around)
editor.profile = { id: "labeling", definitions: { $feature: layer } };// ✅ Correct: the id of the place the expression will run
editor.profile = { id: "popup", definitions: { $feature: layer } };Impact: measured: Count(FeatureSetByName($map, "x")) gets "'FeatureSetByName' is not
defined" and "'$map' is not defined" in labeling; the data-access bundle exists only in some
profiles. A script that validates in one place fails in the other.
Pitfall 3: Applying the script without looking at the diagnostics
// ❌ Anti-pattern
editor.addEventListener("arcgisScriptChange", (e) => { layer.labelingInfo[0].labelExpressionInfo.expression = e.detail; });// ✅ Correct
let errores = 0;
editor.addEventListener("arcgisDiagnosticsChange", (e) => { errores = e.detail.length; });
editor.addEventListener("arcgisScriptChange", (e) => {
if (errores === 0) layer.labelingInfo[0].labelExpressionInfo.expression = e.detail;
});Impact: every keystroke pushes a half-written expression into the map; there is no isValid
to rely on.
When to Read references/
| If you need... | Read |
| Editor component attributes | references/api-detail.md |
| Arcade / SQL editor examples | references/examples.md |
| More pitfalls (5+ extended) | references/pitfalls.md |
Related Skills
arcgis-arcade— run the authored expressionsarcgis-layers— the layer whose fields the profile exposesarcgis-visualization— where a renderer expression ends up
Reference Samples
Changelog
- 0.2.0 (2026-10-27): SDK 5.1. Rewritten: the 0.1.0 guide had no working code (comments only).
Real profile,
testData, diagnostics and script events; measured what the editor flags with and without a profile; the SQL and code editors are@internal(no longer offered); assistant on by default anddisableAssistant;enableDebugger; module CDN script. Run intests/runtime/casos/arcgis-coding-components.ts. - 0.1.0 (2026-05-31): Initial release.
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.

