Fix Your Silent Slash Command Failures with Explicit Tool Calls

Fix Your Silent Slash Command Failures with Explicit Tool Calls

Claude Code slash commands silently fail when instructions are just markdown text. You must use explicit tool calls like 'using Bash tool' to make them execute.

Ggentic.news Editorial·4h ago·3 min read·6 views
Share:
Source: dev.tovia devto_claudecodeSingle Source

The Silent Failure Pattern

A developer's custom Claude Code slash commands (/blog-startaitools, /blog-single-startai) were creating blog posts, building Hugo sites, and reporting successful deployments. Yet, the new posts never appeared online. The site showed HTTP 200, content rendered, and Netlify reported deployment—everything seemed "working perfectly." The root cause? Uncommitted files. The slash command created the markdown file and ran the Hugo build but skipped the Git commit and push, leaving the new post stranded locally. The site appeared live because old content was still deployed.

Root Cause: Markdown Text vs. Tool Invocation

The broken command contained steps written as plain markdown instructions:

5. **Publish (After Approval)**
   - Create file: `/home/jeremy/projects/blog/startaitools/content/posts/[slug].md`
   - Run: `cd /home/jeremy/projects/blog/startaitools && hugo --gc --minify --cleanDestinationDir`
   - Verify build succeeds
   - Git commit with message: "feat: add blog post - [title]"
   - Git push to trigger Netlify deployment
   - Confirm deployment initiated

Claude Code interpreted this as documentation, not a series of actions to execute. It would perform explicit tool calls (like Write for the file and Bash for Hugo) found earlier in the prompt but treat subsequent Git instructions as descriptive text to be acknowledged, not acted upon.

The Fix: Demand Explicit Tool Calls

The solution is to structure slash commands with unambiguous tool invocation. Here's the corrected pattern:

5. **Publish (After Approval)**
   - Create file using Write tool: `/home/jeremy/projects/blog/startaitools/content/posts/[slug].md`
   - Build production using Bash tool:
     ```bash
     cd /home/jeremy/projects/blog/startaitools && hugo --gc --minify --cleanDestinationDir
     ```
   - Verify build output shows no errors
   - **CRITICAL: Execute git workflow using Bash tool:**
     ```bash
     cd /home/jeremy/projects/blog/startaitools
     git add content/posts/[slug].md
     git commit -m "feat: add blog post - [title]"
     git push origin main
     ```
   - Verify git push output shows "main -> main" (deployment trigger)
   - Netlify auto-deploys on successful git push

Key changes:

  1. Explicit Tool References: Phrases like "using Write tool" and "using Bash tool" force Claude Code to treat the instruction as a tool call.
  2. CRITICAL Marker: Adding **CRITICAL:** before a step emphasizes its necessity, reducing the chance the AI skips it.
  3. Verification Steps: Instructions to check command output (e.g., for "main -> main") create a feedback loop to confirm execution.
  4. Concrete Code Blocks: Placing commands inside ```bash blocks clearly delineates executable code from descriptive text.

Audit Your Commands with a Validation Script

To prevent this issue, create a validation script to scan your ~/.claude/commands/ directory. This script checks for Git-related instructions and ensures they are paired with explicit tool call markers.

#!/bin/bash
# ~/.claude/commands/validate-git-workflows.sh

for cmd in ~/.claude/commands/blog*.md; do
    git_refs=$(grep -c "git.*commit\|git.*push" "$cmd" || echo "0")

    if [ "$git_refs" -gt 0 ]; then
        critical=$(grep -c "CRITICAL.*Bash tool" "$cmd" || echo "0")

        if [ "$critical" -gt 0 ]; then
            echo "✅ $(basename $cmd) - PASS"
        else
            echo "⚠️  $(basename $cmd) - Missing CRITICAL markers"
        fi
    fi
done

Run this script after creating or modifying any slash command to catch potential silent failures.

Proactive Debugging: Ask the Right Question

The initial debugging mistake was asking Claude Code, "Is the site working?" The AI correctly verified the live site was up. The correct question was, "Why aren't my NEW posts appearing?" This shifts the verification target from general health to specific, expected outcomes. When debugging automated workflows, always craft verification steps that check for the new state you expect the command to create, not just the existing system status.

AI Analysis

**Audit your existing slash commands today.** Run `grep -n "git\|deploy\|push" ~/.claude/commands/*.md` to find any automation steps written as plain text. For each one, rewrite the step to include an explicit tool call (e.g., "Execute using Bash tool:" followed by a code block). **Adopt a new command authoring standard.** When writing new `/` commands, never list a shell command as a bullet point. Always encapsulate it in a ` ```bash ` block and preface it with a phrase like "Run this using the Bash tool:". This makes the AI's required action unambiguous. **Add verification blocks to critical commands.** For any command that changes state (git, deploy, file write), add a final step that instructs Claude Code to verify the outcome. For example, after a `git push`, include: "Using the Bash tool, run `git log --oneline -1` to confirm the new commit is present." This creates a built-in smoke test.
Enjoyed this article?
Share:

Related Articles

More in Products & Launches

View all