multi-tenancy
Designs multi-tenant architecture: org scoping, row-level security and tenant data isolation. Use when designing or auditing how customers' data is kept separate.
- License 许可
- MIT
- 所属仓库
- vibbs/company-os
- 最近更新
- 2026-10-21
- Stars
- ★ 6
- Forks
- 2
01 前言 Front Matter
- name
- multi-tenancy
- runtimes
- { "claude": { "user-invocable": false } }
- description
- Designs multi-tenant architecture: org scoping, row-level security and tenant data isolation. Use when designing or auditing how customers' data is kept separate.
02 资源文件 15
- 其他bun.lock1.6 KB
- 脚本examples/comprehensive-test.ts13.0 KB
- 脚本examples/screenshot.ts1.8 KB
- 脚本examples/verify-page.ts2.4 KB
- 脚本index.ts22.7 KB
- 参考文档package.json323 B
- 参考文档README.md5.2 KB
- 脚本Tools/Browse.ts18.7 KB
- 脚本Tools/BrowserSession.ts13.8 KB
- 参考文档tsconfig.json404 B
- 参考文档Workflows/Extract.md2.3 KB
- 参考文档Workflows/Interact.md2.4 KB
- 参考文档Workflows/Screenshot.md1.2 KB
- 参考文档Workflows/Update.md2.1 KB
- 参考文档Workflows/VerifyPage.md1.9 KB
03 SKILL.md 正文
Multi-Tenancy
Reference
- ID: S-ENG-04
- Category: Engineering
- Inputs: data model, tenant boundaries, isolation requirements, compliance constraints
- Outputs: multi-tenancy design document → artifacts/engineering/
- Used by: Engineering Agent
- Tool scripts: ./tools/artifact/validate.sh
Purpose
Defines the architecture and conventions for multi-tenant data isolation, ensuring that tenant data is properly scoped, row-level security is enforced, and cross-tenant data leakage is prevented at every layer of the stack.
Procedure
Step 0: Multi-Tenancy Check
Read architecture.multi_tenant from company.config.yaml.
If false or absent: output "Multi-tenancy not configured for this project. Set architecture.multi_tenant: true in company.config.yaml to enable multi-tenant design patterns." and skip the remaining procedure.
If true: proceed with full multi-tenancy design.
Steps
- Define the tenant model: what constitutes a tenant (org, workspace, account).
- Choose the isolation strategy: shared database with RLS, schema-per-tenant, or database-per-tenant.
- Design the org-scoping layer: how every query is automatically scoped to the current tenant.
- Implement row-level security (RLS) policies at the database level.
- Define middleware/context propagation to carry tenant ID through the request lifecycle.
- Audit all data access paths to ensure no unscoped queries exist.
- Design tenant-aware caching: cache keys must include tenant ID.
- Define cross-tenant operation policies (admin access, data migration, support tooling).
- Document testing strategy: how to verify isolation in automated tests.
- Save the design document to
artifacts/engineering/. - Validate the artifact using
./tools/artifact/validate.sh.
Quality Checklist
- [ ] Tenant model is clearly defined with boundary rules
- [ ] RLS policies are applied to all tenant-scoped tables
- [ ] No unscoped queries exist in the codebase
- [ ] Cache keys include tenant ID
- [ ] Middleware propagates tenant context on every request
- [ ] Cross-tenant access is explicitly gated and audited
- [ ] Automated tests verify tenant isolation
- [ ] Artifact passes validation
04 同仓库更多 Skills
typo-field
Fixture skill with a misspelled top-level field.
spaced-comments
Fixture skill with comments and spaces after block keys.
crlf-comments
Fixture skill with Windows line endings.
claude-fields
Fixture skill using top-level fields Claude Code documents.
workflow-router
Maps an objective to the artifacts, stages and agents it needs. Use when deciding what happens next or which agents to involve.
weekly-review
Summarizes your week: what shipped, AI spend, support themes, security health and next priorities. Use at the end of each week.