Initial commit
This commit is contained in:
6
skills/skill-adapter/assets/README.md
Normal file
6
skills/skill-adapter/assets/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for api-request-logger skill
|
||||
|
||||
- [ ] logging_config_template.json: Template for logging configuration files, including settings for formatters, handlers, and log levels.
|
||||
- [ ] example_log_output.json: Example of structured log output in JSON format, demonstrating the use of correlation IDs and other metadata.
|
||||
32
skills/skill-adapter/assets/config-template.json
Normal file
32
skills/skill-adapter/assets/config-template.json
Normal 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": []
|
||||
}
|
||||
}
|
||||
122
skills/skill-adapter/assets/example_log_output.json
Normal file
122
skills/skill-adapter/assets/example_log_output.json
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"_comment": "Example log entry for a successful API request",
|
||||
"level": "INFO",
|
||||
"timestamp": "2024-01-26T10:00:00.000Z",
|
||||
"message": "API request completed successfully",
|
||||
"correlation_id": "a1b2c3d4e5f6g7h8i9j0",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "/api/users/123",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer <redacted>"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status_code": 200,
|
||||
"body_size": 150,
|
||||
"response_time_ms": 75
|
||||
},
|
||||
"user": {
|
||||
"user_id": "user123",
|
||||
"username": "testuser"
|
||||
},
|
||||
"application": "my-app",
|
||||
"environment": "production",
|
||||
"log_type": "api_request",
|
||||
"source": "api-request-logger",
|
||||
"_comment": "Optional fields for request context"
|
||||
},
|
||||
{
|
||||
"_comment": "Example log entry for an API request that resulted in an error",
|
||||
"level": "ERROR",
|
||||
"timestamp": "2024-01-26T10:00:05.000Z",
|
||||
"message": "API request failed with error",
|
||||
"correlation_id": "b2c3d4e5f6g7h8i9j0a1",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"url": "/api/orders",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer <redacted>"
|
||||
},
|
||||
"body": "{\"item_id\": \"456\", \"quantity\": 2}"
|
||||
},
|
||||
"response": {
|
||||
"status_code": 500,
|
||||
"error_message": "Internal Server Error",
|
||||
"response_time_ms": 120
|
||||
},
|
||||
"user": {
|
||||
"user_id": "user456",
|
||||
"username": "anotheruser"
|
||||
},
|
||||
"application": "my-app",
|
||||
"environment": "production",
|
||||
"log_type": "api_request",
|
||||
"source": "api-request-logger",
|
||||
"error": {
|
||||
"type": "ServerError",
|
||||
"message": "Database connection failed"
|
||||
},
|
||||
"_comment": "Error details included for debugging"
|
||||
},
|
||||
{
|
||||
"_comment": "Example log entry for a timed out API request",
|
||||
"level": "WARN",
|
||||
"timestamp": "2024-01-26T10:00:10.000Z",
|
||||
"message": "API request timed out",
|
||||
"correlation_id": "c3d4e5f6g7h8i9j0a1b2",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"url": "/api/slow-endpoint",
|
||||
"headers": {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": "Bearer <redacted>"
|
||||
}
|
||||
},
|
||||
"response": {
|
||||
"status_code": 408,
|
||||
"error_message": "Request Timeout",
|
||||
"response_time_ms": 30000
|
||||
},
|
||||
"user": {
|
||||
"user_id": "user789",
|
||||
"username": "timeoutuser"
|
||||
},
|
||||
"application": "my-app",
|
||||
"environment": "staging",
|
||||
"log_type": "api_request",
|
||||
"source": "api-request-logger",
|
||||
"timeout_ms": 30000,
|
||||
"_comment": "Included timeout value"
|
||||
},
|
||||
{
|
||||
"_comment": "Example log entry for an API request with missing authorization",
|
||||
"level": "WARN",
|
||||
"timestamp": "2024-01-26T10:00:15.000Z",
|
||||
"message": "API request missing authorization header",
|
||||
"correlation_id": "d4e5f6g7h8i9j0a1b2c3",
|
||||
"request": {
|
||||
"method": "POST",
|
||||
"url": "/api/sensitive-data",
|
||||
"headers": {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"body": "{ \"sensitive_info\": \"secret\" }"
|
||||
},
|
||||
"response": {
|
||||
"status_code": 401,
|
||||
"error_message": "Unauthorized",
|
||||
"response_time_ms": 50
|
||||
},
|
||||
"application": "my-app",
|
||||
"environment": "staging",
|
||||
"log_type": "api_request",
|
||||
"source": "api-request-logger",
|
||||
"security": {
|
||||
"missing_authorization": true
|
||||
},
|
||||
"_comment": "Flagging the missing authorization"
|
||||
}
|
||||
]
|
||||
68
skills/skill-adapter/assets/logging_config_template.json
Normal file
68
skills/skill-adapter/assets/logging_config_template.json
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"_comment": "Template for logging configuration. Customize this to fit your needs.",
|
||||
"version": 1,
|
||||
"disable_existing_loggers": false,
|
||||
"formatters": {
|
||||
"standard": {
|
||||
"_comment": "Standard log format with timestamp, level, and message.",
|
||||
"format": "%(asctime)s - %(levelname)s - %(name)s - %(correlation_id)s - %(message)s"
|
||||
},
|
||||
"json": {
|
||||
"_comment": "JSON log format for easier parsing by log aggregation tools.",
|
||||
"format": "{\"timestamp\": \"%(asctime)s\", \"level\": \"%(levelname)s\", \"name\": \"%(name)s\", \"correlation_id\": \"%(correlation_id)s\", \"message\": \"%(message)s\", \"module\": \"%(module)s\", \"funcName\": \"%(funcName)s\", \"lineno\": %(lineno)d}"
|
||||
}
|
||||
},
|
||||
"handlers": {
|
||||
"console": {
|
||||
"_comment": "Console handler for local development.",
|
||||
"class": "logging.StreamHandler",
|
||||
"level": "INFO",
|
||||
"formatter": "standard",
|
||||
"stream": "ext://sys.stdout"
|
||||
},
|
||||
"file": {
|
||||
"_comment": "File handler for persistent logging.",
|
||||
"class": "logging.handlers.RotatingFileHandler",
|
||||
"level": "DEBUG",
|
||||
"formatter": "standard",
|
||||
"filename": "/var/log/api_requests.log",
|
||||
"maxBytes": 10485760,
|
||||
"backupCount": 5,
|
||||
"encoding": "utf8"
|
||||
},
|
||||
"json_file": {
|
||||
"_comment": "JSON file handler for persistent logging in JSON format",
|
||||
"class": "logging.handlers.RotatingFileHandler",
|
||||
"level": "DEBUG",
|
||||
"formatter": "json",
|
||||
"filename": "/var/log/api_requests.json",
|
||||
"maxBytes": 10485760,
|
||||
"backupCount": 5,
|
||||
"encoding": "utf8"
|
||||
}
|
||||
},
|
||||
"loggers": {
|
||||
"api_request_logger": {
|
||||
"_comment": "Logger for API requests.",
|
||||
"level": "DEBUG",
|
||||
"handlers": ["console", "file", "json_file"],
|
||||
"propagate": false
|
||||
},
|
||||
"other_module": {
|
||||
"_comment": "Example of another module's logger.",
|
||||
"level": "WARNING",
|
||||
"handlers": ["console"],
|
||||
"propagate": true
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"_comment": "Root logger configuration.",
|
||||
"level": "WARNING",
|
||||
"handlers": ["console"]
|
||||
},
|
||||
"correlation_id": {
|
||||
"_comment": "Configuration for correlation ID generation.",
|
||||
"header_name": "X-Correlation-ID",
|
||||
"generator": "uuid"
|
||||
}
|
||||
}
|
||||
28
skills/skill-adapter/assets/skill-schema.json
Normal file
28
skills/skill-adapter/assets/skill-schema.json
Normal 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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
27
skills/skill-adapter/assets/test-data.json
Normal file
27
skills/skill-adapter/assets/test-data.json
Normal 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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user