From lidlift-mcp
Analyze whether 'gh repo clone' is the right tool before cloning GitHub repositories. Use when the user wants to clone, download, or get a local copy of a GitHub repository, even if they don't explicitly say "clone" (e.g., "get the code from anthropics/skills", "I need a local copy of that repo", "download the repository to work on it"). This skill scores tool-prompt alignment, detects mismatches (e.g., clone when user only wants to read a file), and suggests safer alternatives like 'gh repo view' or 'gh api' when appropriate. DO NOT trigger for: viewing repo metadata, reading individual files, searching code, or fork/pull request operations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lidlift-mcp:gh-repo-cloneThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Prevent misuse of `gh repo clone` by analyzing tool-prompt fit before execution. This skill demonstrates LidLift's tool-dissonance analysis—a launch-ready product that scores alignment, detects destructive mismatches, and ranks safer alternatives.
Prevent misuse of gh repo clone by analyzing tool-prompt fit before execution. This skill demonstrates LidLift's tool-dissonance analysis—a launch-ready product that scores alignment, detects destructive mismatches, and ranks safer alternatives.
Use this skill when a prompt involves:
DO NOT use this skill for:
gh repo view)gh api or GitHub web interface)gh search)gh repo clone creates a local directory and downloads all repository history. If the user only needs to inspect one file, recommend gh api or gh repo view instead.Phase 1: Parse Intent
Phase 2: Score Tool-Prompt Fit
1 - (lexical×0.35 + domain×0.4 + operation×0.25)Phase 3: Detect Destructive Mismatches
Phase 4: Recommend Action
gh repo clone| User Intent | Wrong Tool | Right Tool | Reason |
|---|---|---|---|
| View README | gh repo clone | gh repo view owner/repo | Read-only, no local state |
| Read one file | gh repo clone | gh api repos/owner/repo/contents/path | Fetches single file |
| Check repo info | gh repo clone | gh repo view owner/repo --json | Metadata only |
| Search code | gh repo clone | gh search code --repo owner/repo | No download needed |
| Fork for PR | gh repo clone | gh repo fork owner/repo --clone | Creates fork + clone |
Prompt: "Show me the README from the anthropics/skills repo"
Analysis:
Recommendation: "Gate this tool behind review and provide a better-matched option."
Better Alternative:
gh repo view anthropics/skills --web
# Opens README in browser, read-only
Prompt: "Clone the anthropics/skills repo so I can try the examples locally"
Analysis:
Recommendation: "This tool is a reasonable fit for the prompt."
Action: Proceed with clone
gh repo clone anthropics/skills
cd skills
# Ready to work with examples
Prompt: "Get me the code from the LidLift repo"
Analysis:
Recommendation: "Gate this tool behind review and provide a better-matched option."
Better Approach: Ask for clarification
Do you want to:
1. Clone the repository to work on it locally? → gh repo clone
2. View the repository structure and files? → gh repo view --web
3. Read a specific file? → gh api repos/.../contents/...
This skill demonstrates two MCP tools from the full LidLift product:
analyze_tool_fitScore how well a single tool matches a prompt and identify mismatches before execution.
Input:
prompt (string): The user's requesttool (ToolCandidate): Tool metadata including name, description, category, operationMode, capabilities, tagsOutput:
alignmentScore (0-1): How well the tool matches the promptdissonanceScore (0-1): Inverse of alignment (1 = complete mismatch)riskLevel: low | moderate | high | criticalrecommendation: Human-readable guidancesignals: Detailed explanation of scoring factorsmatchedDomains, mismatchedDomains, matchedOperations, conflictingOperationsrank_toolsRank a catalog of tools by dissonance for a given prompt and return the safest candidate first.
Input:
prompt (string): The user's requesttools (ToolCandidate[]): Array of candidate tools (max 50)Output:
best (AnalysisResult | null): Lowest dissonance toolranked (AnalysisResult[]): All tools sorted by dissonance (ascending)import { analyzeToolFit } from "@tool-dissonance/core";
const result = analyzeToolFit({
prompt: "Show me the README from anthropics/skills",
tool: {
name: "gh_repo_clone",
description: "Clone a GitHub repository to local machine",
category: "git",
operationMode: "write",
capabilities: ["clone repository", "create local copy"],
tags: ["github", "git", "clone"],
},
});
console.log(result);
// {
// dissonanceScore: 0.65,
// riskLevel: "moderate",
// recommendation: "Gate this tool behind review...",
// signals: [
// { label: "Write-risk mismatch", impact: "negative", ... },
// { label: "Domain match", impact: "positive", ... }
// ],
// ...
// }
// Using LidLift MCP server (Cloudflare Worker)
const response = await fetch("https://your-worker.workers.dev/mcp", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
method: "tools/call",
params: {
name: "rank_tools",
arguments: {
prompt: "Get me a local copy of the anthropics/skills repo",
tools: [
{
name: "gh_repo_clone",
description: "Clone repository to local machine",
operationMode: "write",
// ...
},
{
name: "gh_repo_view",
description: "View repository details without cloning",
operationMode: "read",
// ...
},
{
name: "gh_api",
description: "Fetch repository data via GitHub API",
operationMode: "read",
// ...
}
]
}
},
id: 1
})
});
const { result } = await response.json();
console.log(result.best.tool.name); // "gh_repo_clone" (12% dissonance)
console.log(result.ranked.map(r => r.tool.name));
// ["gh_repo_clone", "gh_repo_view", "gh_api"]
import requests
def should_execute_clone(prompt: str) -> dict:
"""Check if gh repo clone is safe for the given prompt."""
response = requests.post(
"https://your-worker.workers.dev/mcp",
json={
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "analyze_tool_fit",
"arguments": {
"prompt": prompt,
"tool": {
"name": "gh_repo_clone",
"description": "Clone a GitHub repository to local machine",
"category": "git",
"operationMode": "write",
"capabilities": ["clone repository", "create local copy"],
"tags": ["github", "git", "clone"]
}
}
},
"id": 1
}
)
result = response.json()["result"]["structuredContent"]
return {
"safe_to_execute": result["dissonanceScore"] < 0.3,
"risk_level": result["riskLevel"],
"recommendation": result["recommendation"],
"alternative": suggest_alternative(result) if result["dissonanceScore"] > 0.3 else None
}
# Usage
check = should_execute_clone("Show me the README from anthropics/skills")
print(check)
# {
# "safe_to_execute": False,
# "risk_level": "moderate",
# "recommendation": "Gate this tool behind review...",
# "alternative": "gh repo view anthropics/skills"
# }
| User Says | Dissonance | Action | Command |
|---|---|---|---|
| "Clone the repo for local dev" | Low (12%) | ✅ Proceed | gh repo clone owner/repo |
| "Get me a local copy to work on" | Low (18%) | ✅ Proceed | gh repo clone owner/repo |
| "Download the repository" | Low (22%) | ✅ Proceed | gh repo clone owner/repo |
| "Show me the code" | Moderate (42%) | ⚠️ Clarify | Ask: clone or view? |
| "Get the code from that repo" | Moderate (45%) | ⚠️ Clarify | Ask: clone or view? |
| "Show me the README" | High (65%) | ❌ Block | gh repo view --web |
| "What's in the config file?" | High (72%) | ❌ Block | gh api repos/.../contents/config |
| "View the repo structure" | Critical (88%) | ❌ Block | gh repo view or GitHub web |
Dissonance Score Ranges:
├─ 0-30% → Low risk → Proceed with clone
├─ 30-45% → Moderate risk → Suggest review or ask clarification
├─ 45-75% → High risk → Recommend safer alternative
└─ 75-100% → Critical risk → Block execution, redirect to read-only tool
Destructive Mismatch Override:
└─ If READ intent + WRITE tool → Automatic "Critical" risk
Alignment = (lexical_overlap × 0.35) + (domain_alignment × 0.4) + (operation_alignment × 0.25)
- mismatch_penalty - destructive_penalty + domain_match_bonus
Where:
- lexical_overlap = Jaccard similarity of prompt tokens vs. tool tokens
- domain_alignment = Matched domains / total unique domains
- operation_alignment = Matched operations / total unique operations
- mismatch_penalty = 0.12 if mismatched domains exist
- destructive_penalty = 0.25 if READ prompt + WRITE tool
- domain_match_bonus = 0.05 if any domain matches
Dissonance = 1 - Alignment
LidLift is a launch-ready tool-dissonance product for MCP stacks. It prevents costly misexecutions by scoring prompt-to-tool fit before agents invoke tools.
packages/core: Shared heuristics, schemas, and analysis engineapps/web: Next.js operator console (Vercel) with live preview and ranked resultsworkers/mcp: Cloudflare Worker exposing remote MCP tools on /mcpPOST /api/analyze: Deterministic ranking + optional AI Gateway narrativeGET /api/health: Web readiness checksPOST /mcp: Remote MCP transport (HTTP streaming)Local Development:
git clone https://github.com/your-org/lidlift
cd lidlift
pnpm install
pnpm dev:web # Start Next.js console
pnpm dev:mcp # Start MCP server
Deploy to Production:
apps/web, add AI_GATEWAY_API_KEY and NEXT_PUBLIC_MCP_SERVER_URLpnpm --filter mcp deploy, use resulting URLIntegrate via MCP:
# Add to your MCP client config
{
"mcpServers": {
"lidlift": {
"url": "https://your-worker.workers.dev/mcp",
"transport": "http"
}
}
}
/README.md in the LidLift repository/packages/core/src/analyze.ts/packages/core/src/catalog.ts/apps/web/app/api//workers/mcp/src/index.tsApache-2.0
This skill is a demonstration of LidLift's capabilities. To contribute to the full product or report issues, see the LidLift repository.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub igor-holt/lidlift-mcp --plugin lidlift-mcp