temp-files
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTemporary Files Skill
临时文件Skill
When you need to create files to track progress, generate reports, or store temporary data, use the system's temporary directory instead of the repository root.
当你需要创建文件来跟踪进度、生成报告或存储临时数据时,请使用系统的临时目录而非仓库根目录。
Directory Structure
目录结构
Use this base path for all temporary files (aligns with Claude Code's existing task output convention):
/tmp/claude/{sanitized-cwd}/Where is the current working directory path with replaced by (leading slash stripped first to avoid a leading dash).
{sanitized-cwd}/-Example: Working in →
/Users/bobby/workspace/pivot/llamafarm/tmp/claude/Users-bobby-workspace-pivot-llamafarm/所有临时文件请使用以下基础路径(与Claude Code现有的任务输出约定保持一致):
/tmp/claude/{sanitized-cwd}/其中是当前工作目录路径,将替换为(先去除开头的斜杠以避免出现开头的短横线)。
{sanitized-cwd}/-示例:工作目录为 →
/Users/bobby/workspace/pivot/llamafarm/tmp/claude/Users-bobby-workspace-pivot-llamafarm/Creating a Temp File
创建临时文件
Step 1: Create the directory
步骤1:创建目录
bash
SANITIZED_PATH=$(echo "$PWD" | sed 's|^/||' | tr '/' '-')
REPORT_DIR="/tmp/claude/${SANITIZED_PATH}/reviews"
mkdir -p "$REPORT_DIR"bash
SANITIZED_PATH=$(echo "$PWD" | sed 's|^/||' | tr '/' '-')
REPORT_DIR="/tmp/claude/${SANITIZED_PATH}/reviews"
mkdir -p "$REPORT_DIR"Step 2: Generate a unique filename
步骤2:生成唯一文件名
Use this pattern:
{descriptor}-{YYYYMMDD-HHMMSS}.{ext}bash
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
FILENAME="code-review-${TIMESTAMP}.md"
FILEPATH="${REPORT_DIR}/${FILENAME}"使用以下格式:
{descriptor}-{YYYYMMDD-HHMMSS}.{ext}bash
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
FILENAME="code-review-${TIMESTAMP}.md"
FILEPATH="${REPORT_DIR}/${FILENAME}"Step 3: Write the file
步骤3:写入文件
Use the Write tool with the full temp path.
使用Write工具写入完整的临时路径。
Step 4: Inform the user
步骤4:告知用户
Always tell the user where the file was created:
Report saved to:/tmp/claude/Users-bobby-workspace-pivot-llamafarm/reviews/code-review-20260108-143052.md
务必告知用户文件的创建位置:
报告已保存至:/tmp/claude/Users-bobby-workspace-pivot-llamafarm/reviews/code-review-20260108-143052.md
When to Use This Pattern
何时使用此模式
- Code review reports
- Analysis outputs
- Progress tracking files
- Test result summaries
- Any generated documentation not explicitly requested in a specific location
- 代码审查报告
- 分析输出结果
- 进度跟踪文件
- 测试结果汇总
- 任何未被明确要求存储在特定位置的生成文档
When NOT to Use This Pattern
何时不使用此模式
- User explicitly specifies a file path
- Creating files that should be committed (e.g., README, config files)
- Editing existing files
- 用户明确指定了文件路径
- 创建需要提交的文件(如README、配置文件)
- 编辑现有文件
Cleanup Note
清理说明
Files in are cleared on system restart. If the user needs to preserve a file, suggest they copy it to a permanent location.
/tmp//tmp/