How copilot-extensions/skillset-example works
Project type and purpose
• This is a lightweight backend service (written in Go) that implements a GitHub Copilot “Skillset” extension.
• Its sole purpose is to expose three HTTP endpoints that generate random test data by proxying requests to public APIs (whatthecommit.com, loripsum.net, randomuser.me).
• It is not a full‐stack app—there is no frontend component—nor a compiler or monolith. It’s effectively a microservice/API gateway for GitHub Copilot.
File structure
• Top‐level files:
• main.go – application entrypoint, HTTP server setup
• go.mod – dependency manifest
• CODE_OF_CONDUCT.md, LICENSE.txt, SECURITY.md, SUPPORT.md – docs and policy
• handlers/ directory: each file defines one endpoint’s logic:
• handlers/commit_message.go → GET /random-commit-message
• handlers/loripsum.go → GET /random-lorem-ipsum
• handlers/user.go → GET /random-user
• No frontend or data persistence layers—just HTTP routing and outbound API calls.
README for architecture insights
• Conceptual model: “Skillsets” vs “Agents”
• This uses the Skillset approach—straight API endpoints, no custom AI orchestration in your code.
• Deployment hints: run locally on port 8080, expose via ngrok, configure GitHub App skillset URLs.
a. Main components to represent:
• GitHub Copilot Chat subsystem (client)
• GitHub Copilot Skillset Extension (your Go service)
– HTTP server (main.go + router)
– Three handler modules
• External APIs:
– whatthecommit.com
– loripsum.net
– randomuser.me
• ngrok (tunneling layer)
b. Relationships and interactions:
1. Copilot Chat issues an HTTP call to your service’s ngrok URL + endpoint path.
2. ngrok forwards the request to your local Go server.
3. HTTP router in main.go dispatches to the appropriate handler (commit, lorem, user).
4. Handler makes an outbound HTTP request to the respective external API.
5. External API returns data → handler formats → router returns JSON/plain text back to Copilot.
6. Copilot displays the result in the user’s chat window.
c. Architectural patterns and design principles:
• Microservice / API-gateway style: each handler is a single‐responsibility module.
• HTTP routing abstraction: main.go registers routes to handler functions.
• Dependency isolation: no global state, handlers only perform stateless proxy calls.
• 12-factor app principles: environment-driven configuration, no local persistence.
d. Relevant technologies and frameworks:
• Go (net/http) for server
• Go modules (go.mod)
• Public APIs (whatthecommit.com, loripsum.net, randomuser.me)
• ngrok for exposing localhost
• GitHub Apps & Copilot Skillsets configuration
Details to capture
• Explicitly label environment variable dependency (the FQDN/ngrok URL).
• Stateless nature of each handler.
• That Copilot handles all AI/prompt logic; your service simply proxies calls.