agent-skills-framework
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Skills Framework
Agent技能框架
Skill by ara.so — AI Agent Skills collection.
A comprehensive framework of 23 production-grade engineering skills that guide AI coding agents through the complete software development lifecycle. Skills encode workflows, quality gates, and best practices that senior engineers use, packaged for consistent agent execution.
由ara.so提供的Skill——AI Agent技能合集。
这是一套包含23项生产级工程技能的综合框架,可引导AI编码Agent完成完整的软件开发生命周期。这些技能封装了资深工程师所用的工作流、质量关卡和最佳实践,确保Agent执行的一致性。
What It Does
核心功能
Agent Skills provides:
- 7 slash commands mapping to development phases (,
/spec,/plan,/build,/test,/review,/code-simplify)/ship - 23 structured workflows covering everything from idea refinement to production deployment
- Auto-activation based on context (API design triggers , UI work triggers
api-and-interface-design)frontend-ui-engineering - Quality gates with verification steps, anti-rationalization tables, and "STOP" conditions
- Agent personas for specialized reviews (code-reviewer, test-engineer, security-auditor)
- Reference checklists for testing, security, performance, and accessibility
Agent Skills提供以下能力:
- 7条斜杠命令,对应不同开发阶段(、
/spec、/plan、/build、/test、/review、/code-simplify)/ship - 23个结构化工作流,覆盖从需求细化到生产部署的全流程
- 自动激活:基于上下文触发(API设计激活,UI开发激活
api-and-interface-design)frontend-ui-engineering - 质量关卡:包含验证步骤、反合理化表格和"STOP"终止条件
- Agent角色:针对专项评审的预设角色(code-reviewer、test-engineer、security-auditor)
- 参考检查清单:涵盖测试、安全、性能和可访问性领域
Installation
安装指南
Claude Code (Recommended)
Claude Code(推荐)
Via Marketplace:
bash
/plugin marketplace add addyosmani/agent-skills
/plugin install agent-skills@addy-agent-skillsIf SSH fails, use HTTPS:
bash
/plugin marketplace add https://github.com/addyosmani/agent-skills.git
/plugin install agent-skills@addy-agent-skillsLocal Development:
bash
git clone https://github.com/addyosmani/agent-skills.git
claude --plugin-dir /path/to/agent-skills通过市场安装:
bash
/plugin marketplace add addyosmani/agent-skills
/plugin install agent-skills@addy-agent-skills若SSH失败,使用HTTPS:
bash
/plugin marketplace add https://github.com/addyosmani/agent-skills.git
/plugin install agent-skills@addy-agent-skills本地开发:
bash
git clone https://github.com/addyosmani/agent-skills.git
claude --plugin-dir /path/to/agent-skillsCursor
Cursor
Copy individual files or the entire directory into :
SKILL.mdskills/.cursor/rules/bash
undefined将单个文件或整个目录复制到:
SKILL.mdskills/.cursor/rules/bash
undefinedClone the repo
克隆仓库
Copy all skills
复制所有技能
cp -r agent-skills/skills/* .cursor/rules/
cp -r agent-skills/skills/* .cursor/rules/
Or copy specific skills
或复制特定技能
cp agent-skills/skills/spec-driven-development/SKILL.md .cursor/rules/
undefinedcp agent-skills/skills/spec-driven-development/SKILL.md .cursor/rules/
undefinedGemini CLI
Gemini CLI
Install from GitHub:
bash
gemini skills install https://github.com/addyosmani/agent-skills.git --path skillsInstall from local clone:
bash
git clone https://github.com/addyosmani/agent-skills.git
gemini skills install ./agent-skills/skills/从GitHub安装:
bash
gemini skills install https://github.com/addyosmani/agent-skills.git --path skills从本地克隆安装:
bash
git clone https://github.com/addyosmani/agent-skills.git
gemini skills install ./agent-skills/skills/Windsurf
Windsurf
Add skill contents to :
.windsurf/rules.mdbash
undefined将技能内容添加到:
.windsurf/rules.mdbash
undefinedAppend skills to your rules file
将技能追加到规则文件
cat agent-skills/skills/*/SKILL.md >> .windsurf/rules.md
undefinedcat agent-skills/skills/*/SKILL.md >> .windsurf/rules.md
undefinedOpenCode
OpenCode
Uses and the tool for agent-driven execution:
AGENTS.mdskillbash
undefined使用和工具实现Agent驱动的执行:
AGENTS.mdskillbash
undefinedCopy the agents configuration
复制Agent配置
cp agent-skills/AGENTS.md .
cp agent-skills/AGENTS.md .
Skills auto-discovered from skills/ directory
技能将从skills/目录自动发现
undefinedundefinedGitHub Copilot
GitHub Copilot
Use agent personas as Copilot personas and add skills to :
.github/copilot-instructions.mdbash
undefined将Agent角色用作Copilot角色,并将技能添加到:
.github/copilot-instructions.mdbash
undefinedCopy agent definitions
复制Agent定义
cp agent-skills/agents/* .github/copilot-agents/
cp agent-skills/agents/* .github/copilot-agents/
Add skill content
添加技能内容
cat agent-skills/skills/*/SKILL.md >> .github/copilot-instructions.md
undefinedcat agent-skills/skills/*/SKILL.md >> .github/copilot-instructions.md
undefinedKiro IDE & CLI
Kiro IDE & CLI
Skills stored under at project or global level:
.kiro/skills/bash
undefined技能存储在项目或全局级别的目录下:
.kiro/skills/bash
undefinedCopy to project-level skills
复制到项目级技能目录
mkdir -p .kiro/skills
cp -r agent-skills/skills/* .kiro/skills/
undefinedmkdir -p .kiro/skills
cp -r agent-skills/skills/* .kiro/skills/
undefinedAny Other Agent
其他任意Agent
Skills are plain Markdown. Copy to your agent's instruction/context directory:
bash
undefined技能采用纯Markdown格式,复制到你的Agent指令/上下文目录即可:
bash
undefinedGeneric approach
通用方法
cp -r agent-skills/skills/ /path/to/your/agent/context/
undefinedcp -r agent-skills/skills/ /path/to/your/agent/context/
undefinedCore Commands
核心命令
/spec
- Spec Before Code
/spec/spec
- 先写规格再编码
/specDefine what to build before writing code. Activates :
spec-driven-developmentmarkdown
/spec
I need to build a URL shortener API with rate limitingOutput: PRD covering objectives, commands, structure, code style, testing strategy, and boundaries.
在编写代码前定义要构建的内容,激活技能:
spec-driven-developmentmarkdown
/spec
我需要构建一个带限流功能的URL短链API输出: 包含目标、命令、结构、代码风格、测试策略和边界范围的PRD(产品需求文档)。
/plan
- Small, Atomic Tasks
/plan/plan
- 拆分为小型原子任务
/planBreak specs into implementable units. Activates :
planning-and-task-breakdownmarkdown
/plan
Break down the URL shortener spec into tasksOutput: Ordered tasks with acceptance criteria, dependencies, and size estimates.
将规格拆解为可实现的单元,激活技能:
planning-and-task-breakdownmarkdown
/plan
将URL短链的规格拆分为任务输出: 有序任务列表,包含验收标准、依赖关系和规模预估。
/build
- One Slice at a Time
/build/build
- 逐步实现
/buildImplement incrementally with feature flags and safe defaults. Activates :
incremental-implementationmarkdown
/build
Implement task #1: URL shortening endpointOutput: Code + tests for one thin vertical slice, with feature flag wrapper.
通过功能标志和安全默认值增量实现,激活技能:
incremental-implementationmarkdown
/build
实现任务#1:URL短链生成端点输出: 单个垂直切片的代码+测试,包含功能标志包装器。
/test
- Tests Are Proof
/test/test
- 测试即证明
/testRed-Green-Refactor TDD cycle. Activates :
test-driven-developmentmarkdown
/test
Write tests for URL validation logicOutput: Test file following test pyramid (80% unit, 15% integration, 5% E2E).
遵循红-绿-重构的TDD周期,激活技能:
test-driven-developmentmarkdown
/test
为URL验证逻辑编写测试输出: 符合测试金字塔(80%单元测试、15%集成测试、5%端到端测试)的测试文件。
/review
- Improve Code Health
/review/review
- 提升代码健康度
/reviewFive-axis code review with severity labels. Activates :
code-review-and-qualitymarkdown
/review
Review the URL shortener PROutput: Structured feedback on correctness, maintainability, security, performance, testing.
基于五个维度的代码评审,附带严重程度标签,激活技能:
code-review-and-qualitymarkdown
/review
评审URL短链的PR输出: 针对正确性、可维护性、安全性、性能和测试的结构化反馈。
/code-simplify
- Clarity Over Cleverness
/code-simplify/code-simplify
- 清晰优于技巧
/code-simplifyReduce complexity while preserving behavior. Activates :
code-simplificationmarkdown
/code-simplify
Simplify the rate limiting middlewareOutput: Refactored code with change justification and test confirmation.
在保留功能的前提下降低复杂度,激活技能:
code-simplificationmarkdown
/code-simplify
简化限流中间件输出: 重构后的代码,包含变更理由和测试验证结果。
/ship
- Faster Is Safer
/ship/ship
- 更快更安全
/shipPre-launch checklist and staged rollout. Activates :
shipping-and-launchmarkdown
/ship
Prepare URL shortener for productionOutput: Deployment plan, monitoring setup, rollback procedure, feature flag lifecycle.
发布前检查清单和分阶段部署,激活技能:
shipping-and-launchmarkdown
/ship
为URL短链准备生产部署输出: 部署计划、监控设置、回滚流程和功能标志生命周期管理方案。
Key Skills Reference
核心技能参考
Meta: Discover Which Skill Applies
元技能:确定适用技能
using-agent-skillsmarkdown
User: "I want to add authentication to my app"
Agent (activates using-agent-skills):
→ Detects: unclear spec + security concern
→ Activates: interview-me → spec-driven-development → security-and-hardeningusing-agent-skillsmarkdown
用户:"我想给我的应用添加认证功能"
Agent(激活using-agent-skills):
→ 检测到:模糊需求 + 安全关注点
→ 激活:interview-me → spec-driven-development → security-and-hardeningDefine Phase
定义阶段
interview-memarkdown
Trigger: "interview me about the auth feature"
Agent:
Q1: What authentication method? (OAuth, JWT, sessions, magic links)
[waits for answer]
Q2: Which providers? (Google, GitHub, email, all three)
[continues until clear]spec-driven-developmentmarkdown
Activates when: Starting new project/feature
Output structure:interview-memarkdown
触发词:"interview me about the auth feature"
Agent:
问题1:采用哪种认证方式?(OAuth、JWT、会话、魔法链接)
[等待回答]
问题2:支持哪些提供商?(Google、GitHub、邮箱,或全部支持)
[持续提问直至需求清晰]spec-driven-developmentmarkdown
激活时机:启动新项目/功能时
输出结构:Objectives
目标
- User needs
- Success criteria
- 用户需求
- 成功标准
Commands & Usage
命令与用法
- CLI/API surface
- CLI/API接口
Structure
结构
- File organization
- Module boundaries
- 文件组织
- 模块边界
Code Style & Patterns
代码风格与模式
- Framework decisions
- State management
- 框架决策
- 状态管理
Testing Strategy
测试策略
- Coverage targets
- Test types
- 覆盖率目标
- 测试类型
Boundaries & Constraints
边界与约束
- What's in/out of scope
undefined- 需求范围
undefinedPlan Phase
规划阶段
planning-and-task-breakdownmarkdown
Input: PRD for URL shortener
Output:
Task 1: URL shortening endpoint
Acceptance: POST /shorten returns short code
Size: Small (~50 lines)
Depends on: none
Task 2: Redirect handler
Acceptance: GET /:code redirects to original URL
Size: Small (~30 lines)
Depends on: Task 1
Task 3: Rate limiting middleware
Acceptance: 429 after 100 req/min
Size: Medium (~100 lines)
Depends on: Task 1planning-and-task-breakdownmarkdown
输入:URL短链的PRD
输出:
任务1:URL短链生成端点
验收标准:POST /shorten 返回短链码
规模:小型(约50行)
依赖:无
任务2:重定向处理器
验收标准:GET /:code 重定向到原始URL
规模:小型(约30行)
依赖:任务1
任务3:限流中间件
验收标准:每分钟超过100次请求返回429
规模:中型(约100行)
依赖:任务1Build Phase
构建阶段
incremental-implementationbash
undefinedincremental-implementationbash
undefinedPattern for each task
每个任务的模式
- Feature flag wrapper (if multi-step)
- Minimal implementation
- Tests (Red-Green-Refactor)
- Verify locally
- Atomic commit
- Move to next slice
**Example commit sequence:**
```bash
git commit -m "feat: Add URL shortening endpoint
- POST /shorten accepts URL, returns short code
- Feature flag: ENABLE_URL_SHORTENER (default: true)
- Tests: valid URL, invalid URL, duplicate URL
- Safe default: returns 503 if feature disabled"
git commit -m "feat: Add redirect handler
- GET /:code redirects to original URL
- 404 for unknown codes
- Tests: valid code, invalid code, expired code"test-driven-developmentjavascript
// Step 1: RED - Write failing test
describe('URL shortener', () => {
test('generates unique short codes', () => {
const code1 = generateShortCode('https://example.com');
const code2 = generateShortCode('https://example.com');
expect(code1).toHaveLength(6);
expect(code2).toHaveLength(6);
expect(code1).not.toBe(code2); // ❌ FAILS - not implemented
});
});
// Step 2: GREEN - Minimal implementation
function generateShortCode(url) {
return crypto.randomBytes(3).toString('base64url');
}
// ✅ PASSES
// Step 3: REFACTOR - Improve without breaking
function generateShortCode(url) {
const hash = crypto.createHash('sha256').update(url).digest();
const timestamp = Date.now().toString(36);
return (hash.toString('base64url') + timestamp).slice(0, 6);
}
// ✅ STILL PASSESsource-driven-developmentmarkdown
User: "Add Redis caching to the URL shortener"
Agent (activates source-driven-development):
1. Fetch Redis docs: https://redis.io/docs/latest/develop/connect/clients/nodejs/
2. Verify connection pattern from official source
3. Implement with source citation
// Citation in code:
// Pattern from https://redis.io/docs/latest/develop/connect/clients/nodejs/
// Retrieved: 2026-05-16
const redis = require('redis');
const client = redis.createClient({
socket: { host: process.env.REDIS_HOST, port: 6379 }
});doubt-driven-developmentmarkdown
Trigger: Production security change, unfamiliar code, irreversible migration
Process:
1. CLAIM: "This JWT expiration is secure"
2. EXTRACT: ttl = 86400 (24 hours)
3. DOUBT: "24h is long for sensitive data; OWASP recommends 15min for access tokens"
4. RECONCILE: Change to 900s (15min) + refresh token pattern
5. STOP: Present change with justification- 功能标志包装器(若为多步骤任务)
- 最小化实现
- 测试(红-绿-重构)
- 本地验证
- 原子提交
- 进入下一个切片
**提交序列示例:**
```bash
git commit -m "feat: Add URL shortening endpoint
- POST /shorten 接收URL,返回短链码
- 功能标志:ENABLE_URL_SHORTENER(默认值:true)
- 测试:有效URL、无效URL、重复URL
- 安全默认:功能禁用时返回503"
git commit -m "feat: Add redirect handler
- GET /:code 重定向到原始URL
- 未知短链码返回404
- 测试:有效短链码、无效短链码、过期短链码"test-driven-developmentjavascript
// 步骤1:RED - 编写失败的测试
describe('URL shortener', () => {
test('generates unique short codes', () => {
const code1 = generateShortCode('https://example.com');
const code2 = generateShortCode('https://example.com');
expect(code1).toHaveLength(6);
expect(code2).toHaveLength(6);
expect(code1).not.toBe(code2); // ❌ 失败 - 未实现
});
});
// 步骤2:GREEN - 最小化实现
function generateShortCode(url) {
return crypto.randomBytes(3).toString('base64url');
}
// ✅ 通过
// 步骤3:REFACTOR - 优化且不破坏功能
function generateShortCode(url) {
const hash = crypto.createHash('sha256').update(url).digest();
const timestamp = Date.now().toString(36);
return (hash.toString('base64url') + timestamp).slice(0, 6);
}
// ✅ 仍然通过source-driven-developmentmarkdown
用户:"给URL短链添加Redis缓存"
Agent(激活source-driven-development):
1. 获取Redis文档:https://redis.io/docs/latest/develop/connect/clients/nodejs/
2. 从官方源验证连接模式
3. 实现并添加源引用
// 代码中的引用:
// Pattern from https://redis.io/docs/latest/develop/connect/clients/nodejs/
// Retrieved: 2026-05-16
const redis = require('redis');
const client = redis.createClient({
socket: { host: process.env.REDIS_HOST, port: 6379 }
});doubt-driven-developmentmarkdown
触发场景:生产环境安全变更、不熟悉的代码、不可逆迁移
流程:
1. 主张:"这个JWT过期设置是安全的"
2. 提取:ttl = 86400(24小时)
3. 质疑:"24小时对于敏感数据来说太长;OWASP建议访问令牌有效期为15分钟"
4. 调和:改为900秒(15分钟)+ 刷新令牌模式
5. 终止:呈现变更及理由Verify Phase
验证阶段
browser-testing-with-devtoolsbash
undefinedbrowser-testing-with-devtoolsbash
undefinedActivate DevTools connection
激活DevTools连接
chrome-devtools connect http://localhost:3000
chrome-devtools connect http://localhost:3000
Inspect DOM
检查DOM
query-selector 'button[data-testid="submit"]'
query-selector 'button[data-testid="submit"]'
Check console errors
查看控制台错误
get-console-logs --level error
get-console-logs --level error
Measure performance
性能分析
performance-profile --duration 5000
performance-profile --duration 5000
Network waterfall
网络瀑布图
get-network-log --filter fetch
**`debugging-and-error-recovery`** - Five-step triage:
```markdown
1. REPRODUCE
- Minimal repro case
- Consistent failure conditions
2. LOCALIZE
- Binary search through call stack
- Isolate failing component
3. REDUCE
- Strip non-essential code
- Minimal failing example
4. FIX
- Root cause, not symptom
- Safe fallback if fix unclear
5. GUARD
- Add test for regression
- Update error handlingget-network-log --filter fetch
**`debugging-and-error-recovery`** - 五步故障排查:
```markdown
1. 重现
- 最小化复现案例
- 一致的失败条件
2. 定位
- 通过调用栈二分查找
- 隔离故障组件
3. 简化
- 剥离非必要代码
- 最小化失败示例
4. 修复
- 解决根本原因而非表面症状
- 若修复不明确则添加安全回退
5. 防护
- 添加回归测试
- 更新错误处理Review Phase
评审阶段
code-review-and-qualitymarkdown
Reviewing: URL shortener rate limiting PR
✅ CORRECTNESS
- Logic handles edge cases (empty rate limit window)
⚠️ MAINTAINABILITY (Optional)
- Extract magic number 100 to config constant
✅ SECURITY
- Rate limit applied per IP, prevents abuse
📊 PERFORMANCE (FYI)
- Redis lookup adds 2ms latency, acceptable for use case
✅ TESTING
- Unit tests for rate limit logic
- Integration test for 429 response
- Missing: E2E test for reset after window expires (Nit)
SIZE: 87 lines ✅ (target: ~100)code-simplificationjavascript
// BEFORE (complexity: 12, 500+ line file)
function processUrl(url, options = {}) {
const { validate = true, transform = true, cache = true } = options;
if (validate && !isValidUrl(url)) throw new Error('Invalid URL');
let processed = url;
if (transform) {
processed = normalizeUrl(processed);
processed = removeTracking(processed);
processed = enforceHttps(processed);
}
if (cache) {
const cached = getCache(processed);
if (cached) return cached;
}
const result = shorten(processed);
if (cache) setCache(processed, result);
return result;
}
// AFTER (complexity: 4, extracted to modules)
function processUrl(url) {
const validated = validateUrl(url); // url-validator.js
const normalized = normalizeUrl(validated); // url-normalizer.js
return cachedShorten(normalized); // url-cache.js
}code-review-and-qualitymarkdown
评审对象:URL短链限流PR
✅ 正确性
- 逻辑处理了边缘情况(空限流窗口)
⚠️ 可维护性(可选)
- 将魔法数字100提取为配置常量
✅ 安全性
- 按IP应用限流,防止滥用
📊 性能(仅供参考)
- Redis查询增加2ms延迟,符合使用场景要求
✅ 测试
- 限流逻辑的单元测试
- 429响应的集成测试
- 缺失:窗口过期后重置的端到端测试(细微问题)
规模:87行 ✅(目标:约100行)code-simplificationjavascript
// 优化前(复杂度:12,文件超过500行)
function processUrl(url, options = {}) {
const { validate = true, transform = true, cache = true } = options;
if (validate && !isValidUrl(url)) throw new Error('Invalid URL');
let processed = url;
if (transform) {
processed = normalizeUrl(processed);
processed = removeTracking(processed);
processed = enforceHttps(processed);
}
if (cache) {
const cached = getCache(processed);
if (cached) return cached;
}
const result = shorten(processed);
if (cache) setCache(processed, result);
return result;
}
// 优化后(复杂度:4,拆分为模块)
function processUrl(url) {
const validated = validateUrl(url); // url-validator.js
const normalized = normalizeUrl(validated); // url-normalizer.js
return cachedShorten(normalized); // url-cache.js
}Ship Phase
发布阶段
git-workflow-and-versioningbash
undefinedgit-workflow-and-versioningbash
undefinedCommit pattern
提交模式
git commit -m "type(scope): description
- Detail 1
- Detail 2
- Detail 3
[Tests: unit, integration]
[Refs: #123]"
git commit -m "type(scope): description
- 细节1
- 细节2
- 细节3
[Tests: unit, integration]
[Refs: #123]"
Example
示例
git commit -m "feat(api): Add rate limiting middleware
- Redis-backed rate limiter (100 req/min per IP)
- Configurable via RATE_LIMIT_MAX env var
- Returns 429 with Retry-After header
[Tests: unit, integration]
[Refs: #456]"
git commit -m "feat(api): Add rate limiting middleware
- Redis驱动的限流(每IP每分钟100次请求)
- 通过RATE_LIMIT_MAX环境变量配置
- 返回429状态码及Retry-After响应头
[Tests: unit, integration]
[Refs: #456]"
Keep changes small (~100 lines)
保持变更规模较小(约100行)
git diff --stat
git diff --stat
3 files changed, 94 insertions(+), 12 deletions(-)
3 files changed, 94 insertions(+), 12 deletions(-)
**`shipping-and-launch`** - Pre-launch checklist:
```markdown
**`shipping-and-launch`** - 发布前检查清单:
```markdownPre-Launch Checklist
发布前检查清单
Code Quality
代码质量
- All tests passing (unit, integration, E2E)
- Code review approved by 2+ engineers
- No critical security vulnerabilities (npm audit)
- Performance regression test passed
- 所有测试通过(单元、集成、端到端)
- 代码评审获得2+工程师批准
- 无严重安全漏洞(npm audit检查)
- 性能回归测试通过
Configuration
配置
- Feature flags configured (ENABLE_URL_SHORTENER=false initially)
- Environment variables documented (.env.example)
- Secrets rotated for production (REDIS_PASSWORD, JWT_SECRET)
- 功能标志配置完成(生产环境初始值ENABLE_URL_SHORTENER=false)
- 环境变量已文档化(.env.example)
- 生产环境密钥已轮换(REDIS_PASSWORD、JWT_SECRET)
Observability
可观测性
- Logging configured (structured JSON)
- Metrics exported (request count, latency, error rate)
- Alerts defined (error rate >1%, p99 latency >500ms)
- Dashboards created (Grafana/Datadog)
- 日志配置完成(结构化JSON)
- 指标已导出(请求数、延迟、错误率)
- 告警已定义(错误率>1%,p99延迟>500ms)
- 仪表盘已创建(Grafana/Datadog)
Rollback Plan
回滚计划
- Rollback script tested (./scripts/rollback.sh)
- Database migrations reversible
- Feature flag kill switch documented
- 回滚脚本已测试(./scripts/rollback.sh)
- 数据库迁移可回滚
- 功能标志紧急关闭流程已文档化
Staged Rollout
分阶段发布
- Deploy to staging (1 hour soak test)
- Enable for internal users (10% traffic, 24 hours)
- Gradual rollout (25% → 50% → 100% over 1 week)
undefined- 部署到预发布环境(1小时 soak test)
- 对内部用户启用(10%流量,24小时)
- 逐步全量发布(25% → 50% → 100%,耗时1周)
undefinedAgent Personas
Agent角色
Pre-configured specialists for targeted reviews:
预配置的专项评审专家:
Code Reviewer (Senior Staff Engineer)
代码评审员(资深Staff工程师)
bash
undefinedbash
undefinedActivate in Claude Code
在Claude Code中激活
/plugin use code-reviewer
/plugin use code-reviewer
In Cursor, reference in chat
在Cursor中,在聊天中引用
@code-reviewer Review this PR
**Review standard:** "Would a staff engineer approve this?"
**Five axes:** Correctness, Maintainability, Security, Performance, Testing
**Severity labels:**
- `Nit` - Polish, not blocking
- `Optional` - Suggested improvement
- `FYI` - Informational@code-reviewer Review this PR
**评审标准:"Staff工程师会批准这个PR吗?"**
**五个维度:** 正确性、可维护性、安全性、性能、测试
**严重程度标签:**
- `Nit` - 优化建议,不阻塞发布
- `Optional` - 推荐改进
- `FYI` - 信息性提示Test Engineer (QA Specialist)
测试工程师(QA专家)
bash
/plugin use test-engineerbash
/plugin use test-engineerEvaluates test strategy
评估测试策略
**Focus:**
- Test pyramid adherence (80/15/5)
- Coverage gaps
- Flakiness detection
- Prove-It pattern compliance
**关注点:**
- 测试金字塔遵循度(80/15/5)
- 覆盖率缺口
- 不稳定测试检测
- Prove-It模式合规性Security Auditor
安全审计员
bash
/plugin use security-auditorbash
/plugin use security-auditorOWASP Top 10 assessment
OWASP Top 10评估
**Checks:**
- Input validation (SQL injection, XSS)
- Authentication/authorization
- Secrets management
- Dependency vulnerabilities
- CORS/CSP headers
**检查项:**
- 输入验证(SQL注入、XSS)
- 认证/授权
- 密钥管理
- 依赖漏洞
- CORS/CSP响应头Reference Checklists
参考检查清单
Testing Patterns
测试模式
javascript
// Test naming convention
describe('[Unit] URL shortener', () => {
test('generates 6-character codes for valid URLs', () => {
// ARRANGE
const url = 'https://example.com';
// ACT
const code = generateShortCode(url);
// ASSERT
expect(code).toHaveLength(6);
expect(code).toMatch(/^[a-zA-Z0-9_-]{6}$/);
});
test('throws error for invalid URLs', () => {
// ACT & ASSERT
expect(() => generateShortCode('not-a-url')).toThrow('Invalid URL');
});
});
// Integration test
describe('[Integration] URL shortener API', () => {
test('POST /shorten → GET /:code roundtrip', async () => {
const response = await request(app)
.post('/shorten')
.send({ url: 'https://example.com' });
const { code } = response.body;
const redirect = await request(app).get(`/${code}`);
expect(redirect.status).toBe(302);
expect(redirect.headers.location).toBe('https://example.com');
});
});
// E2E test
describe('[E2E] URL shortener user flow', () => {
test('user shortens URL and visits short link', async () => {
await page.goto('http://localhost:3000');
await page.fill('input[name="url"]', 'https://example.com');
await page.click('button[type="submit"]');
const shortUrl = await page.textContent('.short-url');
await page.goto(shortUrl);
expect(page.url()).toBe('https://example.com');
});
});javascript
// 测试命名规范
describe('[Unit] URL shortener', () => {
test('generates 6-character codes for valid URLs', () => {
// 准备
const url = 'https://example.com';
// 执行
const code = generateShortCode(url);
// 断言
expect(code).toHaveLength(6);
expect(code).toMatch(/^[a-zA-Z0-9_-]{6}$/);
});
test('throws error for invalid URLs', () => {
// 执行 & 断言
expect(() => generateShortCode('not-a-url')).toThrow('Invalid URL');
});
});
// 集成测试
describe('[Integration] URL shortener API', () => {
test('POST /shorten → GET /:code roundtrip', async () => {
const response = await request(app)
.post('/shorten')
.send({ url: 'https://example.com' });
const { code } = response.body;
const redirect = await request(app).get(`/${code}`);
expect(redirect.status).toBe(302);
expect(redirect.headers.location).toBe('https://example.com');
});
});
// 端到端测试
describe('[E2E] URL shortener user flow', () => {
test('user shortens URL and visits short link', async () => {
await page.goto('http://localhost:3000');
await page.fill('input[name="url"]', 'https://example.com');
await page.click('button[type="submit"]');
const shortUrl = await page.textContent('.short-url');
await page.goto(shortUrl);
expect(page.url()).toBe('https://example.com');
});
});Security Checklist
安全检查清单
markdown
undefinedmarkdown
undefinedPre-Commit Security Checks
提交前安全检查
- No hardcoded secrets (use process.env.SECRET_NAME)
- All user input validated (schema validation with Zod/Joi)
- SQL queries parameterized (no string concatenation)
- HTML output escaped (use templating engine auto-escaping)
- Authentication required for sensitive endpoints
- Authorization checks before data access
- HTTPS enforced in production (HSTS header)
- CORS configured restrictively (whitelist origins)
- CSP header set (no unsafe-inline)
- Dependencies scanned (npm audit fix)
undefined- 无硬编码密钥(使用process.env.SECRET_NAME)
- 所有用户输入已验证(使用Zod/Joi进行 schema 验证)
- SQL查询已参数化(无字符串拼接)
- HTML输出已转义(使用模板引擎自动转义)
- 敏感端点需要认证
- 数据访问前已做授权检查
- 生产环境强制HTTPS(HSTS响应头)
- CORS配置严格(白名单来源)
- CSP响应头已设置(无unsafe-inline)
- 依赖已扫描(npm audit fix)
undefinedPerformance Checklist
性能检查清单
markdown
undefinedmarkdown
undefinedCore Web Vitals Targets
Core Web Vitals目标
- LCP (Largest Contentful Paint): < 2.5s
- FID (First Input Delay): < 100ms
- CLS (Cumulative Layout Shift): < 0.1
- LCP(最大内容绘制): < 2.5s
- FID(首次输入延迟): < 100ms
- CLS(累积布局偏移): < 0.1
Backend Performance
后端性能
- Database queries indexed (EXPLAIN ANALYZE)
- N+1 queries eliminated (use eager loading)
- Response payloads gzipped
- HTTP caching headers set (Cache-Control, ETag)
- Rate limiting configured
- Connection pooling enabled (database, Redis)
- 数据库查询已建立索引(EXPLAIN ANALYZE)
- N+1查询已消除(使用预加载)
- 响应 payload 已压缩
- HTTP缓存响应头已设置(Cache-Control、ETag)
- 限流已配置
- 连接池已启用(数据库、Redis)
Frontend Performance
前端性能
- Code splitting configured (lazy load routes)
- Images optimized (WebP, responsive sizes)
- Fonts subsetted and preloaded
- Third-party scripts deferred
- Bundle size < 200KB gzipped
- Lighthouse score > 90
undefined- 代码分割已配置(懒加载路由)
- 图片已优化(WebP、响应式尺寸)
- 字体已子集化并预加载
- 第三方脚本已延迟加载
- 包大小 < 200KB(gzip后)
- Lighthouse评分 > 90
undefinedAccessibility Checklist
可访问性检查清单
markdown
undefinedmarkdown
undefinedWCAG 2.1 AA Compliance
WCAG 2.1 AA合规性
- Keyboard navigation (Tab, Enter, Esc work)
- Focus indicators visible (outline on :focus)
- Screen reader labels (aria-label, aria-labelledby)
- Color contrast ratio ≥ 4.5:1 (text) / 3:1 (large text)
- Alt text for images (descriptive, < 125 chars)
- Form inputs labeled (<label> or aria-label)
- Error messages announced (aria-live="assertive")
- Semantic HTML (nav, main, article, button vs div)
- Skip to main content link
- Tested with screen reader (NVDA, VoiceOver)
undefined- 键盘导航可用(Tab、Enter、Esc正常工作)
- 焦点指示器可见(:focus状态下的outline)
- 屏幕阅读器标签(aria-label、aria-labelledby)
- 颜色对比度 ≥ 4.5:1(普通文本)/ 3:1(大文本)
- 图片有替代文本(描述性,<125字符)
- 表单输入有标签(<label>或aria-label)
- 错误消息可被播报(aria-live="assertive")
- 使用语义化HTML(nav、main、article、button而非div)
- 有"跳转到主要内容"链接
- 已通过屏幕阅读器测试(NVDA、VoiceOver)
undefinedConfiguration
配置
Skill Activation Rules
技能激活规则
Skills auto-activate based on context. Customize in :
using-agent-skills/SKILL.mdyaml
undefined技能基于上下文自动激活,可在中自定义:
using-agent-skills/SKILL.mdyaml
undefinedTrigger patterns
触发模式
api_design:
- designing API
- creating endpoints
- REST interface
- GraphQL schema
frontend:
- building UI
- React component
- CSS styling
- accessibility
security:
- authentication
- authorization
- user input
- storing passwords
undefinedapi_design:
- designing API
- creating endpoints
- REST interface
- GraphQL schema
frontend:
- building UI
- React component
- CSS styling
- accessibility
security:
- authentication
- authorization
- user input
- storing passwords
undefinedCommand Aliases
命令别名
Add custom aliases in your agent config:
bash
undefined在Agent配置中添加自定义别名:
bash
undefinedClaude Code
Claude Code
/plugin config agent-skills --alias "review-pr=/review"
/plugin config agent-skills --alias "new-feature=/spec then /plan then /build"
/plugin config agent-skills --alias "review-pr=/review"
/plugin config agent-skills --alias "new-feature=/spec then /plan then /build"
Cursor (.cursor/rules/aliases.md)
Cursor (.cursor/rules/aliases.md)
When user says "review this PR", activate /review
When user says "start new feature", activate /spec → /plan → /build
undefinedWhen user says "review this PR", activate /review
When user says "start new feature", activate /spec → /plan → /build
undefinedQuality Gate Thresholds
质量关卡阈值
Customize in skill frontmatter:
yaml
undefined在技能前置元数据中自定义:
yaml
undefinedcode-review-and-quality/SKILL.md
code-review-and-quality/SKILL.md
review_gates:
max_change_size: 100 # lines
required_approvals: 2
min_test_coverage: 80 # percent
review_gates:
max_change_size: 100 # 行数
required_approvals: 2
min_test_coverage: 80 # 百分比
performance-optimization/SKILL.md
performance-optimization/SKILL.md
performance_targets:
lcp: 2500 # ms
fid: 100 # ms
cls: 0.1
bundle_size: 200 # KB gzipped
undefinedperformance_targets:
lcp: 2500 # 毫秒
fid: 100 # 毫秒
cls: 0.1
bundle_size: 200 # KB(gzip后)
undefinedCommon Patterns
常见模式
Full Lifecycle Example
全生命周期示例
markdown
undefinedmarkdown
undefinedUser starts a new feature
用户启动新功能
User: "I want to add a comment system to my blog"
Agent (activates using-agent-skills):
→ Underspecified, activates interview-me
Agent: "What kind of comments? (Nested threads, flat list, reactions-only)"
User: "Nested threads with reactions"
Agent: "Authentication required? (Login required, anonymous allowed, optional)"
User: "Login required"
Agent: "Moderation? (Pre-approval, post-reporting, auto-filter)"
User: "Post-reporting with flag button"
用户:"我想给我的博客添加评论系统"
Agent(激活using-agent-skills):
→ 需求不明确,激活interview-me
Agent:"需要哪种评论类型?(嵌套线程、扁平列表、仅点赞)"
用户:"带点赞的嵌套线程"
Agent:"需要认证吗?(必须登录、允许匿名、可选)"
用户:"必须登录"
Agent:"需要审核机制吗?(预审核、事后举报、自动过滤)"
用户:"事后举报,带举报按钮"
~95% confidence reached, switches to spec-driven-development
达到约95%置信度,切换到spec-driven-development
Agent: "Here's your PRD for the comment system..."
[PRD generated with objectives, API surface, data model, testing strategy]
User: "/plan"
Agent (activates planning-and-task-breakdown):
Task 1: Comment data model (User, Comment, Reaction tables)
Task 2: POST /comments endpoint (create comment)
Task 3: GET /comments/:postId endpoint (fetch thread)
Task 4: POST /comments/:id/reactions (add reaction)
Task 5: POST /comments/:id/report (flag for moderation)
...
User: "/build task 1"
Agent (activates incremental-implementation + test-driven-development):
- Writes failing test for Comment.create()
- Implements minimal schema
- Tests pass
- git commit -m "feat(comments): Add Comment data model"
[Repeats for each task]
User: "/review"
Agent (activates code-review-and-quality):
Reviewing: Comment system PR (347 lines - split recommended)
✅ CORRECTNESS: Thread nesting logic correct
⚠️ SECURITY (Required): Missing rate limit on POST /comments
✅ TESTING: 82% coverage, missing E2E test for report flow
Recommendation: Split into 2 PRs (data model + API, then reporting)
User: "/ship"
Agent (activates shipping-and-launch):
Pre-launch checklist:
- Feature flag ENABLE_COMMENTS=false in prod
- Rate limiting configured (10 comments/min)
- Monitoring for comment_created events
- Rollback script tested
Rollout plan:
- Deploy with flag off (1 hour soak)
- Enable for beta users (10%, 48 hours)
- Gradual rollout (25% → 50% → 100% over 1 week)
undefinedAgent:"这是评论系统的PRD..."
[生成包含目标、API接口、数据模型、测试策略的PRD]
用户:"/plan"
Agent(激活planning-and-task-breakdown):
任务1:评论数据模型(User、Comment、Reaction表)
任务2:POST /comments端点(创建评论)
任务3:GET /comments/:postId端点(获取评论线程)
任务4:POST /comments/:id/reactions(添加点赞)
任务5:POST /comments/:id/report(举报审核)
...
用户:"/build task 1"
Agent(激活incremental-implementation + test-driven-development):
- 编写Comment.create()的失败测试
- 实现最小化 schema
- 测试通过
- git commit -m "feat(comments): Add Comment data model"
[对每个任务重复此流程]
用户:"/review"
Agent(激活code-review-and-quality):
评审对象:评论系统PR(347行 - 建议拆分)
✅ 正确性:线程嵌套逻辑正确
⚠️ 安全性(必填):POST /comments缺少限流
✅ 测试:覆盖率82%,缺少举报流程的端到端测试
建议:拆分为2个PR(数据模型+API,然后是举报功能)
用户:"/ship"
Agent(激活shipping-and-launch):
发布前检查清单:
- 生产环境功能标志ENABLE_COMMENTS=false
- 限流已配置(每分钟10条评论)
- 已监控comment_created事件
- 回滚脚本已测试
发布计划:
- 关闭功能标志部署(1小时 soak)
- 对beta用户启用(10%流量,48小时)
- 逐步全量发布(25% → 50% → 100%,耗时1周)
undefinedDoubt-Driven Review for High-Stakes Change
高风险变更的质疑式评审
markdown
User: "Migrate user passwords from MD5 to bcrypt"
Agent (activates doubt-driven-development - irreversible migration):
CLAIM: "This migration script safely rehashes all passwords"
EXTRACT:
- Reads user table (10M rows)
- Iterates, rehashing MD5 → bcrypt
- Updates in place
DOUBT:
1. No rollback plan (bcrypt hashes can't reverse to MD5)
2. Table lock during migration (10M rows = ~2 hour downtime)
3. No password verification after rehash
4. Missing feature flag for new hash check
RECONCILE:
Alternative: Lazy migration
1. Add `password_hash_version` column
2. Check version on login
3. If MD5, verify then rehash to bcrypt
4. Update version to 'bcrypt'
5. No downtime, automatic rollback (keep MD5 as fallback)
STOP:
Present both approaches with tradeoff analysis
→ Recommend lazy migration for safetymarkdown
用户:"将用户密码从MD5迁移到bcrypt"
Agent(激活doubt-driven-development - 不可逆迁移):
主张:"此迁移脚本可安全地重新哈希所有密码"
提取信息:
- 读取用户表(1000万行)
- 迭代,将MD5重新哈希为bcrypt
- 原地更新
质疑:
1. 无回滚计划(bcrypt哈希无法还原为MD5)
2. 迁移期间表锁定(1000万行 = 约2小时停机)
3. 重新哈希后无密码验证
4. 缺少新哈希检查的功能标志
调和方案:
替代方案:延迟迁移
1. 添加`password_hash_version`列
2. 登录时检查版本
3. 若为MD5,验证后重新哈希为bcrypt
4. 将版本更新为'bcrypt'
5. 无停机,自动回滚(保留MD5作为 fallback)
终止:
呈现两种方案及权衡分析
→ 推荐延迟迁移以确保安全Source-Driven API Implementation
基于官方源的API实现
markdown
User: "Add Stripe payment processing"
Agent (activates source-driven-development):
1. Fetch official docs: https://stripe.com/docs/api
2. Verify Node.js SDK patterns
3. Extract canonical example
Implementation (with citations):
// Pattern from https://stripe.com/docs/api/payment_intents/create
// Retrieved: 2026-05-16
// SDK version: stripe@14.0.0
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
async function createPayment(amount, currency) {
// Verified: amount in smallest currency unit (cents for USD)
// Source: https://stripe.com/docs/currencies#zero-decimal
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: { enabled: true },
});
return paymentIntent.client_secret;
}
// UNVERIFIED: Webhook signature verification pattern
// TODO: Consult https://stripe.com/docs/webhooks/signatures
// Current implementation is placeholder
function verifyWebhook(payload, signature) {
// PLACEHOLDER - needs source verification
return stripe.webhooks.constructEvent(payload, signature, process.env.STRIPE_WEBHOOK_SECRET);
}markdown
用户:"添加Stripe支付处理"
Agent(激活source-driven-development):
1. 获取官方文档:https://stripe.com/docs/api
2. 验证Node.js SDK模式
3. 提取标准示例
实现(带引用):
// Pattern from https://stripe.com/docs/api/payment_intents/create
// Retrieved: 2026-05-16
// SDK版本: stripe@14.0.0
const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);
async function createPayment(amount, currency) {
// 已验证:金额使用最小货币单位(美元为分)
// 来源:https://stripe.com/docs/currencies#zero-decimal
const paymentIntent = await stripe.paymentIntents.create({
amount,
currency,
automatic_payment_methods: { enabled: true },
});
return paymentIntent.client_secret;
}
// 未验证:Webhook签名验证模式
// TODO: 参考https://stripe.com/docs/webhooks/signatures
// 当前实现为占位符
function verifyWebhook(payload, signature) {
// PLACEHOLDER - 需要源验证
return stripe.webhooks.constructEvent(payload, signature, process.env.STRIPE_WEBHOOK_SECRET);
}Troubleshooting
故障排除
Skills Not Activating
技能未激活
Problem: Commands like don't trigger skills
/specSolutions:
bash
undefined问题: 等命令未触发技能
/spec解决方案:
bash
undefinedClaude Code: Verify installation
Claude Code: 验证安装
/plugin list
/plugin list
Should show: agent-skills@addy-agent-skills
应显示: agent-skills@addy-agent-skills
Reinstall if missing
若缺失则重新安装
/plugin install agent-skills@addy-agent-skills
/plugin install agent-skills@addy-agent-skills
Cursor: Check rules directory
Cursor: 检查规则目录
ls .cursor/rules/
ls .cursor/rules/
Should contain SKILL.md files
应包含SKILL.md文件
Copy if empty
若为空则复制
cp -r /path/to/agent-skills/skills/* .cursor/rules/
cp -r /path/to/agent-skills/skills/* .cursor/rules/
Gemini CLI: Verify skill installation
Gemini CLI: 验证技能安装
gemini skills list
gemini skills list
Should show: agent-skills (23 skills)
应显示: agent-skills (23 skills)
Reinstall if missing
若缺失则重新安装
gemini skills install https://github.com/addyosmani/agent-skills.git --path skills
undefinedgemini skills install https://github.com/addyosmani/agent-skills.git --path skills
undefinedAgent Ignoring Quality Gates
Agent忽略质量关卡
Problem: Agent rationalizes skipping tests or security checks
Solution: Anti-rationalization tables in skills enforce gates
markdown
undefined问题: Agent合理化跳过测试或安全检查
解决方案: 技能中的反合理化表格强制执行关卡
markdown
undefinedExplicitly invoke the skill
显式调用技能
User: "Use test-driven-development for this feature"
用户:"Use test-driven-development for this feature"
Reference the anti-rationalization table
引用反合理化表格
User: "Follow the 'No Rationalizing Away Tests' rule from TDD skill"
用户:"Follow the 'No Rationalizing Away Tests' rule from TDD skill"
Activate doubt-driven-development for adversarial review
激活质疑式评审
User: "Use doubt-driven-development to review this security change"
undefined用户:"Use doubt-driven-development to review this security change"
undefinedSSH Errors During Install
安装时SSH错误
Problem:
git@github.com: Permission denied (publickey)Solutions:
bash
undefined问题:
git@github.com: Permission denied (publickey)解决方案:
bash
undefinedOption 1: Add SSH key to GitHub
选项1:将SSH密钥添加到GitHub
ssh-keygen -t ed25519 -C "your_email@example.com"
cat ~/.ssh/id_ed25519.pub
ssh-keygen -t ed25519 -C "your_email@example.com"
cat ~/.ssh/id_ed25519.pub
Add output to https://github.com/settings/keys
Option 2: Use HTTPS instead
选项2:改用HTTPS
/plugin marketplace add https://github.com/addyosmani/agent-skills.git
/plugin marketplace add https://github.com/addyosmani/agent-skills.git
Option 3: Clone locally and install from path
选项3:本地克隆后从路径安装
git clone https://github.com/addyosmani/agent-skills.git
claude --plugin-dir ./agent-skills
undefinedgit clone https://github.com/addyosmani/agent-skills.git
claude --plugin-dir ./agent-skills
undefinedLarge Changes Not Being Split
未拆分大型变更
Problem: Agent creates 500+ line PRs
Solution: Enforce change sizing from :
code-review-and-qualitymarkdown
User: "Follow the ~100 line change size rule from code-review-and-quality skill"
Agent: "This feature requires 347 lines. Splitting into 3 PRs:
1. Data model + migrations (94 lines)
2. API endpoints (118 lines)
3. Frontend integration (135 lines)"问题: Agent创建超过500行的PR
解决方案: 从技能强制变更规模限制
code-review-and-qualitymarkdown
用户:"Follow the ~100 line change size rule from code-review-and-quality skill"
Agent:"此功能需要347行。拆分为3个PR:
1. 数据模型+迁移(94行)
2. API端点(118行)
3. 前端集成(135行)"Skills Conflicting
技能冲突
Problem: Multiple skills give contradictory advice
Solution: Hierarchy defined in :
using-agent-skillsmarkdown
Priority order:
1. Security (always wins)
2. Correctness (bugs block)
3. Testing (no code without tests)
4. Maintainability (long-term health)
5. Performance (optimize after working)
Example conflict:
- Performance skill: "Cache this database query"
- Security skill: "Don't cache user-specific data in shared cache"
→ Security wins, use per-user cache or skip caching问题: 多个技能给出矛盾建议
解决方案: 中定义了优先级:
using-agent-skillsmarkdown
优先级顺序:
1. 安全(始终优先)
2. 正确性(bug阻塞发布)
3. 测试(无测试不编码)
4. 可维护性(长期健康)
5. 性能(功能正常后优化)
冲突示例:
- 性能技能:"缓存此数据库查询"
- 安全技能:"不要在共享缓存中存储用户特定数据"
→ 安全优先,使用按用户缓存或跳过缓存Environment Variables
环境变量
Skills reference but never include actual secrets:
bash
undefined技能引用但绝不包含实际密钥:
bash
undefinedDatabase
数据库
DATABASE_URL=postgresql://localhost/myapp
DATABASE_URL=postgresql://localhost/myapp
Redis
Redis
REDIS_HOST=localhost
REDIS_PASSWORD=<your-redis-password>
REDIS_HOST=localhost
REDIS_PASSWORD=<your-redis-password>
Authentication
认证
JWT_SECRET=<your-jwt-secret>
SESSION_SECRET=<your-session-secret>
JWT_SECRET=<your-jwt-secret>
SESSION_SECRET=<your-session-secret>
Third-party APIs
第三方API
STRIPE_SECRET_KEY=<your-stripe-key>
STRIPE_WEBHOOK_SECRET=<your-webhook-secret>
STRIPE_SECRET_KEY=<your-stripe-key>
STRIPE_WEBHOOK_SECRET=<your-webhook-secret>
Feature Flags
功能标志
ENABLE_URL_SHORTENER=true
ENABLE_COMMENTS=false
ENABLE_URL_SHORTENER=true
ENABLE_COMMENTS=false
Rate Limiting
限流
RATE_LIMIT_MAX=100 # requests per window
RATE_LIMIT_WINDOW=60 # seconds
RATE_LIMIT_MAX=100 # 每个窗口的请求数
RATE_LIMIT_WINDOW=60 # 秒
Monitoring
监控
SENTRY_DSN=<your-sentry-dsn>
DATADOG_API_KEY=<your-datadog-key>
undefinedSENTRY_DSN=<your-sentry-dsn>
DATADOG_API_KEY=<your-datadog-key>
undefinedBest Practices
最佳实践
Start with /spec
/spec从/spec
开始
/specNever code without a spec:
markdown
❌ Bad:
User: "Build a user dashboard"
Agent: *starts writing React components*
✅ Good:
User: "Build a user dashboard"
Agent (activates spec-driven-development):
"Let me create a spec first. What data should the dashboard show?"绝不无规格编码:
markdown
❌ 错误:
用户:"Build a user dashboard"
Agent: *开始编写React组件*
✅ 正确:
用户:"Build a user dashboard"
Agent(激活spec-driven-development):
"我先创建一个规格。仪表盘需要展示哪些数据?"Use Feature Flags for Multi-Step Changes
对多步骤变更使用功能标志
javascript
// Wrap incomplete features
if (process.env.ENABLE_NEW_DASHBOARD === 'true') {
return <NewDashboard />;
}
return <LegacyDashboard />;
// Deploy with flag off, enable graduallyjavascript
// 包裹未完成的功能
if (process.env.ENABLE_NEW_DASHBOARD === 'true') {
return <NewDashboard />;
}
return <LegacyDashboard />;
// 关闭标志部署,逐步启用Atomic Commits, Always
始终使用原子提交
bash
undefinedbash
undefinedEach commit is independently deployable
每个提交都可独立部署
git log --oneline
abc123 feat(api): Add
git log --oneline
abc123 feat(api): Add