githubEdit

πŸ€–Using AI with Mechanic

circle-info

Mechanic offers dedicated AI tools that understand the platform's patterns, task library, and documentation:

circle-exclamation

AI tools for Mechanic

For developers

The MCP server and Agent Skills are designed to work together. The MCP server gives your AI assistant access to Mechanic's task library and documentation at query time. Agent Skills install Mechanic's task-writing patterns directly into your AI's context, so it knows how to structure subscriptions, handle preview mode, use GraphQL, and produce complete importable task JSON.

For the best results, use both: the MCP server for research and reference, and Agent Skills for writing code.

The Shopify Dev MCP Server is also worth adding β€” it gives your AI assistant direct access to Shopify's GraphQL schema and query validation.

If you're working in Shopify Admin, the Sidekick skill brings Mechanic task-writing expertise directly into Shopify's built-in AI assistant.

For ChatGPT users

The Mechanic GPT has access to Mechanic's full documentation and can answer questions about the platform, explain concepts, and write or debug task code β€” all within ChatGPT. For agentic coding workflows, the MCP server and Agent Skills produce better results β€” but the GPT is a convenient option if ChatGPT is your primary tool.


Tips for working with AI

These apply regardless of which AI tool you're using:

  • Start from the task library. Search tasks.mechanic.devarrow-up-right for an existing task that's close to what you need. Modifying a working task is faster and more reliable than starting from scratch.

  • Check subscriptions. Make sure the task subscribes to the right event topics. A task that listens to shopify/orders/create won't fire on order updates.

  • Prefer GraphQL. Shopify REST is deprecated in Mechanic. Use the GraphQL Admin API for reading and writing Shopify data.

  • Verify the output format. A complete Mechanic task is a JSON object with name, script, subscriptions, subscriptions_template, options, and other fields. If your AI produces only a Liquid script, it's missing the structure needed for import.

  • Watch for async vs sync confusion. This is the most common AI mistake. query | shopify returns data immediately. {% action "shopify" %} queues a mutation that runs after the script finishes. If the AI tries to use a mutation result in the same script run, the task will silently fail.

  • Check for preview mode. Every event topic the task subscribes to needs an {% if event.preview %} block with mock data. If the task subscribes to 3 topics, there should be 3 preview blocks. Missing previews mean Mechanic can't verify the task will produce valid actions.

  • Webhook orders need admin_graphql_api_id. When an order arrives via webhook (like shopify/orders/create), the order ID is REST-style. The task needs to use order.admin_graphql_api_id to get the full GraphQL ID for mutations. Using order.id directly will fail.

Last updated

Was this helpful?