_legacy/automation/cli-development/SKILL.md
CLIツール開発ガイド。Node.js(Commander、Inquirer)、Python(Click、Typer)、Go(Cobra)、引数パース、インタラクティブUI、アーキテクチャ設計、テスト、配布方法など、プロフェッショナルなCLIツール開発のベストプラクティス。
npx skillsauth add gaku52/claude-code-skills cli-developmentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
このSkillは、プロフェッショナルなCLIツール開発をカバーします:
このガイドで学べること: CLIアーキテクチャ設計、フレームワーク選定、引数パース、インタラクティブUI、配布方法 公式で確認すべきこと: 最新のCLIフレームワーク機能、パッケージマネージャーアップデート、配布プラットフォーム変更
Commander.js Documentation - Node.js CLIフレームワーク
Click Documentation - Python CLIフレームワーク
Cobra Documentation - Go CLIフレームワーク
Inquirer.js - インタラクティブCLI
# プロジェクト作成
mkdir my-cli && cd my-cli
npm init -y
# 依存関係インストール
npm install commander inquirer chalk ora
npm install -D typescript @types/node ts-node
src/index.ts:
#!/usr/bin/env node
import { Command } from 'commander'
const program = new Command()
program
.name('my-cli')
.description('A sample CLI tool')
.version('1.0.0')
program
.command('create <name>')
.description('Create a new project')
.option('-t, --template <template>', 'Template to use', 'default')
.action((name, options) => {
console.log(`Creating project: ${name}`)
console.log(`Template: ${options.template}`)
})
program.parse()
# 仮想環境作成
python -m venv venv
source venv/bin/activate
# 依存関係インストール
pip install "typer[all]" rich
main.py:
import typer
from rich.console import Console
app = typer.Typer()
console = Console()
@app.command()
def create(
name: str,
template: str = typer.Option("default", help="Template to use")
):
"""Create a new project"""
console.print(f"[cyan]Creating project: {name}[/cyan]")
console.print(f"Template: [green]{template}[/green]")
if __name__ == "__main__":
app()
# プロジェクト作成
mkdir my-cli && cd my-cli
go mod init github.com/username/my-cli
# 依存関係インストール
go get github.com/spf13/cobra@latest
main.go:
package main
import (
"fmt"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "my-cli",
Short: "A sample CLI tool",
}
var createCmd = &cobra.Command{
Use: "create [name]",
Short: "Create a new project",
Args: cobra.ExactArgs(1),
Run: func(cmd *cobra.Command, args []string) {
name := args[0]
template, _ := cmd.Flags().GetString("template")
fmt.Printf("Creating project: %s\n", name)
fmt.Printf("Template: %s\n", template)
},
}
func init() {
createCmd.Flags().StringP("template", "t", "default", "Template to use")
rootCmd.AddCommand(createCmd)
}
func main() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}
CLI設計原則ガイド
Node.js CLI実装ガイド
CLI配布・パッケージングガイド
CLIアーキテクチャ & デザインパターンガイド 🆕
Python CLI開発ガイド 🆕
Python Typer:
# テンプレートをコピー
cp -r templates/python-typer my-cli
cd my-cli
# 仮想環境作成
python -m venv venv
source venv/bin/activate
# 依存関係インストール
pip install -e ".[dev]"
# CLI 実行
mycli --help
Node.js Commander:
# テンプレートをコピー
cp -r templates/nodejs-commander my-cli
cd my-cli
# 依存関係インストール
npm install
# ビルド
npm run build
# CLI 実行
npm start -- --help
Go Cobra:
# テンプレートをコピー
cp -r templates/go-cobra my-cli
cd my-cli
# 依存関係インストール
go mod download
# ビルド
go build -o mycli
# CLI 実行
./mycli --help
CLI開発チェックリスト で品質を確保:
テストガイド で堅牢性を確保:
配布ガイド で幅広いユーザーに届ける:
機能:
実装: templates/nodejs-commander/ または templates/python-typer/ を参照
機能:
Python 実装例:
import typer
from rich.console import Console
from rich.table import Table
import pandas as pd
app = typer.Typer()
console = Console()
@app.command()
def process(
input_file: str,
output: str = typer.Option(None, "--output", "-o"),
format: str = typer.Option("csv", help="Output format (csv, json, yaml)")
):
"""Process CSV file"""
# データ読み込み
df = pd.read_csv(input_file)
# テーブル表示
table = Table(title="Data")
for col in df.columns:
table.add_column(col)
for _, row in df.head().iterrows():
table.add_row(*[str(val) for val in row])
console.print(table)
# 出力
if output:
if format == "json":
df.to_json(output, orient="records")
elif format == "yaml":
import yaml
with open(output, 'w') as f:
yaml.dump(df.to_dict(orient='records'), f)
else:
df.to_csv(output, index=False)
console.print(f"[green]Saved to {output}[/green]")
機能:
アーキテクチャ: guides/04-cli-architecture.md のレイヤードアーキテクチャを参照
基本的なCLI作成:
Node.js CLIツールを作成してください:
- create <name>コマンド(プロジェクト作成)
- list コマンド(プロジェクト一覧)
- delete <name>コマンド(プロジェクト削除)
- Commanderで引数パース
- Inquirerでインタラクティブプロンプト
- chalkでカラー出力
- Jestでテスト
アーキテクチャ重視のCLI作成:
Python CLIツールを作成してください:
- Typer + Rich を使用
- レイヤードアーキテクチャ(CLI / Core / Infrastructure)
- 設定ファイルサポート(TOML)
- プラグインシステム
- 包括的なテスト(pytest)
- PyPI パッケージング
データ処理CLI作成:
CSV処理CLIツールを作成してください:
- CSVファイルを読み込み
- フィルタリング、ソート、集計
- 複数形式での出力(CSV、JSON、YAML)
- Richでテーブル表示
- プログレスバー付き
| 用途 | 推奨フレームワーク | 理由 | |------|------------------|------| | 小規模CLI | Typer (Python) | シンプル、型安全 | | 中規模CLI | Commander (Node.js) | 柔軟、エコシステム豊富 | | 大規模CLI | Cobra (Go) | 高速、バイナリ配布 | | データ処理 | Typer + Rich | 美しい出力、テーブル | | DevOps ツール | Cobra (Go) | クロスプラットフォーム |
優れた設計
堅牢な実装
優れたUX
適切な配布
guides/ - 詳細な実装ガイドtemplates/ - すぐに使えるテンプレートbest-practices/ - チェックリスト、テスト、配布プロフェッショナルなCLIツールで、開発者体験を向上させましょう。
Last updated: 2026-01-03
tools
Fundamentals of modern web development. Framework selection (React, Vue, Next.js), project architecture, state management, routing, build tools, and CSS strategy best practices.
development
# React Development — Complete Guide > A comprehensive guide to building modern React applications with TypeScript. Covers fundamentals through advanced patterns, Hooks mastery, TypeScript integration, performance optimization, and algorithm internals. ## Target Audience - Developers new to React who want a solid foundation - Intermediate React developers looking to deepen their understanding of Hooks and TypeScript patterns - Engineers who want to understand React's internal algorithms (Virt
development
# Node.js Development Skill > A practical guide collection for Node.js development. Covers all aspects of Node.js application development, including Express, NestJS, asynchronous patterns, and performance optimization. ## Overview This skill covers the following topics: - **Express & NestJS**: When to use a lightweight framework vs. an enterprise framework - **Asynchronous Patterns**: Promise, async/await, Event Emitter, Streams, Worker Threads, Cluster - **Performance Optimization**: Memory
development
# Backend Development — Complete Guide > A comprehensive guide to backend engineering. Covers the fundamentals of HTTP, REST API design, databases, authentication, environment configuration, and algorithm proofs — everything needed to build robust server-side systems. ## Target Audience - Developers new to backend engineering - Frontend engineers expanding toward full-stack development - Engineers looking to solidify their understanding of server-side fundamentals ## Prerequisites - Basic p