Skip to main content
ClaudeWave
Slash Command1.2k repo starsupdated 3mo ago

instinct-import

The instinct-import command imports instincts (behavioral patterns and preferences) from local files or URLs into a Claude project or global scope. Use this when adopting team coding standards, consolidating instincts across projects, or applying external best practice configurations. The command validates instincts, detects duplicates, and merges based on confidence scores, with optional dry-run and force modes.

Install in Claude Code
Copy
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/xu-xiang/everything-claude-code-zh/HEAD/commands/instinct-import.md -o ~/.claude/commands/instinct-import.md
Then start a new Claude Code session; the slash command loads automatically.

instinct-import.md

# 直觉导入命令(Instinct Import Command)

## 实现 (Implementation)

使用插件根路径运行直觉(Instinct)命令行工具(CLI):

```bash
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" import <file-or-url> [--dry-run] [--force] [--min-confidence 0.7] [--scope project|global]
```

或者如果未设置 `CLAUDE_PLUGIN_ROOT`(手动安装):

```bash
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file-or-url>
```

从本地文件路径或 HTTP(S) URL 导入直觉。

## 用法 (Usage)

```
/instinct-import team-instincts.yaml
/instinct-import https://github.com/org/repo/instincts.yaml
/instinct-import team-instincts.yaml --dry-run
/instinct-import team-instincts.yaml --scope global --force
```

## 执行流程 (What to Do)

1. 获取直觉文件(本地路径或 URL)
2. 解析并验证格式
3. 检查现有直觉是否重复
4. 合并或添加新直觉
5. 保存到继承的直觉目录:
   - 项目作用域(Project scope):`~/.claude/homunculus/projects/<project-id>/instincts/inherited/`
   - 全局作用域(Global scope):`~/.claude/homunculus/instincts/inherited/`

## 导入过程 (Import Process)

```
📥 正在导入直觉,来源:team-instincts.yaml
================================================

发现 12 条待导入的直觉。

正在分析冲突...

## 新直觉 (New Instincts) (8)
这些将被添加:
  ✓ use-zod-validation (置信度: 0.7)
  ✓ prefer-named-exports (置信度: 0.65)
  ✓ test-async-functions (置信度: 0.8)
  ...

## 重复直觉 (Duplicate Instincts) (3)
已存在类似的直觉:
  ⚠️ prefer-functional-style
     本地: 0.8 置信度, 12 条观测记录
     导入: 0.7 置信度
     → 保留本地 (置信度更高)

  ⚠️ test-first-workflow
     本地: 0.75 置信度
     导入: 0.9 置信度
     → 更新为导入版本 (置信度更高)

导入 8 条新直觉,更新 1 条?
```

## 合并行为 (Merge Behavior)

导入具有现有 ID 的直觉时:
- 较高置信度的导入项将成为更新候选。
- 相同或较低置信度的导入项将被跳过。
- 除非使用 `--force`,否则需用户确认。

## 来源追踪 (Source Tracking)

导入的直觉会被标记为:
```yaml
source: inherited
scope: project
imported_from: "team-instincts.yaml"
project_id: "a1b2c3d4e5f6"
project_name: "my-project"
```

## 参数列表 (Flags)

- `--dry-run`: 预览而不实际导入。
- `--force`: 跳过确认提示。
- `--min-confidence <n>`: 仅导入高于置信度阈值的直觉。
- `--scope <project|global>`: 选择目标作用域(默认为 `project`)。

## 输出结果 (Output)

导入完成后:
```
✅ 导入完成!

添加:8 条直觉
更新:1 条直觉
跳过:3 条直觉 (已存在相同或更高置信度的直觉)

新直觉已保存至:~/.claude/homunculus/instincts/inherited/

运行 /instinct-status 查看所有直觉。
```
api-designSkill

生产级 API 的 REST API 设计模式,包括资源命名、状态码、分页、过滤、错误响应、版本控制和速率限制。

article-writingSkill

编写文章、指南、博客、教程、时事通讯(Newsletter)等长内容,支持从示例或品牌指南中提取独特的语感语调。适用于需要撰写超过一个段落的精炼文本,尤其是对语气一致性、结构和可信度有较高要求时。

backend-patternsSkill

后端架构模式、API 设计、数据库优化以及 Node.js、Express 和 Next.js API 路由的服务端最佳实践。

coding-standardsSkill

TypeScript、JavaScript、React、Node.js 开发的通用编码标准、最佳实践和模式。

content-engineSkill

为 X、LinkedIn、TikTok、YouTube、时事通讯(Newsletters)以及跨平台内容重加工营销活动(Repurposed multi-platform campaigns)创建平台原生的内容系统。当用户需要社交媒体帖子、推文串(Threads)、脚本、内容日历,或将单一源素材清晰地适配到多个平台时使用。

e2e-testingSkill

Playwright E2E 测试模式、页面对象模型(POM)、配置、CI/CD 集成、产物管理以及不稳定测试(flaky test)策略。

eval-harnessSkill

适用于 Claude Code 会话的正规评测框架(Evaluation Framework),实现了评测驱动开发(Eval-Driven Development, EDD)原则

frontend-patternsSkill

React、Next.js、状态管理(State Management)、性能优化(Performance Optimization)及 UI 最佳实践的前端开发模式。