Wzorce wdrażania
Dzień wydania. Masz 47 commitów do wdrożenia, z czego trzy dotykają schematu bazy danych. Changelog wymaga aktualizacji, notatki wydania trzeba napisać, a ktoś musi zweryfikować, że wszystkie migracje są kompatybilne wstecz. To zabierało pół dnia. Z Claude Code w twoim pipeline wdrożeniowym zajmuje 30 minut.
Co wyniesiesz z tego artykułu
Dział zatytułowany „Co wyniesiesz z tego artykułu”- Checklistę walidacji przed wdrożeniem, którą Claude Code wykonuje automatycznie
- Generowanie changelogów i notatek wydania z historii git
- Sprawdzenia bezpieczeństwa migracji przed wdrożeniem zmian schematu bazy danych
- Pomoc przy wycofywaniu, gdy wdrożenie idzie nie tak
Walidacja przed wdrożeniem
Dział zatytułowany „Walidacja przed wdrożeniem”Checklista wdrożeniowa
Dział zatytułowany „Checklista wdrożeniowa”Run the following pre-deployment checks and report results:
1. TypeScript: npx tsc --noEmit (must pass with zero errors)2. Linting: npm run lint (must pass)3. Tests: npm run test (must pass, report coverage)4. Build: npm run build (must succeed)5. Migrations: Check if there are pending database migrations6. Dependencies: npm audit --production (flag critical vulnerabilities)7. Environment: Verify all required env vars are documented
For each check: PASS/FAIL with details if failed.Stop at the first FAIL -- do not continue if earlier checks fail.Generowanie changelogów
Dział zatytułowany „Generowanie changelogów”Z commitów git
Dział zatytułowany „Z commitów git”# Generate changelog since last taggit log --oneline "$(git describe --tags --abbrev=0)..HEAD" | \ claude -p "Generate a CHANGELOG.md entry from these commits. \ Format: \ ## [$(git describe --tags --abbrev=0 | awk -F. '{print \$1\".\"(\$2+1)\".0\"}' )] - $(date +%Y-%m-%d) \ \ Group by: \ ### Added (new features) \ ### Changed (changes to existing features) \ ### Fixed (bug fixes) \ ### Removed (removed features) \ \ Rules: \ - Write in past tense \ - One line per change \ - Skip merge commits and version bumps \ - Link to PR numbers if present in commit messages" \ --output-format textNotatki wydania
Dział zatytułowany „Notatki wydania”Generate release notes for version 2.5.0 from these changes:
[paste git log or changelog]
Format for:1. A GitHub release (markdown, user-facing, highlight breaking changes)2. An internal Slack post (brief, bullet points, mention impacted teams)3. A customer-facing email (non-technical, focus on benefits)Bezpieczeństwo migracji
Dział zatytułowany „Bezpieczeństwo migracji”Przegląd migracji bazy danych
Dział zatytułowany „Przegląd migracji bazy danych”Review the pending database migrations in db/migrations/.
For each migration:1. Is it backward-compatible? (can the old code run against the new schema?)2. Is there a rollback migration?3. Will it lock tables for an extended period?4. Are there data transformations that could fail on existing data?5. Is it idempotent? (safe to run multiple times?)
Flag any migration that requires a maintenance window.Sprawdzenie wdrożenia zero-downtime
Dział zatytułowany „Sprawdzenie wdrożenia zero-downtime”We deploy with zero downtime using rolling updates. Review the current changesto verify they are safe for rolling deployment:
1. Are all API changes backward-compatible?2. Are database migrations safe to run while old code is still serving traffic?3. Are there any new required environment variables that old pods would not have?4. Do the changes assume all instances are on the same version simultaneously?
If any check fails, describe the required deployment strategy (blue-green, maintenance window, feature flag).Pomoc przy wycofywaniu
Dział zatytułowany „Pomoc przy wycofywaniu”Gdy wdrożenie idzie nie tak:
The deploy of commit abc123 is causing 500 errors on the /api/orders endpoint.Help me execute a rollback:
1. What is the last known good commit? Check deploy logs or tags.2. Are there database migrations between the current and rollback commit?3. If yes, are the migrations reversible? Can the old code work with the new schema?4. Generate the rollback commands (git, deploy tool, and migration rollback)5. What monitoring should I check after rollback to verify recovery?Kiedy coś idzie nie tak
Dział zatytułowany „Kiedy coś idzie nie tak”Changelog pomija ważne zmiany: Claude generuje changelogi z wiadomości commitów. Jeśli twoje commity mówią “fix stuff” i “update code”, changelog będzie bezużyteczny. Pisz opisowe wiadomości commitów lub poproś Claude o odczytanie faktycznego diffa dla każdego commita.
Przegląd migracji pomija przypadki brzegowe: Automatyczny przegląd migracji działa dla typowych wzorców, ale może pominąć problemy zależne od danych. Zawsze testuj migracje na kopii danych produkcyjnych przed wdrożeniem.
Wycofanie zawodzi, bo migracje są nieodwracalne: Wiele ORM-ów generuje jednokierunkowe migracje domyślnie. Uczyń z migracji “down” część swojego workflow i testuj je regularnie.
Co dalej
Dział zatytułowany „Co dalej”- GitHub Actions — Automatyzuj sprawdzenia wdrożeniowe w CI
- Automatyzacja przeglądów — Wyłapuj ryzyka wdrożeniowe podczas przeglądu kodu
- Automatyzacja skryptów — Buduj skrypty wdrożeniowe wielokrotnego użytku