Skip to content
Agentmart
Submit a tool

goca-architecture

Skill by sazardev

IndexedMIT★ 304
Write a review

Chalk Labs

Need help deploying goca-architecture?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/sazardev-goca-architecture

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The publisher has not written a description yet.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions: not checked yet.

What's inside

Skill name
goca-architecture
Description
None
License
MIT
Instructions
157 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • missing YAML frontmatter
  • name: missing
  • description: missing

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Skill: Goca Architecture

**Domain:** Understanding the internal architecture of the Goca CLI code generator — how commands, templates, validators, and subsystems interact.

---

## How a Goca Command Works (End-to-End)

When a user runs `goca entity Product --fields "Name:string"`:

```
cobra.Command.Run()
    ↓
1. Flag parsing (cobra flags → local vars)
    ↓
2. ConfigIntegration.LoadConfigForProject() — reads .goca.yaml
   ConfigIntegration.MergeWithCLIFlags()    — CLI overrides config
    ↓
3. SafetyManager = NewSafetyManager(dryRun, force, backup)
    ↓
4. CommandValidator.ValidateEntityName(name) — rejects invalid names
   FieldValidator.ParseFields(fieldsStr)    — parses "Name:string,Price:float64"
    ↓
5. TemplateGenerator.BuildTemplateData()    — populates TemplateData struct
    ↓
6. TemplateGenerator.GenerateFromTemplate() — text/template rendering
    ↓
7. SafetyManager.WriteFile(path, content)   — writes with conflict checking
    ↓
8. DependencyManager.AddDependency()        — queues go.mod updates
   DependencyManager.RunGoGet()             — executes go get
    ↓
9. Print summary (files created, dry-run preview, etc.)
```

## Key Subsystem Details

### TemplateData Struct

The central data structure passed to all templates:

```go
type TemplateData struct {
    Entity   EntityData    // Name, NameLower, NamePlural, Package
    Fields   []FieldData   // Name, Type, JSONTag, GormTag, ValidateTag, flags
    Module   string        // go module path (e.g. "github.com/user/project")
    Database string        // "postgres", "mysql", "sqlite", etc.
    Features FeatureFlags  // Validation, BusinessRules, Timestamps, SoftDelete, etc.
    Imports  []string      // deduplicated import paths for the generated file
    Methods  []MethodData  // (for use case / handler templates)
}
```

All template variables MUST reference `TemplateData` fields — never hardcoded strings.

### SafetyManager Flow

```
WriteFile(path, content)
    → CheckFileConflict(path)
        → if file exists AND !Force → error
        → if file exists AND Backup → BackupFile(path)
        → if DryRun → record to createdFiles, return nil (no write)
    → os.MkdirAll(dir, 0755)
    → os.WriteFile(path, []byte(content), 0644)
    → append to createdFiles
```

### ConfigIntegration Priority

Config is resolved in this priority order (highest first):

1. CLI flags explicitly set by user (`--database postgres`)
2. `.goca.yaml` configuration file values
3. Built-in defaults (e.g., `database: sqlite`)

### FieldValidator Type Support

Supports all standard Go types plus complex ones:

- Basic: `string`, `int`, `int64`, `float64`, `bool`, `uint`, `byte`, `rune`
- Pointers: `*string`, `*User`
- Slices: `[]string`, `[]*User`, `[][]string`
- Arrays: `[10]string`
- Maps: `map[string]string`, `map[string]interface{}`
- Channels: `chan string`, `<-chan int`, `chan<- bool`
- Functions: `func()`, `func(string) error`
- Interfaces: `interface{}`, `io.Reader`
- Qualified: `time.Time`, `uuid.UUID`

Invalid map keys (not comparable): `map[[]string]int`, `map[func()]string`

## Database Backend Matrix

Goca supports 8 database backends. Repository templates vary by database:

| Database  | Driver Package                 | Connection Type | Generated Driver Import |
| --------- | ------------------------------ | --------------- | ----------------------- |
| postgres  | `gorm.io/driver/postgres`      | DSN string      | ✓                       |
| mysql     | `gorm.io/driver/mysql`         | DSN string      | ✓                       |
| sqlite    | `gorm.io/driver/sqlite`        | file path       | ✓                       |
| sqlserver | `gorm.io/driver/sqlserver`     | DSN string      | ✓                       |
| mongodb   | `go.mongodb.org/mongo-driver`  | URI + client    | ✓ (non-GORM)            |
| redis     | `github.com/redis/go-redis/v9` | options         | ✓ (non-GORM)            |
| cassandra | `github.com/gocql/gocql`       | cluster         | ✓ (non-GORM)            |
| dynamodb  | `github.com/aws/aws-sdk-go-v2` | config          | ✓ (non-GORM)            |

MongoDB, Redis, Cassandra, and DynamoDB use non-GORM templates — they have separate template functions.

## Handler Protocol Matrix

| Protocol | Template       | Generated File                       | Routes      |
| -------- | -------------- | ------------------------------------ | ----------- |
| `http`   | HTTP REST      | `handler/http/<entity>_handler.go`   | gorilla/mux |
| `grpc`   | gRPC service   | `handler/grpc/<entity>_handler.go`   | proto-based |
| `cli`    | CLI subcommand | `handler/cli/<entity>_handler.go`    | cobra       |
| `worker` | Background job | `handler/worker/<entity>_handler.go` | goroutine   |

## Template String Organization

From sazardev/goca, MIT.

Signals

Stars
304
Forks
11
Open issues
0
Last commit (this folder)
Mar 24, 2026 (7 months ago)
Last release
Jul 12, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from sazardev

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get goca-architecture running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying goca-architecture?

CallGet help
Cite this page

goca-architecture skill. Agent Mart. https://agentmart.dev/skills/sazardev-goca-architecture (last updated 2026-10-24)