golang-type-safety

golang-type-safety is a skill for Cursor from codeready-toolchain/tarsy. It costs 38 tokens per session (812 once invoked), scanned A, original, Apache-2.0.

A Go coding guideline for representing fixed choices with named types and typed constants instead of raw strings or numbers. It also covers converting those values to strings only when sending data out of the program.

In plain words
What is it for?
Use it when writing or reviewing Go function signatures, struct fields, switch statements, and enum-like values such as statuses or stages.
Why use it?
It helps the compiler catch invalid values and makes function parameters and data fields clearer. This reduces mistakes caused by typos or arbitrary strings.

Skill for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing or reviewing Go function signatures, struct fields, switch statements, and enum-like values such as statuses or stages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/codeready-toolchain/tarsy/golang-type-safety
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add codeready-toolchain/tarsy --skill golang-type-safety
Clone the repo
git clone --depth 1 https://github.com/codeready-toolchain/tarsy

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for golang-type-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/codeready-toolchain/tarsy/golang-type-safety/github.svg)](https://agentmods.dev/skills/codeready-toolchain/tarsy/golang-type-safety)
Your own site
<a href="https://agentmods.dev/skills/codeready-toolchain/tarsy/golang-type-safety"><img src="https://agentmods.dev/badge/skills/codeready-toolchain/tarsy/golang-type-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for golang-type-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/codeready-toolchain/tarsy/golang-type-safety"><img src="https://agentmods.dev/badge/skills/codeready-toolchain/tarsy/golang-type-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 812 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.00812
Opus 5 $0.00019 $0.00406
Sonnet 5 $0.00008 $0.00162
Haiku 4.5 $0.00004 $0.00081

Measured 11d ago against content hash 115bd6e1649d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

golang-type-safety scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/skills/golang-type-safety/SKILL.md · 116 lines

How it starts

The opening of the file, as written. The whole thing — 116 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Go Type Safety

Use typed constants and named types instead of magic strings and numbers. This catches misuse at compile time and makes intent explicit.

Named String Types for Enums

When a value comes from a defined set (e.g. ent-generated enums, config enums), use the named type:

// Bad — magic string, no compile-time checking
publishStageStatus(ctx, pub, sid, stgID, name, idx, "investigation", status)

// Good — typed constant, typos caught at compile time
publishStageStatus(ctx, pub, sid, stgID, name, idx, stage.StageTypeInvestigation, status)

Function Signatures

Accept the named type, not string, when the parameter is always one of a known set:

// Bad — caller can pass any string
func publishStageStatus(ctx context.Context, ..., stageType string, status string)

// Good — compiler enforces valid stage types
func publishStageStatus(ctx context.Context, ..., stageType stage.StageType, status string)

Convert to string at serialization boundaries (JSON payloads, DB queries, log messages):

payload.StageType = string(stageType)

Warning: Direct Casting Does Not Validate

stage.StageType(s) compiles but does not check whether s is a known value. Always use a parse helper at API/deserialize boundaries where the input is untrusted:

// Bad — silently accepts unknown values
stageType := stage.StageType(req.StageType)

// Good — rejects unknown values at the boundary
stageType, err := parseStageType(req.StageType)
if err != nil {
    return nil, err
}

parseStageType Helper

Define this once near the package entry point (e.g., handler or service layer):

// parseStageType converts a raw string from an API payload or query parameter
// into a stage.StageType, returning an error for unknown values.
//
// Allowed values: stage.StageTypeInvestigation, stage.StageTypeSynthesis,
// stage.StageTypeChat, stage.StageTypeExecSummary, stage.StageTypeScoring.
func parseStageType(s string) (stage.StageType, error) {
    switch stage.StageType(s) {
    case stage.StageTypeInvestigation,
        stage.StageTypeSynthesis,
        stage.StageTypeChat,
        stage.StageTypeExecSummary,
        stage.StageTypeScoring:
        return stage.StageType(s), nil
    default:
        return "", fmt.Errorf("unknown stage type %q", s)
    }
}

Read the full file on GitHub · 116 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 116 lines · 38 tokens per session scan A 115bd6e1649d

Subscribe to this mod's changes

golang-type-safety is a skill published in the GitHub repository codeready-toolchain/tarsy (10 stars, last pushed yesterday), licensed Apache-2.0. It adds 38 tokens to every session and 812 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.