Описание
migrate-to-gigachat-skill — скилл миграции для Cursor: определение стека — находит OpenAI-вызовы в проекте на Python, JS или TS, выбор адаптера — подбирает способ перехода на GigaChat под кодовую базу, переписывание вызовов — аккуратная замена эндпоинтов, моделей и параметров, проверка после замены — что прогнать, чтобы убедиться, что ничего не сломалось. Для команд, выполняющих требования о переходе на российские ИИ.
Что умеет:
— находить OpenAI-вызовы в коде;
— подбирать адаптер под стек;
— переписывать вызовы на GigaChat;
— давать чек-лист проверки после миграции.
Полная документация ниже — автоматически из репозитория asya02/migrate-to-gigachat-skill (ветка main). Оригинальные материалы проекта распространяются на условиях его лицензии.
migrate-to-gigachat-skill
A Cursor skill that automatically migrates Python / JS / TS projects from OpenAI to GigaChat.
Why
If a project uses OpenAI (directly via SDK, through LangChain/LangGraph, or via an OpenAI-compatible endpoint), this skill swaps the provider to GigaChat, picks the right adapter, and verifies the project still starts.
Migration paths
| Stack | Adapter | Package |
|---|---|---|
| Python + LangChain / LangGraph | Native integration | langchain-gigachat |
| Python without LangChain (OpenAI SDK, etc.) | gpt2giga proxy | gpt2giga |
| JS/TS + LangChainJS / LangGraphJS | Native integration | langchain-gigachat (npm) |
| JS/TS without LangChain | GigaChat SDK | gigachat (npm) |
See SKILL.md (sections Path A–D) for detailed instructions on each path.
Project structure
SKILL.md # Skill definition (consumed by the Cursor agent)
scripts/
detect_stack.py # Detects the stack and suggests a migration path
collect_cred_requirements.py # Extracts env vars from README/.env/docs
run_verify.py # Baseline/after verification (tests, lint, smoke)
live_canary_openai_via_proxy.py # Minimal script to smoke-test the gpt2giga proxy
examples/
gpt2giga.env.example # Template .env for gpt2giga proxy
Quick start
1. Install the skill into your project
Copy the repository contents into .cursor/skills/migrate-to-gigachat-skill/ of the target project:
mkdir -p .cursor/skills/migrate-to-gigachat-skill
cp -r /path/to/this/repo/* .cursor/skills/migrate-to-gigachat-skill/
2. Detect the stack
python3 .cursor/skills/migrate-to-gigachat-skill/scripts/detect_stack.py
Outputs a JSON report: detected languages/frameworks and the recommended migration path (A/B/C/D).
3. Collect env-variable requirements
python3 .cursor/skills/migrate-to-gigachat-skill/scripts/collect_cred_requirements.py
Shows which env variables are mentioned in the README, .env.example, docker-compose, and docs.
4. Configure GigaChat credentials
Set environment variables locally (never paste secrets into the agent chat):
export GIGACHAT_CREDENTIALS="your_key"
export GIGACHAT_SCOPE="GIGACHAT_API_PERS" # or GIGACHAT_API_B2B / GIGACHAT_API_CORP
For the gpt2giga proxy, use a dedicated env file (see examples/gpt2giga.env.example):
cp examples/gpt2giga.env.example .env.gpt2giga
# fill in the values
gpt2giga --env-path .env.gpt2giga
5. Baseline verification
VERIFY_MODE=baseline python3 .cursor/skills/migrate-to-gigachat-skill/scripts/run_verify.py
6. Migration
Ask the Cursor agent: "Migrate this project from OpenAI to GigaChat." The agent picks up SKILL.md and follows the migration instructions.
7. Post-migration verification
VERIFY_MODE=after python3 .cursor/skills/migrate-to-gigachat-skill/scripts/run_verify.py
Strict mode (tests and lint are required to pass):
VERIFY_STRICT=1 VERIFY_MODE=after python3 .cursor/skills/migrate-to-gigachat-skill/scripts/run_verify.py
Live canary (one real model call):
VERIFY_LIVE_CMD='your_command_here' VERIFY_MODE=after python3 .cursor/skills/migrate-to-gigachat-skill/scripts/run_verify.py
run_verify.py environment variables
| Variable | Description | Default |
|---|---|---|
PROJECT_ROOT |
Root of the target project | . |
VERIFY_MODE |
baseline or after |
baseline |
VERIFY_STRICT |
1 — lint and tests are required to pass |
0 |
VERIFY_TIMEOUT_S |
Per-step timeout (seconds) | 45 |
VERIFY_LIVE_CMD |
Command for the live canary check | — |
VERIFY_LIVE_REQUIRED |
1 — canary must pass |
0 |
Security
- Secrets (API keys, tokens, certificates) are never committed.
.gitignoreexcludes.env/.env.*files.- The agent never asks you to paste secrets into chat — only to confirm that the variables are set.
- For gpt2giga, a separate
.env.gpt2gigais recommended to isolate proxy credentials from the application’s.env.