PHP / Magento Dev Blog

  • Publikacje
  • O autorze
  • Kontakt

AI workflow 2026 – 2 years later, what works, what doesn’t, Claude 200K in practice

by Henryk Tews / Tuesday, 21 April 2026 / Published in PHP

Two years after I first wrote about AI coding tools, the landscape has changed completely. Context windows went from 8K to 200K+ tokens. Models that were unreliable on Magento code are now genuinely useful. Cursor IDE turned AI from a suggestion machine into a pair programmer. I revisit my 2024 assessment with two years of production experience and concrete workflow changes.

What changed since 2024

Aspect 2024 2026
Context window 8K-32K tokens 200K+ tokens (Claude 3.7, Gemini 2.0)
Magento accuracy ~40% correct first attempt ~70% correct first attempt
PHP 8.4+ syntax Inconsistent Reliable
Test generation Good scaffolding Complete tests, good data providers
Local models Weak qwen2.5-coder:32b = near GPT-4 quality
IDE integration Suggestions only Cursor: multi-file edit, codebase chat

Claude with 200K context – how I use it

# What 200K tokens enables for Magento work:

# Paste an entire Magento module (typical: 15-50K tokens)
find app/code/Vendor/Module -name "*.php" -o -name "*.xml" | \
    xargs wc -l | tail -1
# 3,847 lines = ~15K tokens - fits easily in context

# Workflow 1: Architecture review
# "Review this module for Magento 2 antipatterns, missing null checks,
#  places where ObjectManager is used directly, and Service Contract violations"

# Workflow 2: Explain unknown code
# "Explain what this observer does and how it interacts with the checkout"

# Workflow 3: Write tests for a complete module
# "Write PHPUnit tests for all service classes in this module.
#  Use mocks for all Magento interfaces."

# Workflow 4: Migration planning
# "This module was written for Magento 2.3. What needs to change for 2.4.8?"

# What still fails:
# - Generating correct di.xml for complex virtual type hierarchies
# - Layout XML for unusual block positions
# - Specific Magento 2 version quirks (2.4.6 vs 2.4.8 differences)

Cursor IDE – the real workflow change

# Cursor features that changed my daily workflow:

# 1. Codebase chat: @codebase "How does the checkout totals collection work?"
# Cursor reads your entire project and answers from actual code

# 2. Multi-file edit: describe a change, Cursor edits all affected files
# "Add a new extension attribute 'supplier_code' to Order"
# -> Creates extension_attributes.xml, plugin, interface, setup patch, all at once

# 3. Apply diffs from AI: "Refactor this to use the Repository pattern"
# -> Shows a diff, you apply or reject changes file by file

# 4. Rules files: .cursorrules - project-specific AI instructions
# .cursorrules - Magento 2 project rules for Cursor
You are a Magento 2 developer assistant. Follow these rules:

1. Always use constructor injection (DI), never ObjectManager directly
2. Return Data Interfaces (e.g. ProductInterface), not concrete Models
3. Use Service Contracts for cross-module data access
4. Always declare strict_types=1 in PHP files
5. Prefer plugins over preferences when possible
6. Always set a pageSize when using SearchCriteriaBuilder
7. Use readonly classes for DTOs and Value Objects (PHP 8.2+)
8. Use property hooks for validated setters (PHP 8.4+)
9. Exceptions: use Magento\Framework\Exception\* types

Magento version: 2.4.8, PHP version: 8.5

Local models in 2026 – privacy-safe workflow

# qwen2.5-coder:32b is the recommended local model for PHP in 2026
# Quality: ~85% of Claude 3.5 Sonnet on PHP tasks
# Speed: ~2-3 tokens/second on MacBook M3 Pro (32GB RAM)
# Privacy: runs entirely locally, no data leaves the machine

ollama pull qwen2.5-coder:32b

# Use in Cursor: Settings -> Models -> Add Custom Model
# URL: http://localhost:11434/v1
# Model: qwen2.5-coder:32b

