Creates a new Go project in the monorepo with all necessary files (main.go, README, AGENTS.md, etc.). Use when asked to create, add, or scaffold a new Go project, CLI tool, or library...
Automates the creation of new Go projects in the monorepo, ensuring consistency with established patterns and conventions.
Use this skill when the user requests:
This monorepo supports three types of Go projects:
Ask the user for:
Based on project type:
./{project-name}/./lib/{project-name}/./linters/{project-name}/IMPORTANT: This is a single-module monorepo. Projects do NOT have individual go.mod files - all projects share the root go.mod.
For CLI Tool:
{project-name}/
āāā main.go
āāā README.md
āāā AGENTS.md
āāā .gitignore
For Library:
lib/{project-name}/
āāā README.md
āāā {project-name}.go
For Linter:
linters/{project-name}/
āāā main.go
āāā README.md
āāā AGENTS.md
Use this minimal template:
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
fmt.Fprintf(os.Stderr, "Usage: {project-name} <command>\n")
os.Exit(1)
}
fmt.Printf("Hello from {project-name}!\n")
}
For projects that need a CLI framework, suggest using github.com/spf13/cobra and reference the aihook project as an example.
Template structure:
# {project-name}
{Brief description from user}
## Overview
{Expanded description of what the project does and why it exists}
## Features
- Feature 1
- Feature 2
- Feature 3
## Installation
### From Source
\`\`\`bash
go install github.com/neongreen/mono/{path-to-project}@latest
\`\`\`
### Local Development
\`\`\`bash
go build -o /tmp/{project-name} ./{project-name}
\`\`\`
## Usage
\`\`\`bash
{project-name} [options] <command>
\`\`\`
### Examples
\`\`\`bash
# Example 1
{project-name} example-command
# Example 2
{project-name} --flag value
\`\`\`
## Development
### Running Tests
\`\`\`bash
go test ./{project-name}/... -v
\`\`\`
### Building
\`\`\`bash
go build -o /tmp/{project-name} ./{project-name}
\`\`\`
## License
See the root LICENSE file in the repository.
For libraries, omit the "Installation" and "Usage" sections and instead include an "API" section with example code showing how to use the library.
Template:
# Agent Guidelines for {project-name}
## Project Overview
{Brief description of what the project does}
## Project Structure
\`\`\`
{project-name}/
āāā main.go # CLI entry point
āāā README.md # User documentation
āāā AGENTS.md # This file
\`\`\`
## Development Guidelines
### Building and Testing
Always run tests and build from the repository root:
\`\`\`bash
# Run tests
go test ./{project-name}/...
# Build
go build -o /tmp/{project-name} ./{project-name}
# Run
/tmp/{project-name} [args...]
\`\`\`
### Code Structure
- `main.go` - CLI entry point and main logic
- Keep it simple initially - add packages as complexity grows
## Dependencies
All dependencies are managed via the repository's root go.mod file.
Template:
# Binaries
{project-name}
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test artifacts
*.test
*.out
coverage.txt
# IDE files
.vscode/
.idea/
Run from the repository root to update the shared go.mod/go.sum:
go mod tidy
This updates the root go.mod and go.sum files with any new dependencies.
Build and test:
# Build
go build ./{path-to-project}
# Run (CLI tools only)
./{project-name} --help
# Test
go test ./{path-to-project}/...
This step is REQUIRED for the project to be properly integrated into the monorepo.
Add an entry to go-projects.toml:
[[project]]
dir = "{project-dir}" # e.g., "my-tool" or "lib/my-lib"
module = "{full-module-path}" # REQUIRED: Always use the full module path, e.g., "github.com/neongreen/mono/my-tool"
Important: Always use the full module path for the module field (e.g., github.com/neongreen/mono/my-tool). Some existing projects use short names (e.g., aihook, conf) for historical reasons, but new projects should always use the full path for consistency.
Examples:
dir = "my-tool", module = "github.com/neongreen/mono/my-tool"dir = "lib/my-lib", module = "github.com/neongreen/mono/lib/my-lib"dir = "linters/my-linter", module = "github.com/neongreen/mono/linters/my-linter"This file is used by various tools including the release workflow to detect Go projects.
See @DAGGER.md for complete Dagger setup instructions.
Summary:
dagger.json include list.dagger/project_{name}.godagger call project {project-name} buildOnly if the project should be published to Homebrew, add an entry to release-mirror.toml:
[[mirror.projects]]
name = "{project-name}"
desc = "{Brief description for Homebrew}"
homepage = "https://github.com/neongreen/mono/tree/main/{project-dir}"
binary = "{binary-name}"
test_args = ["--help"]
This is optional and only needed for projects that should have a Homebrew formula.
Run these commands to verify everything is set up correctly:
# Verify go.mod is valid
go mod tidy
# Verify the project appears in go-projects.toml
grep -A1 "{project-name}" go-projects.toml
For Dagger verification, see @DAGGER.md.
Use tk to create a task tracking this new project:
tk create "Add {project-name} project" --description "Created new Go {type} project: {brief description}"
After creating the project, provide a summary:
ā
Created new {type} project: {project-name}
Location: {full-path}
Files created:
- main.go (or {project-name}.go for libraries)
- README.md
- AGENTS.md (for CLI/linter)
- .gitignore (for CLI)
Integration files updated:
- go.mod (root - updated dependencies)
- go-projects.toml (added project entry)
- dagger.json (added to include list)
- .dagger/project_{name}.go (created Dagger build configuration)
- release-mirror.toml (if Homebrew release requested)
Next steps:
1. Implement the core functionality
2. Add tests
3. Update README.md with actual usage examples
4. Test the Dagger build: `dagger call project {project-name} build`
5. Consider adding:
- GitHub workflow (.github/workflows/{project-name}.yml) for project-specific CI
- More comprehensive documentation
- Integration tests
Suggest these dependencies based on project needs:
github.com/spf13/cobragithub.com/neongreen/mono/lib/versiongithub.com/neongreen/mono/lib/configschemagithub.com/neongreen/mono/lib/pathlanggithub.com/neongreen/mono/lib/ghclienttesting package (no external framework needed)Reference these as templates:
aihook, jj-run, printpdftk, conf, wantlib/pathlang, lib/setlang, lib/versionlinters/cobralint, linters/uselesswrapperlib/ for common functionalitySolution: Run go mod tidy from the repository root
Solution: Check if you're creating circular dependencies between packages
Solution: Delete go.sum and run go mod tidy again
Solution: Add the replace directive and require statement, then run go mod tidy