{"id":"file-operations","name":"file-operations","summary":"ファイルを分析し、サイズ、行数、修正時間、コンテンツ統計などの詳細なメタデータを取得しましょう。ユーザーがファイルを変更せずにファイル情報、統計、分析を要求する場合に利用します。","body":"# File Operations\n\nAnalyze files and retrieve metadata using Claude's native tools without modifying files.\n\n## When to Use\n\n- \"analyze [file]\"\n- \"get file info for [file]\"\n- \"how many lines in [file]\"\n- \"compare [file1] and [file2]\"\n- \"file statistics\"\n\n## Core Operations\n\n### File Size & Metadata\n```bash\nstat -f \"%z bytes, modified %Sm\" [file_path]  # Single file\nls -lh [directory]                             # Multiple files\ndu -h [file_path]                              # Human-readable size\n```\n\n### Line Counts\n```bash\nwc -l [file_path]                              # Single file\nwc -l [file1] [file2]                          # Multiple files\nfind [dir] -name \"*.py\" | xargs wc -l          # Directory total\n```\n\n### Content Analysis\nUse **Read** to analyze structure, then count functions/classes/imports.\n\n### Pattern Search\n```\nGrep(pattern=\"^def \", output_mode=\"count\", path=\"src/\")        # Count functions\nGrep(pattern=\"TODO|FIXME\", output_mode=\"content\", -n=true)    # Find TODOs\nGrep(pattern=\"^import \", output_mode=\"count\")                 # Count imports\n```\n\n### Find Files\n```\nGlob(pattern=\"**/*.py\")\n```\n\n## Workflow Examples\n\n### Comprehensive File Analysis\n1. Get size/mod time: `stat -f \"%z bytes, modified %Sm\" file.py`\n2. Count lines: `wc -l file.py`\n3. Read file: `Read(file_path=\"file.py\")`\n4. Count functions: `Grep(pattern=\"^def \", output_mode=\"count\")`\n5. Count classes: `Grep(pattern=\"^class \", output_mode=\"count\")`\n\n### Compare File Sizes\n1. Find files: `Glob(pattern=\"src/**/*.py\")`\n2. Get sizes: `ls -lh src/**/*.py`\n3. Total size: `du -sh src/*.py`\n\n### Code Quality Metrics\n1. Total lines: `find . -name \"*.py\" | xargs wc -l`\n2. Test files: `find . -name \"test_*.py\" | wc -l`\n3. TODOs: `Grep(pattern=\"TODO|FIXME|HACK\", output_mode=\"count\")`\n\n### Find Largest Files\n```bash\nfind . -type f -not -path \"./node_modules/*\" -exec du -h {} + | sort -rh | head -20\n```\n\n## Best Practices\n\n- **Non-destructive**: Use Read/stat/wc, never modify\n- **Efficient**: Read small files fully, use Grep for large files\n- **Context-aware**: Compare to project averages, suggest optimizations\n\n## Integration\n\nWorks with:\n- **code-auditor**: Comprehensive analysis\n- **code-transfer**: After identifying large files\n- **codebase-documenter**: Understanding file purposes","author":"@mhattingpete","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/mhattingpete/claude-skills-marketplace/tree/main/code-operations-plugin/skills/file-operations","license":"Apache-2.0","category":"productivity","lang":"en","tokens":628,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}