Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

project-api

БесплатноБез исполняемых скриптовНе проверен

Complete API lifecycle management for Laravel applications — from OpenAPI design through governance and security hardening. Covers seven phases: design…

nasrulhazimот nasrulhazim★ 26 звёзд на GitHub

Об этом скилле

API Lifecycle Manager

A seven-phase methodology for designing, building, testing, deploying, documenting, governing, and securing production-ready REST APIs in Laravel — anchored on OpenAPI 3.1 as the single source of truth.

Command Reference

Command Phase Description
/api design Design Interview + generate OpenAPI 3.1 spec
/api develop Develop Scaffold controllers, requests, resources from OpenAPI
/api test Test Generate Pest API tests + contract tests
/api deploy Deploy Versioned deployment, feature flags, zero-downtime
/api docs Documentation Auto-generate docs via Scribe/Scramble
/api govern Governance Breaking change detection, deprecation, review
/api security Security OWASP API Top 10 audit + hardening

1. /api design — OpenAPI Spec Generation

1.1 API Discovery Interview

Ask the user for the following in three blocks, one at a time:

Block 1 — API Identity

  • What is the API name and purpose? (one sentence)
  • Who are the consumers? (SPA, mobile app, third-party, internal service)
  • What authentication method? (Sanctum for SPA/mobile, Passport for third-party, API keys)
  • What base URL / server environments? (local, staging, production)

Block 2 — Resources & Operations

  • List the primary resources (e.g., users, orders, products)
  • For each resource: which CRUD operations are needed?
  • Are there any non-CRUD actions? (e.g., approve, publish, archive)
  • What relationships exist between resources? (belongs-to, has-many, many-to-many)

Block 3 — Behaviour & Constraints

  • Versioning strategy: URI-based (/api/v1/) or header-based (Accept: application/vnd.app.v1+json)?
  • Pagination style: cursor-based or offset-based? Default page size?
  • Filtering and sorting requirements?
  • Rate limiting tiers? (public vs authenticated vs admin)
  • Error response format: RFC 7807 Problem Details or custom?

If the user already provided context, extract what you can and only ask for what is missing.

1.2 Generate OpenAPI 3.1 Specification

Read references/openapi-template.md for the base template structure.

Generate a complete OpenAPI 3.1 YAML specification with:

  • info block with title, description, version, contact, license
  • servers for each environment
  • paths for every resource and operation identified
  • components/schemas for request bodies, response bodies, error objects
  • components/securitySchemes for the chosen auth method
  • components/parameters for reusable query parameters (pagination, filtering, sorting)
  • Proper HTTP status codes: 200, 201, 204, 400, 401, 403, 404, 409, 422, 429, 500
  • RFC 7807 error response schema (if selected)
  • Pagination envelope schema

Naming conventions (enforce on every path):

  • Plural nouns for collections: /api/v1/orders not /api/v1/order
  • Kebab-case for multi-word: /api/v1/order-items not /api/v1/orderItems
  • Nested resources max 2 levels: /api/v1/orders/{order}/items
  • No verbs in paths: use HTTP methods instead

1.3 Present Design Output

Save the spec as openapi.yaml. Present it and ask: "Review the spec. Want to adjust any resources, add fields, or change behaviour? Once confirmed, I can scaffold the Laravel code with /api develop."


2. /api develop — Laravel Scaffolding from OpenAPI

2.1 Pre-flight Checks

Before scaffolding, verify:

  • An openapi.yaml exists in the project (or user provides one)
  • Laravel version (10 or 11) — check composer.json
  • Auth package installed (Sanctum or Passport)

2.2 Generate Per-Resource Files

For each resource in the OpenAPI spec, generate:

File Location Purpose
Controller app/Http/Controllers/Api/V1/{Resource}Controller.php RESTful actions
Form Request (Store) app/Http/Requests/Api/V1/Store{Resource}Request.php Create validation
Form Request (Update) app/Http/Requests/Api/V1/Update{Resource}Request.php Update validation
API Resource app/Http/Resources/Api/V1/{Resource}Resource.php Response transformation
Resource Collection app/Http/Resources/Api/V1/{Resource}Collection.php Paginated collection
Policy app/Policies/{Resource}Policy.php Authorization
Migration database/migrations/{timestamp}_create_{table}_table.php Database schema
Model app/Models/{Resource}.php Eloquent model

2.3 Controller Pattern

<?php

namespace App\Http\Controllers\Api\V1;

use App\Http\Controllers\Controller;
use App\Http\Requests\Api\V1\StoreOrderRequest;
use App\Http\Requests\Api\V1\UpdateOrderRequest;
use App\Http\Resources\Api\V1\OrderCollection;
use App\Http\Resources\Api\V1\OrderResource;
use App\Models\Order;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Spatie\QueryBuilder\QueryBuilder;

class OrderController extends Controller
{
    public function __construct()
    {
        $this->authorizeResource(Order::class, 'order');
    }
Полный SKILL.md на GitHub

Установить project-api в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/api-governance-patterns.mdreferences/api-security-checklist.mdreferences/api-test-patterns.mdreferences/openapi-template.md

FAQ

Что делает скилл project-api?

Complete API lifecycle management for Laravel applications — from OpenAPI design through governance and security hardening. Covers seven phases: design (OpenAPI 3.1 spec generation via interview), develop (controller/request/resource scaffolding with Sanctum/Passport auth), test (Pest API test generation with contract testing), deploy (versioned deployment with feature flags and zero-downtime migration), docs (auto-generated documentation with Scribe/Scramble), govern (breaking change detection, deprecation policy, API review), and security (OWASP API Top 10, input validation, rate limiting tiers). Use this skill whenever the user asks to design an API, generate OpenAPI specs, scaffold API endpoints, write API tests, deploy API versions, generate API documentation, review API changes, or harden API security — including requests like "design a REST API for X", "scaffold CRUD endpoints", "generate Pest tests for my API", "set up API versioning", "check my API for breaking changes", "generate API docs", "secure my API", or "review my API design". Also triggers for Malay requests like "reka bentuk API untuk X", "buat ujian API", "jana dokumentasi API", "semak keselamatan API saya", or "sediakan endpoint CRUD". Compatible with Laravel 10/11 projects using Sanctum, Passport, Scribe, and Scramble.

Как установить скилл project-api?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл project-api запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить project-api с