Use when creating one-off scripts, debug tools, analysis reports, or temporary documentation - ensures work is saved to persistent .scratch areas with proper documentation, organization, and executable patterns
Creates persistent `.scratch/` areas for temporary scripts and analysis instead of using `/tmp`. Use when creating one-off debug tools, investigation scripts, or temporary documentation that should be preserved with proper organization and documentation.
/plugin marketplace add technicalpickles/pickled-claude-plugins/plugin install mcpproxy@technicalpickles-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scratch.mdscripts/make-executablescripts/setup-scratch-area.shtemplates/scratch-area-readme-template.mdHelps Claude save one-off scripts and documents to persistent scratch areas instead of littering repositories with temporary files or using /tmp.
Core principles:
/tmp or project tmp/ directories for these files.scratch/ subdirectories with contextAnnounce at start: "I'm using the working-in-scratch-areas skill."
Use this skill when creating:
Don't use for:
NEVER use /tmp or project tmp/ directories. Always use .scratch/ for temporary work.
First, check if a scratch area already exists:
test -L .scratch && echo "Scratch area exists" || echo "No scratch area"
If the symlink exists, verify gitignore is configured (see below), then you're ready to use it.
When no scratch area exists:
~/.claude/CLAUDE.mdSetup Steps:
# 1. Get repo root
git rev-parse --show-toplevel
# Output: /Users/josh/workspace/some-repo
# 2. Check if configured in CLAUDE.md
grep -i "scratch areas:" ~/.claude/CLAUDE.md
# 3a. If configured, run setup (reads from CLAUDE.md automatically)
cd /Users/josh/workspace/some-repo && ~/.claude/skills/working-in-scratch-areas/scripts/setup-scratch-area.sh
# 3b. If not configured, ask user for location and run with --areas-root
cd /Users/josh/workspace/some-repo && ~/.claude/skills/working-in-scratch-areas/scripts/setup-scratch-area.sh --areas-root ~/workspace/scratch-areas
# 3c. If user wants to save preference, add --save-to-claude-md flag
cd /Users/josh/workspace/some-repo && ~/.claude/skills/working-in-scratch-areas/scripts/setup-scratch-area.sh --areas-root ~/workspace/scratch-areas --save-to-claude-md
# 4. Verify gitignore (see Gitignore Setup section below)
What the script does:
~/.claude/CLAUDE.md for configured scratch areas location (or accepts --areas-root flag){repo-root}/.scratch → scratch areaScript Location: ~/.claude/skills/working-in-scratch-areas/scripts/setup-scratch-area.sh
Script Options:
--areas-root PATH - Specify scratch areas root directory (required if not in CLAUDE.md)--save-to-claude-md - Save the areas root to ~/.claude/CLAUDE.md for future use--help - Show help messageThe setup script checks ~/.claude/CLAUDE.md for your preferred scratch areas location. If not found, you must provide --areas-root flag.
To configure in CLAUDE.md, add:
## Scratch Areas
When using the `dev-tools:working-in-scratch-areas` skill, create scratch areas in `~/workspace/scratch-areas` directory.
Suggested locations to offer user:
~/workspace/scratch-areas - Central location for all scratch areas~/workspace/pickled-scratch-area/areas - If using the full pickled-scratch-area repository$(dirname "$REPO_ROOT")/scratch-areas - Sibling to current repository (for project-specific scratch areas)Use AskUserQuestion to present these options when not configured.
After creating scratch area, ensure .scratch is gitignored:
Preferred: Global gitignore
# Check if globally ignored
git config --global core.excludesfile
# Verify .scratch is in that file
# If not set up, add to global gitignore
echo ".scratch" >> ~/.gitignore
git config --global core.excludesfile ~/.gitignore
Alternative: Project .gitignore
If global gitignore isn't used:
# Add to project .gitignore if not present
grep -q "^\.scratch$" .gitignore || echo ".scratch" >> .gitignore
Why global is preferred: Prevents accidental commits across all repositories.
Organize scratch files into topic-specific subdirectories:
.scratch/
├── database-debug/
│ ├── README.md
│ ├── check-connections.sh
│ └── query-results.txt
├── performance-analysis/
│ ├── README.md
│ ├── profile-api.sh
│ └── results-2024-11-05.md
└── data-extraction/
├── README.md
└── extract-users.rb
Do NOT create files directly in .scratch/ root. Always use a subdirectory.
Check for existing relevant subdirectory:
ls -la .scratch/
If relevant subdirectory exists: Ask user if it makes sense to use it:
.scratch/database-debug/ directory. Should I add this script there, or create a new subdirectory?"If creating new subdirectory:
database-debug, api-performance, user-data-extractionSubdirectory README required: Every subdirectory MUST have a README.md describing:
Example subdirectory README:
# Database Connection Debugging
## Purpose
Scripts and notes for investigating database connection timeout issues reported on 2024-11-05.
## Files
- `check-connections.sh` - Monitor active connections
- `query-slow-queries.sql` - Identify slow queries
- `findings.md` - Investigation notes and conclusions
## Status
Investigation completed 2024-11-08. Issue was connection pool exhaustion.
Keeping files for reference.
When creating scripts in scratch areas, follow these mandatory rules:
Every script MUST start with #!/usr/bin/env <command>:
#!/usr/bin/env bash
#!/usr/bin/env python3
#!/usr/bin/env ruby
#!/usr/bin/env node
Why: Enables proper allow list management and makes scripts directly executable.
After creating a script (file with shebang), use the helper script to make it executable:
~/.claude/skills/working-in-scratch-areas/scripts/make-executable .scratch/subdir/script.sh
Why:
./script.sh) instead of through interpreterNever use chmod +x directly - use the helper script instead.
Important: Only make script files executable (files with shebangs). Do NOT make markdown files, text files, or other non-script files executable. The helper script will reject files without shebangs.
When invoking scripts, use direct execution:
✅ CORRECT:
./.scratch/database-debug/check-connections.sh
❌ WRONG:
bash .scratch/database-debug/check-connections.sh # Don't use interpreter
ruby .scratch/data-extraction/extract-users.rb # Don't use interpreter
Why: Direct execution respects shebang and allow list configurations.
When creating files in scratch areas, prefer the Write tool:
✅ CORRECT:
Use Write tool to create .scratch/subdir/script.sh with content
❌ WRONG:
cat > .scratch/subdir/script.sh << 'EOF'
# content
EOF
Why: Write tool requires fewer approvals and is cleaner.
Every file MUST have a documentation header explaining its purpose:
Script header example:
#!/usr/bin/env bash
# check-database-connections.sh
#
# Purpose: Monitor database connection pool usage
# Created: 2024-11-05
# Used for: Investigating connection timeout issues in production
#
# This script helped identify that connection pool was being exhausted
# during peak traffic. Key finding: connection cleanup wasn't happening
# in error paths.
Document header example:
# API Performance Analysis Report
## Purpose
Analysis of API response times after v2.3.0 deployment
## Created
2024-11-05
## Usage Context
Users reported 2-3x slower response times after deploying v2.3.0.
This analysis was conducted to identify the regression.
## Key Findings
- Response times increased by 150% on average
- Root cause: New verbose logging middleware
- Each request was writing 500KB of logs
- Resolution: Disabled verbose logging in production config
## Impact
This analysis prevented a rollback and identified a simple configuration fix.
Deployment was saved by changing one config value.
When using git commands to add and commit files:
❌ NEVER do this:
git add .
git add -A
git add .scratch/
✅ ALWAYS be explicit:
git add specific-file.rb
git add src/components/Button.tsx
git add docs/api.md
Why: Prevents accidentally committing scratch work. Global gitignore is a safety net, but explicit adds are the first line of defense.
.scratch should be in .gitignore (globally preferred)When a file is no longer actively needed:
❌ DON'T: Delete the file ✅ DO: Add retrospective comments explaining:
Example retrospective header:
#!/usr/bin/env bash
# investigate-memory-leak.sh
#
# [RESOLVED - 2024-11-08]
# This script was used to investigate memory leaks in worker processes.
#
# Original purpose: Track memory usage over time to identify leak pattern
# Key finding: Memory leak was in redis-client gem v4.2, not our code
# Resolution: Updated gem to v4.3 which fixed the issue
# Verification: Memory usage stayed stable after upgrade
#
# Keeping this script for reference in case similar issues occur with
# other background workers.
Why: Preserved scripts document your problem-solving process and findings for future reference.
test -L .scratchls -la .scratch/~/.claude/skills/working-in-scratch-areas/scripts/make-executable .scratch/subdir/script.sh./.scratch/subdir/script.shWhen a script's purpose is complete:
When creating any file in scratch area, verify:
.scratch/ root.scratch is in gitignore (global or project)For script files specifically:
#!/usr/bin/env <command>)bash or ruby)When completing work with a file:
#!/usr/bin/env bash
# investigate-{issue}.sh
#
# Purpose: Debug {specific issue}
# Created: {date}
# Used for: {context}
set -euo pipefail
# Investigation logic here
echo "Starting investigation..."
# Document findings in comments as you discover them
#!/usr/bin/env bash
# extract-{data-type}.sh
#
# Purpose: Extract {specific data} for {reason}
# Created: {date}
# Used for: {context}
set -euo pipefail
# Extraction logic
# Output to .scratch/subdir/extracted-data.txt
#!/usr/bin/env bash
# monitor-{resource}.sh
#
# Purpose: Monitor {resource} for {reason}
# Created: {date}
# Used for: {context}
set -euo pipefail
while true; do
# Monitoring logic
sleep 5
done
# {Topic} Analysis Report
## Purpose
{What you're analyzing and why}
## Created
{Date}
## Usage Context
{Why this analysis was needed}
## Methodology
{How you approached the analysis}
## Findings
{What you discovered}
## Conclusions
{What this means}
## Next Steps / Impact
{What actions were taken based on this}
For consistency:
.scratch - The symlink in repository root (e.g., ./.scratch/)scratch area - The concept of a dedicated space for temporary workscratch areas - The overall system of centralized scratch directoriespickled-scratch-area - The central repository managing all scratch areasThis skill provides the core functionality for working with scratch areas. For additional features like migration scripts and testing utilities, see the full repository:
Repository: ~/workspace/pickled-scratch-area/
Available tools:
migrate-scratch-areas.sh - Migrate existing scratch areas to new structuremigrate-to-dot-scratch.sh - Rename scratch symlinks to .scratchmigrate-all-scratch-areas.sh - Batch migration across multiple repositoriestest-setup-scenarios.sh - Comprehensive test suite for setup scriptrename-scratch-areas.sh - Legacy renaming utilitiesThese are typically one-time operations and not needed for day-to-day scratch area usage.
| Task | Command |
|---|---|
| Check if scratch exists | test -L .scratch && echo "exists" || echo "missing" |
| Setup scratch area | Get repo root, then cd /path/to/repo && ~/.claude/skills/working-in-scratch-areas/scripts/setup-scratch-area.sh |
| Check gitignore | git config --global core.excludesfile or grep .scratch .gitignore |
| List subdirectories | ls -la .scratch/ |
| Create subdirectory | Use Write tool to create .scratch/subdir-name/README.md |
| Create script | Write tool with shebang + header |
| Make executable | ~/.claude/skills/working-in-scratch-areas/scripts/make-executable .scratch/subdir/script.sh |
| Run script | ./.scratch/subdir/script-name.sh (not bash .scratch/...) |
| Archive script | Add [RESOLVED] retrospective header, don't delete |
| Git add files | ALWAYS use explicit paths, NEVER git add . or git add -A |
/tmp or project tmp/ - always use .scratch/.scratch/ files to gitThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.