Learn how to write clear, engaging, and comprehensive documentation for Go-Go-Golems libraries and tools
Welcome to the documentation guidelines for Go-Go-Golems libraries and tools! Great documentation isn't just about being technically accurate - it's about creating an engaging, enjoyable learning experience for developers. We believe that documentation should be both comprehensive and a pleasure to read, helping developers not just understand our libraries, but feel excited about using them.
This guide will walk you through our principles and practices for creating documentation that connects with readers while maintaining technical precision. Whether you're documenting a new feature or updating existing docs, these guidelines will help you create content that resonates with developers and makes their journey easier.
Every document starts with YAML frontmatter that helps organize and categorize our content. Think of it as the metadata that helps developers find exactly what they need:
---
Title: Clear, Descriptive Title
Slug: url-friendly-identifier
Short: One-line description of the topic
Topics:
- relevant
- topic
- tags
Commands:
- RelatedCommands
Flags:
- relevant-flags
IsTopLevel: true/false
ShowPerDefault: true/false
SectionType: GeneralTopic
---
Overview Begin with a warm welcome that sets the stage for what readers will learn. Start with the essential details:
For example:
import "github.com/go-go-golems/package/subpackage"
Remember, this is your chance to get developers excited about what they're about to learn!
Table of Contents
Core Concepts
Detailed Component Documentation
Examples
Error Handling
Make your code examples tell a story too! Include narrative comments that explain the thinking behind the code:
import (
"github.com/go-go-golems/package/subpackage"
"github.com/go-go-golems/glazed/pkg/cmds"
)
func ExampleUsage() {
// First, we create a new component with sensible defaults
component, err := subpackage.NewComponent()
if err != nil {
// Always handle errors gracefully - your future self will thank you!
return
}
// Now for the interesting part - let's transform some data
result := component.DoSomething()
// The result gives us exactly what we need for the next step
// in our processing pipeline
}
type Configuration struct {
// Name is the identifier for this configuration
Name string `yaml:"name" json:"name"`
// unexported but important for understanding
internal bool
}
// Processor handles data transformation
type Processor interface {
// Process transforms input data according to configuration
Process(ctx context.Context, data []byte) ([]byte, error)
}
Example:
github.com/go-go-golems/clay/pkg/sqlsql.Configurationgithub.com/go-go-golems/glazed/pkg/cmdsname: example-config
settings:
timeout: 30s
retries: 3
config := &Config{
Name: "example-config",
Settings: Settings{
Timeout: 30 * time.Second,
Retries: 3,
},
}
Completeness
Clarity
Maintainability
Accessibility
Here's a template that showcases our engaging documentation style:
---
Title: Working with Widgets - A Developer's Guide
Slug: widget-guide
Short: Master the art of widget manipulation in your applications
---
## Welcome to the World of Widgets!
Ever wondered how to make your application's widgets dance? The `github.com/organization/widgets`
package is your backstage pass to creating dynamic, responsive widget experiences. Let's dive
into what makes this package special and how you can harness its power in your applications.
## Getting Started
First things first - let's bring widgets into your project:
```go
import "github.com/organization/widgets"
At the heart of our widget world lies the Widget type. Think of it as your Swiss Army knife
for UI manipulation - it's flexible, powerful, and surprisingly easy to use:
type Widget struct {
// These fields are your control panel for widget behavior
Name string
Properties map[string]interface{}
}
Let's create something magical together. Here's how you can bring a widget to life:
widget := widgets.NewWidget("my-first-widget")
// Now we have a widget ready to amaze users!
We've learned a few things on our widget journey. Here are some golden rules that will help you create exceptional widget experiences:
Even the best widget wizards run into challenges sometimes. Here's how to handle common situations with grace and style...
## Conclusion
Remember, great documentation is your chance to have a conversation with developers who use our libraries. By combining technical precision with engaging, human-friendly writing, we create documentation that not only informs but inspires. Let's make learning about Go-Go-Golems libraries an enjoyable journey for everyone!