This article is based on @mcui/mccharts 3.0.0: a native HarmonyOS chart component that drops into an ArkUI page, reuses the Apache ECharts 6.1.0 option model, and renders through native GLES without a WebView. It is available on OHPM (ohpm install @mcui/mccharts@3.0.0).
Ask a coding agent to “add a sales chart” and it has to guess quite a lot: which chart package is installed, which version the project uses, how the existing page manages state, and whether a browser example will work in the native host.
An Agent Skill gives the assistant a compact place to find that project-specific guidance. The mccharts Skill includes an entry file and focused references for integration, options, controllers, export and migration. It can reduce guessing; it cannot decide the business rules or turn an untested build into a verified device interaction.
First, put the instructions where the agent can read them
After obtaining and unpacking the mccharts-skill.zip, keep the complete mccharts/ folder. The entry file points to the reference files, so copying only SKILL.md leaves out details needed for real work.
The installer can target a project. From the directory containing the unpacked mccharts folder, a Codex example is:
node mccharts/scripts/install.mjs --agent codex --project /path/to/your-project --dry-run
The dry run checks and prints the destination. Remove --dry-run to install after checking the path. The project-level Codex destination is .agents/skills/mccharts/; the installer has other mappings for supported clients. If automatic discovery does not find it, ask the assistant to read the actual SKILL.md path. Client version, workspace and trust settings can affect discovery.
The Skill is a set of instructions and an installer, not the chart HAR or HarmonyOS SDK. The application still needs to resolve @mcui/mccharts through its own dependency process. If the project uses a different component version, inspect that version's public API instead of assuming the Skill's 3.0.0 examples apply unchanged.
Give the agent an actual task
Here's a request with enough information to start:
Read the project mccharts Skill and inspect the installed component version.
On the existing store page, show monthly order counts as a line chart.
Keep the current page structure. A button should update the last month.
Explain where the data lives and report the checks you actually ran.
The agent should inspect the project's dependency files and existing page before choosing an implementation. It can read the integration reference to identify the component and the controller reference to understand updates. If the user asks for export, it needs the export reference too; an unrelated migration guide need not be loaded for every task.
A result worth reviewing
One simple implementation for a V2 page is to keep the option in page state and assign a fresh object when the data changes:
import { McChartsV2 } from '@mcui/mccharts';
import type { Options } from '@mcui/mccharts';
function orderOption(lastMonth: number): Options {
return {
animation: false,
xAxis: { type: 'category', data: ['Jan', 'Feb', 'Mar'] },
yAxis: { type: 'value', min: 0, name: 'Orders' },
series: [{
id: 'orders', name: 'Orders', type: 'line',
data: [120, 180, lastMonth]
}]
};
}
@Entry
@ComponentV2
struct AgentOrdersPage {
@Local private option: Options = orderOption(150);
@Local private summary: string = 'Mar: 150';
build() {
Column({ space: 12 }) {
Text(this.summary).width('100%')
McChartsV2({ options: this.option }).width('100%').height(320)
Button('Update March').onClick(() => {
this.option = orderOption(168);
this.summary = 'Mar: 168';
})
}.width('100%').padding(16)
}
}
The stable orders ID identifies the same series, while the new option reference gives the component a change to observe. The summary and chart are updated from the same intended value. A real page would generate both from its business data rather than hard-code a number in two places.
The component source shows the handoff:
@Monitor('options', 'resetKey')
onOptions(): void {
const notMerge = this.appliedResetKey !== this.resetKey;
if (this.session.updateOption(this.options, notMerge)) { this.appliedResetKey = this.resetKey; }
this.interactionActive = this.session.isChartInteractionActive();
}
This is why merely mutating a nested array should not be treated as a universal refresh method. It also shows why a new object and a new chart model are different things: ordinary updates merge, while a changed resetKey requests non-merge behavior.
Ask the questions the Skill cannot answer for you
What happens when the server returns an empty month? Should a missing value be shown as zero? If a user changes stores while a request is in flight, should the old result be ignored? What should a point tap open? Those are business decisions. Give the agent sample records and expected actions, then review whether its mapping and error handling match them.
For export, specify whether the user needs a chart image, a complete report, a saved file or a share sheet. The current native chart export requires a ready V2 host and rasterText: true; it returns PNG data asynchronously. The Skill can point the agent to those constraints, but the application must implement the next step.
Finish with evidence, not a confident paragraph
Ask which files changed, which package version was actually used, and what was run. Build success checks compilation and dependency resolution; it does not establish that the chart was visible, taps matched business records, or export worked on a device. Those actions need their own checks when required.
A useful Skill keeps the important interfaces and failure modes close to the task. A useful review still follows the data from the business source through the option, component and user interaction.