jpskill.com
🛠️ 開発・MCP コミュニティ

command-optimization

コマンドラインツールの開発を専門とし、引数解析設計、タスク自動化、ユーザー体験を考慮したコマンド作成を支援するSkill。

📜 元の英語説明(参考)

CLI command development specialist. Use when creating commands, designing argument parsing, automating tasks, or implementing CLI best practices. Specializes in command design patterns and user experience.

🇯🇵 日本人クリエイター向け解説

一言でいうと

コマンドラインツールの開発を専門とし、引数解析設計、タスク自動化、ユーザー体験を考慮したコマンド作成を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o command-optimization.zip https://jpskill.com/download/6903.zip && unzip -o command-optimization.zip && rm command-optimization.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6903.zip -OutFile "$d\command-optimization.zip"; Expand-Archive "$d\command-optimization.zip" -DestinationPath $d -Force; ri "$d\command-optimization.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して command-optimization.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → command-optimization フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[Skill 名] command-optimization

コマンド最適化

このスキルは、コマンドラインインターフェースの作成、設計、最適化に特化しています。コマンド設計パターン、引数解析、タスク自動化、CLIのベストプラクティスに焦点を当てています。

このスキルを使用するタイミング

  • 新しいCLIコマンドを作成するとき
  • コマンドインターフェースを設計するとき
  • 既存のコマンドを最適化するとき
  • 引数解析を実装するとき
  • CLIを介してタスクを自動化するとき
  • コマンドのユーザーエクスペリエンスを向上させるとき

このスキルができること

  1. コマンド設計: 構造の整ったCLIコマンドを作成します。
  2. 引数解析: 直感的な引数とオプションの構造を設計します。
  3. タスク自動化: コマンドを通じて反復的なタスクを自動化します。
  4. ユーザーエクスペリエンス: コマンドの使いやすさとフィードバックを向上させます。
  5. エラー処理: 堅牢なエラー処理と検証を実装します。
  6. ドキュメンテーション: 明確なコマンドドキュメンテーションとヘルプテキストを作成します。

使用方法

コマンドの作成

Create a command to generate React components
Design a CLI command for database migrations

コマンドの最適化

Improve the user experience of this command

コマンド設計パターン

タスク指向コマンド

構造:

  • 明確なアクション動詞 (generate, create, build)
  • ターゲットオブジェクト (component, migration, test)
  • カスタマイズのためのオプション
  • 役立つ出力とフィードバック

例:

# Good: 明確で実行可能
npm run generate:component UserProfile

# Bad: 目的が不明確
npm run make UserProfile

分析コマンド

構造:

  • 分析タイプ (analyze, check, audit)
  • 分析対象
  • 出力形式オプション
  • 実行可能な推奨事項

例:

# Good: 明確な分析コマンド
npm run analyze:dependencies -- --outdated

# Bad: 曖昧なコマンド
npm run check

引数処理

ファイル/ディレクトリ引数

パターン:

  • 単一のファイルまたはディレクトリを受け入れる
  • グロブパターンをサポートする
  • 存在を検証する
  • 権限を処理する

例:

# 単一ファイル
lint src/utils.js

# ディレクトリ
lint src/

# グロブパターン
lint "src/**/*.js"

設定オプション

一般的なオプション:

  • --config: カスタム設定ファイル
  • --output: 出力ディレクトリまたは形式
  • --verbose: 詳細なログ
  • --dry-run: 実行せずにプレビュー
  • --force: 安全チェックを上書き

エラー処理

入力検証

チェック項目:

  • ファイル/ディレクトリの存在
  • 読み取り/書き込み権限
  • ファイル形式の有効性
  • 必須の依存関係
  • 設定構文

エラーメッセージ

良いエラーメッセージ:

  • 問題の明確な説明
  • 特定の場所 (ファイル、行)
  • 提案される修正
  • 失敗した理由に関するコンテキスト

例:

# Good
Error: Configuration file not found: .eslintrc.json
  Run 'npm run init:config' to create it.

