โ† Back to list
d-oit

command-executor

by d-oit

๐Ÿš€ Intelligent command verification system for documentation with git diff-based cache invalidation. Zero-token operation, cross-platform CLI tool that discovers and validates commands in markdown files with 90%+ cache hit rates. Built for modern JavaScript/Node.js projects with comprehensive testing and self-learning capabilities.

โญ 1๐Ÿด 0๐Ÿ“… Nov 24, 2025

SKILL.md


name: command-executor version: "0.2.0" description: Executes safe commands and captures real output to extend command-verify functionality. Only runs when explicitly requested. Use when asked to actually run commands, execute commands, test if commands work, or verify commands actually execute. author: "Claude Code" categories: ["execution", "testing", "automation", "validation"] keywords: ["command", "execution", "testing", "output", "performance", "safety"] allowed-tools: Read,Glob,Bash,AskUserQuestion

Command Executor

Overview

This skill extends the command-verify skill to actually execute safe commands and capture real output. It provides execution capabilities with safety checks and output capture.

When to Use

Invoke this skill when the user asks to:

  • "Actually run the commands"
  • "Execute the commands"
  • "Test if commands work"
  • "Verify commands actually execute"
  • "Run the safe commands and show output"

Safety First

NEVER auto-execute dangerous commands. Always follow these safety rules:

Commands to NEVER Execute:

  • rm -rf (destructive deletion)
  • git push --force (destructive git operation)
  • npm run clean/clear/reset (destructive cleanup)
  • drop database (database destruction)
  • Any command with --delete or --force flags
  • truncate operations

Commands Requiring Confirmation:

  • npm install (modifies node_modules)
  • npm run format (modifies source files)
  • Commands with --force flags
  • Any command modifying files

Commands Safe to Auto-Execute:

  • npm run build
  • npm run test
  • npm run lint
  • npm run typecheck
  • git status
  • node --version
  • Read-only operations

How It Works

1. Pre-Flight Checks

Before executing any commands:

  • Check git status (ensure working directory is clean)
  • Check git branch (warn if on main/master)
  • Check for uncommitted changes (ask before running)

2. Execution Plan

Always show the user what will be executed:

Execution Plan:
โœ“ npm run build (safe, will execute)
โœ“ npm run test (safe, will execute)
? npm install (conditional, will ask)
โŠ rm -rf node_modules (dangerous, will skip)

Continue? [y/N]

Use the AskUserQuestion tool to get confirmation.

3. Command Execution

Execute commands sequentially (not in parallel for safety):

  • Capture stdout, stderr, exit code, duration
  • Stop on first failure (fail-fast)
  • Log all executions to audit log

4. Output Capture

For each executed command, capture:

  • stdout: Standard output
  • stderr: Error output
  • exit code: Success/failure status
  • duration: Execution time in milliseconds
  • timestamp: When it was executed

Store in .cache/command-validations/executions/<hash>.json:

{
  "command": "npm run build",
  "executedAt": "2025-10-29T10:00:00Z",
  "duration": 2341,
  "exitCode": 0,
  "stdout": "Successfully compiled 42 files",
  "stderr": "",
  "success": true,
  "commit": "a1b2c3d"
}

5. Performance Comparison

Compare execution results with previous runs to detect:

  • Performance regressions: Duration > previous * 1.5
  • New errors: stderr differs from previous
  • Output changes: Significant stdout differences

Instructions for Claude

When this skill is invoked:

  1. Pre-Flight Phase

    • Run git status to check working directory state
    • Run git branch to identify current branch
    • Warn if on main/master
    • Check for uncommitted changes
  2. Discovery Phase

    • Use command-verify skill to discover all commands
    • Categorize each command (safe/conditional/dangerous)
  3. Planning Phase

    • Create execution plan showing which commands will run
    • Use AskUserQuestion tool to get confirmation
    • Show clear indicators (โœ“ safe, ? conditional, โŠ dangerous)
  4. Execution Phase

    • Execute commands sequentially using Bash tool
    • For each command:
      • Capture full output (stdout/stderr)
      • Measure execution time
      • Record exit code
      • Save to cache
    • Stop on first failure
  5. Reporting Phase

    • Show execution results:
      Execution Report:
      
      โœ“ npm run build (2.3s)
        Output: Successfully compiled 42 files
      
      โœ“ npm run test (4.5s)
        Output: 87 tests passed
      
      Summary:
      - Executed: 2/4 commands
      - Success: 2/2
      - Duration: 6.8s
      - Performance: โœ“ No regressions detected
      
    • Highlight any performance regressions
    • Show any new errors or warnings
  6. Cache Update Phase

    • Save execution results to .cache/command-validations/executions/
    • Update audit log at .cache/command-validations/audit.log
    • Format: [timestamp] command - STATUS - duration

