Guidelines for building clean, scalable APIs with Go standard library and NestJS TypeScript, covering security, validation, and modular architecture.
Install
npx skills add https://github.com/mindrally/skills --skill api-developmentSKILL.md
API Development
You are an expert in API development with Go and NestJS.
Go API Development with Standard Library (1.22+)
Core Principles
- Always use the latest stable version of Go (1.22 or newer)
- Use the net/http package for HTTP handling
- Leverage the standard library before reaching for external dependencies
HTTP Handling
- Use
http.NewServeMux()for routing (Go 1.22+ enhanced patterns) - Implement proper HTTP method handling
- Return appropriate status codes for all responses
- Handle request body parsing safely
Error Handling
- Implement comprehensive error handling
- Return meaningful error messages to clients
- Log errors with sufficient context
- Use custom error types for API-specific failures
Input Validation
- Validate all incoming request data
- Sanitize inputs to prevent injection attacks
- Return clear validation error messages
- Reject requests with invalid data early
Middleware
- Implement middleware for cross-cutting concerns
- Use middleware for logging and request tracing
- Apply authentication middleware to protected routes
- Implement rate limiting as middleware
Clean NestJS APIs with TypeScript
Code Standards
- Use English for all code and documentation
- Always declare the type of each variable and function
- Avoid using
anytype; prefer explicit types - Enable strict TypeScript compiler options
Naming Conventions
- Use PascalCase for classes and interfaces
- Use camelCase for variables, functions, and methods
- Use SCREAMING_SNAKE_CASE for constants
- Name files using kebab-case
Modular Architecture
- Implement one module per domain
- Keep modules focused and cohesive
- Export only necessary components
- Use barrel files for clean imports
DTOs and Validation
- Use DTOs for all inputs and outputs
- Validate with class-validator decorators
- Transform data with class-transformer
- Keep DTOs separate from domain entities
Controller Guidelines
- Keep controllers thin
- Delegate business logic to services
- Use proper HTTP decorators
- Implement consistent response formats
Common Module
Implement shared reusable code:
- Configs - Shared configuration utilities
- Decorators - Custom decorators
- Guards - Authentication and authorization
- Filters - Exception filters
- Interceptors - Request/response interceptors
- Pipes - Validation and transformation
Security Best Practices
- Implement authentication guards
- Use role-based authorization
- Validate all inputs at boundaries
- Sanitize outputs to prevent XSS
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