Agent Skills

go-api-development

Go API development guidelines using the standard library (1.22+) with best practices for RESTful API design, error handling, and security

Install

npx skills add https://github.com/mindrally/skills --skill go-api-development
SKILL.md

Go API Development with Standard Library

Core Principles

  • Always use the latest stable version of Go (1.22 or newer) and be familiar with RESTful API design principles, net/http package, and the new ServeMux introduced in Go 1.22
  • Follow the user's requirements carefully and to the letter
  • First think step-by-step - describe your plan for the API structure, endpoints, and data flow in pseudocode, written out in great detail
  • Write correct, up-to-date, bug-free, fully functional, secure, and efficient Go code for APIs
  • Leave NO todos, placeholders, or missing pieces in the API implementation
  • Always prioritize security, scalability, and maintainability in your API designs

API Development Guidelines

Routing and HTTP Handling

  • Use the new http.ServeMux introduced in Go 1.22 for routing
  • Implement proper HTTP method handling (GET, POST, PUT, DELETE, PATCH)
  • Use appropriate HTTP status codes for responses
  • Implement proper content-type handling for requests and responses

Error Handling

  • Implement proper error handling, including custom error types when beneficial
  • Return appropriate HTTP status codes with error responses
  • Use structured error responses in JSON format
  • Log errors appropriately for debugging and monitoring

Input Validation

  • Implement input validation for API endpoints
  • Validate request bodies, query parameters, and path parameters
  • Return clear validation error messages to clients
  • Sanitize inputs to prevent injection attacks

JSON Handling

  • Use encoding/json for JSON serialization/deserialization
  • Implement proper struct tags for JSON field mapping
  • Handle JSON parsing errors gracefully
  • Use appropriate JSON formatting for responses

Concurrency

  • Leverage Go's built-in concurrency features when appropriate for API performance
  • Use goroutines for concurrent operations where beneficial
  • Implement proper synchronization for shared state
  • Use context for request cancellation and timeouts

Middleware

  • Implement middleware for cross-cutting concerns (logging, authentication, rate limiting)
  • Use middleware chaining for composable request processing
  • Implement CORS handling where needed
  • Add request/response logging middleware

Security

  • Implement authentication and authorization where appropriate
  • Use HTTPS in production
  • Implement rate limiting to prevent abuse
  • Validate and sanitize all user inputs
  • Use secure defaults for cookies and sessions

Logging

  • Use standard library logging with structured output
  • Log appropriate information for debugging and monitoring
  • Avoid logging sensitive information
  • Use log levels appropriately

Testing

  • Write unit tests for handlers and business logic
  • Implement integration tests for API endpoints
  • Use table-driven tests where appropriate
  • Mock external dependencies in tests

Related skills

entra-app-registrationmicrosoft606KGuides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.azure-messagingmicrosoft595KTroubleshoot and resolve issues with Azure Messaging SDKs for Event Hubs and Service Bus. Covers connection failures, authentication errors, message processing issues, and SDK configuration problems. WHEN: event hub SDK error, service bus SDK issue, messaging connection failure, AMQP error, event processor host issue, message lock lost, message lock expired, lock renewal, lock renewal batch, send timeout, receiver disconnected, SDK troubleshooting, azure messaging SDK, event hub consumer, servicentra-agent-idmicrosoft328KProvision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmi_path, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmi_path token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registsupabasesupabase298KUse when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, declarative schemas, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector); deb

Search skills and MCP servers

Fuzzy search across 23,137 skills and servers