go-api-development

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

INSTALLATION
npx skills add https://github.com/mindrally/skills --skill go-api-development
Run in your project or agent environment. Adjust flags if your CLI version differs.

SKILL.md

$27

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
BrowserAct

Let your agent run on any real-world website

Bypass CAPTCHA & anti-bot for free. Start local, scale to cloud.

Explore BrowserAct Skills →

Stop writing automation&scrapers

Install the CLI. Run your first Skill in 30 seconds. Scale when you're ready.

Start free
free · no credit card