# Use cases for local model:
# - Client code covered by NDA
# - Security-sensitive code (auth, payment)
# - Proprietary business logic
# - Working offline or on poor connection

Honest assessment: what AI still does badly

<?php

// STILL UNRELIABLE in 2026:

// 1. Magento 2 DI configuration (di.xml)
// AI generates plausible-looking XML but often:
// - Wrong xsi:type for the data being injected
// - Missing MKSTREAM flag on queue configs
// - Incorrect virtualType inheritance

// 2. Complex plugin interactions
// "Write a plugin that modifies X but only when Y is true and Z is not set"
// AI generates something that looks right but fails in edge cases

// 3. Specific version incompatibilities
// "Is this code compatible with Magento 2.4.6 AND 2.4.8?"
// AI often misses deprecation differences between minor versions

// 4. Performance implications
// AI generates functionally correct code that has N+1 problems,
// missing cache warm-up, or fetches the same data multiple times.
// It fixes issues when told about them but doesn't proactively identify them.

// 5. Security vulnerabilities
// Missing input validation, SQL injection via raw queries,
// missing ACL checks on REST endpoints.
// ALWAYS review AI-generated code for security manually.

ROI summary – actual time savings

Task Without AI With AI Saving
New module skeleton 45 min 10 min 35 min
Write service + repository 2h 45 min 75 min
Write full test suite 3h 1h 2h
Debug DI compile error 30 min 8 min 22 min
Refactor to new pattern 2h 40 min 80 min
Write docblocks + PHPDoc 45 min 5 min 40 min

Summary

Two years of daily AI-assisted development produced one clear conclusion: AI is a genuine 2-3x productivity multiplier for a developer who already knows what they are doing. It does not replace expertise; it amplifies it. The 200K context window is the single biggest improvement – being able to show Claude an entire module and ask “what’s wrong with this” is categorically different from pasting individual files. The remaining failure modes are consistent: trust AI for boilerplate, scaffolding, and test generation; verify manually for security, DI configuration, and performance-sensitive code.

About Henryk Tews

What you can read next

PHP 7.2 – object type hint, sodium instead of mcrypt, deprecations

© 2026 Created by

TOP
Zarządzaj zgodą
Aby zapewnić jak najlepsze wrażenia, korzystamy z technologii, takich jak pliki cookie, do przechowywania i/lub uzyskiwania dostępu do informacji o urządzeniu. Zgoda na te technologie pozwoli nam przetwarzać dane, takie jak zachowanie podczas przeglądania lub unikalne identyfikatory na tej stronie. Brak wyrażenia zgody lub wycofanie zgody może niekorzystnie wpłynąć na niektóre cechy i funkcje.
Funkcjonalne Always active
Przechowywanie lub dostęp do danych technicznych jest ściśle konieczny do uzasadnionego celu umożliwienia korzystania z konkretnej usługi wyraźnie żądanej przez subskrybenta lub użytkownika, lub wyłącznie w celu przeprowadzenia transmisji komunikatu przez sieć łączności elektronicznej.
Preferencje
Przechowywanie lub dostęp techniczny jest niezbędny do uzasadnionego celu przechowywania preferencji, o które nie prosi subskrybent lub użytkownik.
Statystyka
Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do celów statystycznych. Przechowywanie techniczne lub dostęp, który jest używany wyłącznie do anonimowych celów statystycznych. Bez wezwania do sądu, dobrowolnego podporządkowania się dostawcy usług internetowych lub dodatkowych zapisów od strony trzeciej, informacje przechowywane lub pobierane wyłącznie w tym celu zwykle nie mogą być wykorzystywane do identyfikacji użytkownika.
Marketing
Przechowywanie lub dostęp techniczny jest wymagany do tworzenia profili użytkowników w celu wysyłania reklam lub śledzenia użytkownika na stronie internetowej lub na kilku stronach internetowych w podobnych celach marketingowych.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
Zobacz preferencje
  • {title}
  • {title}
  • {title}