# Bad
Error: File not found

例1: コンポーネントジェネレーターコマンド

入力: Reactコンポーネントを生成するコマンドを作成してください

出力:

## Command: generate:component

### Usage
```bash
npm run generate:component ComponentName [options]

Options

  • --path <path>: 出力パス (デフォルト: src/components)
  • --type <type>: コンポーネントタイプ (functional|class) (デフォルト: functional)
  • --with-tests: テストファイルを生成する
  • --with-styles: スタイルシートを生成する

Examples

# 基本的なコンポーネント
npm run generate:component UserCard

# オプション付き
npm run generate:component UserCard --path src/features/users --with-tests --with-styles

Implementation

// scripts/generate-component.js
const componentName = process.argv[2];
const options = parseArgs(process.argv.slice(3));

if (!componentName) {
  console.error('Error: Component name required');
  console.log('Usage: npm run generate:component <Name>');
  process.exit(1);
}

generateComponent(componentName, options);

例2: データベースマイグレーションコマンド

入力: データベースマイグレーションコマンドを作成してください

出力:

## Command: db:migrate

### Usage
```bash
npm run db:migrate [migration-name] [options]

Options

  • --create <table>: テーブルの新しいマイグレーションを作成する
  • --rollback: 最後のマイグレーションをロールバックする
  • --status: マイグレーションステータスを表示する
  • --to <version>: 特定のバージョンにマイグレーションする

Examples

# マイグレーションを作成
npm run db:migrate --create users

# マイグレーションを実行
npm run db:migrate

# ステータスを確認
npm run db:migrate --status

# ロールバック
npm run db:migrate --rollback

参照ファイル

  • references/SLASH_COMMAND.template.md - フロントマター、動的コンテキスト、ワークフロー構造を持つスラッシュコマンドテンプレート

ベストプラクティス

コマンド設計

  1. 明確な名前: 説明的でアクション指向の名前を使用します。
  2. 一貫したパターン: プロジェクトの慣例に従います。
  3. 役立つデフォルト: 一般的なユースケースに合わせた適切なデフォルトを設定します。
  4. 良いフィードバック: 明確な出力と進捗インジケーターを提供します。
  5. エラー処理: 役立つメッセージとともに、適切に失敗を処理します。

ユーザーエクスペリエンス

  • 段階的開示: 基本的な使用法を示し、ヘルプで高度なオプションを表示します。
  • 検証: 入力を早期に検証し、明確なエラーを表示します。
  • 確認: 破壊的な操作には確認を求めます。
  • ドライラン: プレビューのために --dry-run をサポートします。
  • 詳細モード: 詳細な出力のために --verbose を使用します。

ドキュメンテーション

  • ヘルプテキスト: 各コマンドの明確で簡潔なヘルプを提供します。
  • : 実用的な例を含めます。
  • エラーメッセージ: 何が問題で、どう修正するかを説明します。
  • README: プロジェクトの README にコマンドを文書化します。

関連するユースケース

  • プロジェクト固有のコマンドの作成
  • 開発タスクの自動化
  • CLIツールの構築
  • コマンドの使いやすさの向上
  • コマンドパターンの標準化
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Command Optimization

This skill specializes in creating, designing, and optimizing command-line interfaces. It focuses on command design patterns, argument parsing, task automation, and CLI best practices.

When to Use This Skill

  • When creating new CLI commands
  • When designing command interfaces
  • When optimizing existing commands
  • When implementing argument parsing
  • When automating tasks via CLI
  • When improving command user experience

What This Skill Does

  1. Command Design: Creates well-structured CLI commands
  2. Argument Parsing: Designs intuitive argument and option structures
  3. Task Automation: Automates repetitive tasks through commands
  4. User Experience: Improves command usability and feedback
  5. Error Handling: Implements robust error handling and validation
  6. Documentation: Creates clear command documentation and help text

How to Use

Create Command

Create a command to generate React components
Design a CLI command for database migrations

