用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill implement-uutils-command命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | implement-uutils-command |
| description | > Use when this capability is needed. |
Port a command from uutils/coreutils — a Rust implementation of GNU coreutils — into this Go codebase with full parity: every flag, every behavior, no shortcuts.
Run the upstream-diff skill to identify missing commands and missing flags. Many missing commands are standard Unix utilities that have canonical behavior defined by uutils. Ask the user which command they want to implement. If they already told you, skip the asking and proceed.
UUTILS=$(mktemp -d)/uutils
git clone --depth 1 https://github.com/uutils/coreutils.git "$UUTILS"
The uutils repo structure is:
src/uu/<command>/src/<command>.rs — the main command implementationsrc/uu/<command>/src/*.rs — additional module files for complex commandstests/by-name/<command>/ — test files (useful for understanding expected behavior)Read the entire Rust source for the command. Do not skim. Pay special attention to:
uu_app() function — this defines all flags via clap. It is the authoritative list
of supported flags, their short/long forms, aliases, default values, and descriptions.uumain() — the entry point that parses args and dispatches to the core logicAlso check tests/by-name/<command>/ for the test suite. These tests reveal expected behaviors
that may not be obvious from the implementation alone.
Before writing code, list out:
-?)Present this plan to the user for confirmation. This is a checkpoint — the user should agree
the scope is correct before you start coding. Some GNU flags may not make sense in a sandbox
context (e.g., --preserve for filesystem metadata that doesn't exist in a virtual FS) — flag
these for discussion.
Read the bundled reference files in this skill's references/ directory — they contain
everything you need without having to search the codebase:
references/helpers.md — all available helper functions (filesystem, IO, text, errors)references/test-template.md — test helpers and boilerplatereferences/fuzz-template.md — fuzz test structure, oracle selection, Makefile integrationCreate commands/<name>.go following these patterns:
package commands
import (
"context"
// other imports as needed
)
type <Name> struct{}
func New<Name>() *<Name> { return &<Name>{} }
func (c *<Name>) Name() string { return "<name>" }
func (c *<Name>) Run(ctx context.Context, inv *Invocation) error {
// 1. Parse flags manually from inv.Args (no external flag library)
// 2. Read inputs using readNamedInputs() or readAllFile()/readAllStdin()
// 3. Process data
// 4. Write output to inv.Stdout
return nil
}
var _ Command = (*<Name>)(nil)
Key conventions:
exitf(inv, code, format, args...) for error messages to stderrallowPath(), openRead(), readAllFile(), readNamedInputs() for filesystem access
(see references/helpers.md for the full list — don't reimplement these)inv.Stdin when no file arguments are given (if the command is a filter).
For multi-file commands, use readNamedInputs(ctx, inv, names, true) which handles
stdin fallback and - as stdin automatically.-f value and -fvalue (attached) and --flag=value
forms. See existing commands like cut.go or wc.go for examples.Full parity means full parity. Implement every flag from the uu_app() clap definition.
Do not skip flags because they seem obscure or rarely used. Do not leave TODO comments for
"later". If the uutils version supports --zero, --complement, or --output-delimiter,
your Go version supports them too. Compare your implementation against the Rust source
function by function to make sure nothing was missed.
Sandbox considerations: Some uutils flags interact with real OS features that don't exist in the virtual filesystem (e.g., file ownership, ACLs, device files). For these:
Add New<Name>() to DefaultRegistry() in commands/registry.go. Place it in the
appropriate category group, keeping alphabetical order within the group.
See references/test-template.md for the full template and helpers. Add integration tests
in the appropriate runtime/*_commands_test.go file.
Cover:
tests/by-name/<command>/, port the
interesting ones to verify your implementation matches GNU behaviorThe test coverage should be thorough enough that you could delete the Rust source and reconstruct the command's behavior entirely from the tests.
This is mandatory — the sandbox is a security boundary. See references/fuzz-template.md
for the complete template, helper list, and oracle selection guide.
Add fuzz coverage in runtime/fuzz_command_targets_test.go (or extend an existing fuzz
function if the command fits an existing category — the template lists all existing categories).
Key points:
newFuzzRuntime, newFuzzSession, runFuzzSessionScriptf.Add()assertSecureFuzzOutcome as the oracle — this is the correct default for all new
commands. It allows non-zero exits but catches crashes, host path leaks, and sensitive
disclosure. Do NOT use assertBaseFuzzOutcome or assertSuccessfulFuzzExecution unless
you have a specific reason.go build ./...
go test ./...
make fuzz FUZZTIME=10s
make lint
Fix any failures before presenting the result to the user. All four commands must pass clean.
uu_app() clap definition is the source of truth
for flags. The uumain() function and helpers contain the behavioral logic. Read both.tests/by-name/<command>/ often reveals edge cases and expected
behaviors that aren't obvious from the implementation.Source: ewhauser/gbash — distributed by TomeVault.