core-principles

Apply Go development principles for maintainable, testable codebases.

1|Updated Dec 2, 2023
One-click install
npx skills add https://github.com/tinywasm/devflow --skill core-principles-tinywasm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core-principles
Source: https://github.com/tinywasm/devflow/tree/main/skills/core-principles
Command: npx skills add https://github.com/tinywasm/devflow --skill core-principles-tinywasm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go teams often struggle with tangled dependencies, bloated main packages, and inconsistent project structure. This Skill provides a principled blueprint to enforce SRP, DI, framework-less development, and strict file organization across Go projects.

Core Features & Use Cases

  • Single Responsibility Principle (SRP): Each file (CSS, Go, JS) must have a single, well-defined purpose, with naming reflecting its role.
  • Mandatory Dependency Injection (DI): No global state; interfaces for external dependencies; main.go minimal; promotes testable library code and easy DI.
  • Framework-less Development: Use the standard library for Web development; avoid external frameworks or libraries.
  • CSS-First Interactivity: UI interactivity implemented with CSS whenever possible; JavaScript only as a last resort.
  • Strict File Structure: Flat project structure; max 500 lines per file; test organization guidance (move tests to tests/ if needed).

Quick Start

Integrate these principles into your current Go project by auditing modules for SRP, DI interfaces, and minimal main packages.

Frequently Asked Questions about core-principles

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

FAQPage Schema
How do I structure a Go project to use clean architecture and dependency injection?

Structure a Go project using clean architecture by enforcing Dependency Injection through interfaces for external dependencies, keeping main.go thin, and avoiding global state to improve code testability. Maintain a flat project structure with strict file organization.

What is the best way to build a Go web application without external frameworks?

The best way to build a framework-less Go web application is using the standard library directly. This approach minimizes external dependencies, ensures predictable structure across large codebases, and leverages native Go capabilities for web development.

How does the Single Responsibility Principle apply to Go file structure?

The Single Responsibility Principle (SRP) in Go requires each file to have a single, well-defined purpose with naming reflecting its role. Strict file organization mandates a maximum of 500 lines per file to ensure maintainability.

Can I use JavaScript for UI interactivity in a framework-less Go application?

In a framework-less Go application, you should implement UI interactivity using CSS-first whenever possible. JavaScript should only be used as a last resort to maintain minimal dependencies and predictable structure.

When should I move Go tests to a dedicated tests directory?

You should move Go tests to a dedicated tests/ directory when strict file organization and test management guidance require it. This helps maintain the 500-line file limit and keeps the flat project structure predictable.

Why does my Go codebase have tangled dependencies and bloated main packages?

Go codebases get tangled dependencies and bloated main packages when lacking strict architectural principles. Applying SRP, mandatory Dependency Injection, and keeping main.go minimal resolves these issues for better maintainability.