Skip to main content Startseite Ersteller jeremylongshore tons-of-skills-marketplace linear-data-handling
linear-data-handling Data synchronization, backup, and consistency patterns for Linear.
Use when implementing data sync, creating backups, exporting data,
or ensuring data consistency between Linear and local state.
Trigger: "linear data sync", "backup linear", "linear export",
"linear data consistency", "sync linear issues".
Zur Installation springen Skills Marktplatz Entdecken und erkunden Sie KI-Skills, die von der Community erstellt wurden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Prompt kopierenPrompt-Details anzeigen Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace --skill linear-data-handlingDer Befehl bleibt in einer Zeile. Scrollen Sie horizontal, um ihn vor dem Kopieren vollständig zu prüfen.
Sie bevorzugen eine lokale Kopie? Laden Sie die Dateien herunter, die SkillsMP derzeit vorliegen.
ZIP herunterladen Herunterladen... Mehr aus diesem Repository langchain-deploy-integration Deploy a LangChain 1.0 / LangGraph 1.0 app to Cloud Run, Vercel, or LangServe correctly — with timeouts sized for chain length, cold-start mitigation, SSE anti-buffering headers, and Secret Manager over .env. Use when prepping a first production deploy, debugging a stream that hangs behind a proxy, or diagnosing p99 latency spikes. Trigger with "langchain deploy", "langchain cloud run", "langchain vercel python", "langchain langserve", or "langchain docker".
langchain-langgraph-agents Build a correct LangGraph 1.0 ReAct agent with create_react_agent — typed tools, error propagation, recursion caps, and stop conditions that actually stop. Use when writing a first tool-calling agent, migrating from AgentExecutor or initialize_agent, or diagnosing an agent that loops on vague prompts. Trigger with "langgraph agent", "create_react_agent", "langgraph tool calling", "AgentExecutor migration", or "agent loop cost".
langchain-langgraph-human-in-loop Build LangGraph 1.0 human-in-the-loop approval flows with interrupt_before /
interrupt_after and Command(resume=...) — JSON-serializable state, clean
resume semantics, and UI wiring for approval decisions. Use when adding an
approval gate before an expensive tool call, wiring a Slack/web UI for agent
approvals, or debugging a graph that crashes on interrupt.
Trigger with "langgraph human in loop", "langgraph interrupt_before",
"langgraph approval flow", "Command resume", "langgraph HITL".
name linear-data-handling description Data synchronization, backup, and consistency patterns for Linear.
Use when implementing data sync, creating backups, exporting data,
or ensuring data consistency between Linear and local state.
Trigger: "linear data sync", "backup linear", "linear export",
"linear data consistency", "sync linear issues".
allowed-tools Read, Write, Edit, Grep, Bash(node:*) version 1.12.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","linear","backup"] compatibility Designed for Claude Code
Linear Data Handling
Overview
Implement reliable data synchronization, backup, and consistency for Linear integrations. Covers full sync, incremental webhook sync, JSON/CSV export, consistency checks, and conflict resolution.
Prerequisites
@linear/sdk with API key configured
Database for local storage (any ORM — Drizzle, Prisma, Knex)
Understanding of eventual consistency
Instructions
Step 1: Data Model Schema
import { z } from "zod" ;
export const LinearIssueSchema = z.object ({
id : z.string ().uuid (),
identifier : z.string (),
title : z.string (),
description : z.string ().nullable (),
priority : z.number ().int ().min (0 ).max (4 ),
estimate : z.number ().nullable (),
stateId : z.string ().uuid (),
stateName : z.string (),
stateType : z.string (),
teamId : z.string ().uuid (),
teamKey : z.string (),
: z. (). (). (),
: z. (). (). (),
: z. (). (). (),
: z. (). (). (),
: z. (). (),
: z. (),
: z. (),
: z. (). (),
: z. (). (),
: z. (),
});
= z. < >;
assigneeId
string
uuid
nullable
projectId
string
uuid
nullable
cycleId
string
uuid
nullable
parentId
string
uuid
nullable
dueDate
string
nullable
createdAt
string
updatedAt
string
completedAt
string
nullable
canceledAt
string
nullable
syncedAt
string
export
type
LinearIssue
infer
typeof
LinearIssueSchema
Step 2: Full Sync Paginate through all issues, resolve relations, and upsert locally.
import { LinearClient } from "@linear/sdk" ;
interface SyncStats {
total : number ;
created : number ;
updated : number ;
deleted : number ;
errors : number ;
}
async function fullSync (client : LinearClient , teamKey : string ): Promise <SyncStats > {
const stats : SyncStats = { total : 0 , created : 0 , updated : 0 , deleted : 0 , errors : 0 };
const remoteIds = new Set <string >();
let cursor : string | undefined ;
let hasNext = true ;
while (hasNext) {
const result = await client.client .rawRequest (`
query FullSync($teamKey: String!, $cursor: String) {
issues(
first: 100,
after: $cursor,
filter: { team: { key: { eq: $teamKey } } },
orderBy: updatedAt
) {
nodes {
id identifier title description priority estimate
dueDate createdAt updatedAt completedAt canceledAt
state { id name type }
team { id key }
assignee { id }
project { id }
cycle { id }
parent { id }
}
pageInfo { hasNextPage endCursor }
}
}
` , { teamKey, cursor });
const issues = result.data .issues ;
for (const issue of issues.nodes ) {
remoteIds.add (issue.id );
stats.total ++;
try {
const mapped : LinearIssue = {
id : issue.id ,
identifier : issue.identifier ,
title : issue.title ,
description : issue.description ,
priority : issue.priority ,
estimate : issue.estimate ,
stateId : issue.state .id ,
stateName : issue.state .name ,
stateType : issue.state .type ,
teamId : issue.team .id ,
teamKey : issue.team .key ,
assigneeId : issue.assignee ?.id ?? null ,
projectId : issue.project ?.id ?? null ,
cycleId : issue.cycle ?.id ?? null ,
parentId : issue.parent ?.id ?? null ,
dueDate : issue.dueDate ,
createdAt : issue.createdAt ,
updatedAt : issue.updatedAt ,
completedAt : issue.completedAt ,
canceledAt : issue.canceledAt ,
syncedAt : new Date ().toISOString (),
};
const existing = await db.issues .findById (issue.id );
if (existing) {
await db.issues .update (issue.id , mapped);
stats.updated ++;
} else {
await db.issues .insert (mapped);
stats.created ++;
}
} catch (error) {
stats.errors ++;
console .error (`Error syncing ${issue.identifier} :` , error);
}
}
hasNext = issues.pageInfo .hasNextPage ;
cursor = issues.pageInfo .endCursor ;
if (hasNext) await new Promise (r => setTimeout (r, 100 ));
}
const localIds = await db.issues .listIds ({ teamKey });
for (const localId of localIds) {
if (!remoteIds.has (localId)) {
await db.issues .softDelete (localId);
stats.deleted ++;
}
}
console .log (`Full sync complete:` , stats);
return stats;
}
Step 3: Incremental Sync via Webhooks async function processWebhookSync (event : {
action: "create" | "update" | "remove" ;
type : string ;
data: any ;
} ) {
if (event.type !== "Issue" ) return ;
const syncedAt = new Date ().toISOString ();
switch (event.action ) {
case "create" :
await db.issues .insert ({
id : event.data .id ,
identifier : event.data .identifier ,
title : event.data .title ,
description : event.data .description ,
priority : event.data .priority ,
estimate : event.data .estimate ,
stateId : event.data .stateId ?? event.data .state ?.id ,
stateName : event.data .state ?.name ?? "Unknown" ,
stateType : event.data .state ?.type ?? "unknown" ,
teamId : event.data .teamId ?? event.data .team ?.id ,
teamKey : event.data .team ?.key ?? "" ,
assigneeId : event.data .assigneeId ?? null ,
projectId : event.data .projectId ?? null ,
cycleId : event.data .cycleId ?? null ,
parentId : event.data .parentId ?? null ,
dueDate : event.data .dueDate ?? null ,
createdAt : event.data .createdAt ,
updatedAt : event.data .updatedAt ,
completedAt : event.data .completedAt ?? null ,
canceledAt : event.data .canceledAt ?? null ,
syncedAt,
});
break ;
case "update" :
await db.issues .update (event.data .id , {
...event.data ,
syncedAt,
});
break ;
case "remove" :
await db.issues .softDelete (event.data .id );
break ;
}
}
Step 4: Data Export / Backup async function exportToJson (client : LinearClient , outputDir : string ) {
const timestamp = new Date ().toISOString ().replace (/[:.]/g , "-" );
const teams = await client.teams ();
const backup = {
exportedAt : new Date ().toISOString (),
version : "1.0" ,
teams : teams.nodes .map (t => ({ id : t.id , key : t.key , name : t.name })),
projects : [] as any [],
issues : [] as any [],
};
const projects = await client.projects ();
backup.projects = projects.nodes .map (p => ({
id : p.id , name : p.name , state : p.state ,
targetDate : p.targetDate , progress : p.progress ,
}));
for (const team of teams.nodes ) {
let cursor : string | undefined ;
let hasNext = true ;
while (hasNext) {
const result = await client.issues ({
first : 100 ,
after : cursor,
filter : { team : { id : { eq : team.id } } },
});
for (const issue of result.nodes ) {
backup.issues .push ({
id : issue.id ,
identifier : issue.identifier ,
title : issue.title ,
description : issue.description ,
priority : issue.priority ,
estimate : issue.estimate ,
createdAt : issue.createdAt ,
updatedAt : issue.updatedAt ,
});
}
hasNext = result.pageInfo .hasNextPage ;
cursor = result.pageInfo .endCursor ;
if (hasNext) await new Promise (r => setTimeout (r, 100 ));
}
}
const path = `${outputDir} /linear-backup-${timestamp} .json` ;
await fs.writeFile (path, JSON .stringify (backup, null , 2 ));
console .log (`Exported ${backup.issues.length} issues to ${path} ` );
}
Step 5: Consistency Check async function checkConsistency (client : LinearClient , teamKey : string ): Promise <{
missing : string [];
stale : string [];
orphaned : string [];
}> {
const remote = await client.issues ({
first : 50 ,
filter : { team : { key : { eq : teamKey } } },
orderBy : "updatedAt" ,
});
const missing : string [] = [];
const stale : string [] = [];
for (const issue of remote.nodes ) {
const local = await db.issues .findById (issue.id );
if (!local) {
missing.push (issue.identifier );
} else if (local.updatedAt < issue.updatedAt ) {
stale.push (issue.identifier );
}
}
const orphaned : string [] = [];
const localSample = await db.issues .findRecent (50 );
for (const local of localSample) {
try {
await client.issue (local.id );
} catch {
orphaned.push (local.identifier );
}
}
const result = { missing, stale, orphaned };
console .log (`Consistency check: ${missing.length} missing, ${stale.length} stale, ${orphaned.length} orphaned` );
if (missing.length > 10 || stale.length > 10 ) {
console .warn ("High inconsistency — triggering full sync" );
await fullSync (client, teamKey);
}
return result;
}
Step 6: Conflict Resolution type ConflictStrategy = "remote-wins" | "local-wins" | "merge" | "manual" ;
interface ConflictResult {
resolved : boolean ;
strategy : ConflictStrategy ;
winner : "local" | "remote" | "merged" ;
}
function resolveConflict (
local : LinearIssue ,
remote : any ,
strategy : ConflictStrategy ,
mergeFields ?: string []
): ConflictResult {
switch (strategy) {
case "remote-wins" :
db.issues .update (remote.id , { ...remote, syncedAt : new Date ().toISOString () });
return { resolved : true , strategy, winner : "remote" };
case "local-wins" :
return { resolved : true , strategy, winner : "local" };
case "merge" :
const merged = { ...local };
for (const field of mergeFields ?? ["title" , "priority" , "stateId" ]) {
(merged as any )[field] = remote[field];
}
merged.syncedAt = new Date ().toISOString ();
db.issues .update (remote.id , merged);
return { resolved : true , strategy, winner : "merged" };
case "manual" :
throw new Error (`Conflict on ${local.identifier} requires manual resolution` );
}
}
Error Handling Issue Cause Solution Sync timeout Too many records Use smaller page sizes, add delays Conflict detected Concurrent edits Apply conflict resolution strategy Stale data Missed webhook events Trigger full sync via consistency check Export failed Rate limit during backup Add 100ms delay between pagination calls Duplicate entries Webhook retry without dedup Deduplicate by Linear-Delivery header
Resources