mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-01 06:33:27 +08:00
Add complete .cursor/ directory with rules, agents, skills, commands, and MCP config adapted for Cursor's format. This makes ecc-universal a truly cross-IDE package supporting Claude Code, Cursor, and OpenCode. - 27 rule files with YAML frontmatter (description, globs, alwaysApply) - 13 agent files with full model IDs and readonly flags - 30 skill directories (identical Agent Skills standard, no translation) - 31 command files (5 multi-* stubbed for missing codeagent-wrapper) - MCP config with Cursor env interpolation syntax - README.md and MIGRATION.md documentation - install.sh --target cursor flag for project-scoped installation - package.json updated with .cursor/ in files and cursor keywords
46 lines
962 B
Markdown
46 lines
962 B
Markdown
---
|
|
description: "Go patterns: functional options, small interfaces, dependency injection"
|
|
globs: ["**/*.go"]
|
|
alwaysApply: false
|
|
---
|
|
|
|
# Go Patterns
|
|
|
|
> This file extends [common/patterns.md](../common/patterns.md) with Go specific content.
|
|
|
|
## Functional Options
|
|
|
|
```go
|
|
type Option func(*Server)
|
|
|
|
func WithPort(port int) Option {
|
|
return func(s *Server) { s.port = port }
|
|
}
|
|
|
|
func NewServer(opts ...Option) *Server {
|
|
s := &Server{port: 8080}
|
|
for _, opt := range opts {
|
|
opt(s)
|
|
}
|
|
return s
|
|
}
|
|
```
|
|
|
|
## Small Interfaces
|
|
|
|
Define interfaces where they are used, not where they are implemented.
|
|
|
|
## Dependency Injection
|
|
|
|
Use constructor functions to inject dependencies:
|
|
|
|
```go
|
|
func NewUserService(repo UserRepository, logger Logger) *UserService {
|
|
return &UserService{repo: repo, logger: logger}
|
|
}
|
|
```
|
|
|
|
## Reference
|
|
|
|
See skill: `golang-patterns` for comprehensive Go patterns including concurrency, error handling, and package organization.
|