promote by alirezarezvani/claude-skills
npx skills add https://github.com/alirezarezvani/claude-skills --skill promote将经过验证的模式从 Claude 的自动记忆转移到项目的规则系统中,使其成为强制执行的指令,而非背景说明。
/si:promote <模式描述> # 自动检测最佳目标
/si:promote <模式> --target claude.md # 提升到 CLAUDE.md
/si:promote <模式> --target rules/testing.md # 提升到作用域规则
/si:promote <模式> --target rules/api.md --paths "src/api/**/*.ts" # 指定路径的作用域规则
解析用户的描述。如果描述模糊,提出一个澄清问题:
# 在 MEMORY.md 中搜索相关条目
MEMORY_DIR="$HOME/.claude/projects/$(pwd | sed 's|/|%2F|g; s|%2F|/|; s|^/||')/memory"
grep -ni "<关键词>" "$MEMORY_DIR/MEMORY.md"
显示匹配的条目并确认它们符合用户的意图。
| 模式作用域 | 目标 | 示例 |
|---|---|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 适用于整个项目 |
./CLAUDE.md |
| "使用 pnpm,而非 npm" |
| 适用于特定文件类型 | .claude/rules/<主题>.md | "API 处理器需要验证" |
| 适用于您的所有项目 | ~/.claude/CLAUDE.md | "首选显式错误处理" |
如果用户未指定目标,则根据作用域推荐一个。
将学习成果从自动记忆的笔记格式转换为 CLAUDE.md 的指令格式:
之前 (MEMORY.md — 描述性):
项目使用 pnpm 工作区。当我尝试 npm install 时失败了。锁文件是 pnpm-lock.yaml。必须使用 pnpm install 来安装依赖。
之后 (CLAUDE.md — 规定性):
## 构建与依赖
- 包管理器:pnpm(非 npm)。使用 `pnpm install`。
提炼规则:
对于 CLAUDE.md:
.claude/rules/对于 .claude/rules/:
paths 的 YAML 前言---
paths:
- "src/api/**/*.ts"
- "tests/api/**/*"
---
# API 开发规则
- 所有端点必须使用 Zod 模式验证输入
- 使用 `ApiError` 类处理错误响应(而非原始 Error)
- 在处理器函数上包含 OpenAPI JSDoc 注释
提升后,移除或标记 MEMORY.md 中的原始条目:
# 显示将要移除的内容
grep -n "<模式>" "$MEMORY_DIR/MEMORY.md"
请用户确认移除。然后编辑 MEMORY.md 以移除已提升的条目。这为新学习成果腾出空间。
✅ 已提升到 {{target}}
规则:"{{提炼后的规则}}"
来源:MEMORY.md 第 {{n}} 行(已移除)
MEMORY.md:剩余 {{lines}}/200 行
该模式现已成为强制执行的指令。Claude 将在所有未来的会话中遵循它。
| 使用 CLAUDE.md 用于 | 使用 .claude/rules/ 用于 |
|---|---|
| 全局项目规则 | 特定文件类型的模式 |
| 构建命令 | 测试约定 |
| 架构决策 | API 设计规则 |
| 团队约定 | 特定框架的注意事项 |
每周安装量
46
仓库
GitHub 星标数
2.8K
首次出现
5 天前
安全审计
安装于
codex42
cursor41
gemini-cli41
claude-code41
github-copilot41
amp41
Moves a proven pattern from Claude's auto-memory into the project's rule system, where it becomes an enforced instruction rather than a background note.
/si:promote <pattern description> # Auto-detect best target
/si:promote <pattern> --target claude.md # Promote to CLAUDE.md
/si:promote <pattern> --target rules/testing.md # Promote to scoped rule
/si:promote <pattern> --target rules/api.md --paths "src/api/**/*.ts" # Scoped with paths
Parse the user's description. If vague, ask one clarifying question:
# Search MEMORY.md for related entries
MEMORY_DIR="$HOME/.claude/projects/$(pwd | sed 's|/|%2F|g; s|%2F|/|; s|^/||')/memory"
grep -ni "<keywords>" "$MEMORY_DIR/MEMORY.md"
Show the matching entries and confirm they're what the user means.
| Pattern scope | Target | Example |
|---|---|---|
| Applies to entire project | ./CLAUDE.md | "Use pnpm, not npm" |
| Applies to specific file types | .claude/rules/<topic>.md | "API handlers need validation" |
| Applies to all your projects | ~/.claude/CLAUDE.md | "Prefer explicit error handling" |
If the user didn't specify a target, recommend one based on scope.
Transform the learning from auto-memory's note format into CLAUDE.md's instruction format:
Before (MEMORY.md — descriptive):
The project uses pnpm workspaces. When I tried npm install it failed. The lock file is pnpm-lock.yaml. Must use pnpm install for dependencies.
After (CLAUDE.md — prescriptive):
## Build & Dependencies
- Package manager: pnpm (not npm). Use `pnpm install`.
Rules for distillation:
For CLAUDE.md:
.claude/rules/ insteadFor.claude/rules/:
paths if scoped---
paths:
- "src/api/**/*.ts"
- "tests/api/**/*"
---
# API Development Rules
- All endpoints must validate input with Zod schemas
- Use `ApiError` class for error responses (not raw Error)
- Include OpenAPI JSDoc comments on handler functions
After promoting, remove or mark the original entry in MEMORY.md:
# Show what will be removed
grep -n "<pattern>" "$MEMORY_DIR/MEMORY.md"
Ask the user to confirm removal. Then edit MEMORY.md to remove the promoted entry. This frees space for new learnings.
✅ Promoted to {{target}}
Rule: "{{distilled rule}}"
Source: MEMORY.md line {{n}} (removed)
MEMORY.md: {{lines}}/200 lines remaining
The pattern is now an enforced instruction. Claude will follow it in all future sessions.
| Use CLAUDE.md for | Use .claude/rules/ for |
|---|---|
| Global project rules | File-type-specific patterns |
| Build commands | Testing conventions |
| Architecture decisions | API design rules |
| Team conventions | Framework-specific gotchas |
Weekly Installs
46
Repository
GitHub Stars
2.8K
First Seen
5 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex42
cursor41
gemini-cli41
claude-code41
github-copilot41
amp41
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
56,200 周安装