magento-cronjob-developer — скилл для Claude Code
Скилл magento-cronjob-developer ведёт агента через создание cron-заданий в Magento 2: конфиг etc/crontab.xml, класс задания, обработка сбоев и отладка.
MIT 165 установок ★ 33 обновлён 2026-01-24
npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a claude-codeЧто делает magento-cronjob-developer
Скилл разбирает фоновые задания Magento 2 по шагам: сначала требования и ожидаемая нагрузка, потом конфиг etc/crontab.xml, потом класс задания. Внутри есть готовый пример с группой default и расписанием */5 * * * *, шаблон класса Vendor\Module\Cron\Job с методом execute и Psr\Log\LoggerInterface в конструкторе, разделы про тесты и выкладку.
Отдельные блоки посвящены тому, что обычно ломается: обработка ошибок и повторные попытки, батчи вместо чтения всей таблицы разом, ограничение памяти, защита от наложения запусков. Для отладки скилл подсказывает bin/magento cron:status и bin/magento cron:run.
Расписание вида */5 * * * * без блокировки означает, что два запуска одного задания пойдут одновременно, если предыдущий не успел закрыться. Это и есть первое, что стоит решить до написания кода.
Какие задачи решает
- Прописать задание в
etc/crontab.xmlи разложить его по группам - Написать класс задания с логированием и повторным запуском после сбоя
- Разбить синхронизацию каталога на батчи, чтобы уложиться в память
- Выяснить, почему задание не выполняется
- Защитить задание от наложения двух запусков подряд
Примеры запросов агенту
- Сделай cron-задание, которое каждые пять минут тянет остатки из API поставщика: конфиг в
etc/crontab.xml, класс вVendor\Module\Cron\SyncStock - Моё задание не запускается. Посмотри
bin/magento cron:statusи разбери конфиг - Перепиши это задание на батчи по 500 записей и добавь запись ошибок в лог
Как установить magento-cronjob-developer
1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a claude-code2Вручную: положить файлы
~/.claude/skills/magento-cronjob-developer/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/magento-cronjob-developer/
1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a codex2Вручную: положить файлы
.agents/skills/magento-cronjob-developer/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a cursor2Вручную: положить файлы
.cursor/skills/magento-cronjob-developer/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install maxnorm/magento2-agent-skills skills/magento-cronjob-developer2Вручную: положить файлы
.github/skills/magento-cronjob-developer/SKILL.md1Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a gemini-cli2Командой платформы
gemini skills install https://github.com/maxnorm/magento2-agent-skills --path skills/magento-cronjob-developerВручную: положить файлы
.devin/skills/magento-cronjob-developer/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о magento-cronjob-developer
Как установить magento-cronjob-developer в Claude Code?
Выполните npx skills add maxnorm/magento2-agent-skills --skill magento-cronjob-developer -a claude-code. Файл скилла появится по пути ~/.claude/skills/magento-cronjob-developer/SKILL.md.
Что делает magento-cronjob-developer?
Помогает агенту проектировать и писать cron-задания для Magento 2: конфиг etc/crontab.xml, класс с методом execute, логирование, ретраи и отладка через bin/magento cron:run.
Какие задания скилл умеет описывать?
Синхронизацию остатков и цен, обновление статусов заказов, импорт и экспорт данных, чистку логов и бэкапы, обработку вебхуков, прогрев кеша и переиндексацию.
Исходный текст
SKILL.md · MIT
---
name: magento-cronjob-developer
description: Implements scheduled tasks and background processing for Magento 2. Use when creating cron jobs, scheduling automated tasks, implementing background processing, or automating system operations. Masters cron configuration, job scheduling, error handling, and performance optimization.
---
# Magento 2 Cron Job Developer
Expert specialist in creating reliable, efficient scheduled tasks and background processes that automate critical business operations while maintaining system performance and reliability.
## When to Use
- Creating scheduled tasks
- Implementing background processing
- Automating system operations
- Building data synchronization jobs
- Implementing maintenance tasks
- Creating notification systems
## Cron Job Architecture
- **Cron Configuration**: Master crontab.xml configuration and job scheduling
- **Job Classes**: Implement robust job execution classes and error handling
- **Schedule Management**: Design flexible scheduling patterns and intervals
- **Resource Management**: Optimize memory and processing resource usage
- **Dependency Management**: Handle job dependencies and execution order
## Cron Development Process
### 1. Job Planning & Design
- **Requirements Analysis**: Understand business requirements and execution patterns
- **Performance Planning**: Plan for expected load and resource requirements
- **Error Scenarios**: Identify potential failure points and recovery strategies
- **Monitoring Strategy**: Plan logging, alerts, and performance tracking
- **Integration Points**: Design integration with existing systems and processes
### 2. Configuration Setup
- **Crontab Configuration**: Configure job scheduling in `etc/crontab.xml`
- **Group Organization**: Organize jobs into logical groups and categories
- **Schedule Definition**: Define appropriate execution intervals and timing
- **Resource Allocation**: Plan memory limits and execution timeouts
- **Environment Configuration**: Configure for different environments
### 3. Job Implementation
- **Job Class Development**: Create robust job execution classes
- **Business Logic**: Implement core job functionality and operations
- **Data Processing**: Handle data validation, transformation, and storage
- **Error Handling**: Implement comprehensive error handling and logging
- **Progress Tracking**: Create progress monitoring and status reporting
### 4. Testing & Deployment
- **Unit Testing**: Test individual job components and logic
- **Integration Testing**: Test job integration with system components
- **Performance Testing**: Validate job performance under expected load
- **Error Testing**: Test error scenarios and recovery mechanisms
- **Deployment Strategy**: Plan safe deployment and rollback procedures
## Cron Configuration
### crontab.xml Structure
```xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="vendor_module_job" instance="Vendor\Module\Cron\Job" method="execute">
<schedule>*/5 * * * *</schedule>
</job>
</group>
</config>
```
### Job Class Implementation
```php
<?php
declare(strict_types=1);
namespace Vendor\Module\Cron;
use Psr\Log\LoggerInterface;
class Job
{
/**
* @param LoggerInterface $logger
*/
public function __construct(
private readonly LoggerInterface $logger
) {
}
/**
* Execute cron job
*/
public function execute(): void
{
try {
// Job logic here
$this->logger->info('Cron job executed successfully');
} catch (\Exception $e) {
$this->logger->error('Cron job failed: ' . $e->getMessage());
throw $e;
}
}
}
```
## Specialized Cron Job Types
### E-commerce Automation
- **Inventory Updates**: Automated stock level synchronization and alerts
- **Price Updates**: Scheduled pricing changes and promotional activations
- **Order Processing**: Automated order status updates and fulfillment
- **Customer Communications**: Automated email campaigns and notifications
- **Report Generation**: Scheduled business reports and analytics
### Data Management Jobs
- **Data Import/Export**: Automated data synchronization with external systems
- **Database Maintenance**: Scheduled cleanup, optimization, and archiving
- **Log Management**: Automated log rotation, cleanup, and archiving
- **Backup Operations**: Scheduled backup creation and validation
- **Cache Management**: Automated cache warming and invalidation
### System Maintenance
- **Performance Monitoring**: Automated system health checks and alerts
- **Security Scans**: Scheduled security audits and vulnerability checks
- **Update Processes**: Automated system and extension updates
- **Cleanup Operations**: Temporary file cleanup and resource optimization
- **Index Management**: Automated reindexing and search optimization
### Integration Jobs
- **API Synchronization**: Scheduled data sync with external APIs
- **Third-party Updates**: Automated integration with external services
- **Webhook Processing**: Background processing of webhook notifications
- **Data Transformation**: Automated data transformation and migration
- **Notification Delivery**: Scheduled notification and alert delivery
## Best Practices
### Performance
- **Batch Processing**: Process data in batches to avoid memory issues
- **Resource Management**: Monitor and limit memory usage
- **Execution Time**: Set appropriate execution timeouts
- **Lock Management**: Prevent job overlap and resource conflicts
- **Optimization**: Optimize queries and data processing
### Reliability
- **Error Handling**: Comprehensive error handling and logging
- **Retry Mechanisms**: Implement retry logic for transient failures
- **Monitoring**: Log job execution and errors
- **Alerting**: Set up alerts for job failures
- **Recovery**: Implement recovery mechanisms for failed jobs
### Security
- **Access Control**: Ensure proper permissions for job execution
- **Data Validation**: Validate all input data
- **Error Messages**: Don't expose sensitive information in error messages
- **Logging**: Log security-relevant events
- **Audit Trail**: Maintain audit trails for critical operations
## Testing
- **Unit Tests**: Test job logic in isolation
- **Integration Tests**: Test job integration with system components
- **Performance Tests**: Validate job performance under load
- **Error Tests**: Test error scenarios and recovery
- **Schedule Tests**: Verify cron schedule configuration
## Monitoring & Debugging
### Logging
```php
$this->logger->info('Job started');
$this->logger->debug('Processing item: ' . $itemId);
$this->logger->error('Job failed: ' . $exception->getMessage());
```
### Cron Status
```bash
# Check cron status
bin/magento cron:status
# Run cron manually
bin/magento cron:run
# Check cron schedule
bin/magento cron:schedule
```
## References
- [Adobe Commerce Cron](https://developer.adobe.com/commerce/php/development/components/cron/)
- [Scheduled Tasks](https://developer.adobe.com/commerce/php/development/components/cron/)
Focus on creating reliable, efficient cron jobs that automate business operations while maintaining system performance and reliability.
© maxnorm · MIT · maxnorm/magento2-agent-skills