克劳德码的线性技巧
全面的 克劳德代码 管理线性问题、项目和团队的技能。为MCP工具、SDK自动化和GraphQL API访问提供模式。
特性
- esbuild预编译 --通过共享透明的tsx回退,CLI启动速度提高了18倍(~50ms对~1s)
scripts/run.sh - 标签分类系统 --基于域的标签,用于一致的分类和代理路由
- 首次设置检查 --具有可操作指导的自动配置验证
- 高层运营 --用于计划、项目和状态更新的简单命令
- 子问题管理 --创建和管理父子问题关系
- 创造前的发现 --强制检查以防止重复项目/问题
- MCP工具集成 --通过Linear MCP服务器进行简单操作
- SDK自动化 --使用TypeScript脚本的复杂操作
- GraphQL API -用于高级查询的直接API访问
- 项目管理 --内容、描述、里程碑、资源链接
- 批量同步 --通过CLI、代理或挂钩与Linear同步代码更改
- 图片上传 --将图像上传到Linear的S3存储并附加到问题
- 冒烟测试 --自动验证构建输出和CLI行为
linCLI集成 --可选快速通道 亚伦白/线性气候 带有静默SDK回退的Rust二进制文件
快速入门(新用户)
1.安装技能
git clone https://github.com/wrsmith108/linear-claude-skill ~/.claude/skills/linear
cd ~/.claude/skills/linear && npm install2.运行安装程序检查
npm run setup这会检查您的配置,并告诉您缺少什么。
3.获取API密钥(如果需要)
- 打开 线性 在浏览器中
- 首选 设置 → 安全和访问 → 个人API密钥
- 点击 创建密钥 并复制它(以开头
lin_api_) - 添加到您的环境中:
# Add to shell profile
echo 'export LINEAR_API_KEY="lin_api_your_key_here"' >> ~/.zshrc
source ~/.zshrc4.验证其是否有效
npm run ops -- whoami你应该看到你的名字和组织。
5.为更快的启动而构建(可选)
npm run build将TypeScript预编译为JavaScript,使CLI冷启动速度提高约18倍。没有构建,命令仍然通过tsx工作(速度较慢但功能齐全)。
6.开始使用它
# Create an initiative
npm run ops -- create-initiative "My Project"
# Create a project
npm run ops -- create-project "Phase 1" "My Project"
# Create a sub-issue under a parent
npm run ops -- create-sub-issue ENG-100 "Add tests" "Unit tests for feature"
# Set parent-child relationships for existing issues
npm run ops -- set-parent ENG-100 ENG-101 ENG-102
# Update issue status
npm run ops -- status Done ENG-123 ENG-124
# See all commands
npm run ops -- help______________________________________________________________________
安装
# Clone directly to your skills directory
git clone https://github.com/wrsmith108/linear-claude-skill ~/.claude/skills/linear
cd ~/.claude/skills/linear && npm install先决条件
- 线性API键 --线性生成→ 设置→ 安全和访问→ 个人API密钥
lin命令行界面 (可选)--更快地执行状态更新、搜索和列表:
brew install aaronkwhite/tap/lin # macOS (Homebrew)
cargo install lincli # Any platform with Rust集 LINEAR_USE_LIN=0 即使已安装,也要禁用。
- 线性MCP服务器 (推荐)--使用 官方Linear MCP服务器 为了获得最佳可靠性:
{
"mcpServers": {
"linear": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.linear.app/sse"],
"env": {
"LINEAR_API_KEY": "your_api_key"
}
}
}
}重要:始终使用Linear的官方MCP服务器mcp.linear.app请勿使用已弃用的社区服务器,例如linear-mcp-server(npm)或jerhadf/linear-mcp-server(GitHub)。
目录结构
linear-claude-skill/
├── SKILL.md # Main skill instructions (Claude Code discovers this)
├── api.md # GraphQL API reference
├── sdk.md # SDK automation patterns
├── sync.md # Bulk sync patterns
├── docs/
│ └── labels.md # Label taxonomy documentation
├── scripts/
│ ├── run.sh # Shared runner (dist/ with tsx fallback)
│ ├── build.mjs # esbuild pre-compilation script
│ ├── linear-ops.ts # High-level operations (issues, projects, labels)
│ ├── query.ts # GraphQL query runner
│ ├── setup.ts # Configuration checker
│ ├── sync.ts # Bulk sync CLI tool
│ ├── upload-image.ts # Upload images to Linear S3
│ ├── extract-image.ts # Extract images from session JSONL
│ ├── linear-api.mjs # Direct API wrapper
│ ├── __tests__/ # Smoke tests (Node built-in test runner)
│ └── lib/ # Shared utilities (taxonomy, labels, verification)
├── dist/ # Pre-compiled JS output (gitignored, in npm package)
└── hooks/
└── post-edit.sh # Auto-sync hook关键模式
创造前的发现(关键!)
在创建项目或问题之前,始终检查Linear。 这可以防止重复:
# Check for existing projects
linear projects list | grep -i "phase\|feature-name"
# Check for existing issues
linear issues list --filter "title:keyword"看 SKILL.md → 完整清单为“创建前的发现”。
工作前的代码库验证(至关重要!)
在接受问题范围之前,始终验证代码库状态。
问题描述可能已经过时或具有推测性。API或功能可能已经实现!
# Before starting "implement API" issues:
ls src/pages/api/admin/members/ # Check if files exist
grep -r "test.skip" tests/ # Check if tests are just skipped关键课程:描述“缺失”功能的问题可能已经实现。真正的工作通常是取消跳过测试和修复断言,而不是重新实现。
看 SKILL.md → 完整检查表为“工作前代码库验证”。
内容与描述(关键!)
Linear有两个文本字段——使用错误的字段会导致显示空白:
| 字段 | 限制 | 显示在 |
|---|---|---|
description | 255个字符 | 列表视图、工具提示 |
content | 无限制 | 主详图面板 |
创建项目时始终设置两者。
项目状态UUID
状态UUID为 特定工作空间。查询您的工作区:
query { projectStatuses { nodes { id name } } }常见状态: Backlog, Planned, In Progress, Completed, Canceled
子问题管理
将问题组织到父子层次结构中,以便更好地跟踪:
# Create a sub-issue under a parent issue
# Inherits team and project from parent automatically
npm run ops -- create-sub-issue
[description] [--priority 1-4] [--labels label1,label2]
# Set existing issues as children of a parent
npm run ops -- set-parent
...
# List all sub-issues of a parent
npm run ops -- list-sub-issues
何时使用子问题:
- 将功能分解为可跟踪的子任务
- 在功能问题下组织TDD/E2E测试问题
- 更大倡议中的顺序阶段
标签分类
一个标准化的标签系统,用于跨项目进行一致的问题分类:
# Show full taxonomy (25 labels across 3 categories)
npm run ops -- labels taxonomy
# Validate label combinations
npm run ops -- labels validate "feature,security,breaking-change"
# Suggest labels based on issue title
npm run ops -- labels suggest "Fix XSS vulnerability in login form"
# Show agent recommendations for labels
npm run ops -- labels agents "security,performance"标签类别:
- 类型 (只需要一个):
feature,bug,refactor,chore,spike - 领域 (1-2推荐):
security,backend,frontend,testing,infrastructure,mcp,cli等等。 - 范围 (0-2可选):
blocked,breaking-change,tech-debt,needs-split,good-first-issue
看 docs/labels.md 获取完整的分类指南。
资源链接
为项目/倡议添加可点击的链接:
mutation {
entityExternalLinkCreate(input: {
url: "https://github.com/wrsmith108/linear-claude-skill/blob/main/docs/phase-1.md",
label: "Implementation Doc",
projectId: ""
}) { success }
}项目里程碑
完成的跟踪定义:
mutation {
projectMilestoneCreate(input: {
projectId: "",
name: "DoD: Testing",
description: "Unit tests, E2E tests, 100% coverage"
}) { success }
}项目更新(状态报告)
将状态更新发布到项目的“更新”选项卡:
npm run ops -- create-project-update "Project Name" "## Update\n\nBody" --health onTrack健康选项: onTrack, atRisk, offTrack
看 SKILL.md 查看完整文档和GraphQL示例。
使用示例
创建问题(MCP)
Create a high priority issue titled "Fix authentication bug" in the ENG team更新项目状态(GraphQL)
mutation {
projectUpdate(id: "
", input: {
statusId: "" # Get from projectStatuses query
}) { success }
}批量操作(SDK)
看 sdk.md 用于循环、过滤和批量更新的TypeScript模式。
批量同步(新)
批量同步代码更改与线性问题:
# Update multiple issues to Done
npm run sync -- --issues ENG-432,ENG-433,ENG-434 --state Done
# Update project status after phase completion
npm run sync -- --project "Phase 11" --state completed
# Verify sync completed
npm run sync -- --verify ENG-432,ENG-433 --expected-state Done代理生成同步
通过任务工具生成并行代理进行自主同步:
Task({
description: "Sync Phase 11 to Linear",
prompt: "Update ENG-432,433,434 to Done. Update project to completed.",
subagent_type: "Linear-specialist"
})钩触发同步
代码编辑后自动建议同步。添加 .claude/settings.json:
{
"hooks": {
"PostToolUse": [{
"matcher": "Write|Edit",
"hooks": [{
"type": "command",
"command": "bash ~/.claude/skills/linear/hooks/post-edit.sh"
}]
}]
}
}看 sync.md 用于包括AgentDB集成在内的完整模式。
更新日志
2.6.3 (2026-04-08)
- 提取共享
scripts/run.sh--所有7个npm脚本现在都使用单个运行器,而不是重复的shell包装器 - 替换
2>/dev/null随着[ -f dist/X.js ]文件存在性检查,以便正确显示运行时错误 - 添加
f() { ...; }; f参数转发到所有npm脚本(由@aphexcx从PR#17中修复) - 为npm脚本参数转发添加烟雾测试
- 一致的
[WARN]所有脚本中的回退消息,包括sync
2.5.0 (2026-03-17)
- 合并的
requireClient()委托给getLinearClient()--单客户端单例 - 为构建输出、CLI行为和延迟客户端初始化添加了冒烟测试
- 已记录
__BUNDLED__构建时定义模式 - 扩展了esb构建回退模式
upload-image和extract-image脚本 - 缓冲SKILL.md版本以匹配package.json
2.4.0 (2026-03-04)
- 为添加了esbuild预编译 CLI启动速度提高18倍 (~50ms vs ~1s)
- 懒惰
getLinearClient()-SDK初始化延迟到第一个API调用 - 通过共享透明回退
scripts/run.sh - 移除
import.meta.urlCLI保护库文件 npm run作为所有文档中的规范调用形式- 具有构建验证和冒烟测试的CI工作流程
2.3.0 (2026-02-27)
- 添加
scripts/upload-image.ts和scripts/extract-image.ts用于图像管理
看 更改日志.md 查看完整版本历史记录。
发展
先决条件
- Node.js>=20.11.0(请参见
.nvmrc) - npm
快速开始
git clone https://github.com/wrsmith108/linear-claude-skill.git
cd linear-claude-skill
npm ci
npm test # builds and runs smoke tests (no API key needed)
npm run build # compile TypeScript to dist/贡献
欢迎投稿!请提交问题和PR以提高技能。
许可证
MIT许可证——见 许可证
学分
为Claude Code社区创建。通过实际项目管理工作流程开发的模式。
