用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill scaffold-go-library命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | scaffold-go-library |
| description | >- Use when this capability is needed. |
Generate the full boilerplate for a new Go library project.
If the user provided a project name in their request, use it as the project name and skip asking for it. Still ask for the remaining parameters (description, minimum Go version, example tests) unless already provided in the user's initial request.
Ask the user for these parameters:
stipple)1.24)example_test.go with a basic Example() functionIf the user already provided some or all of these in their initial request, do not re-ask. Derive what you can from context.
Detect the user's GitHub username and full name for use in templates:
# GitHub username (for module paths, URLs)
gh api user -q .login
# Full name (for LICENSE copyright)
git config user.name
If either command fails or produces no output, ask the user to provide the value. Use the GitHub username wherever templates reference GITHUB-USERNAME and the full name wherever they reference COPYRIGHT-HOLDER.
The project should be scaffolded in a directory named after the project. If the current directory is already named after the project and is empty (or nearly empty), use it. Otherwise, create a subdirectory.
Derive PACKAGE-NAME from PROJECT-NAME by removing hyphens (e.g., my-lib becomes mylib). If the result looks awkward, confirm with the user.
If the directory already contains Go files, warn the user before proceeding.
Skip if already inside a git repository.
git init
Read ./references/go-mod.md for the canonical go mod init invocation.
go mod init github.com/GITHUB-USERNAME/PROJECT-NAME
No dependencies to install -- Go libraries should start stdlib-only.
Read ./references/package-file.md for the package-file template and create PACKAGE-NAME.go from it.
PACKAGE-NAME with the derived package nameThis file contains the package declaration and a Version constant. No doc comment here -- that lives in doc.go.
Read ./references/doc-go.md for the doc.go template and create doc.go from it.
PACKAGE-NAME with the derived package namePROJECT-DESCRIPTION with the short descriptionGITHUB-USERNAME with the detected GitHub usernamePROJECT-NAME with the project nameThis is the canonical location for the package-level doc comment.
If the user requested example tests, create example_test.go with a basic Example() function. This file is not generated from a reference template -- write it contextually based on the package name and description. The file should:
package PACKAGE-NAME_test (external test package)func Example() with a basic usage demonstration// Output: commentRead ./references/makefile.md for the Makefile template and create Makefile from it.
PROJECT-NAME with the project nameRead ./references/gitignore.md for the .gitignore template and create .gitignore from it.
No replacements needed.
If a .gitignore already exists, merge the template entries into it rather than overwriting.
Read ./references/goreleaser.md for the GoReleaser template and create .goreleaser.yml from it.
PROJECT-NAME with the project namePROJECT-DESCRIPTION with the short descriptionGITHUB-USERNAME with the detected GitHub usernameRead ./references/golangci.md for the golangci-lint template and create .golangci.yml from it.
GITHUB-USERNAME with the detected GitHub usernamePROJECT-NAME with the project nameRead ./references/editorconfig.md for the .editorconfig template and create .editorconfig from it.
No replacements needed.
Read ./references/ci-workflow.md for the CI workflow template and create .github/workflows/ci.yml from it.
MINIMUM-GO-VERSION with the minimum Go version (from step 1)Read ./references/release-workflow.md for the release workflow template and create .github/workflows/release.yml from it.
No replacements needed.
Read ./references/license.md for the LICENSE template and create LICENSE from it.
YEAR with the current year (run date +%Y to get it)COPYRIGHT-HOLDER with the detected full nameRead ./references/readme.md for the README template and create README.md from it.
PROJECT-NAME with the project name (kebab-case)PROJECT-TITLE with the project name in title casePROJECT-DESCRIPTION with the short descriptionGITHUB-USERNAME with the detected GitHub usernamePACKAGE-NAME with the derived package nameCreate CHANGELOG.md with the initial changelog template:
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
No replacements needed. The release skill will populate version sections and comparison links on the first release.
Create stub directories for the standard library layout:
# plans directory
mkdir -p docs/plans/todo docs/plans/done
touch docs/plans/todo/.gitkeep docs/plans/done/.gitkeep
Libraries keep tests alongside source files, so no tests/ directory. No internal/ directory -- add it when needed.
go mod tidy
Run a quick build to confirm everything compiles:
go build ./...
If the build fails, diagnose and fix the issue before continuing.
Stage all generated files and create the initial commit:
git add -A
git commit -S -m "feat: scaffold Go library project"
If .github/copilot-instructions.md exists (created by the scaffold-new-repo skill when running in the bootstrap flow, or already present in an existing repo), append the following entries to the PR review section. Before appending each entry, check whether the bold key text already exists in the file; skip entries that are already present.
To locate the PR review section: look for an existing heading whose text includes "PR Review" or "Code Review" (e.g., ## PR Review, ## Code Review, ## PR Review Checklist (CRITICAL)). If no matching heading exists, append a new ## PR Review section at the end of the file and place the entries there.
formatters: as a top-level key and supports golangci-lint fmt as a subcommand. These are correct v2 features. Do not suggest reverting to v1 config format.cboone/gh-actions reusable workflows manage tool versions internally: The CI and release workflows use cboone/gh-actions reusable workflows that handle tool installation, version pinning, caching, and SHA-256 verification internally. Do not suggest replacing reusable workflow calls with inlined third-party actions.If .github/copilot-instructions.md does not exist, skip this step.
Print a summary of what was created:
make help to see available Makefile targetsgit tag v0.1.0 && git push --tags to trigger GoReleaserPACKAGE-NAME_test.go)make coverage to generate an HTML coverage reportgo mod init fails, check that Go is installed and on the PATHgit init fails, continue generating files but warn the user./references/go-mod.md -- go mod init setup./references/package-file.md -- top-level package source file./references/doc-go.md -- doc.go package doc comment./references/makefile.md -- Makefile template./references/gitignore.md -- .gitignore template./references/goreleaser.md -- .goreleaser.yml template./references/golangci.md -- .golangci.yml template./references/editorconfig.md -- .editorconfig template./references/ci-workflow.md -- .github/workflows/ci.yml./references/release-workflow.md -- .github/workflows/release.yml./references/license.md -- MIT license template./references/readme.md -- README templatecboone/gh-actions SHAs before scaffoldingThe cboone/gh-actions reusable-workflow refs in this skill's templates are SHA-pinned with a # vX.Y.Z comment that was current when the template was authored. New releases of cboone/gh-actions rot those SHAs. Before emitting a workflow into a user's repo, refresh both the SHA and the comment to current latest:
TAG="$(gh release view --repo cboone/gh-actions --json tagName --jq '.tagName')"
SHA="$(gh api "repos/cboone/gh-actions/commits/${TAG}" --jq '.sha')"
echo "${SHA} # ${TAG}"
Replace each cboone/gh-actions/.../<workflow>.yml@<old-sha> # <old-tag> in the emitted workflow with the new SHA and tag. Dependabot in the user's repo keeps them in sync afterwards.
Source: cboone/agent-harness-plugins — distributed by TomeVault.
基于 SOC 职业分类