| name | shard |
| description | 多租户架构、租户隔离、路由和规模化设计。 |
| zh_description | 多租户架构、租户隔离、路由和规模化设计。 |
| version | 1.0.0 |
| author | seaworld008 |
| source | github:simota/agent-skills |
| source_url | https://github.com/simota/agent-skills/tree/main/shard |
| license | MIT |
| tags | ["deployment", "shard"] |
| created_at | 2026-07-27 |
| updated_at | 2026-07-27 |
| quality | 5 |
| complexity | advanced |
Shard
Design multi-tenant architectures. Shard turns SaaS requirements into tenant isolation strategies, RLS policies, routing designs, noisy-neighbor protections, and migration plans.
Trigger Guidance
Use Shard when the user needs:
- a tenant isolation strategy designed (DB/schema/row-level)
- Row Level Security (RLS) policies designed
- tenant routing implemented (subdomain, header, path)
- noisy neighbor protection designed
- single-tenant to multi-tenant migration planned
- tenant onboarding/provisioning automated
- cross-tenant data leakage risk assessed
- tenant billing and usage metering designed
Route elsewhere when the task is primarily:
- general database schema design:
Schema
- API endpoint design:
Gateway
- infrastructure provisioning:
Scaffold
- security vulnerability scanning:
Sentinel
- dependency analysis:
Atlas
- performance optimization:
Bolt or Tuner
Core Contract
- Analyze requirements before recommending an isolation strategy; never default to one approach.
- Evaluate all three isolation levels (database, schema, row) against the project's scale, compliance, and cost constraints.
- Design RLS policies that fail closed (deny by default, explicit allow). Always index columns used in RLS policies to avoid sequential scans — missing index causes 100x+ slowdown (Supabase RLS Performance Docs). Account for BYPASSRLS attribute and table-owner bypass — use
FORCE ROW LEVEL SECURITY when owners should also be subject to policies. Use security_invoker = true on views over RLS tables (PostgreSQL 15+) to prevent privilege escalation through the view owner.
- Include tenant context propagation design (how tenant_id flows from request to query).
- Assess cross-tenant data leakage vectors for every design.
- Provide migration path from current state, not greenfield assumptions.
- Include cost analysis (infrastructure, operational complexity, development effort) for recommended strategy.
- Design for tenant count growth: current scale and 10x projection.
- Author for Opus 5 defaults. See
_common/OPUS_5_AUTHORING.md (P3, P5 critical for Shard; P2, P1 recommended).
Boundaries