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 之 CLI 應用增新命,其選項一致、有三出模、有集成試。
用時
- 既有 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) => {
// 1. Get shared context (registries, adapters, paths)
const ctx = getContext(options);
// 2. Resolve what to operate on
const items = resolveItems(ctx, name, options);
if (!items || items.length === 0) {
reporter.error('Nothing found.');
process.exit(1);
}
// 3. Preview if dry-run
if (options.dryRun) reporter.printDryRun();
// 4. Execute the operation
const results = await executeOperation(items, ctx, options);
// 5. Output results (3 modes)
if (options.json) {
console.log(JSON.stringify(results, null, 2));
} else if (options.quiet) {
reporter.printResults(results);
} else {
printHumanOutput(results, options);
}
})
getContext() 共助集中:
- 根目之察
- 註冊之載
- 框架之察或明擇
- 範之解
得:行止之手依五步——境 → 解 → 預 → 行 → 出。
敗則:命不合解—行之模(如純信息類 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;
}
// Default: human-readable output
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,
});
}
儀式之出依語之規:
- 現在時、主動聲(「mystic arrives」,非「mystic was installed」)
- 無感歎號
- 隱喻代術語(「practices」非「dependencies」)
- 敗誠述,非災(「a spark was lost」)
- 末句反映態(「The fire burns.」)
- 無 emoji——用 Unicode 之字(✦ ◉ ◎ ○ ✗)
- 每字皆載信息
詳之終端出模,參 design-cli-output 技。
得:儀式之出依諸語規,生暖而有信息之敘。
敗則:儀式之出覺強或不增信息於標準出之外,略之。非每命皆需儀式之變。
第六步:處誤與邊例
// Unknown item
if (!item) {
reporter.error(`Unknown: ${name}. Use 'tool list' to browse.`);
process.exit(1);
}
// Confirmation for destructive actions
if (!options.yes && !options.quiet && !options.dryRun) {
const answer = await askYesNo('Proceed?');
if (!answer) {
console.log(' Cancelled.');
return;
}
}
// State validation
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(() => { /* cleanup created files/state */ });
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/);
});
});
詳之 CLI 試模,參 test-cli-application 技。
得:至少三試:干跑、JSON 出、誤例。繁命宜增之。
敗則:execSync 超時,增其超時或察是否有交互之問阻命。
驗
- 命已註於 CLI 入點,現於
--help - 標準選項(
--dry-run、--quiet、--json)皆行正 - 默之出人可讀且有信息
- JSON 之出有效可解
- 誤辭示其修法
- 破壞之操需確認(以
--yes略之) - 至少三集成試皆過
- 命依 getContext → 解 → 行 → 出之模
陷
- 忘 JSON 之模:機之消費者(本、CI)依結構之出。雖命似交互之命,必施
--json - 確認之問阻本:問入之命於非交互之境必懸。破壞之命必供
--yes,且--quiet略其問 - 誤之退碼不一:諸誤皆用
process.exit(1)。析 CLI 出之器先察退碼 - 選無默:如
--scope之選宜有合理之默,免每呼皆指 - 儀洩入靜模:
--quiet旗為「機之最小出」。儀文洩入靜模,本因意外之出而破
參
build-cli-plugin— 建命所操之適配/插件test-cli-application— 全 CLI 試模,超第七步之基design-cli-output— 諸冗餘級之終端出設install-almanac-content— 結構良之 CLI 命技之例
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 생성, 브랜치 정리와 같은 워크플로우를 안내합니다. 코드가 준비되고 테스트가 완료되었을 때 개발 프로세스를 체계적으로 마무리하기 위해 사용하세요.
