Başlangıç Basit
Claude'a Dosya Aktarma
Hızlı kod incelemesi veya analiz için stdin pipe ile dosya içeriğini besleyin
Komut
"color:#9CA3AF;font-style:italic"># Pipe a single file $ "color:#7C5CFC">cat src/auth.py | "color:#7C5CFC">claude -p "Review this ">for security issues" "color:#9CA3AF;font-style:italic"># Pipe filtered content (saves tokens) $ grep -n "TODO\|FIXME\|HACK" src/*.ts | "color:#7C5CFC">claude -p "Prioritize these" "color:#9CA3AF;font-style:italic"># Pipe with output format $ "color:#7C5CFC">cat package.json | "color:#7C5CFC">claude -p "List outdated patterns" "color:#d97757">--output-format text
Yanıt
## Security Review: auth.py ### Critical - Line 42: SQL injection in `login()` — use parameterized queries - Line 89: Hardcoded secret in `verify_token()` ### Medium - Line 15: Missing rate limiting on auth endpoint
Ayrıştırma Kodu
059669">">const { execSync } = require(059669059669">">'child_process'); 059669">">// Pipe content programmatically 059669">">const content = fs.readFileSync(059669059669">">'src/auth.py', 059669059669">">'utf-8'); 059669">">const output = execSync( 059669">`echo ${JSON.stringify(content)} | claude -p "Review 059669">">for security" --output-format text`, { encoding: 059669059669">">'utf-8', env: { ...process.env, CLAUDECODE: 059669">'' } } );
Tuzaklar
! Aktarılan içerik prompt'un bir parçası olarak sayılır — büyük dosyalar önemli miktarda token tüketir
! Token maliyetini azaltmak için aktarmadan önce grep veya head ile filtreleyin
! Stdin pipe + -p bayrağı: aktarılan içerik kullanıcı mesajının bir parçası olur