magento-api

Create Magento 2 REST and GraphQL API endpoints with service contracts.

32|3|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/furan917/magento-ai-toolkit --skill magento-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: magento-api
Source: https://github.com/furan917/magento-ai-toolkit/tree/main/skills/magento-api
Command: npx skills add https://github.com/furan917/magento-ai-toolkit --skill magento-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often need to create Magento 2 REST and GraphQL endpoints with strong contract guarantees, leading to boilerplate code and potential contract drift. This Skill provides a structured approach to create service-contract backed APIs, ensuring consistent interfaces and security.

Core Features & Use Cases

  • Contract-backed REST endpoints via webapi.xml and Api interfaces, ensuring proper authentication and input validation.
  • GraphQL endpoints via schema.graphqls with resolvers wired to Api interfaces, promoting consistent data access patterns.
  • Clear scaffolding and best practices for Magento API development, including documentation and testing recipes for common extension scenarios.

Quick Start

Paste this file as a system prompt, then describe the Magento API endpoint you need to build.

Frequently Asked Questions about magento-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Magento 2 REST API endpoint using service contracts?

To create a Magento 2 REST API endpoint using service contracts, define an Api interface, add PHPDoc annotations for JSON serialization, and configure webapi.xml routes with proper authentication and input validation.

How do I implement GraphQL resolvers in Magento 2?

To implement GraphQL resolvers in Magento 2, define a schema.graphqls file and wire the resolvers directly to your service contract Api interfaces to ensure consistent data access patterns.

Why do Magento 2 API interfaces need PHPDoc annotations?

Magento 2 API interfaces need PHPDoc annotations for @param, @return, and @throws to enable the framework's automatic JSON serialization and ensure correct data type handling for REST and GraphQL endpoints.

What is the best way to prevent contract drift in Magento 2 APIs?

The best way to prevent contract drift in Magento 2 APIs is to back both REST and GraphQL endpoints with service contracts, ensuring webapi.xml routes and GraphQL resolvers consistently use the same interface-based data access patterns.

Can I use the same Api interface for both Magento 2 REST and GraphQL endpoints?

Yes, you can use the same service contract Api interface for both Magento 2 REST and GraphQL endpoints, which promotes consistent data access patterns and eliminates boilerplate code across your extension architecture.

How do I configure authentication for a Magento 2 webapi.xml route?

To configure authentication for a Magento 2 webapi.xml route, define the access level in the route configuration while ensuring your service contract interface handles input validation and security properly.