一键导入
rsh-simplify
Analyze the Restish codebase for simplification and refactoring opportunities, then implement approved changes
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze the Restish codebase for simplification and refactoring opportunities, then implement approved changes
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Write and maintain Restish documentation, blog posts, release announcements, tutorials, recipes, and user-facing product explanations.
Shape Restish product direction, feature strategy, and CLI/developer-tool UX. Use when planning, prioritizing, designing, or reviewing a Restish feature before or during implementation; when evaluating whether a request fits Restish; when turning user feedback into a feature proposal; when checking CLI UX, help, errors, output, docs, tests, compatibility, or release readiness.
Run Restish release readiness QA from main using recent commits, built-in historical risk patterns, docs, and full release gates; report reproducible issues without patching product code
Review Restish code changes for bugs, regressions, missing tests, and repo-specific risks
Write or improve Restish tests with concise, high-density Go coverage, especially CLI behavior tests using OpenAPI specs, mock HTTP servers, real CLI commands, and expected output
| name | rsh-simplify |
| description | Analyze the Restish codebase for simplification and refactoring opportunities, then implement approved changes |
Identify and eliminate unnecessary complexity in the Restish codebase. Fewer lines, fewer files, fewer abstraction layers — as long as required features are intact and the user experience is unchanged or better.
User experience comes first. Developer experience comes second. Simplifications that improve both are highest value. Simplifications that improve only developer experience at some user cost are not acceptable.
Follow the "PR Review and Cleanup Discipline" section in AGENTS.md. When shrinking a PR after review loops, target duplicated test setup, repeated assertions, over-large inline fixtures, and helper code that obscures the behavior under test. Prefer deleting ceremony over deleting coverage, and avoid code golf: a shorter diff that is harder to audit, especially around security/auth/cache behavior, is not a simplification.
Unless the user has pointed at a specific file, package, or area, survey the whole codebase:
find . -name '*.go' | grep -v '_test.go' | grep -v 'vendor/' | sort
Read the key files in internal/cli/, the other internal/ packages, plugin/, and cmd/. Look specifically for:
TODO: remove comments, disabled or no-op code pathsreturn otherFunc(args) with no transformation, extra layers added "for future extensibility" that have never been extendedUse grep and structural reading — don't just skim. Pattern:
# Find unexported functions that might be dead
grep -rn 'func [a-z]' internal/ --include='*.go' | grep -v '_test.go'
# Find single-method interfaces
grep -A2 'type.*interface' internal/ -rn --include='*.go'
Before making any changes, produce a prioritized findings list. Group by category. For each finding:
Use this structure:
## Simplification Opportunities
### High Value
[findings that delete the most code or remove entire files/packages]
### Medium Value
[findings that flatten structure or remove indirection without deleting much]
### Low Value / Polish
[small consolidations or minor clarity improvements]
---
Estimated total: ~N lines removed, M files merged/deleted
End the report by asking the user which items to proceed with, or whether to proceed with all of them.
Only proceed after the user approves (all items, a subset, or a modified scope). Then:
go test ./...
go build ./cmd/restish
go build ./cmd/restish-bulk ./cmd/restish-csv ./cmd/restish-mcp
After all changes, produce a brief summary:
These patterns are common sources of unnecessary complexity in Go codebases. Treat each as a strong simplification signal:
An interface with one implementation that is never injected, mocked in tests, or documented as an extension point is almost always removable. Replace with the concrete type directly. Exception: the CLI struct boundary in internal/cli/ where plugin and test substitution is real.
A package that contains one .go file (excluding tests) and fewer than ~150 lines is usually a candidate for inlining into its parent. Exception: packages that are imported by external callers (the public plugin/ API).
Functions of the form:
func wrapThing(x X) Y {
return someOtherPackage.Thing(x)
}
with no added behavior can be deleted; callers can call the wrapped function directly.
errors.New / sentinel errors that are never checkedIf an error value is created but no caller ever does errors.Is(err, ErrFoo), it is just a string. Replace with fmt.Errorf at the call site and delete the sentinel.
If a struct field is always its zero value in every instantiation across the codebase, the field is dead. Remove it and simplify the struct.
If an exported function or type is only called within its own package, unexport it. This reduces the public API surface and often triggers further simplification.
Three or more identical sequences of error-check + return scattered through the same file are usually a sign that a small helper or a restructured control flow would be cleaner.
If a function has four or more levels of indentation, it is usually doing too much. Extract sub-steps, return early, or flatten with switch. Prefer early-return (guard clauses) over deeply nested if/else trees.
If the only reason a production interface exists is to allow mocking in tests, prefer httptest.Server, fake implementations, or table-driven integration tests that use the real type.
internal/cli/ packageThis is the largest package. Before merging files here, check whether the split reflects distinct responsibilities or is just historical. Files like http.go, api.go, generated.go, and request_exec.go may have overlapping concerns worth consolidating.
plugin/ vs internal/plugin/The top-level plugin/ package is the public contract for external plugin authors; internal/plugin/ is the host-side implementation. Trace what each package actually exports and whether any wrapping between them is load-bearing before collapsing it.
docs/design/ alignmentWhen removing or collapsing a subsystem, check whether a design doc describes it. If so, update or retire the design doc. Stale design docs are a form of complexity.
restish and plugin subprocesses is a public contract. Internal reshuffling that does not change the wire format is fine.plugin/ or cmd/ packages without confirming with the user that a breaking change is acceptable.