linear-local-dev-loop
Linearのローカル開発環境をセットアップし、テストワークフローを構築します。ローカルでの開発設定、統合テスト、またはLinearを使用した開発ワークフローのセットアップが必要な場合に使用してください。「linear local development」「linear dev setup」「test linear locally」「linear development environment」といったフレーズでトリガーされます。
description の原文を見る
Set up local Linear development environment and testing workflow. Use when configuring local development, testing integrations, or setting up a development workflow with Linear. Trigger with phrases like "linear local development", "linear dev setup", "test linear locally", "linear development environment".
SKILL.md 本文
Linear ローカル開発ループ
概要
Linear インテグレーション用の効率的なローカル開発ワークフローを構築します。
前提条件
- Node.js 18 以上と TypeScript
- Linear SDK がインストール済み
- 開発用の独立した Linear ワークスペース(推奨)
- ngrok またはこれに類するツール(Webhook テスト用)
手順
Step 1: プロジェクトセットアップ
# プロジェクトを初期化
mkdir linear-integration && cd linear-integration
npm init -y
npm install @linear/sdk typescript ts-node dotenv
npm install -D @types/node vitest
# tsconfig.json を作成
npx tsc --init --target ES2022 --module NodeNext --moduleResolution NodeNext
Step 2: 環境構成
# ローカル開発用の .env を作成
cat > .env << 'EOF'
LINEAR_API_KEY=lin_api_dev_xxxxxxxxxxxx
LINEAR_WEBHOOK_SECRET=your_webhook_secret
NODE_ENV=development
EOF
# .env.example を作成(こちらをコミット)
cat > .env.example << 'EOF'
LINEAR_API_KEY=lin_api_xxxxxxxxxxxx
LINEAR_WEBHOOK_SECRET=
NODE_ENV=development
EOF
# .gitignore に追加
echo ".env" >> .gitignore
echo ".env.local" >> .gitignore
Step 3: 開発用クライアントの作成
// src/client.ts
import { LinearClient } from "@linear/sdk";
import dotenv from "dotenv";
dotenv.config();
export const linearClient = new LinearClient({
apiKey: process.env.LINEAR_API_KEY!,
});
export async function verifyClient(): Promise<boolean> {
try {
const viewer = await linearClient.viewer;
console.log(`[Linear] Connected as ${viewer.name}`);
return true;
} catch (error) {
console.error("[Linear] Connection failed:", error);
return false;
}
}
Step 4: テスト用ユーティリティの作成
// src/test-utils.ts
import { linearClient } from "./client";
export async function createTestIssue(teamKey: string) {
const teams = await linearClient.teams();
const team = teams.nodes.find(t => t.key === teamKey);
if (!team) throw new Error(`Team ${teamKey} not found`);
const result = await linearClient.createIssue({
teamId: team.id,
title: `[TEST] ${new Date().toISOString()}`,
description: "Automated test issue - safe to delete",
});
return result.issue;
}
export async function cleanupTestIssues(teamKey: string) {
const issues = await linearClient.issues({
filter: {
team: { key: { eq: teamKey } },
title: { startsWith: "[TEST]" },
},
});
for (const issue of issues.nodes) {
await issue.delete();
}
console.log(`Cleaned up ${issues.nodes.length} test issues`);
}
Step 5: ウォッチモードの設定
// package.json scripts
{
"scripts": {
"dev": "ts-node --watch src/index.ts",
"test": "vitest",
"test:watch": "vitest --watch",
"verify": "ts-node src/verify.ts"
}
}
出力
- ローカル開発環境が準備完了
- 環境変数が構成済み
- テストデータを作成・削除するためのテスト用ユーティリティ
- 高速な反復開発のためのウォッチモード
エラーハンドリング
| エラー | 原因 | 解決方法 |
|---|---|---|
API key not set | .env ファイルが見つからない | .env.example を .env にコピーする |
Cannot find module | TypeScript の設定に問題がある | tsconfig.json のパスを確認する |
Connection refused | ネットワークの問題 | インターネット接続を確認する |
Webhook not received | トンネルが実行されていない | ngrok トンネルを起動する |
例
ngrok を使用した Webhook 開発
# ターミナル 1: Webhook サーバーを起動
npm run dev
# ターミナル 2: ngrok トンネルを起動
ngrok http 3000
# https URL をコピーして Linear の Webhook 設定に追加
インテグレーションテストの例
// tests/integration.test.ts
import { describe, it, expect, afterAll } from "vitest";
import { createTestIssue, cleanupTestIssues } from "../src/test-utils";
describe("Linear Integration", () => {
const teamKey = "ENG"; // テストチーム
afterAll(async () => {
await cleanupTestIssues(teamKey);
});
it("should create and fetch an issue", async () => {
const issue = await createTestIssue(teamKey);
expect(issue).toBeDefined();
expect(issue?.title).toContain("[TEST]");
});
});
リソース
次のステップ
ローカル開発のセットアップ後は、ベストプラクティスについて linear-sdk-patterns を参照してください。
ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ
詳細情報
- 作者
- Brmbobo
- リポジトリ
- Brmbobo/Web2podcast
- ライセンス
- MIT
- 最終更新
- 2026/1/26
Source: https://github.com/Brmbobo/Web2podcast / ライセンス: MIT
関連スキル
doubt-driven-development
重要な判断はすべて、本番環境への展開前に新しい視点から対抗的レビューを実施します。速度より正確性が重要な場合、不慣れなコードを扱う場合、本番環境・セキュリティに関わるロジック・取り消し不可の操作など影響度が高い場合、または後でバグを修正するよりも今検証する方が効率的な場合に活用してください。
apprun-skills
TypeScriptを使用したAppRunアプリケーションのMVU設計に関する総合的なガイダンスが得られます。コンポーネントパターン、イベントハンドリング、状態管理(非同期ジェネレータを含む)、パラメータと保護機能を備えたルーティング・ナビゲーション、vistestを使用したテストに対応しています。AppRunコンポーネントの設計・レビュー、ルートの配線、状態フローの管理、AppRunテストの作成時に活用してください。
desloppify
コードベースのヘルスチェックと技術負債の追跡ツールです。コード品質、技術負債、デッドコード、大規模ファイル、ゴッドクラス、重複関数、コードスメル、命名規則の問題、インポートサイクル、結合度の問題についてユーザーが質問した場合に使用してください。また、ヘルススコアの確認、次の改善項目の提案、クリーンアップ計画の作成をリクエストされた際にも対応します。29言語に対応しています。
debugging-and-error-recovery
テストが失敗したり、ビルドが壊れたり、動作が期待と異なったり、予期しないエラーが発生したりした場合に、体系的な根本原因デバッグをガイドします。推測ではなく、根本原因を見つけて修正するための体系的なアプローチが必要な場合に使用してください。
test-driven-development
テスト駆動開発により実装を進めます。ロジックの実装、バグの修正、動作の変更など、あらゆる場面で活用できます。コードが正常に動作することを証明する必要がある場合、バグ報告を受けた場合、既存機能を修正する予定がある場合に使用してください。
incremental-implementation
変更を段階的に実施します。複数のファイルに影響する機能や変更を実装する場合に使用してください。大量のコードを一度に書こうとしている場合や、タスクが一度では完結できないほど大きい場合に活用します。