Help us improve
Share bugs, ideas, or general feedback.
From golang
Go 模板开发规范:text/template 与 html/template 最佳实践、XSS 安全防护、模板预编译缓存优化、自定义 FuncMap、Go 1.22+ embed 嵌入集成、常见错误模式。适用于模板渲染、HTML 生成、代码生成场景。
npx claudepluginhub lazygophers/ccplugin --plugin golangHow this skill is triggered — by the user, by Claude, or both
Slash command
/golang:gtpl-skillssonnetThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- **dev** - 开发专家(主要使用者)
templ templating: syntax, components, attributes, styling, and JavaScript integration. Invoke when task involves any interaction with templ — writing .templ files, creating components, composing templates, testing rendered output, or understanding templ syntax.
Go development standards covering naming conventions, error handling, concurrency patterns, testing practices, and performance optimization for high-quality Go codebases.
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
Share bugs, ideas, or general feedback.
| 场景 | Skill | 说明 |
|---|---|---|
| 核心规范 | Skills(golang:core) | 核心规范:强制约定 |
| 错误处理 | Skills(golang:error) | 模板渲染错误处理 |
| 工具库 | Skills(golang:libs) | stringx 用于模板函数 |
| 文档 | 内容 | 适用场景 |
|---|---|---|
| SKILL.md | 核心原则、优先级速览 | 快速入门 |
| template-design-security.md | 模板选择、结构设计、安全防护 | 模板设计和安全 |
| functions-performance-patterns.md | 自定义函数、性能优化、常见错误 | 函数开发和优化 |
html/templatehtml/template 防止 XSSsync.Once 或 init()//go:embed 嵌入模板文件text/template 生成 HTMLimport "embed"
//go:embed templates/*.html
var templateFS embed.FS
var tmpl = template.Must(
template.ParseFS(templateFS, "templates/*.html"),
)
| AI 可能的理性化解释 | 实际应该检查的内容 | 严重程度 |
|---|---|---|
| "text/template 更灵活" | 生成 HTML 是否用 html/template? | 高 |
| "每次请求解析模板" | 模板是否预编译并缓存? | 高 |
| "模板里算逻辑方便" | 复杂逻辑是否在 Go 代码中处理? | 中 |
| "用户输入直接渲染" | 是否验证并转义了用户输入? | 高 |
| "嵌入文件太大" | embed 是否只嵌入必要的模板? | 低 |
| "忽略渲染错误" | 模板错误是否被正确处理? | 高 |
参见 template-design-security.md 了解模板选择指南、结构设计和安全规范。
参见 functions-performance-patterns.md 了解自定义函数、性能优化和最佳实践检查清单。