Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Database schema patterns for InsForge including social graphs, e-commerce, content publishing, and multi-tenancy with RLS policies. Use when designing data models with relationships, foreign keys, or Row Level Security.
.claude/skills/microck-insforge-schema-patterns/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 55% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 30% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 174% | 0% |
Expert patterns for designing PostgreSQL schemas optimized for InsForge's PostgREST backend.
Use when: Building social features like Twitter, Instagram, LinkedIn connections
Schema:
sqlCREATE TABLE follows ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), follower_id UUID REFERENCES users(id) ON DELETE CASCADE, following_id UUID REFERENCES users(id) ON DELETE CASCADE, created_at TIMESTAMPTZ DEFAULT NOW(), UNIQUE(follower_id, following_id) ); -- Index for fast lookups CREATE INDEX idx_follows_follower ON follows(follower_id); CREATE INDEX idx_follows_following ON follows(following_id); -- RLS: Users can read all follows but only create their own ALTER TABLE follows ENABLE ROW LEVEL SECURITY; CREATE POLICY "Anyone can read follows" ON follows FOR SELECT USING (true); CREATE POLICY "Users can follow others" ON follows FOR INSERT TO authenticated WITH CHECK (uid() = follower_id); CREATE POLICY "Users can unfollow" ON follows FOR DELETE TO authenticated USING (uid() = follower_id);
Query with InsForge SDK:
javascript// Get users I follow with their profiles const { data: following } = await client.database .from('follows') .select('*, following:following_id(id, nickname, avatar_url, bio)') .eq('follower_id', currentUserId); // Get my followers const { data: followers } = await client.database .from('follows') .select('*, follower:follower_id(id, nickname, avatar_url, bio)') .eq('following_id', currentUserId); // Check if user1 follows user2 const { data: isFollowing } = await client.database .from('follows') .select() .eq('follower_id', user1Id) .eq('following_id', user2Id) .single(); // Follow a user await client.database .from('follows') .insert([{ follower_id: currentUserId, following_id: targetUserId }]);
Use when: Users can like posts, comments, or other content
Schema:
sqlCREATE TABLE likes ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id UUID REFERENCES users(id) ON DELETE CASCADE, post_id UUID REFERENCES posts(id) ON DELETE CASCADE, created_at TIMESTAMPTZ DEFAULT NOW(), UNIQUE(user_id, post_id) -- Prevent duplicate likes ); CREATE INDEX idx_likes_post ON likes(post_id); CREATE INDEX idx_likes_user ON likes(user_id); ALTER TABLE likes ENABLE ROW LEVEL SECURITY; CREATE POLICY "Anyone can read likes" ON likes FOR SELECT USING (true); CREATE POLICY "Users can like posts" ON likes FOR INSERT TO authenticated WITH CHECK (uid() = user_id); CREATE POLICY "Users can unlike their likes" ON likes FOR DELETE TO authenticated USING (uid() = user_id);
Query with InsForge SDK:
javascript// Get post with like count and whether current user liked it const { data: post } = await client.database .from('posts') .select(` *, likes(count), user_like:likes!inner(id, user_id) `) .eq('id', postId) .eq('user_like.user_id', currentUserId) .single(); // Like a post await client.database .from('likes') .insert([{ user_id: currentUserId, post_id: postId }]); // Unlike a post await client.database .from('likes') .delete() .eq('user_id', currentUserId) .eq('post_id', postId);
Use when: Building comment threads, nested replies
Schema:
sqlCREATE TABLE comments ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), post_id UUID REFERENCES posts(id) ON DELETE CASCADE, user_id UUID REFERENCES users(id) ON DELETE CASCADE, parent_comment_id UUID REFERENCES comments(id) ON DELETE CASCADE, content TEXT NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW(), updated_at TIMESTAMPTZ DEFAULT NOW() ); CREATE INDEX idx_comments_post ON comments(post_id); CREATE INDEX idx_comments_parent ON comments(parent_comment_id); ALTER TABLE comments ENABLE ROW LEVEL SECURITY; CREATE POLICY "Anyone can read comments" ON comments FOR SELECT USING (true); CREATE POLICY "Authenticated users can comment" ON comments FOR INSERT TO authenticated WITH CHECK (uid() = user_id); CREATE POLICY "Users can edit their comments" ON comments FOR UPDATE TO authenticated USING (uid() = user_id) WITH CHECK (uid() = user_id); CREATE POLICY "Users can delete their comments" ON comments FOR DELETE TO authenticated USING (uid() = user_id);
Query with InsForge SDK:
javascript// Get top-level comments with author info const { data: comments } = await client.database .from('comments') .select('*, author:user_id(nickname, avatar_url)') .eq('post_id', postId) .is('parent_comment_id', null) .order('created_at', { ascending: false }); // Get replies to a comment const { data: replies } = await client.database .from('comments') .select('*, author:user_id(nickname, avatar_url)') .eq('parent_comment_id', commentId) .order('created_at', { ascending: true });
Use when: Building SaaS apps where data is scoped to organizations/workspaces
Schema:
sqlCREATE TABLE organizations ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), name TEXT NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW() ); CREATE TABLE organization_members ( organization_id UUID REFERENCES organizations(id) ON DELETE CASCADE, user_id UUID REFERENCES users(id) ON DELETE CASCADE, role TEXT NOT NULL CHECK (role IN ('owner', 'admin', 'member')), joined_at TIMESTAMPTZ DEFAULT NOW(), PRIMARY KEY (organization_id, user_id) ); CREATE TABLE projects ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), organization_id UUID REFERENCES organizations(id) ON DELETE CASCADE, name TEXT NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW() ); -- RLS: Users can only see projects in their organizations ALTER TABLE projects ENABLE ROW LEVEL SECURITY; CREATE POLICY "Users see org projects" ON projects FOR SELECT TO authenticated USING ( organization_id IN ( SELECT organization_id FROM organization_members WHERE user_id = uid() ) ); CREATE POLICY "Admins can create projects" ON projects FOR INSERT TO authenticated WITH CHECK ( organization_id IN ( SELECT organization_id FROM organization_members WHERE user_id = uid() AND role IN ('owner', 'admin') ) );
table:column(fields)table(count)nested_table!inner() for inner join behavior.single() on queries that might return multiple rows → Errors| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 17,418 | 11,695 | -33% | 1 | 1 | 0% | 3,720 | 4,407 | +18% | 0 | 0 | — |
case-02 | fail→pass | 16,591 | 10,022 | -40% | 1 | 1 | 0% | 3,309 | 3,904 | +18% | 0 | 0 | — |
case-03 | fail→pass | 16,348 | 14,441 | -12% | 1 | 1 | 0% | 3,339 | 5,182 | +55% | 0 | 0 | — |
case-04 | fail→pass | 11,787 | 4,902 | -58% | 1 | 1 | 0% | 2,236 | 2,902 | +30% | 0 | 0 | — |
case-05 | pass→pass | 10,768 | 7,433 | -31% | 1 | 1 | 0% | 1,907 | 3,423 | +79% | 0 | 0 | — |
case-06 | fail→fail | 15,742 | 10,843 | -31% | 1 | 1 | 0% | 2,254 | 3,975 | +76% | 0 | 0 | — |
case-07 | pass→pass | 10,494 | 5,833 | -44% | 1 | 1 | 0% | 1,721 | 2,907 | +69% | 0 | 0 | — |
case-08 | fail→pass | 5,280 | 4,187 | -21% | 1 | 1 | 0% | 1,004 | 2,747 | +174% | 0 | 0 | — |
case-09 | fail→pass | 7,142 | 3,425 | -52% | 1 | 1 | 0% | 1,131 | 2,623 | +132% | 0 | 0 | — |
case-10 | pass→pass | 13,133 | 10,749 | -18% | 1 | 1 | 0% | 2,317 | 3,986 | +72% | 0 | 0 | — |
case-11 | pass→pass | 15,217 | 13,203 | -13% | 1 | 1 | 0% | 2,429 | 4,084 | +68% | 0 | 0 | — |
case-12 | pass→pass | 13,250 | 8,992 | -32% | 1 | 1 | 0% | 2,299 | 2,948 | +28% | 0 | 0 | — |
case-13 | pass→pass | 8,667 | 8,586 | -1% | 1 | 1 | 0% | 1,469 | 3,530 | +140% | 0 | 0 | — |
case-14 | pass→pass | 4,961 | 3,541 | -29% | 1 | 1 | 0% | 912 | 2,634 | +189% | 0 | 0 | — |
case-15 | pass→pass | 7,939 | 4,869 | -39% | 1 | 1 | 0% | 1,347 | 2,809 | +109% | 0 | 0 | — |
case-16 | pass→pass | 4,981 | 4,099 | -18% | 1 | 1 | 0% | 865 | 2,654 | +207% | 0 | 0 | — |
case-17 | fail→pass | 6,886 | 3,743 | -46% | 1 | 1 | 0% | 1,163 | 2,495 | +115% | 0 | 0 | — |
case-18 | pass→pass | 8,345 | 7,045 | -16% | 1 | 1 | 0% | 1,420 | 3,176 | +124% | 0 | 0 | — |
case-19 | fail→fail | 12,102 | 5,517 | -54% | 1 | 1 | 0% | 1,200 | 2,909 | +142% | 0 | 0 | — |
case-20 | pass→pass | 11,768 | 10,639 | -10% | 1 | 1 | 0% | 2,113 | 3,928 | +86% | 0 | 0 | — |
case-21 | pass→pass | 5,898 | 4,006 | -32% | 1 | 1 | 0% | 1,004 | 2,607 | +160% | 0 | 0 | — |
case-22 | pass→pass | 16,644 | 12,903 | -22% | 1 | 1 | 0% | 2,461 | 4,257 | +73% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +32 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.