audit-command
Audit an existing CLI command for correctness against established patterns.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Audit an existing CLI command for correctness against established patterns.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | audit-command |
| description | Audit an existing CLI command for correctness against established patterns. |
| argument-hint | [resource] [command] |
| user-invocable | true |
Invoke this skill when the user:
Arguments may be provided via $ARGUMENTS or gathered interactively.
Expected arguments:
resource - Resource name (e.g., collection, study, workspace)command - Command name (e.g., list, get, create, update). Omit to review all commands under the resource.If arguments are missing, use the ask_user tool to gather them.
Work through each section below. For each item, check the relevant source files in
cmd/{resource}/ and ui/{resource}/. Report findings at the end grouped by severity:
What to check: Every list command must register the output flags via shared.AddOutputFlags.
Expected pattern in cmd/{resource}/list.go (or equivalent list file):
// Options struct must embed OutputOptions
type ListOptions struct {
Output shared.OutputOptions
// ... other fields
}
// At the bottom of the constructor, after all other flags:
shared.AddOutputFlags(cmd, &opts.Output)
How to verify:
shared.OutputOptions is present in the options structshared.AddOutputFlags(cmd, &opts.Output) is called in the constructorshared.ResolveFormat(opts.Output) drives the rendering switch (see §3)Why it matters: Without this, users cannot use --json, --csv, --table, or -n flags,
which breaks scripting and pipeline use cases.
What to check: Command constructors must use dependency injection — never construct a real client or writer internally.
Expected constructor signatures:
// Command with a hardcoded Use string
func New{Action}Command(client client.API, w io.Writer) *cobra.Command
// Command where the caller supplies the Use string
func New{Action}Command(commandName string, client client.API, w io.Writer) *cobra.Command
Check which pattern the other commands in the same package use and be consistent.
What to flag:
*client.Client instead of client.APIos.Stdout inside a command file (should always use the injected w)PROLIFIC_TOKEN directlyWhat to check: List commands must use shared.ResolveFormat to select the renderer,
and must support all four output modes.
Expected switch in RunE:
format := shared.ResolveFormat(opts.Output)
switch format {
case "json":
r := ui.JSONRenderer[model.{Resource}]{}
if err := r.Render(results, w); err != nil {
return fmt.Errorf("error: %s", err)
}
case "csv":
r := ui.CsvRenderer[model.{Resource}]{}
if err := r.Render(results, fields, w); err != nil {
return fmt.Errorf("error: %s", err)
}
case "table":
r := ui.TableRenderer[model.{Resource}]{}
if err := r.Render(results, fields, w); err != nil {
return fmt.Errorf("error: %s", err)
}
default:
r := &InteractiveRenderer{}
if err := r.Render(client, results, w); err != nil {
return fmt.Errorf("error: %s", err)
}
}
What to flag:
tabwriter output instead of going through a rendererjson or csv cases in the switchnonInteractive bool instead of shared.OutputOptionsInteractiveRenderer called unconditionally (no format check)Reference: cmd/study/list.go, cmd/collection/list.go
What to check: Every command must have Short, Long, and Example populated.
| Field | Requirement |
|---|---|
Short | One sentence, imperative, no trailing period |
Long | Paragraph describing what the command does and when to use it |
Example | At least one $ prolific ... invocation per major flag combination |
For list commands, examples must cover:
--table / -t--csv / -c--json / -j--workspace, --status)For view commands, examples must cover:
--web / -W flag (if implemented)For create/update commands, examples must cover:
--template / -tWhat to flag:
Long or Example fields<id> without explaining what it is--non-interactive instead of --table)What to check: Errors returned from RunE must be prefixed consistently.
Expected pattern:
if err != nil {
return fmt.Errorf("error: %s", err)
}
What to flag:
return err without a prefix (loses context at the cobra level)fmt.Errorf("error: %s", err.Error()) — .Error() call is redundant with %s"failed: ", "could not: ")What to check: If a stable web URL exists for the resource, view commands should
support --web / -W to open it in the browser.
Expected pattern:
flags.BoolVarP(&opts.Web, "web", "W", false, "Open the resource in the web application")
And inside RunE, checked before any API call:
if opts.Web {
return browser.OpenURL({resourceui}.Get{Resource}URL(opts.Args[0]))
}
Uses github.com/pkg/browser. If a URL helper doesn't exist yet, note it as a missing
piece but do not block the review on it.
After completing all checks, produce a summary:
## Review: prolific {resource} {command}
### 🔴 Must Fix
- [Check Type] [issue description] (`cmd/{resource}/{file}.go:{line}`)
### 🟡 Should Fix
- [Check Type] [issue description]
### 🟢 OK
- [Check Type], [Check Type], ...
Example
- 🔴 [Error Formatting]: Inconsistent error prefixes in `publishCollection` helper — `"failed to get collection: %s"`, `"failed to read template file: %s"`, etc. — all must use `"error: %s"`
If there are no issues, say so clearly: "All checks passed — no issues found."
After reporting, ask the user whether they want you to fix any of the flagged issues.
| Pattern | Reference File |
|---|---|
| Output flags + rendering | cmd/study/list.go |
| Output flags + rendering | cmd/collection/list.go |
| View with --web flag | cmd/project/view.go |
| Shared output helpers | cmd/shared/list_format_flags.go |
| Test pattern | cmd/workspace/list_test.go |
$ARGUMENTS