Каждый месяц вы сводите одни и те же выгрузки в один и тот же отчёт? Пусть Claude Code один раз напишет скрипт. Дальше кладёте свежие выгрузки в папку, дважды щёлкаете по файлу — и через минуту готовый отчёт со сверкой итога. Без Claude, без ручных шагов, у любого коллеги.
Do you merge the same exports into the same report every month? Let Claude Code write a script once. From then on you drop fresh exports into a folder, double-click a file, and a minute later you have a finished report with a reconciled total. No Claude, no manual steps, on any colleague's laptop.
Каждый раз заново: насыпать, залить, следить. Объясняете Claude задачу, проверяете, и в этот раз он может сделать чуть иначе.
Every time from scratch: measure, pour, watch. You explain the task to Claude, check it, and this time it may do it slightly differently.
Один раз настроили — дальше кнопка. Результат одинаковый, нажать может любой, Claude для запуска не нужен.
Set it up once, then it's a button. Same result every time, anyone can press it, Claude isn't needed to run it.
Так выглядит папка готового отчёта. Её можно скопировать на любой ноутбук или положить в общую папку отдела:
This is what a finished report folder looks like. It can be copied to any laptop or placed in the team's shared folder:
Отчет_план_факт\
input\ ← сюда кладёте свежие выгрузки
output\ ← сюда скрипт пишет отчёт с датой в имени
report.py ← скрипт (пишет Claude Code)
RUN_report.bat ← кнопка: двойной щелчок
README.md ← как запускать, что куда класть Plan_vs_actual_report\
input\ ← drop fresh exports here
output\ ← the script writes the dated report here
report.py ← the script (written by Claude Code)
RUN_report.bat ← the button: double-click
README.md ← how to run, what goes where Шаг 1. Создайте папку отчёта и подпапку input. Положите туда выгрузки за один прошлый месяц — тот, для которого у вас уже есть правильный отчёт. Это ваш эталон: по нему проверите скрипт.
Step 1. Create the report folder and an input subfolder. Put in the exports for one past month — one for which you already have a correct report. That is your reference: you will check the script against it.
Шаг 2. Откройте Claude Code в этой папке (как — урок 15-24), включите режим плана (урок 15-25) и дайте задачу. Правила в запросе — главное: без них скрипт заработает только у вас и только сегодня.
Step 2. Open Claude Code in that folder (how — lesson 15-24), switch on plan mode (lesson 15-25) and give the task. The rules in the request matter most: without them the script works only for you and only today.
Я экономист «Долины напитков». В папке input лежат выгрузки: план и факт продаж по городам и SKU за месяц. Напиши скрипт report.py на Python, который делает отчёт «план/факт по городам»: план, факт, отклонение в тыс. литров и в %. Правила: 1) исходные файлы только читать, никогда не менять; 2) результат — новый Excel в папке output, в имени дата запуска; 3) все пути — от папки скрипта, никаких C:\Users\…; 4) в конце вывести в консоль итог плана и факта из исходника и из отчёта — они должны совпасть; 5) если файл отчёта открыт в Excel — понятное сообщение, а не падение; 6) в начале скрипта — описание: что делает, что читает, что пишет. Сначала покажи план и спроси, если что-то в выгрузках непонятно.
I'm an analyst at Valley Beverages. The input folder holds exports: planned and actual sales by city and SKU for a month. Write a Python script report.py that builds a "plan vs actual by city" report: plan, actual, variance in thousand litres and in %. Rules: 1) read source files only, never change them; 2) the result is a new Excel file in the output folder with the run date in its name; 3) all paths relative to the script's folder, no C:\Users\…; 4) at the end print the plan and actual totals from the source and from the report — they must match; 5) if the report file is open in Excel, show a clear message instead of crashing; 6) start the script with a description: what it does, what it reads, what it writes. Show the plan first and ask if anything in the exports is unclear.
Скрипт, который получится, будет примерно такой формы. Читать код не обязательно, но полезно узнать в нём свои правила:
The resulting script will look roughly like this. You don't have to read code, but it helps to recognise your rules in it:
"""Отчёт план/факт по городам.
Читает выгрузку input/sales.xlsx (не меняет её), пишет новый файл в output.
"""
from pathlib import Path
from datetime import date
import pandas as pd
HERE = Path(__file__).parent # путь от скрипта, а не C:\Users\...
df = pd.read_excel(HERE / "input" / "sales.xlsx") # исходник только читаем
rep = df.groupby("Город")[["План", "Факт"]].sum()
rep["Откл, %"] = (rep["Факт"] / rep["План"] - 1) * 100
out = HERE / "output" / f"Отчет_план_факт_{date.today():%Y-%m-%d}.xlsx"
out.parent.mkdir(exist_ok=True)
try:
rep.to_excel(out)
except PermissionError:
raise SystemExit(f"Файл открыт в Excel, закройте его: {out.name}")
print("План: исходник", df["План"].sum(), "| отчёт", rep["План"].sum())
print("Факт: исходник", df["Факт"].sum(), "| отчёт", rep["Факт"].sum()) """Plan vs actual report by city.
Reads input/sales.xlsx (never changes it), writes a new file to output.
"""
from pathlib import Path
from datetime import date
import pandas as pd
HERE = Path(__file__).parent # path from the script, not C:\Users\...
df = pd.read_excel(HERE / "input" / "sales.xlsx") # source is read-only
rep = df.groupby("City")[["Plan", "Actual"]].sum()
rep["Var, %"] = (rep["Actual"] / rep["Plan"] - 1) * 100
out = HERE / "output" / f"Plan_vs_actual_{date.today():%Y-%m-%d}.xlsx"
out.parent.mkdir(exist_ok=True)
try:
rep.to_excel(out)
except PermissionError:
raise SystemExit(f"The file is open in Excel, close it: {out.name}")
print("Plan: source", df["Plan"].sum(), "| report", rep["Plan"].sum())
print("Actual: source", df["Actual"].sum(), "| report", rep["Actual"].sum()) | ПравилоRule | ПочемуWhy |
|---|---|
| Только латиница внутри .batLatin characters only inside the .bat | Кириллица в .bat превращается в кракозябры, и cmd выполняет не те команды. Русские сообщения пишет скрипт .pyCyrillic in a .bat turns into gibberish and cmd runs the wrong commands. Russian messages come from the .py script |
| cd /d "%~dp0" в началеcd /d "%~dp0" at the start | Переходит в папку, где лежит сам .bat. Тогда скрипт найдёт input и output у любого коллегиMoves into the folder where the .bat itself sits. Then the script finds input and output on any colleague's laptop |
| pause в концеpause at the end | Без неё окно закроется сразу, и вы не увидите ни итог сверки, ни ошибкуWithout it the window closes at once and you see neither the reconciliation total nor the error |
| Имя с RUN_ в началеName starting with RUN_ | Коллега сразу видит, на что нажиматьA colleague immediately sees what to click |
@echo off
REM Plan vs actual report. Double-click to run.
cd /d "%~dp0"
python report.py
pause @echo off
REM Plan vs actual report. Double-click to run.
cd /d "%~dp0"
python report.py
pause Сделай RUN_report.bat для запуска report.py двойным щелчком. Только ASCII-символы внутри, никакой кириллицы. В начале перейди в папку самого .bat, в конце pause. Все сообщения на русском пусть печатает report.py.
Make RUN_report.bat to run report.py with a double-click. ASCII characters only inside, no Cyrillic. Start by moving into the .bat's own folder, end with pause. Let report.py print all the human-readable messages.
Напиши README.md для этой папки для коллеги, который никогда не видел Python: что установить, какие выгрузки и с какими именами класть в input, как запустить RUN_report.bat, где найти отчёт, как проверить итог, что делать при ошибке «файл открыт в Excel». Коротко, по шагам.
Write README.md for this folder for a colleague who has never seen Python: what to install, which exports with which names go into input, how to run RUN_report.bat, where to find the report, how to check the total, what to do on the "file is open in Excel" error. Short, step by step.
Шесть ситуаций из жизни. Что пошло не так?
Six real-life situations. What went wrong?
| ОшибкаMistake | Как правильноDo this instead |
|---|---|
| Каждый месяц просят Claude в чате сделать тот же отчётAsking Claude in chat for the same report every month | Один раз — скрипт и кнопка; дальше без ClaudeOnce — a script and a button; then no Claude needed |
| Скрипт пишет поверх исходной выгрузкиThe script overwrites the source export | Исходники только читаем, результат — новым файлом с датойSources are read-only, the result is a new dated file |
| Проверили код — «всё правильно» — отчёт не перезапустилиChecked the code — "all correct" — didn't rerun the report | После каждой правки — запуск и сверка с эталономAfter every fix — run and reconcile with the reference |
| Русские слова в .batCyrillic words in the .bat | .bat — только латиница, русское — в .py.bat — Latin only, Cyrillic — in the .py |
| Работает «только у меня»Works "only on my laptop" | Относительные пути, README, проверка у коллегиRelative paths, a README, a test on a colleague's laptop |