gosourcemapper-guide

AI Assistant Guide: Go (Gin) & React Project

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "gosourcemapper-guide" with this command: npx skills add chinmay-sawant/gosourcemap/chinmay-sawant-gosourcemap-gosourcemapper-guide

AI Assistant Guide: Go (Gin) & React Project

This document serves as a guideline for GitHub Copilot, Antigravity, and other AI coding assistants to ensure consistency, maintainability, and adherence to best practices within this codebase.

  1. Tech Stack Overview
  • Backend: Go (Golang) with Gin Web Framework.

  • Frontend: React (Vite).

  • Documentation: Markdown/Starlight (if applicable).

  1. Backend (Go + Gin) Best Practices

Project Structure (Standard Go Layout)

We follow the standard project layout:

├── cmd/ │ └── server/ │ └── main.go # Entry point. Initializes the app. ├── internal/ # Private application code (not importable by other projects). │ ├── config/ # Configuration loading (e.g., env vars). │ ├── handlers/ # HTTP handlers (controllers). │ ├── models/ # Domain models and data structures. │ ├── repository/ # Database access layer. │ ├── middleware/ # Gin middleware (logging, auth, CORS). │ ├── router/ # Route definitions. │ └── service/ # Business logic. ├── pkg/ # Library code ok to use by external applications (if any). ├── docs/ # Swagger/OpenAPI docs. └── go.mod

coding Guidelines

  • Dependency Injection: Avoid global state. Inject services into handlers, and repositories into services.

  • Example: Define a Handler struct that holds references to Service interfaces.

  • Error Handling:

  • Use custom error types to distinguish between client errors (4xx) and server errors (5xx).

  • Return errors up the stack; handle them centrally in the HTTP handler or a middleware.

  • Check all errors.

  • Gin Specifics:

  • Use gin.Context only in the Handler layer. Do not pass it down to services.

  • specific route groups (e.g., v1 := router.Group("/v1") ).

  • Use Struct Tags for binding and validation (e.g., binding:"required" ).

  • Configuration: Use a strong configuration pattern (e.g., loading from environment variables into a struct).

  • Concurrency: Use Goroutines and Channels responsibly. Always handle context cancellation (ctx.Done() ).

Naming Conventions

  • Interfaces: simple descriptors (e.g., Service , Repository ) or er suffix (e.g., Reader , Writer ).

  • files: snake_case.go

  • Variables: camelCase.

  • Exported: PascalCase.

  1. Frontend (React + Vite) Best Practices
  • Component Structure: Functional components with Hooks.

  • State Management: Use useState / useReducer for local state; Context API or external libraries (Zustand/Redux) for global state if complex.

  • Styling: Modular CSS or Tailwind (if configured). Avoid inline styles.

  • Performance: Use useMemo and useCallback judiciously to prevent unnecessary re-renders.

  1. Documentation
  • Keep docs/ and documentation/ updated.

  • Inline comments should explain why, not what.

  • Exported functions must have Godoc comments.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Xiaohongshu Crawler

爬取小红书内容,支持登录搜索、笔记详情获取、用户主页信息及热门笔记,无需登录部分功能可用。

Registry SourceRecently Updated
General

TAPD

当用户需要查询、修改 TAPD 项目中需求、缺陷、任务等信息时,如修改状态、添加评论等,通过调用 TAPD MCP 提供相应的服务。当用户要求时,通过 send_qiwei_message 发送消息到企业微信。

Registry SourceRecently Updated
General

Roast Generator

吐槽生成器。温和吐槽、毒舌模式、朋友互怼、名人吐槽、自嘲、Battle模式。Roast generator with gentle, savage modes. 吐槽、毒舌、搞笑。

Registry SourceRecently Updated
General

Unixtime

Quick Unix timestamp utility. Get current Unix time, convert timestamps to dates and back, show relative time (how long ago), and display time in different f...

Registry SourceRecently Updated