mirror of
https://github.com/sweetwisdom/everything-claude-code-zh.git
synced 2026-03-21 22:10:09 +00:00
chore: sync with upstream e7cb442 + update zh translations
This commit is contained in:
@@ -1,144 +1,144 @@
|
||||
---
|
||||
name: evolve
|
||||
description: Cluster related instincts into skills, commands, or agents
|
||||
description: 将相关的直觉(Instincts)聚类为技能(Skills)、命令(Commands)或智能体(Agents)
|
||||
command: true
|
||||
---
|
||||
|
||||
# Evolve Command
|
||||
# Evolve 命令
|
||||
|
||||
## Implementation
|
||||
## 实现 (Implementation)
|
||||
|
||||
Run the instinct CLI using the plugin root path:
|
||||
使用插件根路径运行直觉(Instinct)命令行界面(CLI):
|
||||
|
||||
```bash
|
||||
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" evolve [--generate]
|
||||
```
|
||||
|
||||
Or if `CLAUDE_PLUGIN_ROOT` is not set (manual installation):
|
||||
或者如果未设置 `CLAUDE_PLUGIN_ROOT`(手动安装):
|
||||
|
||||
```bash
|
||||
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve [--generate]
|
||||
```
|
||||
|
||||
Analyzes instincts and clusters related ones into higher-level structures:
|
||||
- **Commands**: When instincts describe user-invoked actions
|
||||
- **Skills**: When instincts describe auto-triggered behaviors
|
||||
- **Agents**: When instincts describe complex, multi-step processes
|
||||
分析直觉(Instincts)并将相关的直觉聚类为更高级的结构:
|
||||
- **命令(Commands)**:当直觉描述用户调用的操作时
|
||||
- **技能(Skills)**:当直觉描述自动触发的行为时
|
||||
- **智能体(Agents)**:当直觉描述复杂的、多步骤的流程时
|
||||
|
||||
## Usage
|
||||
## 用法 (Usage)
|
||||
|
||||
```
|
||||
/evolve # Analyze all instincts and suggest evolutions
|
||||
/evolve --domain testing # Only evolve instincts in testing domain
|
||||
/evolve --dry-run # Show what would be created without creating
|
||||
/evolve --threshold 5 # Require 5+ related instincts to cluster
|
||||
/evolve # 分析所有直觉并建议演进方案
|
||||
/evolve --domain testing # 仅演进测试领域(testing domain)中的直觉
|
||||
/evolve --dry-run # 显示将要创建的内容而不实际创建
|
||||
/evolve --threshold 5 # 要求至少有 5 个以上的相关直觉才进行聚类
|
||||
```
|
||||
|
||||
## Evolution Rules
|
||||
## 演进规则 (Evolution Rules)
|
||||
|
||||
### → Command (User-Invoked)
|
||||
When instincts describe actions a user would explicitly request:
|
||||
- Multiple instincts about "when user asks to..."
|
||||
- Instincts with triggers like "when creating a new X"
|
||||
- Instincts that follow a repeatable sequence
|
||||
### → 命令 (Command)(用户调用)
|
||||
当直觉描述用户会明确请求的操作时:
|
||||
- 多个关于“当用户要求...”的直觉
|
||||
- 带有“当创建新的 X 时”等触发器的直觉
|
||||
- 遵循可重复序列的直觉
|
||||
|
||||
Example:
|
||||
示例:
|
||||
- `new-table-step1`: "when adding a database table, create migration"
|
||||
- `new-table-step2`: "when adding a database table, update schema"
|
||||
- `new-table-step3`: "when adding a database table, regenerate types"
|
||||
|
||||
→ Creates: `/new-table` command
|
||||
→ 创建:`/new-table` 命令
|
||||
|
||||
### → Skill (Auto-Triggered)
|
||||
When instincts describe behaviors that should happen automatically:
|
||||
- Pattern-matching triggers
|
||||
- Error handling responses
|
||||
- Code style enforcement
|
||||
### → 技能 (Skill)(自动触发)
|
||||
当直觉描述应该自动发生的行为时:
|
||||
- 模式匹配触发器
|
||||
- 错误处理响应
|
||||
- 代码风格强制执行
|
||||
|
||||
Example:
|
||||
示例:
|
||||
- `prefer-functional`: "when writing functions, prefer functional style"
|
||||
- `use-immutable`: "when modifying state, use immutable patterns"
|
||||
- `avoid-classes`: "when designing modules, avoid class-based design"
|
||||
|
||||
→ Creates: `functional-patterns` skill
|
||||
→ 创建:`functional-patterns` 技能(Skill)
|
||||
|
||||
### → Agent (Needs Depth/Isolation)
|
||||
When instincts describe complex, multi-step processes that benefit from isolation:
|
||||
- Debugging workflows
|
||||
- Refactoring sequences
|
||||
- Research tasks
|
||||
### → 智能体 (Agent)(需要深度/隔离)
|
||||
当直觉描述复杂的、多步骤的流程,且受益于隔离环境时:
|
||||
- 调试工作流(Workflow)
|
||||
- 重构序列
|
||||
- 研究任务
|
||||
|
||||
Example:
|
||||
示例:
|
||||
- `debug-step1`: "when debugging, first check logs"
|
||||
- `debug-step2`: "when debugging, isolate the failing component"
|
||||
- `debug-step3`: "when debugging, create minimal reproduction"
|
||||
- `debug-step4`: "when debugging, verify fix with test"
|
||||
|
||||
→ Creates: `debugger` agent
|
||||
→ 创建:`debugger` 智能体(Agent)
|
||||
|
||||
## What to Do
|
||||
## 操作步骤 (What to Do)
|
||||
|
||||
1. Read all instincts from `~/.claude/homunculus/instincts/`
|
||||
2. Group instincts by:
|
||||
- Domain similarity
|
||||
- Trigger pattern overlap
|
||||
- Action sequence relationship
|
||||
3. For each cluster of 3+ related instincts:
|
||||
- Determine evolution type (command/skill/agent)
|
||||
- Generate the appropriate file
|
||||
- Save to `~/.claude/homunculus/evolved/{commands,skills,agents}/`
|
||||
4. Link evolved structure back to source instincts
|
||||
1. 从 `~/.claude/homunculus/instincts/` 读取所有直觉(Instincts)
|
||||
2. 按以下维度对直觉进行分组:
|
||||
- 领域(Domain)相似性
|
||||
- 触发模式重合度
|
||||
- 操作序列关联性
|
||||
3. 对于每个包含 3 个及以上相关直觉的聚类:
|
||||
- 确定演进类型(命令/技能/智能体)
|
||||
- 生成相应的文件
|
||||
- 保存至 `~/.claude/homunculus/evolved/{commands,skills,agents}/`
|
||||
4. 将演进后的结构链接回原始直觉
|
||||
|
||||
## Output Format
|
||||
## 输出格式 (Output Format)
|
||||
|
||||
```
|
||||
🧬 Evolve Analysis
|
||||
🧬 演进分析 (Evolve Analysis)
|
||||
==================
|
||||
|
||||
Found 3 clusters ready for evolution:
|
||||
发现 3 个已准备好演进的聚类:
|
||||
|
||||
## Cluster 1: Database Migration Workflow
|
||||
Instincts: new-table-migration, update-schema, regenerate-types
|
||||
Type: Command
|
||||
Confidence: 85% (based on 12 observations)
|
||||
## 聚类 1:数据库迁移工作流 (Database Migration Workflow)
|
||||
直觉 (Instincts): new-table-migration, update-schema, regenerate-types
|
||||
类型: 命令 (Command)
|
||||
置信度: 85% (基于 12 次观察)
|
||||
|
||||
Would create: /new-table command
|
||||
Files:
|
||||
将创建: /new-table 命令
|
||||
文件:
|
||||
- ~/.claude/homunculus/evolved/commands/new-table.md
|
||||
|
||||
## Cluster 2: Functional Code Style
|
||||
Instincts: prefer-functional, use-immutable, avoid-classes, pure-functions
|
||||
Type: Skill
|
||||
Confidence: 78% (based on 8 observations)
|
||||
## 聚类 2:函数式代码风格 (Functional Code Style)
|
||||
直觉 (Instincts): prefer-functional, use-immutable, avoid-classes, pure-functions
|
||||
类型: 技能 (Skill)
|
||||
置信度: 78% (基于 8 次观察)
|
||||
|
||||
Would create: functional-patterns skill
|
||||
Files:
|
||||
将创建: functional-patterns 技能 (Skill)
|
||||
文件:
|
||||
- ~/.claude/homunculus/evolved/skills/functional-patterns.md
|
||||
|
||||
## Cluster 3: Debugging Process
|
||||
Instincts: debug-check-logs, debug-isolate, debug-reproduce, debug-verify
|
||||
Type: Agent
|
||||
Confidence: 72% (based on 6 observations)
|
||||
## 聚类 3:调试流程 (Debugging Process)
|
||||
直觉 (Instincts): debug-check-logs, debug-isolate, debug-reproduce, debug-verify
|
||||
类型: 智能体 (Agent)
|
||||
置信度: 72% (基于 6 次观察)
|
||||
|
||||
Would create: debugger agent
|
||||
Files:
|
||||
将创建: debugger 智能体 (Agent)
|
||||
文件:
|
||||
- ~/.claude/homunculus/evolved/agents/debugger.md
|
||||
|
||||
---
|
||||
Run `/evolve --execute` to create these files.
|
||||
运行 `/evolve --execute` 来创建这些文件。
|
||||
```
|
||||
|
||||
## Flags
|
||||
## 参数标志 (Flags)
|
||||
|
||||
- `--execute`: Actually create the evolved structures (default is preview)
|
||||
- `--dry-run`: Preview without creating
|
||||
- `--domain <name>`: Only evolve instincts in specified domain
|
||||
- `--threshold <n>`: Minimum instincts required to form cluster (default: 3)
|
||||
- `--type <command|skill|agent>`: Only create specified type
|
||||
- `--execute`: 实际创建演进后的结构(默认为预览)
|
||||
- `--dry-run`: 预览而不创建
|
||||
- `--domain <name>`: 仅演进指定领域(Domain)中的直觉
|
||||
- `--threshold <n>`: 形成聚类所需的最小直觉数量(默认值:3)
|
||||
- `--type <command|skill|agent>`: 仅创建指定类型
|
||||
|
||||
## Generated File Format
|
||||
## 生成的文件格式 (Generated File Format)
|
||||
|
||||
### Command
|
||||
### 命令 (Command)
|
||||
```markdown
|
||||
---
|
||||
name: new-table
|
||||
@@ -150,16 +150,16 @@ evolved_from:
|
||||
- regenerate-types
|
||||
---
|
||||
|
||||
# New Table Command
|
||||
# New Table 命令
|
||||
|
||||
[Generated content based on clustered instincts]
|
||||
[基于聚类直觉生成的正文内容]
|
||||
|
||||
## Steps
|
||||
## 步骤
|
||||
1. ...
|
||||
2. ...
|
||||
```
|
||||
|
||||
### Skill
|
||||
### 技能 (Skill)
|
||||
```markdown
|
||||
---
|
||||
name: functional-patterns
|
||||
@@ -170,12 +170,12 @@ evolved_from:
|
||||
- avoid-classes
|
||||
---
|
||||
|
||||
# Functional Patterns Skill
|
||||
# Functional Patterns 技能 (Skill)
|
||||
|
||||
[Generated content based on clustered instincts]
|
||||
[基于聚类直觉生成的正文内容]
|
||||
```
|
||||
|
||||
### Agent
|
||||
### 智能体 (Agent)
|
||||
```markdown
|
||||
---
|
||||
name: debugger
|
||||
@@ -187,7 +187,7 @@ evolved_from:
|
||||
- debug-reproduce
|
||||
---
|
||||
|
||||
# Debugger Agent
|
||||
# Debugger 智能体 (Agent)
|
||||
|
||||
[Generated content based on clustered instincts]
|
||||
[基于聚类直觉生成的正文内容]
|
||||
```
|
||||
|
||||
@@ -8,11 +8,11 @@ description: 增量修复 Go 构建错误、go vet 警告和 linter 问题。调
|
||||
|
||||
## 此命令的作用
|
||||
|
||||
1. **运行诊断**:执行 `go build`、`go vet`、`staticcheck`
|
||||
2. **解析错误**:按文件分组并按严重程度排序
|
||||
3. **增量修复**:一次修复一个错误
|
||||
4. **验证每次修复**:每次更改后重新运行构建
|
||||
5. **报告摘要**:显示已修复的内容和剩余的问题
|
||||
1. **运行诊断**:执行 `go build`、`go vet`、`staticcheck`
|
||||
2. **解析错误**:按文件分组并按严重程度排序
|
||||
3. **增量修复**:一次修复一个错误
|
||||
4. **验证每次修复**:每次更改后重新运行构建
|
||||
5. **报告摘要**:显示已修复的内容和剩余的问题
|
||||
|
||||
## 何时使用
|
||||
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
---
|
||||
name: instinct-export
|
||||
description: Export instincts for sharing with teammates or other projects
|
||||
description: 导出直觉(Instincts)以便与团队成员或其他项目共享
|
||||
command: /instinct-export
|
||||
---
|
||||
|
||||
# Instinct Export Command
|
||||
# 直觉导出(Instinct Export)命令
|
||||
|
||||
Exports instincts to a shareable format. Perfect for:
|
||||
- Sharing with teammates
|
||||
- Transferring to a new machine
|
||||
- Contributing to project conventions
|
||||
将直觉(Instincts)导出为可共享的格式。非常适用于:
|
||||
- 与团队成员共享
|
||||
- 迁移到新机器
|
||||
- 为项目规范(Conventions)贡献内容
|
||||
|
||||
## Usage
|
||||
## 用法
|
||||
|
||||
```
|
||||
/instinct-export # Export all personal instincts
|
||||
/instinct-export --domain testing # Export only testing instincts
|
||||
/instinct-export --min-confidence 0.7 # Only export high-confidence instincts
|
||||
/instinct-export # 导出所有个人直觉
|
||||
/instinct-export --domain testing # 仅导出测试相关的直觉
|
||||
/instinct-export --min-confidence 0.7 # 仅导出高置信度的直觉
|
||||
/instinct-export --output team-instincts.yaml
|
||||
```
|
||||
|
||||
## What to Do
|
||||
## 执行流程
|
||||
|
||||
1. Read instincts from `~/.claude/homunculus/instincts/personal/`
|
||||
2. Filter based on flags
|
||||
3. Strip sensitive information:
|
||||
- Remove session IDs
|
||||
- Remove file paths (keep only patterns)
|
||||
- Remove timestamps older than "last week"
|
||||
4. Generate export file
|
||||
1. 从 `~/.claude/homunculus/instincts/personal/` 读取直觉
|
||||
2. 根据标志位(Flags)进行过滤
|
||||
3. 脱敏处理(剥离敏感信息):
|
||||
- 移除会话 ID(Session IDs)
|
||||
- 移除文件路径(仅保留模式匹配符 Pattern)
|
||||
- 移除早于“上周”的时间戳
|
||||
4. 生成导出文件
|
||||
|
||||
## Output Format
|
||||
## 输出格式
|
||||
|
||||
Creates a YAML file:
|
||||
创建一个 YAML 文件:
|
||||
|
||||
```yaml
|
||||
# Instincts Export
|
||||
@@ -67,25 +67,25 @@ instincts:
|
||||
observations: 6
|
||||
```
|
||||
|
||||
## Privacy Considerations
|
||||
## 隐私考量
|
||||
|
||||
Exports include:
|
||||
- ✅ Trigger patterns
|
||||
- ✅ Actions
|
||||
- ✅ Confidence scores
|
||||
- ✅ Domains
|
||||
- ✅ Observation counts
|
||||
导出内容包括:
|
||||
- ✅ 触发模式(Trigger patterns)
|
||||
- ✅ 动作(Actions)
|
||||
- ✅ 置信度分数(Confidence scores)
|
||||
- ✅ 域(Domains)
|
||||
- ✅ 观察次数(Observation counts)
|
||||
|
||||
Exports do NOT include:
|
||||
- ❌ Actual code snippets
|
||||
- ❌ File paths
|
||||
- ❌ Session transcripts
|
||||
- ❌ Personal identifiers
|
||||
导出内容 **不包括**:
|
||||
- ❌ 实际代码片段
|
||||
- ❌ 文件路径
|
||||
- ❌ 会话转录文本
|
||||
- ❌ 个人身份标识符
|
||||
|
||||
## Flags
|
||||
## 标志位(Flags)
|
||||
|
||||
- `--domain <name>`: Export only specified domain
|
||||
- `--min-confidence <n>`: Minimum confidence threshold (default: 0.3)
|
||||
- `--output <file>`: Output file path (default: instincts-export-YYYYMMDD.yaml)
|
||||
- `--format <yaml|json|md>`: Output format (default: yaml)
|
||||
- `--include-evidence`: Include evidence text (default: excluded)
|
||||
- `--domain <name>`: 仅导出指定的域(Domain)
|
||||
- `--min-confidence <n>`: 最低置信度阈值(默认值:0.3)
|
||||
- `--output <file>`: 输出文件路径(默认值:instincts-export-YYYYMMDD.yaml)
|
||||
- `--format <yaml|json|md>`: 输出格式(默认值:yaml)
|
||||
- `--include-evidence`: 包含证据文本(默认值:排除)
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
---
|
||||
name: instinct-import
|
||||
description: Import instincts from teammates, Skill Creator, or other sources
|
||||
description: 从团队成员、技能创建者(Skill Creator)或其他来源导入直觉(Instincts)
|
||||
command: true
|
||||
---
|
||||
|
||||
# Instinct Import Command
|
||||
# 直觉导入命令(Instinct Import Command)
|
||||
|
||||
## Implementation
|
||||
## 实现
|
||||
|
||||
Run the instinct CLI using the plugin root path:
|
||||
使用插件根路径运行直觉 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]
|
||||
```
|
||||
|
||||
Or if `CLAUDE_PLUGIN_ROOT` is not set (manual installation):
|
||||
如果未设置 `CLAUDE_PLUGIN_ROOT`(手动安装):
|
||||
|
||||
```bash
|
||||
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file-or-url>
|
||||
```
|
||||
|
||||
Import instincts from:
|
||||
- Teammates' exports
|
||||
- Skill Creator (repo analysis)
|
||||
- Community collections
|
||||
- Previous machine backups
|
||||
可以从以下来源导入直觉:
|
||||
- 团队成员的导出文件
|
||||
- 技能创建者(Skill Creator)(仓库分析)
|
||||
- 社区集合
|
||||
- 以前的机器备份
|
||||
|
||||
## Usage
|
||||
## 用法
|
||||
|
||||
```
|
||||
/instinct-import team-instincts.yaml
|
||||
@@ -34,109 +34,109 @@ Import instincts from:
|
||||
/instinct-import --from-skill-creator acme/webapp
|
||||
```
|
||||
|
||||
## What to Do
|
||||
## 核心流程
|
||||
|
||||
1. Fetch the instinct file (local path or URL)
|
||||
2. Parse and validate the format
|
||||
3. Check for duplicates with existing instincts
|
||||
4. Merge or add new instincts
|
||||
5. Save to `~/.claude/homunculus/instincts/inherited/`
|
||||
1. 获取直觉文件(本地路径或 URL)
|
||||
2. 解析并验证格式
|
||||
3. 检查与现有直觉是否重复
|
||||
4. 合并或添加新直觉
|
||||
5. 保存至 `~/.claude/homunculus/instincts/inherited/`
|
||||
|
||||
## Import Process
|
||||
## 导入过程示例
|
||||
|
||||
```
|
||||
📥 Importing instincts from: team-instincts.yaml
|
||||
📥 正在从以下路径导入直觉:team-instincts.yaml
|
||||
================================================
|
||||
|
||||
Found 12 instincts to import.
|
||||
发现 12 条待导入的直觉。
|
||||
|
||||
Analyzing conflicts...
|
||||
正在分析冲突...
|
||||
|
||||
## New Instincts (8)
|
||||
These will be added:
|
||||
✓ use-zod-validation (confidence: 0.7)
|
||||
✓ prefer-named-exports (confidence: 0.65)
|
||||
✓ test-async-functions (confidence: 0.8)
|
||||
## 新直觉 (8)
|
||||
以下内容将被添加:
|
||||
✓ use-zod-validation (置信度: 0.7)
|
||||
✓ prefer-named-exports (置信度: 0.65)
|
||||
✓ test-async-functions (置信度: 0.8)
|
||||
...
|
||||
|
||||
## Duplicate Instincts (3)
|
||||
Already have similar instincts:
|
||||
## 重复直觉 (3)
|
||||
已存在类似的直觉:
|
||||
⚠️ prefer-functional-style
|
||||
Local: 0.8 confidence, 12 observations
|
||||
Import: 0.7 confidence
|
||||
→ Keep local (higher confidence)
|
||||
本地: 0.8 置信度, 12 次观察
|
||||
导入: 0.7 置信度
|
||||
→ 保留本地版本(置信度更高)
|
||||
|
||||
⚠️ test-first-workflow
|
||||
Local: 0.75 confidence
|
||||
Import: 0.9 confidence
|
||||
→ Update to import (higher confidence)
|
||||
本地: 0.75 置信度
|
||||
导入: 0.9 置信度
|
||||
→ 更新为导入版本(置信度更高)
|
||||
|
||||
## Conflicting Instincts (1)
|
||||
These contradict local instincts:
|
||||
## 冲突直觉 (1)
|
||||
这些直觉与本地直觉冲突:
|
||||
❌ use-classes-for-services
|
||||
Conflicts with: avoid-classes
|
||||
→ Skip (requires manual resolution)
|
||||
冲突项:avoid-classes
|
||||
→ 跳过(需要手动解决)
|
||||
|
||||
---
|
||||
Import 8 new, update 1, skip 3?
|
||||
导入 8 条新直觉,更新 1 条,跳过 3 条?
|
||||
```
|
||||
|
||||
## Merge Strategies
|
||||
## 合并策略(Merge Strategies)
|
||||
|
||||
### For Duplicates
|
||||
When importing an instinct that matches an existing one:
|
||||
- **Higher confidence wins**: Keep the one with higher confidence
|
||||
- **Merge evidence**: Combine observation counts
|
||||
- **Update timestamp**: Mark as recently validated
|
||||
### 处理重复项
|
||||
当导入的直觉与现有直觉匹配时:
|
||||
- **高置信度优先**:保留置信度较高的版本
|
||||
- **合并证据**:合并观察计数(observation counts)
|
||||
- **更新时间戳**:标记为最近已验证
|
||||
|
||||
### For Conflicts
|
||||
When importing an instinct that contradicts an existing one:
|
||||
- **Skip by default**: Don't import conflicting instincts
|
||||
- **Flag for review**: Mark both as needing attention
|
||||
- **Manual resolution**: User decides which to keep
|
||||
### 处理冲突
|
||||
当导入的直觉与现有直觉相矛盾时:
|
||||
- **默认跳过**:不导入冲突的直觉
|
||||
- **标记待评审**:将两者都标记为需要关注
|
||||
- **手动解决**:由用户决定保留哪一个
|
||||
|
||||
## Source Tracking
|
||||
## 来源追踪
|
||||
|
||||
Imported instincts are marked with:
|
||||
导入的直觉会带有以下标记:
|
||||
```yaml
|
||||
source: "inherited"
|
||||
imported_from: "team-instincts.yaml"
|
||||
imported_at: "2025-01-22T10:30:00Z"
|
||||
original_source: "session-observation" # or "repo-analysis"
|
||||
original_source: "session-observation" # 或 "repo-analysis"
|
||||
```
|
||||
|
||||
## Skill Creator Integration
|
||||
## 技能创建者(Skill Creator)集成
|
||||
|
||||
When importing from Skill Creator:
|
||||
从技能创建者导入时:
|
||||
|
||||
```
|
||||
/instinct-import --from-skill-creator acme/webapp
|
||||
```
|
||||
|
||||
This fetches instincts generated from repo analysis:
|
||||
- Source: `repo-analysis`
|
||||
- Higher initial confidence (0.7+)
|
||||
- Linked to source repository
|
||||
这将获取通过仓库分析生成的直觉:
|
||||
- 来源:`repo-analysis`
|
||||
- 初始置信度较高 (0.7+)
|
||||
- 链接到源仓库
|
||||
|
||||
## Flags
|
||||
## 参数选项(Flags)
|
||||
|
||||
- `--dry-run`: Preview without importing
|
||||
- `--force`: Import even if conflicts exist
|
||||
- `--merge-strategy <higher|local|import>`: How to handle duplicates
|
||||
- `--from-skill-creator <owner/repo>`: Import from Skill Creator analysis
|
||||
- `--min-confidence <n>`: Only import instincts above threshold
|
||||
- `--dry-run`:预览而不执行导入
|
||||
- `--force`:即使存在冲突也执行导入
|
||||
- `--merge-strategy <higher|local|import>`:如何处理重复项
|
||||
- `--from-skill-creator <owner/repo>`:从技能创建者分析中导入
|
||||
- `--min-confidence <n>`:仅导入高于阈值的直觉
|
||||
|
||||
## Output
|
||||
## 输出
|
||||
|
||||
After import:
|
||||
导入完成后:
|
||||
```
|
||||
✅ Import complete!
|
||||
✅ 导入完成!
|
||||
|
||||
Added: 8 instincts
|
||||
Updated: 1 instinct
|
||||
Skipped: 3 instincts (2 duplicates, 1 conflict)
|
||||
添加:8 条直觉
|
||||
更新:1 条直觉
|
||||
跳过:3 条直觉 (2 条重复,1 条冲突)
|
||||
|
||||
New instincts saved to: ~/.claude/homunculus/instincts/inherited/
|
||||
新直觉已保存至:~/.claude/homunculus/instincts/inherited/
|
||||
|
||||
Run /instinct-status to see all instincts.
|
||||
运行 /instinct-status 以查看所有直觉。
|
||||
```
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
---
|
||||
name: instinct-status
|
||||
description: Show all learned instincts with their confidence levels
|
||||
description: 显示所有已学习的本能及其置信度
|
||||
command: true
|
||||
---
|
||||
|
||||
# Instinct Status Command
|
||||
# 本能状态查询命令(Instinct Status Command)
|
||||
|
||||
Shows all learned instincts with their confidence scores, grouped by domain.
|
||||
显示所有已学习的本能(Instincts)及其置信度分数,并按领域(Domain)进行分组。
|
||||
|
||||
## Implementation
|
||||
## 实现方式
|
||||
|
||||
Run the instinct CLI using the plugin root path:
|
||||
使用插件根路径运行本能 CLI:
|
||||
|
||||
```bash
|
||||
python3 "${CLAUDE_PLUGIN_ROOT}/skills/continuous-learning-v2/scripts/instinct-cli.py" status
|
||||
```
|
||||
|
||||
Or if `CLAUDE_PLUGIN_ROOT` is not set (manual installation), use:
|
||||
如果未设置 `CLAUDE_PLUGIN_ROOT`(手动安装),请使用:
|
||||
|
||||
```bash
|
||||
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py status
|
||||
```
|
||||
|
||||
## Usage
|
||||
## 用法
|
||||
|
||||
```
|
||||
/instinct-status
|
||||
@@ -30,57 +30,57 @@ python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py status
|
||||
/instinct-status --low-confidence
|
||||
```
|
||||
|
||||
## What to Do
|
||||
## 执行逻辑
|
||||
|
||||
1. Read all instinct files from `~/.claude/homunculus/instincts/personal/`
|
||||
2. Read inherited instincts from `~/.claude/homunculus/instincts/inherited/`
|
||||
3. Display them grouped by domain with confidence bars
|
||||
1. 从 `~/.claude/homunculus/instincts/personal/` 读取所有个人本能文件。
|
||||
2. 从 `~/.claude/homunculus/instincts/inherited/` 读取继承的本能。
|
||||
3. 按领域分组显示,并附带置信度进度条。
|
||||
|
||||
## Output Format
|
||||
## 输出格式
|
||||
|
||||
```
|
||||
📊 Instinct Status
|
||||
📊 本能状态 (Instinct Status)
|
||||
==================
|
||||
|
||||
## Code Style (4 instincts)
|
||||
## 代码风格 (Code Style) (4 条本能)
|
||||
|
||||
### prefer-functional-style
|
||||
Trigger: when writing new functions
|
||||
Action: Use functional patterns over classes
|
||||
Confidence: ████████░░ 80%
|
||||
Source: session-observation | Last updated: 2025-01-22
|
||||
触发器 (Trigger):编写新函数时
|
||||
动作 (Action):优先使用函数式模式而非类
|
||||
置信度 (Confidence):████████░░ 80%
|
||||
来源 (Source):会话观察 (session-observation) | 最近更新:2025-01-22
|
||||
|
||||
### use-path-aliases
|
||||
Trigger: when importing modules
|
||||
Action: Use @/ path aliases instead of relative imports
|
||||
Confidence: ██████░░░░ 60%
|
||||
Source: repo-analysis (github.com/acme/webapp)
|
||||
触发器 (Trigger):导入模块时
|
||||
动作 (Action):使用 @/ 路径别名而非相对导入
|
||||
置信度 (Confidence):██████░░░░ 60%
|
||||
来源 (Source):仓库分析 (repo-analysis) (github.com/acme/webapp)
|
||||
|
||||
## Testing (2 instincts)
|
||||
## 测试 (Testing) (2 条本能)
|
||||
|
||||
### test-first-workflow
|
||||
Trigger: when adding new functionality
|
||||
Action: Write test first, then implementation
|
||||
Confidence: █████████░ 90%
|
||||
Source: session-observation
|
||||
触发器 (Trigger):添加新功能时
|
||||
动作 (Action):先写测试,再写实现
|
||||
置信度 (Confidence):█████████░ 90%
|
||||
来源 (Source):会话观察 (session-observation)
|
||||
|
||||
## Workflow (3 instincts)
|
||||
## 工作流 (Workflow) (3 条本能)
|
||||
|
||||
### grep-before-edit
|
||||
Trigger: when modifying code
|
||||
Action: Search with Grep, confirm with Read, then Edit
|
||||
Confidence: ███████░░░ 70%
|
||||
Source: session-observation
|
||||
触发器 (Trigger):修改代码时
|
||||
动作 (Action):先用 Grep 搜索,再用 Read 确认,最后 Edit 编辑
|
||||
置信度 (Confidence):███████░░░ 70%
|
||||
来源 (Source):会话观察 (session-observation)
|
||||
|
||||
---
|
||||
Total: 9 instincts (4 personal, 5 inherited)
|
||||
Observer: Running (last analysis: 5 min ago)
|
||||
总计:9 条本能 (4 条个人, 5 条继承)
|
||||
观察器 (Observer):运行中 (最近分析:5 分钟前)
|
||||
```
|
||||
|
||||
## Flags
|
||||
## 参数 (Flags)
|
||||
|
||||
- `--domain <name>`: Filter by domain (code-style, testing, git, etc.)
|
||||
- `--low-confidence`: Show only instincts with confidence < 0.5
|
||||
- `--high-confidence`: Show only instincts with confidence >= 0.7
|
||||
- `--source <type>`: Filter by source (session-observation, repo-analysis, inherited)
|
||||
- `--json`: Output as JSON for programmatic use
|
||||
- `--domain <name>`: 按领域筛选(如 code-style, testing, git 等)
|
||||
- `--low-confidence`: 仅显示置信度 < 0.5 的本能
|
||||
- `--high-confidence`: 仅显示置信度 >= 0.7 的本能
|
||||
- `--source <type>`: 按来源筛选(session-observation, repo-analysis, inherited)
|
||||
- `--json`: 以 JSON 格式输出,便于程序化调用
|
||||
|
||||
297
commands/python-review.md
Normal file
297
commands/python-review.md
Normal file
@@ -0,0 +1,297 @@
|
||||
---
|
||||
description: 针对 PEP 8 标准、类型提示、安全性及 Pythonic 惯用写法的 Python 代码全面审查。调用 python-reviewer 智能体(Agent)。
|
||||
---
|
||||
|
||||
# Python 代码审查 (Python Code Review)
|
||||
|
||||
此命令调用 **python-reviewer** 智能体(Agent),进行全面的 Python 专项代码审查。
|
||||
|
||||
## 此命令的作用
|
||||
|
||||
1. **识别 Python 变更**:通过 `git diff` 查找修改过的 `.py` 文件
|
||||
2. **运行静态分析**:执行 `ruff`、`mypy`、`pylint`、`black --check`
|
||||
3. **安全扫描**:检查 SQL 注入、命令注入、不安全的反序列化
|
||||
4. **类型安全审查**:分析类型提示(Type Hints)和 mypy 错误
|
||||
5. **Pythonic 代码检查**:验证代码是否符合 PEP 8 和 Python 最佳实践
|
||||
6. **生成报告**:按严重程度(Severity)对问题进行分类
|
||||
|
||||
## 适用场景
|
||||
|
||||
在以下情况下使用 `/python-review`:
|
||||
- 编写或修改 Python 代码后
|
||||
- 提交 Python 变更前
|
||||
- 审查包含 Python 代码的拉取请求(Pull Requests)
|
||||
- 接入新的 Python 代码库时
|
||||
- 学习 Pythonic 模式和惯用法时
|
||||
|
||||
## 审查类别
|
||||
|
||||
### 严重 (CRITICAL) (必须修复)
|
||||
- SQL/命令注入漏洞
|
||||
- 不安全的 eval/exec 使用
|
||||
- Pickle 不安全的反序列化
|
||||
- 硬编码凭据
|
||||
- YAML 不安全的加载 (unsafe load)
|
||||
- 隐藏错误的裸 except 子句
|
||||
|
||||
### 高 (HIGH) (应该修复)
|
||||
- 公共函数缺失类型提示
|
||||
- 可变默认参数 (Mutable default arguments)
|
||||
- 静默吞掉异常
|
||||
- 未对资源使用上下文管理器 (Context Managers)
|
||||
- 使用 C 风格循环而非推导式 (Comprehensions)
|
||||
- 使用 type() 而非 isinstance()
|
||||
- 无锁状态下的竞态条件
|
||||
|
||||
### 中 (MEDIUM) (建议考虑)
|
||||
- 违反 PEP 8 格式规范
|
||||
- 公共函数缺失文档字符串 (Docstrings)
|
||||
- 使用 print 语句而非日志 (Logging)
|
||||
- 低效的字符串操作
|
||||
- 无命名常量的魔术数字 (Magic numbers)
|
||||
- 未使用 f-strings 进行格式化
|
||||
- 不必要的列表创建
|
||||
|
||||
## 运行的自动化检查
|
||||
|
||||
```bash
|
||||
# 类型检查
|
||||
mypy .
|
||||
|
||||
# 代码检查与格式化
|
||||
ruff check .
|
||||
black --check .
|
||||
isort --check-only .
|
||||
|
||||
# 安全扫描
|
||||
bandit -r .
|
||||
|
||||
# 依赖审计
|
||||
pip-audit
|
||||
safety check
|
||||
|
||||
# 测试
|
||||
pytest --cov=app --cov-report=term-missing
|
||||
```
|
||||
|
||||
## 示例用法
|
||||
|
||||
```text
|
||||
User: /python-review
|
||||
|
||||
Agent:
|
||||
# Python 代码审查报告
|
||||
|
||||
## 已审查文件
|
||||
- app/routes/user.py (已修改)
|
||||
- app/services/auth.py (已修改)
|
||||
|
||||
## 静态分析结果
|
||||
✓ ruff: 无问题
|
||||
✓ mypy: 无错误
|
||||
⚠️ black: 2 个文件需要重新格式化
|
||||
✓ bandit: 无安全问题
|
||||
|
||||
## 发现的问题
|
||||
|
||||
[CRITICAL] SQL 注入漏洞
|
||||
文件: app/routes/user.py:42
|
||||
问题: 用户输入直接插入到 SQL 查询中
|
||||
```python
|
||||
query = f"SELECT * FROM users WHERE id = {user_id}" # 不良做法
|
||||
```
|
||||
修复: 使用参数化查询
|
||||
```python
|
||||
query = "SELECT * FROM users WHERE id = %s" # 推荐做法
|
||||
cursor.execute(query, (user_id,))
|
||||
```
|
||||
|
||||
[HIGH] 可变默认参数
|
||||
文件: app/services/auth.py:18
|
||||
问题: 可变默认参数会导致状态共享
|
||||
```python
|
||||
def process_items(items=[]): # 不良做法
|
||||
items.append("new")
|
||||
return items
|
||||
```
|
||||
修复: 使用 None 作为默认值
|
||||
```python
|
||||
def process_items(items=None): # 推荐做法
|
||||
if items is None:
|
||||
items = []
|
||||
items.append("new")
|
||||
return items
|
||||
```
|
||||
|
||||
[MEDIUM] 缺失类型提示
|
||||
文件: app/services/auth.py:25
|
||||
问题: 公共函数没有类型注解
|
||||
```python
|
||||
def get_user(user_id): # 不良做法
|
||||
return db.find(user_id)
|
||||
```
|
||||
修复: 添加类型提示
|
||||
```python
|
||||
def get_user(user_id: str) -> Optional[User]: # 推荐做法
|
||||
return db.find(user_id)
|
||||
```
|
||||
|
||||
[MEDIUM] 未使用上下文管理器
|
||||
文件: app/routes/user.py:55
|
||||
问题: 异常发生时文件未关闭
|
||||
```python
|
||||
f = open("config.json") # 不良做法
|
||||
data = f.read()
|
||||
f.close()
|
||||
```
|
||||
修复: 使用上下文管理器
|
||||
```python
|
||||
with open("config.json") as f: # 推荐做法
|
||||
data = f.read()
|
||||
```
|
||||
|
||||
## 摘要
|
||||
- 严重 (CRITICAL): 1
|
||||
- 高 (HIGH): 1
|
||||
- 中 (MEDIUM): 2
|
||||
|
||||
建议: ❌ 在修复严重问题前阻止合并
|
||||
|
||||
## 需要格式化
|
||||
运行: `black app/routes/user.py app/services/auth.py`
|
||||
```
|
||||
|
||||
## 批准标准
|
||||
|
||||
| 状态 | 条件 |
|
||||
|--------|-----------|
|
||||
| ✅ 批准 (Approve) | 无“严重”或“高”级别问题 |
|
||||
| ⚠️ 警告 (Warning) | 仅存在“中”级别问题(谨慎合并) |
|
||||
| ❌ 阻止 (Block) | 发现“严重”或“高”级别问题 |
|
||||
|
||||
## 与其他命令的集成
|
||||
|
||||
- 先使用 `/python-test` 确保测试通过
|
||||
- 使用 `/code-review` 处理非 Python 专项的关注点
|
||||
- 在提交(commit)前使用 `/python-review`
|
||||
- 如果静态分析工具报错,使用 `/build-fix`
|
||||
|
||||
## 框架专项审查
|
||||
|
||||
### Django 项目
|
||||
审查者会检查:
|
||||
- N+1 查询问题(使用 `select_related` 和 `prefetch_related`)
|
||||
- 模型变更缺失迁移文件
|
||||
- 在 ORM 可用的情况下使用原生 SQL
|
||||
- 多步操作缺失 `transaction.atomic()`
|
||||
|
||||
### FastAPI 项目
|
||||
审查者会检查:
|
||||
- CORS 配置错误
|
||||
- 用于请求校验的 Pydantic 模型
|
||||
- 响应模型的正确性
|
||||
- 恰当的 async/await 使用
|
||||
- 依赖注入模式
|
||||
|
||||
### Flask 项目
|
||||
审查者会检查:
|
||||
- 上下文管理(应用上下文、请求上下文)
|
||||
- 恰当的错误处理
|
||||
- 蓝图 (Blueprint) 组织结构
|
||||
- 配置管理
|
||||
|
||||
## 相关
|
||||
|
||||
- 智能体 (Agent): `agents/python-reviewer.md`
|
||||
- 技能 (Skills): `skills/python-patterns/`, `skills/python-testing/`
|
||||
|
||||
## 常见修复方案
|
||||
|
||||
### 添加类型提示
|
||||
```python
|
||||
# 修复前
|
||||
def calculate(x, y):
|
||||
return x + y
|
||||
|
||||
# 修复后
|
||||
from typing import Union
|
||||
|
||||
def calculate(x: Union[int, float], y: Union[int, float]) -> Union[int, float]:
|
||||
return x + y
|
||||
```
|
||||
|
||||
### 使用上下文管理器
|
||||
```python
|
||||
# 修复前
|
||||
f = open("file.txt")
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
# 修复后
|
||||
with open("file.txt") as f:
|
||||
data = f.read()
|
||||
```
|
||||
|
||||
### 使用列表推导式
|
||||
```python
|
||||
# 修复前
|
||||
result = []
|
||||
for item in items:
|
||||
if item.active:
|
||||
result.append(item.name)
|
||||
|
||||
# 修复后
|
||||
result = [item.name for item in items if item.active]
|
||||
```
|
||||
|
||||
### 修复可变默认参数
|
||||
```python
|
||||
# 修复前
|
||||
def append(value, items=[]):
|
||||
items.append(value)
|
||||
return items
|
||||
|
||||
# 修复后
|
||||
def append(value, items=None):
|
||||
if items is None:
|
||||
items = []
|
||||
items.append(value)
|
||||
return items
|
||||
```
|
||||
|
||||
### 使用 f-strings (Python 3.6+)
|
||||
```python
|
||||
# 修复前
|
||||
name = "Alice"
|
||||
greeting = "Hello, " + name + "!"
|
||||
greeting2 = "Hello, {}".format(name)
|
||||
|
||||
# 修复后
|
||||
greeting = f"Hello, {name}!"
|
||||
```
|
||||
|
||||
### 修复循环中的字符串拼接
|
||||
```python
|
||||
# 修复前
|
||||
result = ""
|
||||
for item in items:
|
||||
result += str(item)
|
||||
|
||||
# 修复后
|
||||
result = "".join(str(item) for item in items)
|
||||
```
|
||||
|
||||
## Python 版本兼容性
|
||||
|
||||
审查者会提示代码何时使用了较新 Python 版本的特性:
|
||||
|
||||
| 特性 | 最低 Python 版本 |
|
||||
|---------|----------------|
|
||||
| 类型提示 (Type hints) | 3.5+ |
|
||||
| f-strings | 3.6+ |
|
||||
| 海象运算符 (Walrus operator `:=`) | 3.8+ |
|
||||
| 仅限位置参数 (Position-only parameters) | 3.8+ |
|
||||
| 匹配语句 (Match statements) | 3.10+ |
|
||||
| 类型联合 (Type unions `x | None`) | 3.10+ |
|
||||
|
||||
请确保项目的 `pyproject.toml` 或 `setup.py` 指定了正确的最低 Python 版本。
|
||||
@@ -1,59 +1,59 @@
|
||||
---
|
||||
name: skill-create
|
||||
description: Analyze local git history to extract coding patterns and generate SKILL.md files. Local version of the Skill Creator GitHub App.
|
||||
description: 分析本地 Git 历史以提取编码模式并生成 SKILL.md 文件。Skill Creator GitHub App 的本地版本。
|
||||
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
|
||||
---
|
||||
|
||||
# /skill-create - Local Skill Generation
|
||||
# /skill-create - 本地技能生成(Local Skill Generation)
|
||||
|
||||
Analyze your repository's git history to extract coding patterns and generate SKILL.md files that teach Claude your team's practices.
|
||||
分析你仓库的 Git 历史记录以提取编码模式,并生成 SKILL.md 文件,以便让 Claude 学习你团队的工程实践。
|
||||
|
||||
## Usage
|
||||
## 用法(Usage)
|
||||
|
||||
```bash
|
||||
/skill-create # Analyze current repo
|
||||
/skill-create --commits 100 # Analyze last 100 commits
|
||||
/skill-create --output ./skills # Custom output directory
|
||||
/skill-create --instincts # Also generate instincts for continuous-learning-v2
|
||||
/skill-create # 分析当前仓库
|
||||
/skill-create --commits 100 # 分析最近 100 条提交
|
||||
/skill-create --output ./skills # 指定自定义输出目录
|
||||
/skill-create --instincts # 同时为 continuous-learning-v2 生成直觉(instincts)
|
||||
```
|
||||
|
||||
## What It Does
|
||||
## 功能说明(What It Does)
|
||||
|
||||
1. **Parses Git History** - Analyzes commits, file changes, and patterns
|
||||
2. **Detects Patterns** - Identifies recurring workflows and conventions
|
||||
3. **Generates SKILL.md** - Creates valid Claude Code skill files
|
||||
4. **Optionally Creates Instincts** - For the continuous-learning-v2 system
|
||||
1. **解析 Git 历史** - 分析提交(commits)、文件变更和模式。
|
||||
2. **检测模式** - 识别循环出现的工作流(Workflow)和约定。
|
||||
3. **生成 SKILL.md** - 创建有效的 Claude Code 技能(Skill)文件。
|
||||
4. **可选生成直觉(Instincts)** - 用于 continuous-learning-v2 系统。
|
||||
|
||||
## Analysis Steps
|
||||
## 分析步骤(Analysis Steps)
|
||||
|
||||
### Step 1: Gather Git Data
|
||||
### 第 1 步:收集 Git 数据
|
||||
|
||||
```bash
|
||||
# Get recent commits with file changes
|
||||
# 获取带有文件变更的近期提交
|
||||
git log --oneline -n ${COMMITS:-200} --name-only --pretty=format:"%H|%s|%ad" --date=short
|
||||
|
||||
# Get commit frequency by file
|
||||
# 获取按文件统计的提交频率
|
||||
git log --oneline -n 200 --name-only | grep -v "^$" | grep -v "^[a-f0-9]" | sort | uniq -c | sort -rn | head -20
|
||||
|
||||
# Get commit message patterns
|
||||
# 获取提交信息模式
|
||||
git log --oneline -n 200 | cut -d' ' -f2- | head -50
|
||||
```
|
||||
|
||||
### Step 2: Detect Patterns
|
||||
### 第 2 步:检测模式
|
||||
|
||||
Look for these pattern types:
|
||||
寻找以下模式类型:
|
||||
|
||||
| Pattern | Detection Method |
|
||||
| 模式 (Pattern) | 检测方法 (Detection Method) |
|
||||
|---------|-----------------|
|
||||
| **Commit conventions** | Regex on commit messages (feat:, fix:, chore:) |
|
||||
| **File co-changes** | Files that always change together |
|
||||
| **Workflow sequences** | Repeated file change patterns |
|
||||
| **Architecture** | Folder structure and naming conventions |
|
||||
| **Testing patterns** | Test file locations, naming, coverage |
|
||||
| **提交规范 (Commit conventions)** | 对提交信息使用正则匹配 (feat:, fix:, chore:) |
|
||||
| **文件关联变更 (File co-changes)** | 总是同时发生变化的文件 |
|
||||
| **工作流序列 (Workflow sequences)** | 重复出现的文件变更模式 |
|
||||
| **架构 (Architecture)** | 文件夹结构和命名规范 |
|
||||
| **测试模式 (Testing patterns)** | 测试文件位置、命名、覆盖率 |
|
||||
|
||||
### Step 3: Generate SKILL.md
|
||||
### 第 3 步:生成 SKILL.md
|
||||
|
||||
Output format:
|
||||
输出格式:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@@ -64,24 +64,24 @@ source: local-git-analysis
|
||||
analyzed_commits: {count}
|
||||
---
|
||||
|
||||
# {Repo Name} Patterns
|
||||
# {Repo Name} 模式
|
||||
|
||||
## Commit Conventions
|
||||
{detected commit message patterns}
|
||||
## 提交规范
|
||||
{检测到的提交信息模式}
|
||||
|
||||
## Code Architecture
|
||||
{detected folder structure and organization}
|
||||
## 代码架构
|
||||
{检测到的文件夹结构和组织方式}
|
||||
|
||||
## Workflows
|
||||
{detected repeating file change patterns}
|
||||
## 工作流
|
||||
{检测到的重复文件变更模式}
|
||||
|
||||
## Testing Patterns
|
||||
{detected test conventions}
|
||||
## 测试模式
|
||||
{检测到的测试约定}
|
||||
```
|
||||
|
||||
### Step 4: Generate Instincts (if --instincts)
|
||||
### 第 4 步:生成直觉 (如果使用了 --instincts)
|
||||
|
||||
For continuous-learning-v2 integration:
|
||||
用于 continuous-learning-v2 集成:
|
||||
|
||||
```yaml
|
||||
---
|
||||
@@ -92,19 +92,19 @@ domain: git
|
||||
source: local-repo-analysis
|
||||
---
|
||||
|
||||
# Use Conventional Commits
|
||||
# 使用约定式提交 (Conventional Commits)
|
||||
|
||||
## Action
|
||||
Prefix commits with: feat:, fix:, chore:, docs:, test:, refactor:
|
||||
## 操作 (Action)
|
||||
在提交信息前添加前缀:feat:, fix:, chore:, docs:, test:, refactor:
|
||||
|
||||
## Evidence
|
||||
- Analyzed {n} commits
|
||||
- {percentage}% follow conventional commit format
|
||||
## 证据 (Evidence)
|
||||
- 已分析 {n} 条提交
|
||||
- {percentage}% 遵循约定式提交格式
|
||||
```
|
||||
|
||||
## Example Output
|
||||
## 输出示例
|
||||
|
||||
Running `/skill-create` on a TypeScript project might produce:
|
||||
在 TypeScript 项目上运行 `/skill-create` 可能会产生:
|
||||
|
||||
```markdown
|
||||
---
|
||||
@@ -115,60 +115,60 @@ source: local-git-analysis
|
||||
analyzed_commits: 150
|
||||
---
|
||||
|
||||
# My App Patterns
|
||||
# My App 模式
|
||||
|
||||
## Commit Conventions
|
||||
## 提交规范 (Commit Conventions)
|
||||
|
||||
This project uses **conventional commits**:
|
||||
- `feat:` - New features
|
||||
- `fix:` - Bug fixes
|
||||
- `chore:` - Maintenance tasks
|
||||
- `docs:` - Documentation updates
|
||||
该项目使用 **约定式提交 (conventional commits)**:
|
||||
- `feat:` - 新功能
|
||||
- `fix:` - 错误修复
|
||||
- `chore:` - 维护任务
|
||||
- `docs:` - 文档更新
|
||||
|
||||
## Code Architecture
|
||||
## 代码架构 (Code Architecture)
|
||||
|
||||
```
|
||||
src/
|
||||
├── components/ # React components (PascalCase.tsx)
|
||||
├── hooks/ # Custom hooks (use*.ts)
|
||||
├── utils/ # Utility functions
|
||||
├── types/ # TypeScript type definitions
|
||||
└── services/ # API and external services
|
||||
├── components/ # React 组件 (PascalCase.tsx)
|
||||
├── hooks/ # 自定义 Hooks (use*.ts)
|
||||
├── utils/ # 工具函数
|
||||
├── types/ # TypeScript 类型定义
|
||||
└── services/ # API 和外部服务
|
||||
```
|
||||
|
||||
## Workflows
|
||||
## 工作流 (Workflows)
|
||||
|
||||
### Adding a New Component
|
||||
1. Create `src/components/ComponentName.tsx`
|
||||
2. Add tests in `src/components/__tests__/ComponentName.test.tsx`
|
||||
3. Export from `src/components/index.ts`
|
||||
### 添加新组件
|
||||
1. 创建 `src/components/ComponentName.tsx`
|
||||
2. 在 `src/components/__tests__/ComponentName.test.tsx` 中添加测试
|
||||
3. 从 `src/components/index.ts` 导出
|
||||
|
||||
### Database Migration
|
||||
1. Modify `src/db/schema.ts`
|
||||
2. Run `pnpm db:generate`
|
||||
3. Run `pnpm db:migrate`
|
||||
### 数据库迁移
|
||||
1. 修改 `src/db/schema.ts`
|
||||
2. 运行 `pnpm db:generate`
|
||||
3. 运行 `pnpm db:migrate`
|
||||
|
||||
## Testing Patterns
|
||||
## 测试模式 (Testing patterns)
|
||||
|
||||
- Test files: `__tests__/` directories or `.test.ts` suffix
|
||||
- Coverage target: 80%+
|
||||
- Framework: Vitest
|
||||
- 测试文件:`__tests__/` 目录或 `.test.ts` 后缀
|
||||
- 覆盖率目标:80%+
|
||||
- 框架:Vitest
|
||||
```
|
||||
|
||||
## GitHub App Integration
|
||||
## GitHub App 集成
|
||||
|
||||
For advanced features (10k+ commits, team sharing, auto-PRs), use the [Skill Creator GitHub App](https://github.com/apps/skill-creator):
|
||||
对于高级功能(1万+ 提交、团队共享、自动 PR),请使用 [Skill Creator GitHub App](https://github.com/apps/skill-creator):
|
||||
|
||||
- Install: [github.com/apps/skill-creator](https://github.com/apps/skill-creator)
|
||||
- Comment `/skill-creator analyze` on any issue
|
||||
- Receives PR with generated skills
|
||||
- 安装:[github.com/apps/skill-creator](https://github.com/apps/skill-creator)
|
||||
- 在任何 Issue 上评论 `/skill-creator analyze`
|
||||
- 接收包含生成的技能的 PR
|
||||
|
||||
## Related Commands
|
||||
## 相关命令
|
||||
|
||||
- `/instinct-import` - Import generated instincts
|
||||
- `/instinct-status` - View learned instincts
|
||||
- `/evolve` - Cluster instincts into skills/agents
|
||||
- `/instinct-import` - 导入生成的直觉
|
||||
- `/instinct-status` - 查看已学习的直觉
|
||||
- `/evolve` - 将直觉聚类为技能/智能体
|
||||
|
||||
---
|
||||
|
||||
*Part of [Everything Claude Code](https://github.com/affaan-m/everything-claude-code)*
|
||||
*属于 [Everything Claude Code](https://github.com/affaan-m/everything-claude-code) 的一部分*
|
||||
|
||||
@@ -8,11 +8,11 @@ description: Enforce test-driven development workflow. Scaffold interfaces, gene
|
||||
|
||||
## 此命令的作用
|
||||
|
||||
1. **搭建接口(Scaffold Interfaces)** - 首先定义类型/接口
|
||||
2. **先生成测试** - 编写失败的测试(红/RED)
|
||||
3. **编写最小化实现代码** - 只编写刚好能通过测试的代码(绿/GREEN)
|
||||
4. **重构(Refactor)** - 在保持测试通过的前提下优化代码(重构/REFACTOR)
|
||||
5. **验证覆盖率** - 确保测试覆盖率达到 80% 以上
|
||||
1. **搭建接口(Scaffold Interfaces)** - 首先定义类型/接口
|
||||
2. **先生成测试** - 编写失败的测试(红/RED)
|
||||
3. **编写最小化实现代码** - 只编写刚好能通过测试的代码(绿/GREEN)
|
||||
4. **重构(Refactor)** - 在保持测试通过的前提下优化代码(重构/REFACTOR)
|
||||
5. **验证覆盖率** - 确保测试覆盖率达到 80% 以上
|
||||
|
||||
## 适用场景
|
||||
|
||||
@@ -27,13 +27,13 @@ description: Enforce test-driven development workflow. Scaffold interfaces, gene
|
||||
|
||||
tdd-guide 智能体将:
|
||||
|
||||
1. 为输入/输出**定义接口**
|
||||
2. **编写会失败(FAIL)的测试**(因为代码尚未存在)
|
||||
3. **运行测试**并验证它们因预期的原因而失败
|
||||
4. **编写最小化实现**以使测试通过
|
||||
5. **运行测试**并验证它们通过
|
||||
6. 在保持测试通过的前提下**重构**代码
|
||||
7. **检查覆盖率**,如果低于 80% 则添加更多测试
|
||||
1. 为输入/输出**定义接口**
|
||||
2. **编写会失败(FAIL)的测试**(因为代码尚未存在)
|
||||
3. **运行测试**并验证它们因预期的原因而失败
|
||||
4. **编写最小化实现**以使测试通过
|
||||
5. **运行测试**并验证它们通过
|
||||
6. 在保持测试通过的前提下**重构**代码
|
||||
7. **检查覆盖率**,如果低于 80% 则添加更多测试
|
||||
|
||||
## TDD 循环
|
||||
|
||||
|
||||
Reference in New Issue
Block a user