Tool Integration in Skills: Connecting to External Systems
Learn how to design skills that guide Claude's tool usage. Master when to invoke tools, how to interpret results, and tool-aware skill patterns.
Learn how to design skills that guide Claude's tool usage. Master when to invoke tools, how to interpret results, and tool-aware skill patterns.
Skills are not limited to text processing. Claude has access to tools: reading and writing files, executing shell commands, interacting with Git, and connecting to external services via MCP. Skills can guide how Claude uses these tools.
Effective tool integration means knowing when to use tools, how to use them appropriately, and how to interpret their results. This guide covers tool-aware skill design, from basic file operations to complex multi-tool workflows.
Claude Code provides access to several tool categories:
Filesystem:
Shell:
Git:
MCP (Model Context Protocol):
Skills guide tool usage by:
Guide Claude on when tools add value:
## Tool Usage Guidelines
### Use Filesystem Tools When
- Need to verify current code state before suggesting changes
- Must check if files exist before referencing them
- Need to read configuration to understand project setup
- Verifying changes after making edits
### Use Shell Tools When
- Running tests to validate changes
- Checking installed dependencies
- Building the project to catch errors
- Running linters or formatters
### Do NOT Use Tools When
- Question can be answered from conversation context
- User is asking hypothetical questions ("what if...")
- Tool output would not change the answer
- A faster approach exists without tools
### Prefer Conversation Over Tools When
- Previous messages contain needed information
- User has provided the relevant code
- Working with general concepts, not specific code
## Efficiency Guidelines
### Before Using a Tool, Ask
1. Do I already have this information?
2. Has the user provided what I need?
3. Will tool output change my answer?
4. Is there a simpler approach?
### Common Unnecessary Tool Uses
**Reading files already in context:**
If user pasted code, do not re-read the file.
**Checking things you just did:**
After writing a file, you know its content.
**Running commands for information you have:**
If you know the project uses React, do not run commands to verify.
### When Tools ARE Necessary
**Verification:**
After making changes, verify they work.
**Discovery:**
Finding files, checking project structure.
**Execution:**
Running tests, builds, or other processes.
## File Reading Guidelines
### Before Reading
1. Check if content is already in conversation
2. Consider if partial read is sufficient
3. Verify file path makes sense for project
### Reading Patterns
**Targeted Reading:**
Read specific files when you know what you need.
Read: src/components/UserProfile.tsx Purpose: Understand current implementation before suggesting changes
**Discovery Reading:**
Start broad, then narrow down.
**Minimal Reading:**
Read only what is necessary.
Do: Read the function being discussed Don't: Read the entire 2000-line file
### After Reading
- Reference specific line numbers
- Quote relevant code sections
- Connect findings to user's question
## File Writing Guidelines
### Before Writing
1. Understand current file content (read first unless new file)
2. Confirm the write serves user's goal
3. Plan minimal, targeted changes
### Writing Patterns
**Edit Existing Files:**
**Create New Files:**
**Destructive Changes:**
For deleting content or files:
### After Writing
- Verify file syntax (run linter if available)
- Confirm change achieves intended goal
- Inform user of what was modified
## Shell Command Guidelines
### Safe Commands (Run Freely)
- Read-only operations: `ls`, `cat`, `grep`, `find`
- Status checks: `git status`, `npm list`
- Project tools: `npm test`, `npm run lint`
### Caution Commands (Consider Before Running)
- Installation: `npm install` (modifies node_modules)
- Builds: `npm run build` (may take time)
- Git operations: `git commit` (permanent)
### Dangerous Commands (Avoid or Confirm)
- Deletion: `rm`, especially `rm -rf`
- System modification: changing permissions, configs
- Network: uploading, external API calls
- Destructive git: `git reset --hard`, force push
### Command Patterns
**Chaining Commands:**
```bash
# Good: Related commands chained
npm install && npm test
# Avoid: Unrelated commands chained
npm test && rm -rf node_modules # Dangerous mix
Output Handling:
# Capture output for analysis
npm test 2>&1 | head -50
# Limit output for large results
find . -name "*.ts" | head -20
### Interpreting Command Output
```markdown
## Command Output Interpretation
### Test Output
PASS src/utils.test.ts (5 tests) FAIL src/api.test.ts (2 tests) ✕ should handle errors (15ms) ✕ should validate input (8ms)
Interpretation:
- 2 failing tests in api.test.ts
- Both related to error/validation handling
- Next step: Examine specific test failures
### Build Output
Warning: unused variable 'temp' in UserService.ts:45 Error: Cannot find module './config'
Interpretation:
- Warning is informational (can address later)
- Error blocks build (must fix import path)
- Priority: Fix error first
### Linter Output
UserService.ts:45:10 error Unexpected any. @typescript-eslint/no-explicit-any UserService.ts:52:1 warning Missing return type @typescript-eslint/explicit-function-return-type
Interpretation:
- 1 error (blocks if strict mode)
- 1 warning (should address but not blocking)
- Both in same file, can fix together
## Git Usage Guidelines
### Status and Diff
Always check before committing:
```bash
git status # What is changed
git diff # What specifically changed
git diff --staged # What will be committed
# Feature branches
git checkout -b feature/add-user-validation
# Fix branches
git checkout -b fix/resolve-null-pointer
# Never commit directly to main
# Conventional commit format
git commit -m "type(scope): description"
# Types: feat, fix, docs, style, refactor, test, chore
# Scope: Component or area affected
# Description: Imperative mood, present tense
git reset --hard without confirminggit push --force without warninggit status before destructive operationsgit stash over discarding changes
## MCP Integration
### Using MCP Servers
```markdown
## MCP Server Usage
### Available MCP Servers
Check project configuration for available MCP connections:
- Database access
- External APIs
- Custom tools
### MCP Patterns
**Discovery:**
**Invocation:**
mcp_call( server="database", tool="query", arguments={ "sql": "SELECT * FROM users LIMIT 10", "database": "production" } )
**Result Handling:**
- Check for errors before using data
- Validate data structure matches expectations
- Handle pagination for large results
### Security Considerations
- Never expose credentials in tool calls
- Check permissions before querying sensitive data
- Log sensitive operations appropriately
## Sequential Workflow: Code Change
1. **Understand Current State**
- Read relevant files
- Check git status
2. **Make Changes**
- Edit files with targeted modifications
- Create new files if needed
3. **Verify Changes**
- Run linter
- Run tests
- Check build
4. **Report Results**
- Summarize what changed
- Report any issues
- Suggest next steps
### Example Flow
read(src/UserService.ts) → understand current implementation
edit(src/UserService.ts, changes) → apply modifications
shell(npm run lint) → check for style issues
shell(npm test) → verify tests pass
git diff → show what changed
report to user → summarize changes and test results
## Parallel Workflow: Project Analysis
When tools are independent, execute together:
Parallel: ├── read(package.json) → understand dependencies ├── read(tsconfig.json) → understand config ├── shell(git log -5 --oneline) → recent history └── find(*.test.ts) → test file locations
All results → comprehensive project overview
### When to Parallelize
- Reading multiple independent files
- Running non-conflicting status commands
- Gathering context from various sources
### When NOT to Parallelize
- Write operations (order matters)
- Commands that depend on each other
- Operations that might conflict
## Conditional Workflow: Error Recovery
Try: shell(npm test)
If fails: → Read test file to understand failure → Analyze error message → Suggest fix
If passes: → Continue to next step → Report success
### Decision Points
**Test Failure:**
If test fails with:
**Build Failure:**
If build fails with:
## Error Handling
### Filesystem Errors
**File Not Found:**
Error: ENOENT: no such file or directory
Response:
**Permission Denied:**
Error: EACCES: permission denied
Response:
### Shell Errors
**Command Not Found:**
Error: npm: command not found
Response:
**Non-Zero Exit:**
Exit code: 1
Response:
### Recovery Strategies
1. **Retry with modifications**
Different path, different command
2. **Fallback approach**
Alternative tool or method
3. **Inform and ask**
Report error, ask user for guidance
4. **Graceful degradation**
Proceed without that tool's input
# Code Review Skill
## Tool Usage
### Before Review
git diff (or read PR diff) → Understand what changed
git log -5 --oneline → Context of recent changes
Read changed files if needed → Full context for complex changes
### During Review
### After Review
If suggesting changes:
# Documentation Generation Skill
## Tool Usage
### Discovery Phase
### Generation Phase
### Verification Phase
Tool integration transforms skills from text-only guidance into powerful, action-oriented capabilities. Effective tool integration:
Skills that integrate tools well extend Claude from an advisor into an assistant that can take action, verify results, and complete real tasks.
This concludes the AI Skills guide series. You now have a comprehensive understanding of skill design, from basic concepts through advanced techniques. Start building skills that transform how you work with AI.
> Learn how to write effective Skills that Claude can discover and use successfully.