Error Handling

  • Command fails: Capture error, report clearly, continue if user approves
  • Timeout: Kill process after 5 minutes, mark as timeout
  • Permission denied: Skip command, suggest permission fix
  • Missing dependencies: Provide installation instructions

Performance Expectations

  • Discovery: ~100ms (reuse command-verify)
  • Planning: ~50ms (categorization)
  • Execution: Depends on commands
  • Reporting: ~50ms

Safety Features

Dry Run Mode

Show what would be executed without actually running:

Dry Run - Would execute:
โœ“ npm run build
โœ“ npm run test

Would skip:
โŠ rm -rf node_modules (dangerous)

Audit Log

All executions logged to .cache/command-validations/audit.log:

[2025-10-29 10:00:00] npm run build - SUCCESS - 2.3s
[2025-10-29 10:00:03] npm run test - SUCCESS - 4.5s
[2025-10-29 10:00:08] npm install - SKIPPED - user declined

Confirmation Required For

  • First time executing a command
  • Commands in dangerous category
  • Commands on production branch
  • Commands with side effects

Integration

This skill works alongside command-verify:

  1. command-verify discovers and validates commands
  2. command-executor actually runs safe ones
  3. Both share the same cache structure
  4. Results enhance future validations

Example Usage

User: "Verify and execute the safe commands"

Claude's actions:

  1. Invoke command-verify to discover commands
  2. Categorize commands (safe/conditional/dangerous)
  3. Show execution plan to user
  4. Get user confirmation via AskUserQuestion
  5. Execute safe commands using Bash
  6. Capture and report results
  7. Update cache with execution data

Output:

โœ“ Found 15 commands
โœ“ 8 safe, 5 conditional, 2 dangerous

Execution Plan:
โœ“ npm run build
โœ“ npm run test
โœ“ npm run lint

Continue? y

Executing...
โœ“ npm run build (2.3s) - Success
โœ“ npm run test (4.5s) - Success
โœ“ npm run lint (1.2s) - Success

All commands executed successfully!
No performance regressions detected.

Score

Total Score

75/100

Based on repository quality metrics

โœ“SKILL.md

SKILL.mdใƒ•ใ‚กใ‚คใƒซใŒๅซใพใ‚Œใฆใ„ใ‚‹

+20
โœ“LICENSE

ใƒฉใ‚คใ‚ปใƒณใ‚นใŒ่จญๅฎšใ•ใ‚Œใฆใ„ใ‚‹

+10
โœ“่ชฌๆ˜Žๆ–‡

100ๆ–‡ๅญ—ไปฅไธŠใฎ่ชฌๆ˜ŽใŒใ‚ใ‚‹

+10
โ—‹ไบบๆฐ—

GitHub Stars 100ไปฅไธŠ

0/15
โœ“ๆœ€่ฟ‘ใฎๆดปๅ‹•

3ใƒถๆœˆไปฅๅ†…ใซๆ›ดๆ–ฐ

+5
โ—‹ใƒ•ใ‚ฉใƒผใ‚ฏ

10ๅ›žไปฅไธŠใƒ•ใ‚ฉใƒผใ‚ฏใ•ใ‚Œใฆใ„ใ‚‹

0/5
โœ“Issue็ฎก็†

ใ‚ชใƒผใƒ—ใƒณIssueใŒ50ๆœชๆบ€

+5
โœ“่จ€่ชž

ใƒ—ใƒญใ‚ฐใƒฉใƒŸใƒณใ‚ฐ่จ€่ชžใŒ่จญๅฎšใ•ใ‚Œใฆใ„ใ‚‹

+5
โœ“ใ‚ฟใ‚ฐ

1ใคไปฅไธŠใฎใ‚ฟใ‚ฐใŒ่จญๅฎšใ•ใ‚Œใฆใ„ใ‚‹

+5

Reviews

๐Ÿ’ฌ

Reviews coming soon