Kullanım örnekleri

Bob Shell'i hata ayıklama, kod iyileştirme, dosya oluşturma, dokümantasyon oluşturma ve yeni kavramlar öğrenmek için nasıl kullanacağını gösteren pratik örnekler.

Shell komutlarındaki hataları düzeltme

Shell komutlarında hatalarla karşılaştığında Bob Shell, bunları teşhis etmenize ve düzeltmenize yardımcı olabilir:

# Proje dizinine git
cd your-project/

# Bob Shell'i başlat
bob chat

# Shell moduna geç
> !

# Hata veren komutu yaz
> make build

# 'No rule to make target `xxx', needed by `yyy'.' gibi bir hata mesajı gördüğünde

# Shell modundan çıkmak için ESC'ye bas veya '!' tekrar gir

# Bob Shell'den yardım iste
> Help me to fix the error

Kod açıklama ve iyileştirme

Bob Shell, mevcut kodu anlaman ve iyileştirmene yardımcı olabilir:

# Bob Shell'i proje dizininde başlat
bob chat

# Belirli bir dosyanın açıklamasını iste
> Explain what @src/utils.js does and how it works

# Kodun iyileştirilmesini iste
> Review @src/api.js and suggest improvements for error handling

Yeni dosyalar ve özellikler oluşturma

Bob Shell'i yeni bileşenler veya özellikler oluşturmanı yardımcı olmak için kullan:

# Bob Shell'i proje dizininde başlat
bob chat

# Yeni bir bileşen oluşturmak için yardım iste
> Create a React component for a user profile page that displays name, email, and avatar

# Yardımcı fonksiyon oluştur
> Write a utility function that formats dates in YYYY-MM-DD format

Hata ayıklama yardımı

Bob Shell, kodundaki sorunları hata ayıklamanı yardımcı olabilir:

# Bob Shell'i proje dizininde başlat
bob chat

# Hata loglarını Bob Shell ile paylaş
> I'm getting this error when running my app: "TypeError: Cannot read property 'map' of undefined". Here's the relevant code: @src/components/List.js

# Veya hata çıktısını doğrudan Bob Shell'e aktar
# Terminalinde (Bob Shell'de değil)
npm run start 2>&1 | bob run "Help me understand and fix this error"

Dokümantasyon oluşturma

Bob Shell kullanarak kodun için dokümantasyon oluştur:

# Bob Shell'i proje dizininde başlat
bob chat

# Belirli bir dosya için dokümantasyon oluştur
> Create JSDoc comments for all functions in @src/helpers.js

# Projen için README oluştur
> Create a README.md file for my project based on the code in @src/index.js

Yeni kavramlar öğrenme

Yeni teknolojiler veya kavramlar öğrenmek için Bob Shell'i kullan:

# Bob Shell'i başlat
bob chat

# Belirli bir teknoloji hakkında sor
> Explain how React hooks work and give me examples of useState and useEffect

# Tasarım desenleri hakkında öğren
> Explain the Observer pattern and how I might implement it in JavaScript
Bu konu nasıl?