refactor-cli

refactor-cli is a skill for Claude Code from natthasath/natthasath-marketplace. It costs 165 tokens per session (2,168 once invoked), scanned A, original, MIT.

A guide for reviewing and restructuring command-line interface tools, which are programs operated through a terminal. It covers command layout, input and output, errors, exit codes, interactive use, and safety behavior.

In plain words
What is it for?
Use it to improve command hierarchies, help text, automation support, sessions, state, resource operations, and shell completion in Rust, Go, Python, or Node tools.
Why use it?
It makes terminal commands more predictable and reduces mistakes caused by unclear options, inconsistent behavior, or unsafe actions.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the refactor plugin — 5 skills shipped together

Good fit Use it to improve command hierarchies, help text, automation support, sessions, state, resource operations, and shell completion in Rust, Go, Python, or Node tools.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/natthasath/natthasath-marketplace/refactor-cli
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add natthasath/natthasath-marketplace --skill refactor-cli
Clone the repo
git clone --depth 1 https://github.com/natthasath/natthasath-marketplace

Made for: Claude Code.

Or install refactor, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refactor-cli

README.md
[![agentmods](https://agentmods.dev/badge/skills/natthasath/natthasath-marketplace/refactor-cli/github.svg)](https://agentmods.dev/skills/natthasath/natthasath-marketplace/refactor-cli)
Your own site
<a href="https://agentmods.dev/skills/natthasath/natthasath-marketplace/refactor-cli"><img src="https://agentmods.dev/badge/skills/natthasath/natthasath-marketplace/refactor-cli/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refactor-cli

Your own site · 80×15
<a href="https://agentmods.dev/skills/natthasath/natthasath-marketplace/refactor-cli"><img src="https://agentmods.dev/badge/skills/natthasath/natthasath-marketplace/refactor-cli.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 165 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,168 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00165 $0.02168
Opus 5.5 $0.00066 $0.00867
Sonnet 5.5 $0.00033 $0.00434
Haiku 4.5 $0.00016 $0.00217

Measured 15d ago against content hash 96e0177e19be, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refactor-cli scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 15d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/refactor/skills/refactor-cli/SKILL.md · 113 lines

How it starts

The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLI Structure Refactorer

คุณทำหน้าที่ตรวจสอบและรีแฟกเตอร์ "โครงสร้าง command" ของ CLI tool ให้เป็นไปตามมาตรฐานการออกแบบ CLI ที่ดี — ไม่ใช่แค่ปรับข้อความ --help แต่แก้โครงสร้างจริงของ command hierarchy, safety model, session/state, input/output contract ฯลฯ ให้สม่ำเสมอ คาดเดาได้ และปลอดภัย

CLI ที่ดีคือ CLI ที่ผู้ใช้เดา behavior ได้ก่อนรัน — flag อันตรายชื่อต้องดูอันตราย, exit code ต้องมีความหมาย สม่ำเสมอ, และ pattern ต้องเหมือนกันทั้งเครื่องมือ ไม่ใช่แต่ละ subcommand ออกแบบเอาเอง

Core Rules (Non-negotiable)

  1. ต้องตรวจภาษา/framework ของ CLI ก่อนแตะโค้ดบรรทัดแรกเสมอ — อ่าน references/language-detection.md ก่อน เพราะวิธีแก้ (เช่น "Dry Run flag" หน้าตาใน Rust clap กับ Python argparse ไม่เหมือนกัน) ขึ้นกับ ภาษา/framework ที่ใช้จริง ไม่ใช่เดาจาก pattern ทั่วไป
  2. แก้ไฟล์ตรงๆ ในโปรเจกต์ ไม่ต้องตอบเป็น Artifact
  3. ห้ามทำ breaking change แบบเงียบๆ — ถ้าจะเปลี่ยนชื่อ flag/subcommand ที่มีอยู่แล้ว (ผู้ใช้เดิมพิมพ์อยู่) ต้องอธิบายเหตุผลและถามก่อนเสมอ ไม่ใช่เปลี่ยนแล้วค่อยบอกทีหลัง
  4. ห้ามแก้โค้ดแล้วปล่อยเอกสารไม่ตรงของจริง — README.md ของโปรเจกต์, shell completion script, CHANGELOG ต้อง sync กับโครงสร้างใหม่เสมอ
  5. --help ของทุก command ที่แก้ต้อง render ตรงตาม references/help-text-format.md เป็นภาษาอังกฤษเสมอ
  6. ถ้า tool ไม่มี source code ให้แก้ (เช่น เป็น binary ที่ติดตั้งจากคนอื่น) ห้ามพยายามแก้ไบนารี — สลับเป็นโหมด audit-only แทน (ดู Edge cases)

Workflow

1. อ่าน reference ที่เกี่ยวข้องก่อนเริ่ม

ก่อนแก้อะไร ให้อ่านไฟล์ที่เกี่ยวข้องก่อนเสมอ (รายละเอียดเต็มอยู่ใน Supporting files ด้านล่าง) โดยเฉพาะ references/language-detection.md เพื่อตรวจภาษา/framework ก่อนเป็นอันดับแรก

2. ตรวจภาษาก่อนเสมอ

อ่าน references/language-detection.md แล้วยืนยันว่า CLI นี้เขียนด้วยภาษาอะไร ก่อนแตะโค้ดบรรทัดแรก เพราะวิธีแก้ขึ้นกับภาษา/framework ที่ใช้จริง

3. สำรวจโครงสร้างปัจจุบันจริง

รัน <tool> --help และ subcommand help ที่สำคัญ (ไม่ใช่เดาจากโค้ดอย่างเดียว) เพื่อดูว่าตอนนี้ผู้ใช้เห็น อะไรจริงๆ

4. จัดประเภท tool ก่อนเช็ค checklist

ตอบคำถามเหล่านี้เพื่อรู้ว่า reference กลุ่มไหนเกี่ยวข้องบ้าง (ไม่ต้องไล่เช็คทุกหมวดกับทุก tool):

  • มี side effect (เขียน/ลบ/รันคำสั่ง) หรือ read-only? → เกี่ยวกับ safety-and-trust.md
  • มี session/state ข้ามการเรียกใช้ไหม? → เกี่ยวกับ session/state ใน interaction-and-automation.md
  • จัดการ "ทรัพยากร" ที่มีชื่อ/ตัวตนไหม (server, plugin, user)? → เกี่ยวกับ resource-and-crud.md
  • ต้องรันใน script/CI ได้ไหม? → เกี่ยวกับ automation/output design ใน io-contract.md
  • แจกจ่ายผ่าน package manager หลายตัวไหม? → เกี่ยวกับ lifecycle-and-distribution.md

Read the full file on GitHub · 113 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 15d ago Changed · +25 lines 96e0177e19be
  2. 1mo ago First seen · 88 lines · 165 tokens per session scan A 371144bff39d

Subscribe to this mod's changes

refactor-cli is a skill published in the GitHub repository natthasath/natthasath-marketplace (1 stars, last pushed 10d ago), licensed MIT. It adds 165 tokens to every session and 2,168 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-09.

Related

Other skills, from other repositories

cpp-pro

Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance…

Jeffallan/claude-skills · 79 tokens

shiny-py-optimize

Diagnose and fix performance problems in Shiny for Python apps — slow startup, sluggish interactions, blocking operations, and apps that struggle beyond a handful of concurrent users. Use when a Shiny for Python app is slow, hangs, recomputes too much, times out, or must support more users; when the user asks to…

posit-dev/skills · 105 tokens

phx-investigate

Investigate Elixir/Phoenix bugs root-cause first. Reproduce failures, cite evidence, and use optional Amp subagents only when useful.

oliver-kriska/claude-elixir-phoenix · 35 tokens

phx-trace

Use when debugging how a value or request reaches Elixir code, finding who calls a function, or planning a signature change. Builds the call tree with mix xref callers instead of reading files one by one.

oliver-kriska/claude-elixir-phoenix · 47 tokens

operating-cadence

Designs the rhythm an organization runs on — which reviews happen weekly, monthly and quarterly, what each one decides, who owns the numbers presented, and how a signal at the front line reaches the people who can act on it. Use this to set up a management operating system, fix a meeting calendar that produces no…

cbrock84/headcount · 95 tokens

regex-debugger

Debug regex patterns with visual breakdowns, plain English explanations, test case generation, and flavor conversion. Use when user needs help with regular expressions or pattern matching.

OneWave-AI/claude-skills · 36 tokens