Communitygithub.com

ASoudy/AGS - /si:promote — 将学习内容提升为规则

将经过验证的模式从自动记忆(MEMORY.md)提升到 CLAUDE.md 或 .claude/rules/ 中,使其成为永久执行的指令。

AGS - /si:promote — 将学习内容提升为规则 是什么?

该技能旨在帮助开发者将 Claude 自动记忆(MEMORY.md)中反复出现的、成熟的工作模式,提升为项目或全局的强制规则。通过 `/si:promote` 命令,用户可以将一个描述性的笔记转化为 `CLAUDE.md` 或 `.claude/rules/` 中的规范性指令,确保 Claude 在未来会话中始终遵守该规则。技能详细描述了从解析用户意图、检索自动记忆、确定规则适用范围(全局、按文件类型或路径)、提炼指令(从“描述性”转为“规范性”)、写入目标文件,到清理自动记忆的完整工作流。它还提供了提升决策指南,帮助用户判断何时应该提升模式(例如出现 3 次以上)或不应提升(例如一次性调试笔记),并区分了 `CLAUDE.md` 与 `.claude/rules/` 的适用场景。该技能适用于所有支持 Claude 规则系统的平台,如 Claude Code、Cursor 或任何遵循 Claude 规则约定的开发环境。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ASoudy/AGS/tree/HEAD/claude_skills_libraries/nginity-skills-library/engineering-team/self-improving-agent/skills/promote

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

/si: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"  # 带路径作用域

工作流程

步骤 1: 理解模式

解析用户的描述。如果描述模糊,提出一个澄清性问题:

  • "Claude 应该遵循什么具体行为?"
  • "这适用于所有文件还是特定路径?"

步骤 2: 在自动记忆中查找模式

# 在 MEMORY.md 中搜索相关条目
MEMORY_DIR="$HOME/.claude/projects/$(pwd | sed 's|/|%2F|g; s|%2F/|/|; s|^/||')/memory"
grep -ni "<关键词>" "$MEMORY_DIR/MEMORY.md"

显示匹配的条目并确认这是用户想要的。

步骤 3: 确定合适的目标

模式作用域目标示例
适用于整个项目./CLAUDE.md"使用 pnpm,而不是 npm"
适用于特定文件类型.claude/rules/<主题>.md"API 处理器需要校验"
适用于你所有项目~/.claude/CLAUDE.md"优先使用显式错误处理"

如果用户未指定目标,请根据作用域推荐一个。

步骤 4: 提炼为简洁的规则

将学习内容从自动记忆的笔记格式转换为 CLAUDE.md 的指令格式:

之前 (MEMORY.md — 描述性):

该项目使用 pnpm 工作空间。当我尝试 npm install 时失败了。锁文件是 pnpm-lock.yaml。必须使用 pnpm install 来安装依赖。

之后 (CLAUDE.md — 规范性):

## 构建与依赖
- 包管理器:pnpm(不是 npm)。使用 `pnpm install`。

提炼规则:

  • 每条规则尽量一行
  • 使用祈使语气("使用 X"、"始终 Y"、"绝不 Z")
  • 包含命令或示例,而不仅仅是概念
  • 不要背景故事——只需指令

步骤 5: 写入目标

对于 CLAUDE.md:

  1. 读取现有的 CLAUDE.md
  2. 找到合适的部分(或创建一个)
  3. 在正确的标题下追加新规则
  4. 如果文件超过 200 行,建议改用 .claude/rules/

对于 .claude/rules/:

  1. 如果文件不存在则创建
  2. 如果带作用域,则添加包含 paths 的 YAML 前置元数据
  3. 写入规则内容
---
paths:
  - "src/api/**/*.ts"
  - "tests/api/**/*"
---

# API 开发规则

- 所有端点必须使用 Zod 模式校验输入
- 使用 `ApiError` 类处理错误响应(而不是原始 Error)
- 在处理函数上包含 OpenAPI JSDoc 注释

步骤 6: 清理自动记忆

提升后,移除或标记 MEMORY.md 中的原始条目:

# 显示将被移除的内容
grep -n "<模式>" "$MEMORY_DIR/MEMORY.md"

要求用户确认移除。然后编辑 MEMORY.md 以移除已提升的条目。这为新的学习内容腾出空间。

步骤 7: 确认

✅ 已提升到 {{目标}}

规则: "{{提炼后的规则}}"
来源: MEMORY.md 第 {{n}} 行(已移除)
MEMORY.md: 剩余 {{lines}}/200 行

该模式现在是一条强制执行的指令。Claude 将在所有未来会话中遵循它。

提升决策指南

何时提升:

  • 模式在自动记忆中出现 3 次以上
  • 你曾不止一次纠正 Claude 关于它的事情
  • 这是一个任何贡献者都应该知道的项目约定
  • 它防止了重复出现的错误

何时不提升:

  • 这是一次性的调试笔记(留在自动记忆中)
  • 这是会话特定的上下文(会话存储器会处理此情况)
  • 它可能很快会改变(例如迁移期间)
  • 现有规则已经涵盖了它

CLAUDE.md 与 .claude/rules/

使用 CLAUDE.md 的场景使用 .claude/rules/ 的场景
全局项目规则文件类型特定的模式
构建命令测试约定
架构决策API 设计规则
团队约定框架特定的陷阱

提示

  • 保持 CLAUDE.md 在 200 行以内——超出部分使用 rules/ 目录
  • 每行一条规则比段落更容易维护
  • 包含具体的命令,而不仅仅是概念
  • 每季度审查已提升的规则——移除不再相关的内容

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ASoudy/AGS

Advanced JavaScript animation library skill for creating complex, high-performance web animations.

ASoudy/AGS

Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

ASoudy/AGS

Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

ASoudy/AGS

One sentence - what this skill does and when to invoke it

ASoudy/AGS

Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects. Use when animations stutter, transitions jank, or reviewing CSS/JS animation performance.

ASoudy/AGS

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

ASoudy/AGS

Pull a YouTube video transcript into a queryable markdown vault with yt-dlp subtitle discovery, VTT cleanup, metadata frontmatter, and capture-seed stubs.

ASoudy/AGS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

ASoudy/AGS

Generates high-converting Next.js/React landing pages with Tailwind CSS. Uses PAS, AIDA, and BAB frameworks for optimized copy/components (Heroes, Features, Pricing). Focuses on Core Web Vitals/SEO.

ASoudy/AGS

AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

ASoudy/AGS

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

ASoudy/AGS

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

ASoudy/AGS

Next.js App Router principles. Server Components, data fetching, routing patterns.

ASoudy/AGS

Expert integration of Supabase Auth with Next.js App Router

ASoudy/AGS

React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

ASoudy/AGS

Best practices for Remotion - Video creation in React

ASoudy/AGS

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

ASoudy/AGS

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

ASoudy/AGS

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

ASoudy/AGS

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

相关技能