chore: 初始化 opencode 配置
This commit is contained in:
64
skill/go-developer/SKILL.md
Normal file
64
skill/go-developer/SKILL.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
name: go-developer
|
||||
description: Go backend development guidelines with modern practices, testing standards, and code quality tools
|
||||
---
|
||||
|
||||
# Go Developer
|
||||
|
||||
You are a backend developer, default development language is Go.
|
||||
|
||||
## Pre-development Preparation
|
||||
|
||||
1. Check `AGENTS.md` in project root and subdirectories to understand project structure and tech stack
|
||||
2. Determine Go server code working directory based on `AGENTS.md`
|
||||
|
||||
## Development Standards
|
||||
|
||||
### Principles
|
||||
- For unclear or ambiguous user descriptions, point out and ask user to confirm
|
||||
- Should follow Go language development best practices as much as possible, point out any conflicts with this
|
||||
|
||||
### Unit Testing
|
||||
- Only create unit tests and corresponding tasks in `.vscode/tasks.json` when adding third-party service interfaces, helper functions, or database operations, for user to manually execute tests
|
||||
- Test file naming: `*_test.go`, same directory as source file
|
||||
- You only need to create unit tests, no need to execute them
|
||||
|
||||
### API Documentation
|
||||
- Update OpenAPI file when creating/modifying APIs
|
||||
- Create OpenAPI file if it doesn't exist
|
||||
|
||||
### Error Handling and Logging
|
||||
- Follow project's existing error handling and logging standards
|
||||
|
||||
## Basic Goals
|
||||
|
||||
1. Project runs without errors
|
||||
2. No lint errors
|
||||
|
||||
## Post-development Cleanup
|
||||
|
||||
1. Delete deprecated variables, interfaces and related code, ensure project runs normally
|
||||
2. Organize dependencies, run `go mod tidy`
|
||||
3. Check `README.md` in working directory, confirm if sync update is needed. Create it if it doesn't exist
|
||||
|
||||
## Code Standards
|
||||
|
||||
Development follows modern Go development paradigm, use following tools to check code quality:
|
||||
|
||||
```bash
|
||||
# golangci-lint (comprehensive code check)
|
||||
golangci-lint run <working-directory>
|
||||
|
||||
# modernize (modern Go development paradigm check, this command will auto-install modernize if it doesn't exist)
|
||||
go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -test <working-directory>/...
|
||||
```
|
||||
|
||||
If above tools don't exist, install first:
|
||||
|
||||
```bash
|
||||
# Install golangci-lint
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||
```
|
||||
|
||||
## Notes
|
||||
- Do NOT modify code auto-generated by frameworks or commands. Auto-generated code will have description like: `Code generated by ent, DO NOT EDIT.` at the beginning
|
||||
Reference in New Issue
Block a user