Claude Code v akci

Vývoj softwaru s Claude Code

Dani Zysman

AI Curriculum Manager @ DataCamp

Vývoj softwaru s Claude Code

Kam Claude Code zapadá

Hierarchie produktů Claude: Web Chat, Desktop App, Terminal CLI

  • Claude.ai: chatovací rozhraní pro obecné úkoly
  • Claude Desktop: aplikace s přístupem k souborům
  • Claude Code: terminálový nástroj pro programování
Vývoj softwaru s Claude Code

Začínáme

$ curl -fsSL https://claude.ai/install.sh | bash

Další informace najdeš na: https://code.claude.com/docs/en/overview

$ cd /path/to/your/project
$ claude

Užitečné příkazy:

  • /clear vymaže historii konverzace
  • /exit nebo Ctrl + C ukončí relaci
  • /help zobrazí dostupné příkazy
Vývoj softwaru s Claude Code

Orientace ve zmatečném kódu

def process_data(records, threshold=0.5):
    result = []
    for r in records:
        if r.get('value') and r['value'] > threshold:
            x = r['value'] * 1.1 if r.get('premium') else r['value']
            result.append({'id': r['id'], 'adjusted': x, 'flag': x > 1})
    return sorted(result, key=lambda d: d['adjusted'], reverse=True)[:10]
  • Jednopísmenné proměnné
  • Žádné komentáře
  • Zhuštěná logika
Vývoj softwaru s Claude Code

Claude vysvětluje a dokumentuje

> What does process_data() do?
process_data(): Filter, Adjust & Rank

Filter: Keep records where value > threshold (default: 0.5)
Adjust: Apply 10% boost if premium=True
Transform: Output id, adjusted value, and flag (if adjusted > 1)
Sort: Return top 10 by adjusted descending
> Add a docstring to process_data()
"""Filter records above threshold, apply 10% premium uplift, and return 
the top 10 by adjusted value."""
Vývoj softwaru s Claude Code

Odhalení chyby

def add_item(item, item_list=[]):
    item_list.append(item)
    return item_list

Poznáš, v čem je problém?

Vývoj softwaru s Claude Code

Claude najde a opraví chybu

> Find the bug in add_item() and fix it
Bug found and fixed: The issue was a mutable default argument. 

Using item_list=[] means all calls to add_item() without providing a 
list argument would share the same default list object, 
causing items to accumulate across calls.
def add_item(item, item_list=None):
    if item_list is None:
        item_list = []
    item_list.append(item)
    return item_list
Vývoj softwaru s Claude Code

Řešení problémů

Problém Řešení
„Context window exceeded" Použij /clear k resetování
Limity požadavků Počkej a zkus to znovu
Nekvalitní výsledky Udržuj prompty zaměřené na jeden úkol
Vývoj softwaru s Claude Code

Zpětnovazební smyčka

Vývojový cyklus: Popsat, Vygenerovat, Zkontrolovat, Upravit

Vývoj softwaru s Claude Code

Pojďme cvičit!

Vývoj softwaru s Claude Code

Preparing Video For Download...