Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Tenant Safe Artifact Workflow

    0

    Turn mutable tenant records into auditable, immutable artifacts with durable storage and narrowly scoped external access.

    $15

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Tenant Safe Artifact Workflow

    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

    PhaseActionTenant Isolation Mechanism
    DraftingCRUD operations on invoices tableApp-level tenant_id filter + DB Row Level Security
    PublicationGenerate PDF, upload to S3, update state to SENTIdempotent job scoped to invoice_id AND tenant_id
    ArchivalInsert into invoice_artifacts (immutable)Foreign key constraint to tenants with no UPDATE permissions
    AccessGenerate signed S3 URL for recipientHigh-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

    1. Review the invoice_artifacts schema migration to ensure the tenant_id column is indexed.
    2. Update the S3 bucket policy to strictly deny cross-prefix access based on the application role.
    3. Run the new tests/security/tenant-isolation.test.ts suite 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

    1. Inspect the repository’s authentication, tenant propagation, persistence, storage, background jobs, audit facilities, and tests.
    2. Define lifecycle transitions, including the point at which a version becomes immutable.
    3. Apply tenant-aware authorization and persistence rules consistent with the project.
    4. Persist a version snapshot and durable artifact reference.
    5. 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.

    Requires existing tenant context and storage abstraction. Does not provide legal advice or define retention periods. engineering workflow only.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    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

    Requires

    Gmail

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    Allowed Hosts

    gmail.googleapis.com
    Listed19 days ago

    What's inside

    Frequently Asked Questions

    This skill helps SaaS developers build secure systems for turning database records into immutable documents, like invoices or reports, while ensuring no tenant can ever access another tenant's data.

    It is compatible with any AI agent capable of interacting with codebases, particularly those that support PostgreSQL and cloud storage integrations like S3 or GCS.

    The skill includes a structured implementation framework, state transition templates, security verification patterns, and best practices for building tenant-scoped storage logic.

    No, it is designed to adapt to your existing repository's authorization patterns, Row Level Security (RLS) setup, and storage abstractions rather than forcing a new framework.

    It focuses on technical implementation and security isolation; it does not provide legal advice, specific data retention policies, or the physical storage infrastructure itself.

    It automates idempotency logic, ensuring that if an artifact generation job is retried or triggered multiple times, it won't create duplicate files or corrupt existing data.

    New in Security