Skill api-docs
Menyesuaikan dokumentasi OpenAPI v3 untuk resource API Platform menggunakan attribute, konfigurasi YAML, atau factory decorator.
- Bintang GitHub
- 29
- File
- 1
- Commit terakhir
- 22 Okt 2026
- Lisensi
- —
- Tool yang diizinkan
- —
Apa fungsi skill api-docs?
api-docs adalah agent skill. Menyesuaikan dokumentasi OpenAPI v3 untuk resource API Platform menggunakan attribute, konfigurasi YAML, atau factory decorator.
Ringkasan dibuat dari SKILL.md skill ini.
Tentang skill api-docs
Fungsi utama dari SKILL ini adalah memodifikasi dokumentasi OpenAPI v3 untuk resource API Platform. Developer menggunakannya saat perlu menyempurnakan deskripsi endpoint, menambahkan contoh properti, atau mengelola tampilan resource pada output Swagger. Skill ini menyediakan sintaks dan pola konfigurasi yang diperlukan untuk lingkungan Symfony maupun Laravel guna memastikan dokumentasi API mencerminkan kode underlying secara akurat.
Agent harus memuat skill ini ketika pengguna meminta perubahan pada dokumentasi API, seperti mendokumentasikan field tertentu, menyembunyikan operasi, atau menambahkan deskripsi response kustom. Skill ini memberikan panduan penggunaan PHP attribute seperti ApiProperty dan Post, mengonfigurasi informasi global melalui file YAML atau PHP, serta mengimplementasikan OpenApiFactory decorator untuk perubahan skala besar seperti mengatur custom server URL. Ini mencakup tugas teknis spesifik seperti menonaktifkan pembuatan ID pada embedded objects dan mendefinisikan custom header parameters.
Apa yang bisa dilakukan agent dengannya
- 1Menyembunyikan endpoint sensitifMencegah operasi tertentu atau seluruh resource muncul dalam dokumentasi OpenAPI yang dihasilkan.
- 2Mengonfigurasi metadata API globalMengatur judul API, versi, dan security schemes pada level aplikasi.
Ditulis dari SKILL.md milik skill tersebut. Setiap use case diverifikasi dengan kutipan darinya.
Cara install skill api-docs
Setiap perintah menyalin folder skill ke direktori skills client. Restart client atau mulai sesi baru untuk memuatnya.Install skill api-docs di Plugin
/plugin marketplace add api-platform/skillset /plugin install api-platform@api-platform-skillset
Install skill api-docs di Claude Code
~/.claude/skills/api-docs/SKILL.md
$ npx degit api-platform/skillset/skills/api-docs ~/.claude/skills/api-docsInstall skill api-docs di Claude Code (project)
.claude/skills/api-docs/SKILL.md
$ npx degit api-platform/skillset/skills/api-docs .claude/skills/api-docsInstall skill api-docs di Codex
~/.agents/skills/api-docs/SKILL.md
$ npx degit api-platform/skillset/skills/api-docs ~/.agents/skills/api-docsInstall skill api-docs di Gemini CLI
~/.gemini/skills/api-docs/SKILL.md
$ npx degit api-platform/skillset/skills/api-docs ~/.gemini/skills/api-docsInstall skill api-docs di Claude.ai
npx degit api-platform/skillset/skills/api-docs api-docs && zip -r api-docs.zip api-docs # claude.ai → Customize → Skills → + → Create skill → Upload a skill → api-docs.zip
SKILL.md
Lihat di GitHubCustomizing API Documentation
API Platform generates OpenAPI v3 documentation automatically. Customize it using attributes.
Global Info & Security Schemes (YAML)
Set the API-wide title, version, description and auth schemes in
config/packages/api_platform.yaml:
api_platform:
openapi:
info:
title: 'My API'
version: '1.0.0'
description: 'What this API does.'
components:
securitySchemes:
Bearer:
type: http
scheme: bearer
bearerFormat: JWT
Operation-Level Customization
use ApiPlatform\Metadata\Post;
use ApiPlatform\OpenApi\Model\Operation;
use ApiPlatform\OpenApi\Model\Response as OpenApiResponse;
#[Post(
openapi: new Operation(
summary: 'Create a new order',
description: 'Creates an order and sends confirmation email.',
responses: [
'201' => new OpenApiResponse(description: 'Order created successfully'),
'422' => new OpenApiResponse(description: 'Validation failed'),
]
)
)]
class Order {}
Property Documentation
use ApiPlatform\Metadata\ApiProperty;
class Order
{
#[ApiProperty(description: 'The unique identifier', example: 1)]
public int $id;
#[ApiProperty(
description: 'Current status',
example: 'pending',
openapiContext: ['enum' => ['pending', 'shipped', 'delivered']]
)]
public string $status;
#[ApiProperty(
genId: false,
types: ['https://schema.org/sender'],
openapiContext: [
'example' => ['address' => 'user@example.com', 'name' => 'John'],
],
)]
public Recipient $from;
}
Use genId: false on embedded objects (non-IRI properties) to suppress @id generation.
Hiding from Documentation
// Hide entire resource
#[ApiResource(openapi: false)]
// Hide specific operation
#[Get(openapi: false)]
// Hide from Hydra entrypoint only (keep in OpenAPI)
#[Get(hydra: false)]
Custom Parameters
use ApiPlatform\Metadata\HeaderParameter;
#[Post(
parameters: [
'X-Idempotency-Key' => new HeaderParameter(
description: 'Unique key to prevent duplicate processing',
required: true,
),
],
)]
OpenApiFactory Decorator (Global Customization)
Decorate the built-in factory for global changes like custom server URLs:
<?php
namespace App\OpenApi;
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\OpenApi\Model;
use ApiPlatform\OpenApi\OpenApi;
final class OpenApiFactory implements OpenApiFactoryInterface
{
public function __construct(
private readonly OpenApiFactoryInterface $decorated,
private readonly string $openapiUrl,
) {}
public function __invoke(array $context = []): OpenApi
{
$openApi = $this->decorated->__invoke($context);
return $openApi->withServers([
new Model\Server($this->openapiUrl),
]);
}
}
Register as a decorator in services.yaml:
App\OpenApi\OpenApiFactory:
decorates: 'api_platform.openapi.factory'
arguments:
$openapiUrl: '%env(OPENAPI_URL)%'
Laravel
All the attribute-level customization — operation openapi: new Operation(...),
#[ApiProperty] description/example/openapiContext, openapi: false, hydra: false,
HeaderParameter — is framework-neutral and works unchanged. Only the global pieces
differ:
- Global title/version/description are top-level keys in
config/api-platform.php('title','version','description'); there is noopenapi.infoYAML. Security schemes are configured under theswagger_uiblock (apiKeys,oauth,http_auth) in the same file, andopenapi.tagsis available there too. - To decorate the OpenAPI factory, bind your decorator in a service provider with the
container's
extend()(resolving the innerOpenApiFactoryInterface) instead of the Symfonydecorates:YAML — theOpenApiFactoryInterfaceandwithServers(...)API are identical.
Berkas dalam skill ini
1Pertanyaan seputar skill api-docs
Bagaimana cara install skill api-docs di Claude Code?
Jalankan npx degit api-platform/skillset/skills/api-docs ~/.claude/skills/api-docs. Claude Code memuat skill dari ~/.claude/skills (semua proyek) atau .claude/skills (satu proyek) dan menggunakan skill saat deskripsinya cocok dengan tugas.
Client mana saja yang bisa menggunakan skill api-docs?
Client apa pun yang membaca format Agent Skills: Claude Code, Codex, Gemini CLI, dan claude.ai (unggah sebagai ZIP). Script dalam skill hanya berjalan di client yang mengizinkan eksekusi kode.
Bagaimana cara menambahkan deskripsi atau contoh kustom ke properti API?
Gunakan attribute #[ApiProperty] untuk menentukan deskripsi, nilai contoh, atau konteks OpenAPI tambahan.
Bisakah saya menyesuaikan informasi API global seperti judul dan versi?
Ya, di Symfony Anda dapat mengaturnya di config/packages/api_platform.yaml di bawah key openapi.info, sedangkan di Laravel diatur di config/api-platform.php.
Bagaimana cara menonaktifkan pembuatan @id untuk embedded objects?
Terapkan genId: false pada properti menggunakan attribute #[ApiProperty].