new-package
Skill0 starsChanged 45 days agoMITView on GitHub
Add a package to the module following the 9-step package workflow
5 other projects use a version of this.
Adopted by
Most recently taken up by
- LedgerHQ/ledger-livetheir own version, first seen Nov 9, 2026
- jthorare/agentic-workflowtheir own version, first seen Oct 25, 2026
- joi-fairshare/agentic-workflowtheir own version, first seen Oct 13, 2026
- petarzarkov/dunxtheir own version, first seen Oct 9, 2026
- RemiMyrset/rootstheir own version, first seen Oct 2, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- LedgerHQ/ledger-live★ 628same name
- petarzarkov/dunx★ 93same name
- joi-fairshare/agentic-workflow★ 3same name
- jthorare/agentic-workflow★ 3same name
- RemiMyrset/roots★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Follow every step in order.
- Distinctive: line 19
Before writing any code:
- Distinctive: line 28
If it exists, report the finding and ask: skip / overwrite / modify.
- Very specific: line 52
Create internal/<pkg>/<pkg>.go (or cmd/<binary>/main.go) with the matching package clause.
- Very specific: line 59
Every exported identifier gets a doc comment starting with its own name (// New returns …).
- Very specific: line 108
If .agents/new-package.local.md exists, follow it now, before the gate.
- Distinctive: line 116
Every gate, zero findings, before committing.
- Very specific: line 146
Every returned error is checked in non-test code — errcheck is on, and _ = does not satisfy it.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- language/go/tasks/new-unit.md · v1.0.1 -->Adding a package
The exact procedure for adding or modifying a single package in this Go module. Follow every step in order; do not skip or reorder.
The package to add: $ARGUMENTS
Pre-flight
Before writing any code:
- Ask for confirmation. State which package you are about to add and what it will contain. Wait for explicit approval. Do not start on your own initiative.
- Check if the package already exists:
If it exists, report the finding and ask: skip / overwrite / modify. Never silently overwrite.ls internal/<pkg>/ 2>/dev/null && echo EXISTS || echo MISSING
Decide the location before scaffolding: internal/<pkg>/ for a private package,
cmd/<binary>/main.go for an executable, pkg/<pkg>/ only if it is genuinely
meant for import from outside this module.
9-step checklist (one package)
Complete all nine steps before committing. Never commit a partial package.
1. Scaffold the package
mkdir -p internal/<pkg> # use cmd/<binary> for an executable insteadPackage directory and name are short and all-lowercase (e.g. internal/store,
package store). A binary lives at cmd/<binary>/main.go with package main.
2. First file
Create internal/<pkg>/<pkg>.go (or cmd/<binary>/main.go) with the matching
package clause. There is no per-package manifest — Go discovers the package
from its directory.
3. Public API surface
- Export only what callers need; keep the rest unexported (lowercase).
- Every exported identifier gets a doc comment starting with its own name
(
// New returns …). - The package gets a
// Package <pkg> …comment, indoc.goor atop the primary file.
4. File split
Any file growing past ~150 LOC, or holding a distinct concern, moves to its own
lowercase .go file in the same package (e.g. repository.go, errors.go).
5. Unit tests
<file>_test.go beside the code, using table-driven subtests:
func TestDoThing(t *testing.T) {
cases := []struct {
name string
in int
want int
}{
{"doubles", 2, 4},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
if got := DoThing(tc.in); got != tc.want {
t.Errorf("DoThing(%d) = %d, want %d", tc.in, got, tc.want)
}
})
}
}6. Examples + black-box tests
Examplefunctions with an// Output:comment document and verify usage; they run undergo testand appear ingo doc.- For consumer-facing coverage, use
package <pkg>_testfiles that import the package as an outside caller would.
7. Dependencies & wiring
Cross-package use is a plain import:
import "<module-path>/internal/<other>", with the module path from go.mod.
New third-party dependencies are added with go get <module> and land in
go.mod/go.sum — run go mod tidy before committing.
8. Verification gate
If .agents/new-package.local.md exists, follow it now, before the gate. It
holds the steps this repository adds to this checklist; it is written by hand,
and agentcfg leaves it alone.
make ciEvery gate, zero findings, before committing. See Testing instructions for what it runs.
Two that catch people out on a new package specifically:
reviverequires a package comment as well as a doc comment on every exported identifier, so a package is red until it has one.goimportsgroups this module's own imports last. An import blockgofmtaccepts can still failmake fmt-check.
9. Commit, then hand the PR over
feat(<pkg>): add <pkg> packageOne package per PR. Never batch multiple packages. Commit and hand the PR over as Git flow and PR instructions say.
Before committing
Points that are easy to get wrong, so verify each one:
- A package comment (
// Package <pkg> …) on one file, and a doc comment starting with the identifier's own name on every exported identifier.reviveenforces both, so the package is red without them. - Imports of this module are grouped last by
goimports. An import block thatgofmtaccepts can still failmake fmt-check. - Every returned
erroris checked in non-test code —errcheckis on, and_ =does not satisfy it. Errors are wrapped with%was they propagate. - At least one test, table-driven with subtests where there are multiple cases.
make cipasses before you commit.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

