Generates configuration and extension code for the CrestApps Orchard Core Attachments module, which attaches files to any record with byte-based format detection, scanning, encrypted storage, and signed download links.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate accurate configuration and extension code for the CrestApps Attachments module. It keeps the files attached to records (a RecordRef owner such as TimelineEntry:{id}): checked by their own bytes, scanned, encrypted at rest and served only to people the owner's module allows, or through a signed link. The timeline uses it for the files of notes, comments and ticket replies; the Tickets API and portal upload through it.
CrestApps.OrchardCore.Attachments in the web/startup project and enable the feature; Timeline and Tickets use it when it is on (no hard dependency).CrestApps.OrchardCore.Attachments.Abstractions (IAttachmentService, IAttachmentAccessProvider, IAttachmentScanner, FileFormats, AttachmentOptions, registration helpers) from your module.IAttachmentService checks nothing about the user. Ask IAttachmentAccessService on a page that acts for a user; it asks the IAttachmentAccessProvider registered for the owner's kind. A kind without a provider is refused.sealed modifier, except View Models.| Feature | ID | Depends on |
|---|---|---|
| Attachments | CrestApps.OrchardCore.Attachments | none |
Category Organization. No admin menu, permissions, recipe or deployment steps; files belong to their records.
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Attachments"
],
"disable": []
}
]
}
| Project | Holds |
|---|---|
CrestApps.OrchardCore.Attachments.Abstractions | FileFormat, FileFormats, Attachment, AttachmentUpload, AttachmentResult, AttachmentOptions, IAttachmentService, IAttachmentScanner, IAttachmentAccessProvider, IAttachmentAccessService, AttachmentsConstants, AddAttachmentAccessProvider<T>(), AddAttachmentScanner<T>() |
CrestApps.OrchardCore.Attachments.Core | AttachmentStore and AttachmentIndex (collection Attachments), IAttachmentFileStore, EncryptedAttachmentFileStore, DefaultAttachmentService, DefaultAttachmentAccessService, AddAttachmentsCore(configuration) |
CrestApps.OrchardCore.Attachments (module) | Migration, FileCreationAttachmentScanner, download endpoint |
AttachmentOptions binds from CrestApps:Attachments (AttachmentsConstants.ConfigurationSection) in the tenant's configuration:
{
"OrchardCore": {
"CrestApps": {
"Attachments": {
"MaxFileBytes": 20971520,
"MaxFilesPerUpload": 10,
"AllowedFormats": [ "JPEG", "PNG", "PDF" ],
"AzureBlob": {
"ConnectionString": "UseDevelopmentStorage=true",
"ContainerName": "attachments",
"BasePath": "{{ ShellSettings.Name }}"
}
}
}
}
}
| Setting | Default | Meaning |
|---|---|---|
MaxFileBytes | 20 MB | Largest file |
MaxFilesPerUpload | 10 | Files in one AddAsync call |
AllowedFormats | empty (all of FileFormats.All) | Names from FileFormats: JPEG, PNG, GIF, WebP, PDF, Word, Excel, PowerPoint, Text, CSV, vCard |
AzureBlob (CrestApps:Attachments:AzureBlob) | none | ConnectionString, ContainerName, optional BasePath; without it files live in App_Data/Sites/{tenant}/Attachments |
.png is refused. The record keeps the format's media type and the original file name for downloads.removeOnTenantRemoval). ContainerName and BasePath may hold Liquid such as {{ ShellSettings.Name }}; the shared tenant blob options also take CreateContainer (default true), RemoveContainer and RemoveFilesFromBasePath.FileFormats for the files they carry, with their own store.var result = await _attachmentService.AddAsync(
[
new AttachmentUpload
{
Owner = new RecordRef("Inspection", inspectionId),
FileName = file.FileName,
DeclaredContentType = file.ContentType,
Content = bytes,
UploadedBy = new PartyRef(PartyKinds.User, userId),
},
]);
if (!result.Succeeded)
{
// result.Errors: too many files, too large, no allowed format matches, or a scanner refused it.
}
IAttachmentService member | Does |
|---|---|
AddAsync(uploads) | Checks every file before storing any, then stores them; returns AttachmentResult { Attachments, Errors } |
FindAsync(id), GetAsync(ids), ListAsync(owner) | Load records (Attachment: Owner, FileName, ContentType, Length, IsImage, UploadedBy, UploadedUtc); ListAsync newest first |
ListUploadedBeforeAsync(ownerKinds, beforeUtc, fromUtc, take) | Files of kinds uploaded before a time (the timeline's orphan sweeper uses it) |
ReadAsync(attachment) | The decrypted bytes |
DeleteAsync(id) | Removes the record and the bytes |
DiscardUncommittedAsync(id) | Removes the file of an attachment added in this request whose record will never commit because the request failed after AddAsync (the record rolls back, the file was written at once). Never call it for a record that may have committed |
CreateSignedPath(id, lifetime) | /attachments/{id}?token=... with the tenant's path base, for e-mails and guests |
The module runs every file through Orchard Core's FileCreationService, so each IFileEventHandler (such as the antivirus feature) can refuse it before it is stored. Add your own check with services.AddAttachmentScanner<T>(); every scanner must accept a file.
public sealed class NoEmptyFilesScanner : IAttachmentScanner
{
public Task<string> ScanAsync(AttachmentUpload upload, string contentType, CancellationToken cancellationToken = default)
=> Task.FromResult(upload.Content.Length == 0 ? "The file is empty." : null);
}
// Startup: services.AddAttachmentScanner<NoEmptyFilesScanner>();
Return null to accept, or the reason to refuse.
public sealed class InspectionAttachmentAccess : IAttachmentAccessProvider
{
private readonly IAuthorizationService _authorizationService;
public InspectionAttachmentAccess(IAuthorizationService authorizationService)
{
_authorizationService = authorizationService;
}
public string OwnerKind => "Inspection";
public async Task<bool> CanViewAsync(ClaimsPrincipal user, RecordRef owner, CancellationToken cancellationToken = default)
=> await _authorizationService.AuthorizeAsync(user, InspectionPermissions.ViewInspections);
public async Task<bool> CanManageAsync(ClaimsPrincipal user, RecordRef owner, CancellationToken cancellationToken = default)
=> await _authorizationService.AuthorizeAsync(user, InspectionPermissions.ManageInspections);
}
// Startup: services.AddAttachmentAccessProvider<InspectionAttachmentAccess>();
GET /attachments/{id} serves a file to a signed-in user the owner's provider allows, or to anyone holding a valid signed link. Others are asked to sign in (whether or not the id exists); a signed-in user who may not read gets not found.?download=true, is a download. Responses carry X-Content-Type-Options: nosniff, no caching and a sandboxing content security policy.TimelineEntry (TimelineConstants.AttachmentOwnerKind) and are exactly as visible as the entry; redacting the entry removes them. The Timeline module registers that provider when Attachments is on.| Symptom | Check |
|---|---|
| Upload refused as an unknown format | The bytes match none of AllowedFormats (a renamed file, or a format not listed). |
| Download asks to sign in | No signed token, and the user is anonymous; or the link expired. |
| Download returns not found for a signed-in user | The owner kind has no IAttachmentAccessProvider, or it refused the user. |
| No file picker on the timeline composer or ticket forms | The Attachments feature is off. |
| Antivirus doesn't scan uploads | The antivirus feature must register an IFileEventHandler; Attachments calls it through FileCreationService. |
| Files lost on a new server | Files live in the tenant's App_Data unless AzureBlob is configured; data protection keys must travel too. |
Related skills: orchardcore-timeline, orchardcore-tickets, orchardcore-antivirus, orchardcore-file-upload-security, orchardcore-omnichannel-messaging.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, file-attachments, file-upload, signed-urls, file-scanning
/crestapps-orchardcore:orchardcore-attachmentsfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job