API Mesh prompting guide
One of the fastest ways to build an API Mesh configuration file is by using AI to assist with writing the boilerplate code. When building, iterating on, or debugging meshes using AI tools and Large Language Models (LLMs), a well-structured and extensive prompt helps provide the model with clearer guidelines and examples that can dramatically improve output.
The API Mesh starter kit repository also contains resources and examples for generating Adobe API Mesh configurations using AI prompting techniques.
These resources can help developers quickly build, test, and deploy meshes by leveraging Cursor's AI capabilities and structured prompting rules.
Relevant files:
The following files are used when prompting your agent to create a mesh. You can review the contents of these files for a better understanding the context provided to the agent. You can also customize these files to address your specific mesh generation needs.
llm.txt- Source context and knowledge base for API Mesh.cursor/rules/api-mesh.mdc- Active Cursor AI rules for this project
The API Mesh starter kit also allows you to create a mesh from a template.
Prerequisites
The following prerequisites are required to use mesh prompting:
While you can use alternative coding agents, this guide focuses on creating meshes using Cursor.
A coding agent - Cursor is recommended.
Node.js 18+
The Adobe I/O CLI:
Copied to your clipboardnpm install -g @adobe/aio-cliThe API Mesh plugin:
Copied to your clipboardaio plugins:install @adobe/aio-cli-plugin-api-mesh
Clone the repo and open the project in Cursor.
Create a mesh with a prompt
Select the desired model, and instruct your agent to create a mesh that fits your needs. For example:
Copied to your clipboardCreate a mesh configuration that connects my Adobe Commerce GraphQL and a custom REST API. The mesh should include an authentication hook.
Review the responses of the AI, which should instruct you on manual steps, like adding your API URLs to the environment variables file.
Troubleshooting
If you encounter an error, ask the agent for assistance. For example:
Copied to your clipboardMy mesh is returning a 401 error. How do I debug this locally?
Contributing
Adobe welcomes contributions of new patterns, prompts, and examples. As you discover them, please submit a pull request to the API Mesh starter kit repository with your changes.