bulk-operations-patterns
БесплатноБез исполняемых скриптовНе проверенBulk data operations with Excel import/export, batch processing, and validation for ABP Framework. Use when: (1) implementing bulk import/update from…
Об этом скилле
Bulk Operations Patterns
Master bulk data operations including Excel import/export, batch processing, and efficient database operations in ABP Framework applications.
When to Use This Skill
- Implementing bulk import from Excel/CSV files
- Processing large datasets with validation
- Bulk database inserts/updates with
InsertManyAsync/UpdateManyAsync - File upload handling with blob storage
- Progress tracking for long-running operations
- Export data to Excel/CSV formats
Excel Import Pattern
1. DTO for Excel Import
// Application.Contracts/{EntityPlural}/BulkImport{Entity}Dto.cs
public class BulkImportProductDto
{
[ExcelColumnName("Product Code")]
public string ProductCode { get; set; }
[ExcelColumnName("Product Name")]
public string Name { get; set; }
[ExcelColumnName("Price")]
public string PriceText { get; set; } // String for validation
[ExcelColumnName("Stock")]
public string StockText { get; set; }
[ExcelColumnName("Category")]
public string CategoryName { get; set; }
// Parsed values (not from Excel)
[ExcelIgnore]
public decimal Price { get; set; }
[ExcelIgnore]
public int Stock { get; set; }
[ExcelIgnore]
public Guid? CategoryId { get; set; }
}
2. File Upload DTO
// Application.Contracts/{EntityPlural}/BulkImportFileDto.cs
public class BulkImportFileDto
{
[Required]
public IFormFile File { get; set; }
public bool ValidateOnly { get; set; } = false;
}
// Allowed extensions
public static class BulkImportFileExtensions
{
public static readonly string[] Allowed = { ".xlsx", ".xls", ".csv" };
public const long MaxFileSize = 10 * 1024 * 1024; // 10MB
}
3. AppService Implementation
public class ProductAppService : ApplicationService, IProductAppService
{
private readonly IRepository<Product, Guid> _productRepository;
private readonly IRepository<Category, Guid> _categoryRepository;
private readonly IBlobContainer<BulkImportFileContainer> _fileContainer;
private readonly ILogger<ProductAppService> _logger;
[Authorize(ProductPermissions.Products.Import)]
public async Task<BulkImportResultDto> BulkImportAsync(BulkImportFileDto input)
{
_logger.LogInformation(
"[{Service}] BulkImportAsync - Started - FileName: {FileName}",
nameof(ProductAppService), input.File.FileName);
// Step 1: Validate file
ValidateFile(input.File);
// Step 2: Parse Excel
var items = await ParseExcelAsync(input.File);
if (!items.Any())
{
throw new UserFriendlyException("No data found in file");
}
// Step 3: Load reference data
var categories = await _categoryRepository.GetListAsync();
// Step 4: Validate all rows
var validationErrors = await ValidateImportDataAsync(items, categories);
if (validationErrors.Any())
{
return new BulkImportResultDto
{
IsSuccess = false,
TotalRows = items.Count,
ErrorCount = validationErrors.Count,
Errors = validationErrors
};
}
if (input.ValidateOnly)
{
return new BulkImportResultDto
{
IsSuccess = true,
TotalRows = items.Count,
Message = "Validation passed. Ready to import."
};
}
// Step 5: Process import
var result = await ProcessImportAsync(items, categories);
_logger.LogInformation(
"[{Service}] BulkImportAsync - Completed - Imported: {Count}",
nameof(ProductAppService), result.SuccessCount);
return result;
}
private void ValidateFile(IFormFile file)
{
var extension = Path.GetExtension(file.FileName).ToLowerInvariant();
if (!BulkImportFileExtensions.Allowed.Contains(extension))
{
throw new UserFriendlyException(
$"Invalid file type. Allowed: {string.Join(", ", BulkImportFileExtensions.Allowed)}");
}
if (file.Length > BulkImportFileExtensions.MaxFileSize)
{
throw new UserFriendlyException(
$"File size exceeds maximum allowed ({BulkImportFileExtensions.MaxFileSize / 1024 / 1024}MB)");
}
}
private async Task<List<BulkImportProductDto>> ParseExcelAsync(IFormFile file)
{
using var stream = new MemoryStream();
await file.CopyToAsync(stream);
stream.Position = 0;
// Register encoding provider for older Excel formats
System.Text.Encoding.RegisterProvider(
System.Text.CodePagesEncodingProvider.Instance);
using var importer = new ExcelImporter(stream);
var sheet = importer.ReadSheet();
return sheet.ReadRows<BulkImportProductDto>()
.Where(x => !string.IsNullOrWhiteSpace(x.Pro
Установить bulk-operations-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл bulk-operations-patterns?
Bulk data operations with Excel import/export, batch processing, and validation for ABP Framework. Use when: (1) implementing bulk import/update from Excel/CSV, (2) batch processing with progress tracking, (3) file upload with validation, (4) bulk database operations with InsertManyAsync/UpdateManyAsync.
Как установить скилл bulk-operations-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bulk-operations-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic