skills/custom-apps/ai-service-layer/SKILL.md
Toolkit-first AIClient patterns for generation, text-to-sql, and response parsing.
npx skillsauth add stahura/domo-ai-vibe-rules ai-service-layerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This rule is toolkit-first. Use AIClient from @domoinc/toolkit.
yarn add @domoinc/toolkit
import { AIClient } from '@domoinc/toolkit';
Do not instantiate AIClient for these methods.
Wrong:
const ai = new AIClient();
await ai.text_to_sql('...');
Correct:
await AIClient.text_to_sql('...');
const response = await AIClient.generate_text(
'Explain this sales trend in simple terms',
{ template: 'You are a business analyst. ${input}' },
{ tone: 'professional' },
undefined,
{ temperature: 0.7 }
);
const body = response.data || response.body || response;
const text = body.output || body.choices?.[0]?.output;
text_to_sql schema argument must be an arrayWrong:
await AIClient.text_to_sql('Show top vendors by spend', {
dataSourceName: 'vendorPayments',
columns: [{ name: 'amount', type: 'number' }]
});
Correct:
await AIClient.text_to_sql('Show top vendors by spend', [
{
dataSourceName: 'vendorPayments',
description: 'Vendor payment invoices',
columns: [
{ name: 'vendor', type: 'string' },
{ name: 'amount', type: 'number' },
{ name: 'date', type: 'date' }
]
}
]);
(Approximate; check installed toolkit typings for exact current signature.)
AIClient.text_to_sql(
input: string,
dataSourceSchemas?: DataSourceSchema[], // array
promptTemplate?: any,
parameters?: Record<string, string>,
model?: string,
modelConfiguration?: Record<string, Object>
): Promise<Response<TextAIResponse>>;
Why array: this supports multi-table SQL generation (including join-aware SQL) when multiple schemas are provided.
text_to_sql is great for ad-hoc SQL, but /sql/v1 does not automatically apply dashboard/page filters.
If filter-awareness is required in embedded cards, use Query API (/data/v1 via @domoinc/query) for execution.
const sqlResult = await AIClient.text_to_sql('Show total sales by region', [
{
dataSourceName: 'Sales',
description: 'Sales transactions',
columns: [{ name: 'region', type: 'string' }, { name: 'amount', type: 'number' }]
}
]);
const beastModeResult = await AIClient.text_to_beastmode(
'Calculate year over year growth percentage',
{ dataSourceName: 'Revenue', columns: [{ name: 'revenue', type: 'number' }, { name: 'date', type: 'date' }] }
);
AIClient responses are not always shaped like other toolkit clients:
response.dataoutput and choicesUse defensive parsing plus a strict string guard:
const body = response?.data ?? response?.body ?? response;
const outputCandidate = body?.output ?? body?.choices?.[0]?.output;
const output = typeof outputCandidate === 'string' ? outputCandidate.trim() : '';
if (!output) throw new Error('AI returned no usable output');
AIClient methods use snake_case (generate_text, text_to_sql, etc.)AIClient methods are called statically (for example AIClient.text_to_sql(...), not instance methods)AIClient.text_to_sql second argument is DataSourceSchema[] (array), not a single objectdata/body fallbacktools
Step-by-step orchestrator for building Domo App Studio apps with native KPI cards via community-domo-cli. Sequences app creation, pages, theme, hero metrics, native charts, filter cards, layout assembly, and navigation. CLI-first — no raw API calls.
tools
Create, update, and execute Magic ETL dataflows programmatically via API and CLI. Covers DAG-based JSON dataflow definitions, input/transform/output node wiring, join operations, and execution lifecycle.
tools
Magic ETL dataflows via community-domo-cli — list, get-definition, create, update, run, execution status; JSON DAG actions, transforms, joins. Use when automating dataflows with the community Domo CLI end-to-end. For REST/Java-CLI–first flows or mixed API patterns, use magic-etl instead.
development
Clean, professional dashboard theme for Domo custom apps. CSS custom properties, layout patterns, typography, and design polish that feel native to the Domo platform. Includes OKLCH color palette, layered shadows, concentric border radius, tabular numbers, and micro-interaction patterns.