Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:52:11 +08:00
commit f18fd2aa23
17 changed files with 2621 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Assets
Bundled resources for api-documentation-generator skill
- [ ] openapi_template.yaml: A template for creating OpenAPI documentation.
- [ ] swagger_ui_config.json: A configuration file for customizing the Swagger UI.
- [ ] example_api_definition.yaml: Example of a complete API definition in OpenAPI format.

View File

@@ -0,0 +1,32 @@
{
"skill": {
"name": "skill-name",
"version": "1.0.0",
"enabled": true,
"settings": {
"verbose": false,
"autoActivate": true,
"toolRestrictions": true
}
},
"triggers": {
"keywords": [
"example-trigger-1",
"example-trigger-2"
],
"patterns": []
},
"tools": {
"allowed": [
"Read",
"Grep",
"Bash"
],
"restricted": []
},
"metadata": {
"author": "Plugin Author",
"category": "general",
"tags": []
}
}

View File

@@ -0,0 +1,236 @@
# OpenAPI 3.0.3 specification for example API
openapi: 3.0.3
# API information
info:
title: Example API
version: 1.0.0
description: This is a sample API definition for demonstration purposes.
termsOfService: https://www.example.com/terms/
contact:
name: API Support
url: https://www.example.com/support
email: support@example.com
license:
name: MIT
url: https://opensource.org/licenses/MIT
# Server URLs
servers:
- url: https://api.example.com/v1
description: Production server
- url: https://staging.api.example.com/v1
description: Staging server
# Paths (API endpoints)
paths:
/users:
get:
summary: Get all users
description: Returns a list of all users.
operationId: getUsers
tags:
- Users
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'500':
description: Internal server error
post:
summary: Create a new user
description: Creates a new user with the provided information.
operationId: createUser
tags:
- Users
requestBody:
description: User object to be created
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserCreate'
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Invalid input
'500':
description: Internal server error
/users/{userId}:
get:
summary: Get a user by ID
description: Returns a single user based on the provided ID.
operationId: getUserById
tags:
- Users
parameters:
- name: userId
in: path
description: ID of the user to retrieve
required: true
schema:
type: integer
format: int64
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'404':
description: User not found
'500':
description: Internal server error
put:
summary: Update a user by ID
description: Updates an existing user with the provided information.
operationId: updateUser
tags:
- Users
parameters:
- name: userId
in: path
description: ID of the user to update
required: true
schema:
type: integer
format: int64
requestBody:
description: User object to be updated
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserUpdate'
responses:
'200':
description: User updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Invalid input
'404':
description: User not found
'500':
description: Internal server error
delete:
summary: Delete a user by ID
description: Deletes a user based on the provided ID.
operationId: deleteUser
tags:
- Users
parameters:
- name: userId
in: path
description: ID of the user to delete
required: true
schema:
type: integer
format: int64
responses:
'204':
description: User deleted successfully (no content)
'404':
description: User not found
'500':
description: Internal server error
# Components (reusable schemas, parameters, etc.)
components:
schemas:
User:
type: object
properties:
id:
type: integer
format: int64
description: Unique identifier for the user
username:
type: string
description: User's username
email:
type: string
format: email
description: User's email address
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
createdAt:
type: string
format: date-time
description: Date and time the user was created
required:
- id
- username
- email
UserCreate:
type: object
properties:
username:
type: string
description: User's username
email:
type: string
format: email
description: User's email address
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
password:
type: string
description: User's password (REPLACE_ME - consider security best practices)
required:
- username
- email
- password
UserUpdate:
type: object
properties:
username:
type: string
description: User's username
email:
type: string
format: email
description: User's email address
firstName:
type: string
description: User's first name
lastName:
type: string
description: User's last name
securitySchemes:
bearerAuth: # Define a security scheme for JWT authentication
type: http
scheme: bearer
bearerFormat: JWT
# Security requirements for the API
security:
- bearerAuth: [] # Apply the JWT authentication scheme globally
# Tags (for grouping operations)
tags:
- name: Users
description: Operations related to users

View File