Optimize Command

Improve the user experience of this command

Command Design Patterns

Task-Oriented Commands

Structure:

  • Clear action verb (generate, create, build)
  • Target object (component, migration, test)
  • Options for customization
  • Helpful output and feedback

Example:

# Good: Clear and actionable
npm run generate:component UserProfile

# Bad: Unclear purpose
npm run make UserProfile

Analysis Commands

Structure:

  • Analysis type (analyze, check, audit)
  • Target to analyze
  • Output format options
  • Actionable recommendations

Example:

# Good: Clear analysis command
npm run analyze:dependencies -- --outdated

# Bad: Vague command
npm run check

Argument Handling

File/Directory Arguments

Pattern:

  • Accept single file or directory
  • Support glob patterns
  • Validate existence
  • Handle permissions

Example:

# Single file
lint src/utils.js

# Directory
lint src/

# Glob pattern
lint "src/**/*.js"

Configuration Options

Common Options:

  • --config: Custom configuration file
  • --output: Output directory or format
  • --verbose: Detailed logging
  • --dry-run: Preview without execution
  • --force: Override safety checks

Error Handling

Input Validation

Check:

  • File/directory existence
  • Read/write permissions
  • File format validity
  • Required dependencies
  • Configuration syntax

Error Messages

Good Error Messages:

  • Clear description of the problem
  • Specific location (file, line)
  • Suggested fix
  • Context about why it failed

Example:

# Good
Error: Configuration file not found: .eslintrc.json
  Run 'npm run init:config' to create it.

# Bad
Error: File not found

Examples

Example 1: Component Generator Command

Input: Create a command to generate React components

Output:

## Command: generate:component

### Usage
```bash
npm run generate:component ComponentName [options]

Options

  • --path <path>: Output path (default: src/components)
  • --type <type>: Component type (functional|class) (default: functional)
  • --with-tests: Generate test file
  • --with-styles: Generate stylesheet

Examples

# Basic component
npm run generate:component UserCard

# With options
npm run generate:component UserCard --path src/features/users --with-tests --with-styles

Implementation

// scripts/generate-component.js
const componentName = process.argv[2];
const options = parseArgs(process.argv.slice(3));

if (!componentName) {
  console.error('Error: Component name required');
  console.log('Usage: npm run generate:component <Name>');
  process.exit(1);
}

generateComponent(componentName, options);

Example 2: Database Migration Command

Input: Create a database migration command

Output:

## Command: db:migrate

### Usage
```bash
npm run db:migrate [migration-name] [options]

Options

  • --create <table>: Create new migration for table
  • --rollback: Rollback last migration
  • --status: Show migration status
  • --to <version>: Migrate to specific version

Examples

# Create migration
npm run db:migrate --create users

# Run migrations
npm run db:migrate

# Check status
npm run db:migrate --status

# Rollback
npm run db:migrate --rollback


## Reference Files

- **`references/SLASH_COMMAND.template.md`** - Slash command template with frontmatter, dynamic context, and workflow structure

## Best Practices

### Command Design

1. **Clear Names**: Use descriptive, action-oriented names
2. **Consistent Patterns**: Follow project conventions
3. **Helpful Defaults**: Sensible defaults for common use cases
4. **Good Feedback**: Clear output and progress indicators
5. **Error Handling**: Graceful failure with helpful messages

### User Experience

- **Progressive Disclosure**: Show basic usage, advanced options in help
- **Validation**: Validate inputs early with clear errors
- **Confirmation**: Ask for confirmation on destructive operations
- **Dry Run**: Support --dry-run for preview
- **Verbose Mode**: --verbose for detailed output

### Documentation

- **Help Text**: Clear, concise help for each command
- **Examples**: Include practical examples
- **Error Messages**: Explain what went wrong and how to fix
- **README**: Document commands in project README

## Related Use Cases

- Creating project-specific commands
- Automating development tasks
- Building CLI tools
- Improving command usability
- Standardizing command patterns