Initial commit

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

View File

@@ -0,0 +1,7 @@
# Assets
Bundled resources for api-gateway-builder skill
- [ ] api_gateway_template.yaml: YAML template for defining API gateway configurations.
- [ ] example_api_definition.json: Example API definition file.
- [ ] error_response_templates/: Directory containing templates for different error responses (e.g., 400, 401, 500).

View File

@@ -0,0 +1,55 @@
# API Gateway Configuration Template
# Gateway Metadata
name: my-api-gateway # Name of the API gateway
description: Production-ready API gateway configuration. # Description of the gateway
# Global Configuration
global:
# Default rate limit for all routes (requests per minute)
default_rate_limit: 60 # Requests per minute
# Enable/Disable global CORS settings. Set to 'true' or 'false'.
enable_cors: true
# Allowed origins for CORS (e.g., ['https://example.com', 'https://another.com', '*'])
cors_allowed_origins: ['*'] # REPLACE_ME: List of allowed origins
# Allowed methods for CORS (e.g., ['GET', 'POST', 'PUT', 'DELETE'])
cors_allowed_methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
# Allowed headers for CORS (e.g., ['Content-Type', 'Authorization'])
cors_allowed_headers: ['Content-Type', 'Authorization', 'YOUR_HEADER_HERE']
# Expose headers for CORS (e.g., ['Content-Type', 'Authorization'])
cors_exposed_headers: ['Content-Type', 'Authorization']
# Authentication Configuration
authentication:
# Authentication type: 'jwt' or 'none'
type: jwt
jwt:
# JWT secret key (used for verifying signatures)
secret: REPLACE_ME # JWT Secret Key
# Audience (optional)
audience: YOUR_VALUE_HERE # JWT Audience
# Issuer (optional)
issuer: YOUR_VALUE_HERE # JWT Issuer
# Routes Configuration
routes:
- path: /users # Path for the route
method: GET # HTTP method (GET, POST, PUT, DELETE, etc.)
upstream_url: http://users-service:8080 # URL of the upstream service
rate_limit: 120 # Route-specific rate limit (overrides global default)
authentication_required: true # Requires authentication for this route
# Optional plugins to apply to this route
plugins:
- name: circuit-breaker
config:
failure_threshold: 5
recovery_timeout: 30
- path: /products
method: POST
upstream_url: http://products-service:8080
rate_limit: 60
authentication_required: true
- path: /public
method: GET
upstream_url: http://public-service:8080
authentication_required: false # Public route, no authentication required

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,104 @@
{
"_comment": "Example API Definition - Use this as a template for your API gateway configuration.",
"api_name": "MyAwesomeAPI",
"version": "v1",
"base_path": "/api/v1",
"authentication": {
"_comment": "Authentication configuration. 'jwt' is currently the only supported method.",
"type": "jwt",
"jwt": {
"_comment": "JWT specific configuration.",
"issuer": "https://my-auth-server.example.com",
"jwks_uri": "https://my-auth-server.example.com/.well-known/jwks.json",
"audience": "my-api-audience"
}
},
"rate_limiting": {
"_comment": "Global rate limiting configuration. Applies to all routes.",
"enabled": true,
"requests_per_minute": 100,
"burst_size": 200,
"identifier": "ip"
},
"routes": [
{
"_comment": "Route for getting user details.",
"path": "/users/{user_id}",
"method": "GET",
"target_url": "http://user-service.example.com/users/{user_id}",
"authentication_required": true,
"rate_limiting": {
"_comment": "Override global rate limiting for this route.",
"enabled": true,
"requests_per_minute": 20,
"burst_size": 40,
"identifier": "user_id"
},
"circuit_breaker": {
"_comment": "Circuit breaker configuration for this route.",
"enabled": true,
"error_threshold_percentage": 50,
"reset_timeout_ms": 30000,
"volume_threshold": 10
}
},
{
"_comment": "Route for creating a new user.",
"path": "/users",
"method": "POST",
"target_url": "http://user-service.example.com/users",
"authentication_required": false,
"rate_limiting": {
"_comment": "Use global rate limiting."
},
"circuit_breaker": {
"_comment": "Use global circuit breaker settings or disable circuit breaker",
"enabled": false
}
},
{
"_comment": "Route for listing all products.",
"path": "/products",
"method": "GET",
"target_url": "http://product-service.example.com/products",
"authentication_required": true,
"rate_limiting": {
"_comment": "Override global rate limiting for this route.",
"enabled": true,
"requests_per_minute": 50,
"burst_size": 100,
"identifier": "ip"
},
"circuit_breaker": {
"_comment": "Circuit breaker configuration for this route.",
"enabled": true,
"error_threshold_percentage": 50,
"reset_timeout_ms": 30000,
"volume_threshold": 10
}
},
{
"_comment": "Route for health check.",
"path": "/health",
"method": "GET",
"target_url": "http://health-service.example.com/health",
"authentication_required": false,
"rate_limiting": {
"_comment": "No rate limiting for health check.",
"enabled": false
},
"circuit_breaker": {
"_comment": "Disable circuit breaker for health check",
"enabled": false
}
}
],
"load_balancing": {
"_comment": "Load balancing configuration",
"algorithm": "round_robin",
"targets": [
"http://user-service-instance1.example.com",
"http://user-service-instance2.example.com"
]
}
}

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,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"
}
}