@@ -0,0 +1,137 @@
# openapi_template.yaml
# This is a template for creating OpenAPI 3.0.3 documentation.
openapi: 3.0.3
info:
title: REPLACE_ME - API Documentation
version: 1.0.0
description: YOUR_VALUE_HERE - Description of the API.
termsOfService: https://example.com/terms/
contact:
name: API Support
url: https://example.com/support
email: support@example.com
license:
name: MIT
url: https://opensource.org/licenses/MIT
# Define the servers where the API is hosted.
servers:
- url: https://YOUR_VALUE_HERE/api/v1
description: Production server
- url: http://localhost:8080/api/v1
description: Development server
# Define security schemes (e.g., API key, OAuth2).
components:
securitySchemes:
ApiKeyAuth: # Security scheme name
type: apiKey
in: header # Can be "header", "query" or "cookie"
name: X-API-Key # The name of the header/query parameter/cookie
# Define paths and operations.
paths:
/items:
get:
summary: Get a list of items
description: Returns a list of all available items.
security:
- ApiKeyAuth: [] # Apply the ApiKeyAuth security scheme
tags:
- Items
responses:
'200':
description: Successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Item'
'500':
description: Internal server error
post:
summary: Create a new item
description: Creates a new item with the given data.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ItemInput'
responses:
'201':
description: Item created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Item'
'400':
description: Bad request
/items/{itemId}:
get:
summary: Get an item by ID
description: Returns a single item based on its ID.
parameters:
- in: path
name: itemId
required: true
schema:
type: integer
description: The ID of the item to retrieve.
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Item'
'404':
description: Item not found
# Define reusable schemas.
components:
schemas:
Item:
type: object
properties:
id:
type: integer
description: The unique identifier for the item.
name:
type: string
description: The name of the item.
description:
type: string
description: A description of the item.
price:
type: number
format: float
description: The price of the item.
required:
- id
- name
ItemInput:
type: object
properties:
name:
type: string
description: The name of the item.
description:
type: string
description: A description of the item.
price:
type: number
format: float
description: The price of the item.
required:
- name
- price
# Define tags for grouping operations.
tags:
- name: Items
description: Operations related to items.

View File

@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Claude Skill Configuration",
"type": "object",
"required": ["name", "description"],
"properties": {
"name": {
"type": "string",
"pattern": "^[a-z0-9-]+$",
"maxLength": 64,
"description": "Skill identifier (lowercase, hyphens only)"
},
"description": {
"type": "string",
"maxLength": 1024,
"description": "What the skill does and when to use it"
},
"allowed-tools": {
"type": "string",
"description": "Comma-separated list of allowed tools"
},
"version": {
"type": "string",
"pattern": "^\\d+\\.\\d+\\.\\d+$",
"description": "Semantic version (x.y.z)"
}
}
}

View File

@@ -0,0 +1,51 @@
{
"_comment": "Swagger UI configuration file",
"swagger": {
"_comment": "Swagger UI configuration options",
"url": "/openapi.json",
"dom_id": "#swagger-ui",
"deepLinking": true,
"presets": [
"SwaggerUIBundle.presets.apis",
"SwaggerUIStandalonePreset"
],
"plugins": [
"SwaggerUIBundle.plugins.DownloadUrl"
],
"layout": "StandaloneLayout",
"docExpansion": "none",
"filter": true,
"showRequestDuration": true,
"requestInterceptor": "(req) => { console.log('Request Interceptor:', req); return req; }",
"responseInterceptor": "(res) => { console.log('Response Interceptor:', res); return res; }",
"displayOperationId": false,
"displayRequestDuration": true,
"defaultModelsExpandDepth": 1,
"defaultModelExpandDepth": 1,
"defaultModelRendering": "example",
"displayRequestDuration": true,
"showExtensions": true,
"showCommonExtensions": true,
"validatorUrl": null,
"oauth2RedirectUrl": null,
"syntaxHighlight": {
"activate": true,
"theme": "monokai"
},
"tryItOutEnabled": true,
"persistAuthorization": true
},
"customCss": ".swagger-ui .topbar { display: none; }",
"customJs": null,
"customFavIcon": null,
"customSiteTitle": "API Documentation",
"oauth2": {
"_comment": "OAuth 2.0 configuration (optional)",
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"realm": "your-realm",
"appName": "API Documentation App",
"scopeSeparator": " ",
"additionalQueryStringParams": {}
}
}

View File

@@ -0,0 +1,27 @@
{
"testCases": [
{
"name": "Basic activation test",
"input": "trigger phrase example",
"expected": {
"activated": true,
"toolsUsed": ["Read", "Grep"],
"success": true
}
},
{
"name": "Complex workflow test",
"input": "multi-step trigger example",
"expected": {
"activated": true,
"steps": 3,
"toolsUsed": ["Read", "Write", "Bash"],
"success": true
}
}
],
"fixtures": {
"sampleInput": "example data",
"expectedOutput": "processed result"
}
}