Works with the AI Agents you already use
Tenant Safe Artifact Workflow
Turn mutable tenant records into auditable, immutable artifacts with durable storage and narrowly scoped external access.
$15
Tenant Safe Artifact Workflow
Example session with this skill installed
Design an immutable invoice publication workflow for our tenant-based billing system. We use PostgreSQL with RLS and S3 for storage. Invoices shouldn't be editable after being marked as 'Sent'.
- Read your context and instructions
- Compiled the tenant safe artifact
I have mapped the invoice lifecycle for your billing system. The implementation ensures that once an invoice transitions to the SENT state, its metadata and generated PDF are locked to the tenant and persisted as immutable records.
Implementation Plan: Tenant-Safe Invoice Workflow
| Phase | Action | Tenant Isolation Mechanism |
|---|---|---|
| Drafting | CRUD operations on invoices table | App-level tenant_id filter + DB Row Level Security |
| Publication | Generate PDF, upload to S3, update state to SENT | Idempotent job scoped to invoice_id AND tenant_id |
| Archival | Insert into invoice_artifacts (immutable) | Foreign key constraint to tenants with no UPDATE permissions |
| Access | Generate signed S3 URL for recipient | High-entropy secret grant with 7-day expiration |
Modified Components
// services/invoice-publisher.ts
export async function publishInvoice(tenantId: string, invoiceId: string) {
// 1. Authorization: Verify tenant ownership
const invoice = await db.invoices.findFirstOrThrow({
where: { id: invoiceId, tenantId: tenantId, status: 'DRAFT' }
});
// 2. Idempotency Check: Prevent duplicate files
if (invoice.artifactKey) return invoice.artifactKey;
// 3. Immutable Snapshot
const pdfBuffer = await generateInvoicePdf(invoice);
const storageKey = `tenants/${tenantId}/invoices/${invoiceId}.pdf`;
await storage.put(storageKey, pdfBuffer);
// 4. State Lock
return await db.invoices.update({
where: { id: invoiceId, tenantId: tenantId },
data: {
status: 'SENT',
artifactKey: storageKey,
publishedAt: new Date()
}
});
}
Next steps
- Review the
invoice_artifactsschema migration to ensure thetenant_idcolumn is indexed. - Update the S3 bucket policy to strictly deny cross-prefix access based on the application role.
- Run the new
tests/security/tenant-isolation.test.tssuite to verify cross-tenant denial.
Connects securely to your tools. The creator never sees your data.
About this skill
Building a SaaS often means turning a mutable record into a versioned invoice, contract, certificate, statement, or report. In a multi-tenant system, that transition needs clear authorization, tenant scoping, immutable history, and careful external-access boundaries.
Tenant-Safe Artifact Workflow gives an AI coding agent a structured process for designing, implementing, or reviewing tenant-scoped immutable artifact workflows inside an existing codebase. It helps the agent inspect current conventions first, then plan the smallest compatible change.
What it helps with
- Designing publication workflows for immutable documents and exports.
- Mapping authorization, trusted tenant context, and data-access boundaries.
- Separating editable records from immutable published versions and snapshots.
- Storing durable artifact bytes in approved object storage while retaining metadata and immutable references in the database.
- Designing expiring, version-scoped, read-only external access grants.
- Planning idempotency, retry, audit, and concurrency behavior for publication jobs.
- Creating focused verification plans for authorization, cross-tenant denial, lifecycle behavior, and expired public access.
Typical workflow
- Inspect the repository’s authentication, tenant propagation, persistence, storage, background jobs, audit facilities, and tests.
- Define lifecycle transitions, including the point at which a version becomes immutable.
- Apply tenant-aware authorization and persistence rules consistent with the project.
- Persist a version snapshot and durable artifact reference.
- Add targeted tests and clearly report what was verified.
Best fit
Best suited to multi-tenant SaaS projects using PostgreSQL, or a database with comparable isolation controls, plus object storage and a durable job mechanism where artifact generation or delivery is required. The skill is framework-agnostic and preserves existing repository conventions.
Use cases
- Versioned tenant reports that remain unchanged after delivery.
- Read-only, expiring links for a specific published artifact.
- Security reviews of document workflows for tenant-scope gaps.
- Immutable billing statements, certificates, contracts, or approval records.
Limitations
This skill does not replace security review, legal advice, compliance assessment, or threat modeling. It does not choose retention rules, configure cloud providers, or guarantee compatibility with every stack.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Requires existing tenant context and storage abstraction. Does not provide legal advice or define retention periods. engineering workflow only.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 19 days ago
- Accounts
Gmail
Permissions
Allowed Hosts