Initial commit
This commit is contained in:
9
skills/skill-adapter/assets/README.md
Normal file
9
skills/skill-adapter/assets/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for grpc-service-generator skill
|
||||
|
||||
- [ ] templates/service.proto.template: A Jinja2 template for generating .proto files with customizable service and message definitions.
|
||||
- [ ] examples/unary_rpc.proto: Example .proto file demonstrating a simple unary RPC.
|
||||
- [ ] examples/streaming_rpc.proto: Example .proto file demonstrating a server-side streaming RPC.
|
||||
- [ ] examples/client_streaming_rpc.proto: Example .proto file demonstrating a client-side streaming RPC.
|
||||
- [ ] examples/bidirectional_streaming_rpc.proto: Example .proto file demonstrating a bidirectional streaming RPC.
|
||||
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": []
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package examples;
|
||||
|
||||
option go_package = "examples";
|
||||
|
||||
// The greeting service definition.
|
||||
service BidirectionalGreeter {
|
||||
// A bidirectional streaming RPC.
|
||||
//
|
||||
// Accepts a stream of GreetingRequests and returns a stream of GreetingResponses.
|
||||
BidirectionalGreeting (stream GreetingRequest) returns (stream GreetingResponse);
|
||||
}
|
||||
|
||||
// The request message containing the user's name.
|
||||
message GreetingRequest {
|
||||
string name = 1;
|
||||
// Add additional request fields here. Consider adding metadata or context.
|
||||
string request_id = 2; // Example: a unique request identifier
|
||||
}
|
||||
|
||||
// The response message containing the greetings.
|
||||
message GreetingResponse {
|
||||
string message = 1;
|
||||
// Add additional response fields here. Consider adding status information.
|
||||
string server_timestamp = 2; // Example: timestamp of the server when the response was generated
|
||||
}
|
||||
|
||||
// Example usage comments:
|
||||
//
|
||||
// - The BidirectionalGreeting RPC allows the client and server to exchange multiple messages
|
||||
// in a single connection. This is useful for real-time communication or data streaming.
|
||||
//
|
||||
// - The GreetingRequest can include metadata, such as a request ID, to track individual requests
|
||||
// within the stream.
|
||||
//
|
||||
// - The GreetingResponse can include information about the server's processing, such as a timestamp.
|
||||
//
|
||||
// - Consider adding error handling and retry mechanisms to your gRPC client to handle potential
|
||||
// network issues.
|
||||
//
|
||||
// - Implement appropriate logging and monitoring to track the performance of your gRPC service.
|
||||
//
|
||||
// - For production environments, enable TLS for secure communication between the client and server.
|
||||
//
|
||||
// - Implement interceptors for logging, authentication, and other cross-cutting concerns.
|
||||
@@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package example;
|
||||
|
||||
option go_package = "example.com/grpc-service-generator/examples";
|
||||
|
||||
// The service definition.
|
||||
service StreamingService {
|
||||
// Sends a greeting
|
||||
rpc ClientStreamingExample (stream ClientStreamingRequest) returns (ClientStreamingResponse) {}
|
||||
}
|
||||
|
||||
// The request message containing the user's name.
|
||||
message ClientStreamingRequest {
|
||||
string message = 1; // The message from the client. Can represent chunks of data.
|
||||
}
|
||||
|
||||
// The response message containing the greetings
|
||||
message ClientStreamingResponse {
|
||||
string result = 1; // The aggregated result based on the client's stream.
|
||||
}
|
||||
|
||||
// Instructions:
|
||||
// 1. Define your request and response messages
|
||||
// 2. Define the RPC service, using the stream keyword for streaming RPCs
|
||||
// 3. Implement the server and client code
|
||||
// 4. Remember to handle errors and closing the stream gracefully.
|
||||
38
skills/skill-adapter/assets/examples/streaming_rpc.proto
Normal file
38
skills/skill-adapter/assets/examples/streaming_rpc.proto
Normal file
@@ -0,0 +1,38 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package example;
|
||||
|
||||
option go_package = "example.com/grpc-service-generator/examples";
|
||||
|
||||
// Define the service
|
||||
service StreamingService {
|
||||
// Server-side streaming RPC. The client sends a single request, and the
|
||||
// server responds with a stream of messages.
|
||||
rpc ServerStreamingExample (StreamingRequest) returns (stream StreamingResponse) {}
|
||||
}
|
||||
|
||||
// The request message for the ServerStreamingExample RPC.
|
||||
message StreamingRequest {
|
||||
string request_id = 1; // A unique identifier for the request.
|
||||
int32 num_responses = 2; // The number of responses the server should send.
|
||||
string message_prefix = 3; // A prefix to add to each response message.
|
||||
}
|
||||
|
||||
// The response message for the ServerStreamingExample RPC.
|
||||
message StreamingResponse {
|
||||
string response_id = 1; // A unique identifier for the response.
|
||||
string message = 2; // The message content.
|
||||
}
|
||||
|
||||
// Example usage notes:
|
||||
//
|
||||
// - The `request_id` field in `StreamingRequest` can be used for logging and
|
||||
// correlation.
|
||||
// - The `num_responses` field allows the client to control the number of
|
||||
// messages received. Consider adding a maximum limit to prevent resource exhaustion.
|
||||
// - The `message_prefix` field demonstrates how to parameterize the server's
|
||||
// response. This could be used to customize the response based on user preferences.
|
||||
// - The `response_id` field in `StreamingResponse` allows for identifying individual messages in the stream.
|
||||
// - Consider adding error handling to the server implementation to gracefully
|
||||
// handle situations where the client disconnects prematurely.
|
||||
// - For production, consider adding authentication and authorization to the service.
|
||||
28
skills/skill-adapter/assets/examples/unary_rpc.proto
Normal file
28
skills/skill-adapter/assets/examples/unary_rpc.proto
Normal file
@@ -0,0 +1,28 @@
|
||||
// examples/unary_rpc.proto
|
||||
//
|
||||
// This file defines a simple gRPC service with a unary RPC.
|
||||
//
|
||||
// To compile this .proto file:
|
||||
// protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative examples/unary_rpc.proto
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package example;
|
||||
|
||||
option go_package = "github.com/example/grpc-service-generator/example"; // Replace with your actual Go package
|
||||
|
||||
// The greeting service definition.
|
||||
service Greeter {
|
||||
// Sends a greeting
|
||||
rpc SayHello (HelloRequest) returns (HelloReply) {}
|
||||
}
|
||||
|
||||
// The request message containing the user's name.
|
||||
message HelloRequest {
|
||||
string name = 1;
|
||||
}
|
||||
|
||||
// The response message containing the greetings
|
||||
message HelloReply {
|
||||
string message = 1;
|
||||
}
|
||||
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)"
|
||||
}
|
||||
}
|
||||
}
|
||||
56
skills/skill-adapter/assets/templates/service.proto.template
Normal file
56
skills/skill-adapter/assets/templates/service.proto.template
Normal file
@@ -0,0 +1,56 @@
|
||||
// templates/service.proto.template
|
||||
// This is a Jinja2 template for generating .proto files.
|
||||
// Use this template to define your gRPC service and messages.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package {{ package_name }}; // Replace with your package name
|
||||
|
||||
// Option to specify the go package. Replace with your desired path.
|
||||
option go_package = "{{ go_package_path }}";
|
||||
|
||||
// Define your service here. Replace "YourService" with your service name.
|
||||
// Consider adding authentication and authorization interceptors.
|
||||
service {{ service_name }} {
|
||||
// Unary RPC example: A simple request-response.
|
||||
rpc {{ unary_method_name }} ({{ unary_request_type }}) returns ({{ unary_response_type }});
|
||||
|
||||
// Server-side streaming RPC example: The server sends a stream of responses
|
||||
// after receiving the request. Useful for pushing updates.
|
||||
rpc {{ server_streaming_method_name }} ({{ streaming_request_type }}) returns (stream {{ streaming_response_type }});
|
||||
|
||||
// Client-side streaming RPC example: The client sends a stream of requests
|
||||
// to the server, which responds with a single response. Useful for batch processing.
|
||||
rpc {{ client_streaming_method_name }} (stream {{ streaming_request_type }}) returns ({{ streaming_response_type }});
|
||||
|
||||
// Bidirectional streaming RPC example: Both the client and the server send
|
||||
// a stream of messages using a read-write stream. Useful for real-time communication.
|
||||
rpc {{ bidirectional_streaming_method_name }} (stream {{ streaming_request_type }}) returns (stream {{ streaming_response_type }});
|
||||
}
|
||||
|
||||
// Define your message types here. Make sure the fields are well-defined and documented.
|
||||
// Consider using well-known types from google/protobuf/timestamp.proto for timestamps.
|
||||
|
||||
// Example request message for unary RPC
|
||||
message {{ unary_request_type }} {
|
||||
string id = 1; // A unique identifier. Consider adding validation.
|
||||
string name = 2; // A name. Consider adding validation (e.g., max length).
|
||||
}
|
||||
|
||||
// Example response message for unary RPC
|
||||
message {{ unary_response_type }} {
|
||||
string message = 1; // A confirmation message.
|
||||
int32 status_code = 2; // HTTP-like status code for finer-grained error handling.
|
||||
}
|
||||
|
||||
// Example request message for streaming RPC
|
||||
message {{ streaming_request_type }} {
|
||||
string data = 1; // Data to be processed. Consider adding rate limiting on the server.
|
||||
int64 timestamp = 2; // Timestamp of the data.
|
||||
}
|
||||
|
||||
// Example response message for streaming RPC
|
||||
message {{ streaming_response_type }} {
|
||||
string result = 1; // Result of the processing.
|
||||
bool success = 2; // Indicate if the processing was successful.
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
8
skills/skill-adapter/references/README.md
Normal file
8
skills/skill-adapter/references/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# References
|
||||
|
||||
Bundled resources for grpc-service-generator skill
|
||||
|
||||
- [ ] grpc_best_practices.md: A document outlining gRPC best practices for service design, error handling, and security.
|
||||
- [ ] protobuf_style_guide.md: A document detailing the Protocol Buffer style guide for writing clean and maintainable .proto files.
|
||||
- [ ] grpc_error_handling.md: A document explaining different gRPC error handling strategies.
|
||||
- [ ] grpc_interceptors.md: A document explaining how to use gRPC interceptors for authentication, logging, and monitoring.
|
||||
69
skills/skill-adapter/references/best-practices.md
Normal file
69
skills/skill-adapter/references/best-practices.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Skill Best Practices
|
||||
|
||||
Guidelines for optimal skill usage and development.
|
||||
|
||||
## For Users
|
||||
|
||||
### Activation Best Practices
|
||||
|
||||
1. **Use Clear Trigger Phrases**
|
||||
- Match phrases from skill description
|
||||
- Be specific about intent
|
||||
- Provide necessary context
|
||||
|
||||
2. **Provide Sufficient Context**
|
||||
- Include relevant file paths
|
||||
- Specify scope of analysis
|
||||
- Mention any constraints
|
||||
|
||||
3. **Understand Tool Permissions**
|
||||
- Check allowed-tools in frontmatter
|
||||
- Know what the skill can/cannot do
|
||||
- Request appropriate actions
|
||||
|
||||
### Workflow Optimization
|
||||
|
||||
- Start with simple requests
|
||||
- Build up to complex workflows
|
||||
- Verify each step before proceeding
|
||||
- Use skill consistently for related tasks
|
||||
|
||||
## For Developers
|
||||
|
||||
### Skill Development Guidelines
|
||||
|
||||
1. **Clear Descriptions**
|
||||
- Include explicit trigger phrases
|
||||
- Document all capabilities
|
||||
- Specify limitations
|
||||
|
||||
2. **Proper Tool Permissions**
|
||||
- Use minimal necessary tools
|
||||
- Document security implications
|
||||
- Test with restricted tools
|
||||
|
||||
3. **Comprehensive Documentation**
|
||||
- Provide usage examples
|
||||
- Document common pitfalls
|
||||
- Include troubleshooting guide
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Keep version updated
|
||||
- Test after tool updates
|
||||
- Monitor user feedback
|
||||
- Iterate on descriptions
|
||||
|
||||
## Performance Tips
|
||||
|
||||
- Scope skills to specific domains
|
||||
- Avoid overlapping trigger phrases
|
||||
- Keep descriptions under 1024 chars
|
||||
- Test activation reliability
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- Never include secrets in skill files
|
||||
- Validate all inputs
|
||||
- Use read-only tools when possible
|
||||
- Document security requirements
|
||||
70
skills/skill-adapter/references/examples.md
Normal file
70
skills/skill-adapter/references/examples.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Skill Usage Examples
|
||||
|
||||
This document provides practical examples of how to use this skill effectively.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Example 1: Simple Activation
|
||||
|
||||
**User Request:**
|
||||
```
|
||||
[Describe trigger phrase here]
|
||||
```
|
||||
|
||||
**Skill Response:**
|
||||
1. Analyzes the request
|
||||
2. Performs the required action
|
||||
3. Returns results
|
||||
|
||||
### Example 2: Complex Workflow
|
||||
|
||||
**User Request:**
|
||||
```
|
||||
[Describe complex scenario]
|
||||
```
|
||||
|
||||
**Workflow:**
|
||||
1. Step 1: Initial analysis
|
||||
2. Step 2: Data processing
|
||||
3. Step 3: Result generation
|
||||
4. Step 4: Validation
|
||||
|
||||
## Advanced Patterns
|
||||
|
||||
### Pattern 1: Chaining Operations
|
||||
|
||||
Combine this skill with other tools:
|
||||
```
|
||||
Step 1: Use this skill for [purpose]
|
||||
Step 2: Chain with [other tool]
|
||||
Step 3: Finalize with [action]
|
||||
```
|
||||
|
||||
### Pattern 2: Error Handling
|
||||
|
||||
If issues occur:
|
||||
- Check trigger phrase matches
|
||||
- Verify context is available
|
||||
- Review allowed-tools permissions
|
||||
|
||||
## Tips & Best Practices
|
||||
|
||||
- ✅ Be specific with trigger phrases
|
||||
- ✅ Provide necessary context
|
||||
- ✅ Check tool permissions match needs
|
||||
- ❌ Avoid vague requests
|
||||
- ❌ Don't mix unrelated tasks
|
||||
|
||||
## Common Issues
|
||||
|
||||
**Issue:** Skill doesn't activate
|
||||
**Solution:** Use exact trigger phrases from description
|
||||
|
||||
**Issue:** Unexpected results
|
||||
**Solution:** Check input format and context
|
||||
|
||||
## See Also
|
||||
|
||||
- Main SKILL.md for full documentation
|
||||
- scripts/ for automation helpers
|
||||
- assets/ for configuration examples
|
||||
8
skills/skill-adapter/scripts/README.md
Normal file
8
skills/skill-adapter/scripts/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for grpc-service-generator skill
|
||||
|
||||
- [ ] generate_proto.sh: Generates a basic .proto file with example service and message definitions.
|
||||
- [ ] compile_proto.sh: Compiles the .proto file into gRPC stubs for different languages (Python, Go, Java).
|
||||
- [ ] run_grpc_server.py: A basic Python gRPC server implementation for testing the generated stubs.
|
||||
- [ ] test_grpc_client.py: A basic Python gRPC client implementation for testing the gRPC server.
|
||||
42
skills/skill-adapter/scripts/helper-template.sh
Executable file
42
skills/skill-adapter/scripts/helper-template.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Helper script template for skill automation
|
||||
# Customize this for your skill's specific needs
|
||||
|
||||
set -e
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: $0 [options]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -v, --verbose Enable verbose output"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
VERBOSE=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Your skill logic here
|
||||
if [ "$VERBOSE" = true ]; then
|
||||
echo "Running skill automation..."
|
||||
fi
|
||||
|
||||
echo "✅ Complete"
|
||||
32
skills/skill-adapter/scripts/validation.sh
Executable file
32
skills/skill-adapter/scripts/validation.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Skill validation helper
|
||||
# Validates skill activation and functionality
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Validating skill..."
|
||||
|
||||
# Check if SKILL.md exists
|
||||
if [ ! -f "../SKILL.md" ]; then
|
||||
echo "❌ Error: SKILL.md not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate frontmatter
|
||||
if ! grep -q "^---$" "../SKILL.md"; then
|
||||
echo "❌ Error: No frontmatter found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check required fields
|
||||
if ! grep -q "^name:" "../SKILL.md"; then
|
||||
echo "❌ Error: Missing 'name' field"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -q "^description:" "../SKILL.md"; then
|
||||
echo "❌ Error: Missing 'description' field"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Skill validation passed"
|
||||
Reference in New Issue
Block a user