scaffold-cli-command
정보
이 스킬은 구조화된 옵션, 액션 핸들러, 세 가지 출력 모드(가독성 높은 모드, 정숙 모드, JSON 모드)를 갖춘 새로운 Commander.js CLI 명령어를 구성합니다. 명령어 설계, 공유 컨텍스트, 오류 처리, 통합 테스트를 위한 패턴을 제공합니다. 기존 CLI에 기능을 추가하거나, 새로운 도구를 처음부터 구축하거나, 다중 명령어 애플리케이션에서 명령어를 표준화할 때 사용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/scaffold-cli-commandClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
架 CLI 命
加新命於 Commander.js 應、一致選、三出模、整測。
用
- 加命於既 Commander.js CLI→用
- 自無設多命 CLI→用
- 一規諸命結構→用
- 加禮變(暖敘出代機出)→用
入
- 必:命名與動詞(如
gather、audit、sync) - 必:命作(一句)
- 必:CLI 入口徑(如
cli/index.js) - 可:需禮變乎
- 可:標選外之選
- 可:位參(
<name>或[names...])
行
一:擇命名與類
選傳動之動詞。組命入類:
| 類 | 動 | 式 |
|---|---|---|
| CRUD | install、uninstall、list、search | 操容 |
| 生 | init、sync、audit | 管項態 |
| 禮 | gather、scatter、tend、campfire | 暖敘出 |
名規:
- 用單動(非
install-skill—讓選定何) - 小寫、命名內無連字
- 位參:
<必>、[可]、[多...]
program
.command('gather <name>')
.description('Gather a team around the campfire')
得:命名、述、位參定。
敗:動詞與既存命疊→組之(加選於既命)或於述清辨。
二:定選
每命宜支共選與命特。
標選(按需):
.option('-n, --dry-run', 'Preview without making changes')
.option('-q, --quiet', 'Suppress human-readable output')
.option('--json', 'Output as JSON')
.option('-f, --framework <id>', 'Target specific framework')
.option('-g, --global', 'Use global scope')
.option('--scope <scope>', 'Scope: project, workspace, global', 'project')
.option('--source <path>', 'Path to tool root directory')
命特選—僅加所需:
.option('--ceremonial', 'Show each item arriving individually')
.option('--only <items>', 'Comma-separated subset to include')
.option('-y, --yes', 'Skip confirmation prompts')
設則:
- 短旗(
-n)為常用 - 長旗(
--dry-run)為清 - 默值為第三參
- 布旗為切
得:選鏈含標與特。
敗:選累 > 8→分子命或組相關選。
三:作動處理
動處理循一致式:
.action(async (name, options) => {
const ctx = getContext(options);
const items = resolveItems(ctx, name, options);
if (!items || items.length === 0) {
reporter.error('Nothing found.');
process.exit(1);
}
if (options.dryRun) reporter.printDryRun();
const results = await executeOperation(items, ctx, options);
if (options.json) {
console.log(JSON.stringify(results, null, 2));
} else if (options.quiet) {
reporter.printResults(results);
} else {
printHumanOutput(results, options);
}
})
getContext() 共助中:
- 根目察
- 譜載
- 框察或顯選
- 範解
得:動處理循 5 步—境→解→預→行→出。
敗:命不合「解-行」式(如純訊如 detect)→簡為境→算→出。
四:加三出模
每命宜支三模:
默(人讀):
Installing 3 item(s) to Claude Code...
+ create-skill [claude-code] .claude/skills/create-skill
+ write-tests [claude-code] .claude/skills/write-tests
= commit-changes [claude-code] (skipped)
2 installed, 1 skipped
靜(--quiet):
標報出—簡行含態符(+、-、=、!),無禮、無飾。
JSON(--json):
{
"command": "install",
"items": 3,
"installed": 2,
"skipped": 1,
"failed": 0
}
行式:
if (options.json) {
console.log(JSON.stringify(data, null, 2));
return;
}
if (options.quiet) {
reporter.printResults(results);
return;
}
printHumanReadable(results, options);
得:三模皆出有用。JSON 可解。靜簡。默訊。
敗:命無有意 JSON 表(如 detect)→略 JSON 模、文錄因。
五:加禮變(可)
宜暖敘出代易出之命:
if (options.json) {
ceremonyReporter.printJson(data);
} else if (options.quiet) {
reporter.printResults(results);
} else {
ceremonyReporter.printArrival({
teamId: name,
agents,
results: { installed, skipped, failed },
ceremonial: options.ceremonial || false,
});
}
禮出循聲則:
- 現時、主動聲
- 無歎號
- 喻代術
- 敗誠、非災
- 末行映態
- 無 emoji—用 Unicode 字符(✦ ◉ ◎ ○ ✗)
- 每字載訊
詳見 design-cli-output 技。
得:禮出循諸聲則、生暖訊敘。
敗:禮覺強或不增訊→略。非每命需禮變。
六:理誤與邊例
if (!item) {
reporter.error(`Unknown: ${name}. Use 'tool list' to browse.`);
process.exit(1);
}
if (!options.yes && !options.quiet && !options.dryRun) {
const answer = await askYesNo('Proceed?');
if (!answer) {
console.log(' Cancelled.');
return;
}
}
if (!state.fires[name]) {
reporter.error(`Not active. Nothing to remove.`);
process.exit(1);
}
誤設則:
- 誤訊建糾正動
process.exit(1)為不可復誤- 確認提予破壞動(
--yes繞) - 預演恆成(不阻於確)
得:諸誤路生助訊。破壞動需確認。
敗:確擾本→確 --yes 與 --quiet 皆繞。
七:書整測
import { describe, it, after } from 'node:test';
import assert from 'node:assert/strict';
import { execSync } from 'child_process';
const CLI = 'node cli/index.js';
function run(args) {
return execSync(`${CLI} ${args}`, { encoding: 'utf8', timeout: 10000 });
}
describe('new-command', () => {
after(() => { });
it('dry-run shows preview', () => {
const out = run('new-command arg --dry-run');
assert.match(out, /DRY RUN/);
});
it('--json outputs valid JSON', () => {
const out = run('new-command arg --json');
const start = out.indexOf('{');
const data = JSON.parse(out.slice(start));
assert.equal(data.command, 'new-command');
});
it('rejects unknown input', () => {
assert.throws(() => run('new-command nonexistent'), /Unknown/);
});
});
詳見 test-cli-application 技。
得:≥ 3 測—預演、JSON、誤例。複命更多。
敗:execSync 超時→增時或察互動提阻命。
驗
- 命註於 CLI 入口、見於
--help - 標選(
--dry-run、--quiet、--json)正 - 默出人讀且訊
- JSON 出有效可解
- 誤訊建糾正動
- 破壞動需確(
--yes繞) - ≥ 3 整測過
- 命循 getContext → 解 → 行 → 出 式
忌
- 忘 JSON 模:機消費(本、CI)依結構出。雖命似互動唯亦行
--json - 確阻本:問入命於非互動境掛。破壞命予
--yes、--quiet抑提 - 誤退碼不一:諸誤用
process.exit(1)。析 CLI 出之工先察退碼 - 選無默:如
--scope宜有合理默以免每次定 - 禮泄入靜模:
--quiet為「機之最小出」。禮泄入靜→本破於非期出
參
build-cli-plugintest-cli-applicationdesign-cli-outputinstall-almanac-content
GitHub 저장소
연관 스킬
evaluating-llms-harness
테스팅이 Claude Skill은 MMLU, GSM8K를 포함한 60개 이상의 표준화된 학술 과제에서 LLM 성능을 벤치마크하기 위해 lm-evaluation-harness를 실행합니다. 개발자들이 모델 품질을 비교하고, 학습 진행 상황을 추적하거나 학술 결과를 보고할 수 있도록 설계되었습니다. 이 도구는 HuggingFace와 vLLM 모델을 포함한 다양한 백엔드를 지원합니다.
cloudflare-cron-triggers
테스팅이 스킬은 cron 표현식을 사용하여 Worker를 스케줄링하기 위한 Cloudflare Cron Triggers 구현에 관한 포괄적인 지식을 제공합니다. 주기적 작업, 유지보수 작업, 자동화된 워크플로우 설정 방법을 다루며, 잘못된 cron 표현식이나 시간대 문제 같은 일반적인 이슈들을 해결하는 방법을 포함합니다. 개발자들은 이를 통해 스케줄된 핸들러 구성, cron 트리거 테스트, Workflows 및 Green Compute와의 연동 작업을 수행할 수 있습니다.
webapp-testing
테스팅이 Claude Skill은 Python 스크립트를 통해 로컬 웹 애플리케이션을 테스트하기 위한 Playwright 기반 툴킷을 제공합니다. 프론트엔드 검증, UI 디버깅, 스크린샷 캡처, 로그 확인 기능을 지원하며 서버 라이프사이클을 관리합니다. 브라우저 자동화 작업에 사용하되 컨텍스트 오염을 방지하기 위해 소스 코드를 읽지 않고 스크립트를 직접 실행하세요.
finishing-a-development-branch
테스팅이 스킬은 테스트 통과를 확인한 후 체계적인 통합 옵션을 제시하여 개발자가 완성된 작업을 마무리하도록 돕습니다. 구현이 완료된 후 머지, PR 생성, 브랜치 정리와 같은 워크플로우를 안내합니다. 코드가 준비되고 테스트가 완료되었을 때 개발 프로세스를 체계적으로 마무리하기 위해 사용하세요.
