file-structure-guidelines

Enforce domain-based Go directories and a 200-line-per-file limit.

1|Updated Jul 16, 2025
One-click install
npx skills add https://github.com/linskybing/platform-go --skill file-structure-guidelines
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-structure-guidelines
Source: https://github.com/linskybing/platform-go/tree/main/.github/skills/file-structure-guidelines
Command: npx skills add https://github.com/linskybing/platform-go --skill file-structure-guidelines

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill reduces the risk of monolithic codebases by promoting modular, domain-based directory structures and enforcing a 200-line-per-file guideline.

Core Features & Use Cases

  • Domain-based organization: Split code into coherent packages (e.g., api, service, repository, domain) to simplify navigation and testing.
  • File-size discipline: Maintain small, focused files (roughly 200 lines) to improve readability and PR review efficiency.
  • Refactoring guidance: Provide migration strategies, templates, and naming conventions to safely reorganize existing code without breaking builds.

Quick Start

Identify large files by responsibility, create per-domain folders, move related code into new files under 200 lines, update imports, and run tests.

Frequently Asked Questions about file-structure-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a monolithic Go file into a modular domain-based directory structure?

To refactor a monolithic Go file, identify responsibilities, create per-domain folders such as api, service, repository, and domain, move related code into focused files under 200 lines, update imports, and run tests to prevent breaking builds.

What is the recommended file size limit for organizing Go code into modular packages?

The recommended file size limit for organizing Go code is roughly 200 lines per file. Maintaining small, focused files improves code readability, simplifies navigation, and increases PR review efficiency within domain-based packages.

Does this modular code structure approach work with existing Go projects during feature development?

Yes, this modular code structure approach works with existing Go projects during feature development and architectural planning. It provides migration templates and documented directory conventions to safely reorganize existing code without breaking builds.

What's the best way to split a large Go codebase into api, service, repository, and domain packages?

The best way to split a large Go codebase is adopting domain-based organization. Split code into coherent packages like api, service, repository, and domain to simplify navigation and testing while enforcing a 200-line-per-file guideline.

Can I safely reorganize internal Go packages without breaking builds?

You can safely reorganize internal Go packages by following established migration strategies, naming conventions, and templates. Move related code into new files, update imports, and run tests to ensure builds remain unbroken during refactoring.

Why does my Go project need domain-based directories for code organization?

Your Go project needs domain-based directories to prevent monolithic codebases. Organizing code into coherent packages like api, service, repository, and domain simplifies navigation, enhances testability, and maintains file-size discipline.