Detect Foreign Keys

Identify foreign key relationships between tables using heuristics, value overlap analysis, and referential integrity checks

5 stars 2 forksOther Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add tilmon-engineering/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add tilmon-engineering/claude-skills --skill detect-foreign-keys
Manual install
git clone --depth 1 https://github.com/tilmon-engineering/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/plugins/datapeeker/skills/detect-foreign-keys ~/.claude/skills/detect-foreign-keys

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Detecting Foreign Keys

## Purpose

This component skill guides systematic foreign key relationship detection in relational databases. Use it when:
- Multiple tables exist in the database and relationships are undocumented
- Need to understand table relationships before joining data
- Validating referential integrity between tables
- Identifying orphaned records that reference non-existent parent records
- Referenced by importing-data or cleaning-data skills requiring relationship analysis

## Prerequisites

- Tables exist in database (relational database with SQL support)
- SQL query tool available (database CLI, IDE, or query interface)
- Table schemas have been examined (Phase 1 of understanding-data)
- Analysis workspace created

## Foreign Key Detection Process

Create a TodoWrite checklist for the 5-phase FK detection process:

```
Phase 1: Candidate Identification - pending
Phase 2: Value Overlap Analysis - pending
Phase 3: Cardinality Assessment - pending
Phase 4: Referential Integrity Validation - pending
Phase 5: Relationship Documentation - pending
```

Mark each phase as you complete it. Document all findings in structured format.

---

## Phase 1: Candidate Identification

**Goal:** Identify columns that are likely foreign keys based on naming patterns, data types, and uniqueness.

### Identify Candidate FK Columns by Naming Convention

**Common FK naming patterns:**
- Columns ending in `_id` (e.g., `customer_id`, `product_id`)
Read the full skill on GitHub

Details

Skill name
detect-foreign-keys
Path
plugins/datapeeker/skills/detect-foreign-keys/SKILL.md
License
MIT
Repo updated
22 May 2026

FAQ

What does the Detect Foreign Keys skill do?

Identify foreign key relationships between tables using heuristics, value overlap analysis, and referential integrity checks

How do I install the Detect Foreign Keys skill?

Claude Code plugin: /plugin marketplace add tilmon-engineering/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Detect Foreign Keys popular?

It lives in tilmon-engineering/claude-skills, which has 5 GitHub stars and 2 forks.

Related skills

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.