Agent skill
workflow-management
TD workflow debugging and operations. Covers tdx wf commands for monitoring (sessions, attempt, logs), retry/backfill patterns, alerting (_error with Slack/email), and data quality checks.
Install this agent skill to your Project
npx add-skill https://github.com/treasure-data/td-skills/tree/main/workflow-skills/workflow-management
SKILL.md
TD Workflow Management
Setup & CLI Commands
For full CLI reference, see tdx-skills/workflow. Quick start:
tdx wf use my_project # Set default project for session
tdx wf pull my_project # Pull project locally for editing
tdx wf push # Push changes with diff preview
Debugging Steps
tdx wf sessions --status error- find failed sessionstdx wf timeline --session-id <id>- visualize task executiontdx wf attempt <id> logs +failed_task- read error logs- Verify query syntax if td> failed
- Check time ranges - does data exist for session_date?
- Validate parameter values
- Check resource limits (memory, timeout)
tdx wf attempt <id> retry --resume-from +failed_task- retry from failure
Alerting
+critical_task:
td>: queries/important.sql
_error:
+slack_alert:
sh>: |
curl -X POST ${secret:slack.webhook_url} \
-H 'Content-Type: application/json' \
-d '{"text": "Workflow failed: ${session_id}"}'
Data Quality Checks
+process:
td>: queries/process.sql
create_table: results
+validate:
td>:
query: |
SELECT COUNT(*) as cnt,
SUM(CASE WHEN id IS NULL THEN 1 ELSE 0 END) as nulls
FROM results
store_last_results: true
+check:
if>: ${td.last_results.cnt == 0}
_do:
+fail:
sh>: exit 1
Wait for Data
+wait_for_data:
sh>: |
for i in {1..30}; do
COUNT=$(tdx query -d analytics "SELECT COUNT(*) FROM src WHERE date='${session_date}'" --format csv | tail -1)
if [ "$COUNT" -gt 0 ]; then exit 0; fi
sleep 60
done
exit 1
Idempotent Operations
+safe_insert:
td>:
query: |
DELETE FROM target WHERE date = '${session_date}';
INSERT INTO target SELECT * FROM source WHERE date = '${session_date}'
Backfill Pattern
+backfill:
loop>:
dates: ["2024-01-01", "2024-01-02", "2024-01-03"]
_do:
+process:
call>: main_workflow.dig
params:
session_date: ${dates}
Secrets
See tdx-skills/workflow for tdx wf secrets commands. Usage in .dig files:
+task:
sh>: curl -H "Authorization: ${secret:API_KEY}" https://api.example.com
Common Issues
| Issue | Solution |
|---|---|
| Timeout | Add timeout: 3600s, _retry: 2 |
| Intermittent failures | Add _retry: 5 with exponential backoff |
| Out of memory | Reduce data volume, use approx functions |
| Duplicate runs | Use idempotent DELETE+INSERT pattern |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
email-campaign
This skill should be used when the user asks to "create an email", "build an email campaign", "design an email template", "generate an email for a segment", "preview an email", or "push an email to Engage". Generates enterprise-grade HTML email templates with live preview in Treasure Studio and natural language editing, then pushes the final version to Treasure Engage.
action-report
YAML format reference for action reports rendered via preview_action_report. MUST be read before writing any action report YAML — defines the report structure (title, summary, actions array) and action item fields (as_is, to_be, reason, priority, category, impact) with incremental build workflow. Required by seo-analysis and any skill that produces prioritized recommendations.
grid-dashboard
YAML format reference for grid dashboards rendered via preview_grid_dashboard. MUST be read before writing any dashboard YAML — defines the page structure, 6 cell types (kpi, gauge, scores, table, chart, markdown), grid layout rules, cell merging syntax, and incremental build workflow. Required by seo-analysis and any skill that produces visual data dashboards.
seo-analysis
Runs SEO and AEO (Answer Engine Optimization) analysis on websites or specific pages. Use when the user mentions SEO, AEO, search rankings, search optimization, or wants to analyze how their pages perform in search engines and AI answers. Produces a data dashboard and action report with before/after recommendations.
aps-doc-core
Core documentation generation patterns and framework for Treasure Data pipeline layers. Provides shared templates, quality validation, testing framework, and Confluence integration used by all layer-specific documentation skills.
aps-doc-id-unification
Expert documentation generation for ID unification layers. Documents identity resolution algorithms, merge strategies, match rules, entity graphs, and multi-workflow orchestration. Use when documenting ID unification processes.
Didn't find tool you were looking for?