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
data-variant=help
data-slots=text
Prerequisites
The following prerequisites are required to use mesh prompting:
data-variant=info
data-slots=text
-
A coding agent - Cursor is recommended.
-
Node.js 18+
-
The Adobe I/O CLI:
npm install -g @adobe/aio-cli -
The API Mesh plugin:
aio 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:
Create 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:
My 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.