Appearance
skill-creator打造AI开发流水线:六大技能从需求到上线
skill-creator是Anthropic官方开源的元技能(Meta-Skill),专门用于创建、优化和评估其他技能。通过六大核心技能编排,实现从需求到上线的全流程自动化。
skill-creator简介
skill-creator是一个元技能,核心功能是帮助开发者快速创建、测试和优化其他技能。
标准技能目录结构:
my-skill/
├── SKILL.md # 核心配置(必需)
├── scripts/ # 可执行脚本
├── references/ # 参考文档
└── assets/ # 静态资源skill-creator创建技能的标准流程
启动skill-creator
在Claude中直接输入:
/skill-creator create a new skill提供需求描述
skill-creator会引导你完成:技能名称、功能描述、触发场景、需要使用的工具、复杂度级别。
实战:创建六大开发技能
1. 产品技能(product-skill)
yaml
---
name: product-skill
description: |
Product requirement analysis and user story creation skill.
Use when users need to: analyze requirements, create user stories,
write PRDs, or define acceptance criteria.
Triggers: "analyze requirement", "create user story", "write PRD"
---
# Product Skill
## Overview
This skill helps transform raw requirements into structured product documentation.
## Instructions
### Step 1: Requirement Analysis
Identify: Who are the users? What do they want? Why is this important?
### Step 2: User Story Creation
Generate stories using template:
## US-XXX: [Story Title]
**As a** [user type]
**I want** [goal]
**So that** [benefit]
### Step 3: PRD Generation
Create Product Requirements Document with:
1. Executive Summary
2. User Stories
3. Functional Requirements
4. Non-Functional Requirements
## Output
- Structured user stories
- Complete PRD document
- Acceptance criteria matrix2. UI设计技能(ui-design-skill)
yaml
---
name: ui-design-skill
description: |
UI design specification and component documentation skill.
Triggers: "design UI", "create spec", "component specification"
---
# UI Design Skill
## Phase 1: Layout Planning
Design page structure with responsive breakpoints.
## Phase 2: Component Design
Document each component with:
- Visual specs (size, colors, typography)
- States (default, hover, active, disabled)
- Variants
## Phase 3: Interaction Specification
Define behaviors and animations.
## Output
- Page layout diagrams
- Component specifications
- Interaction documentation3. 后端开发技能(backend-skill)
yaml
---
name: backend-skill
description: |
Backend API development and database architecture skill.
Triggers: "design API", "create model", "backend implementation"
dependencies: python>=3.8, fastapi, sqlalchemy
---
# Backend Development Skill
## API Design Patterns
RESTful endpoints with Pydantic models.
## Database Models
SQLAlchemy models with relationships.
## Authentication
JWT tokens with bcrypt password hashing.
## Example: Login Endpoint
@router.post("/login")
async def login(request: LoginRequest, db: Session):
# Check account lock
if await is_locked(request.email, db):
raise HTTPException(status_code=429)
# Verify user
user = await get_user(request.email, db)
if not verify(request.password, user.hash):
await record_failure(request.email, db)
raise HTTPException(status_code=401)
return {"token": create_token(user.id)}4. 前端开发技能(frontend-skill)
yaml
---
name: frontend-skill
description: |
Frontend React component development skill.
Triggers: "build component", "implement page", "frontend"
dependencies: react, typescript, @tanstack/react-query
---
# Frontend Development Skill
## Component Template
export const Component: React.FC<Props> = ({ id, onSuccess }) => {
const { data } = useQuery({ queryKey: ['data', id], queryFn: () => fetch(id) });
const mutation = useMutation({ mutationFn: update, onSuccess });
return (
<Card>
<h3>{data?.name}</h3>
<Button onClick={() => mutation.mutate(id)}>
Update
</Button>
</Card>
);
};
## API Integration
// useAuth.ts - Authentication hook
// useApi.ts - Data fetching hook
// apiService.ts - API client5. 测试技能(testing-skill)
yaml
---
name: testing-skill
description: |
Automated testing skill for unit, integration, and E2E tests.
Triggers: "write test", "run test", "coverage report"
dependencies: jest, pytest, playwright
---
# Testing Skill
## Unit Test (Jest)
describe('AuthService', () => {
it('should return token on valid credentials', async () => {
const result = await authService.login({ email, password });
expect(result).toHaveProperty('token');
});
});
## Integration Test (Supertest)
describe('POST /api/v1/auth/login', () => {
it('should return 200 with token', async () => {
const res = await request(app).post('/login').send({ email, password });
expect(res.status).toBe(200);
});
});
## E2E Test (Playwright)
test('successful login', async ({ page }) => {
await page.fill('[data-testid="email"]', 'test@example.com');
await page.fill('[data-testid="password"]', 'password123');
await page.click('[data-testid="submit"]');
await expect(page).toHaveURL('/dashboard');
});6. 代码审核技能(code-review-skill)
yaml
---
name: code-review-skill
description: |
Automated code review and quality analysis skill.
Triggers: "review code", "quality check", "security scan"
dependencies: eslint, security-scan
---
# Code Review Skill
## Review Categories
1. Code Quality (complexity, naming, comments)
2. Security Vulnerabilities (OWASP Top 10)
3. Best Practices (error handling, logging)
## Output Format
{
"summary": {
"files_reviewed": 15,
"issues_found": 8,
"quality_score": "A"
},
"issues": [
{
"severity": "high",
"message": "SQL Injection Risk",
"fix": "Use parameterized queries"
}
]
}构建主技能编排流水线
dev-pipeline主技能
yaml
---
name: dev-pipeline
description: |
Complete development pipeline orchestrator.
Coordinates: product → UI → backend → frontend → testing → review.
Triggers: "build feature", "start development", "run pipeline"
---
# Development Pipeline
## Sub-Skills Configuration
sub_skills:
- name: product-skill
trigger: "requirements"
depends_on: []
- name: ui-design-skill
trigger: "design"
depends_on: ["product-skill"]
- name: backend-skill
trigger: "backend"
depends_on: ["product-skill"]
- name: frontend-skill
trigger: "frontend"
depends_on: ["backend-skill"]
- name: testing-skill
trigger: "testing"
depends_on: ["frontend-skill"]
- name: code-review-skill
trigger: "review"
depends_on: ["testing-skill"]
## Usage
/dev-pipeline --feature "user-login" --input "./requirements.md"流水线执行流程
[1. Requirements] → [2. Product Analysis] → [3. UI Design]
↓
[6. Code Review] ← [5. Testing]
↑ ↓
[4. Backend] ←────────┘
↓
[7. Frontend]完整案例:用户登录功能开发
启动流水线
/dev-pipeline --feature "user-login"各技能输出
| 技能 | 输出 |
|---|---|
| 产品技能 | PRD文档、用户故事US-001/002/003、验收标准 |
| 后端技能 | API接口设计 POST /api/v1/auth/login |
| 前端技能 | Vue登录组件、表单验证、状态管理 |
| 测试技能 | 单元测试、集成测试、E2E测试用例 |
用户故事示例
| ID | 用户故事 |
|---|---|
| US-001 | As a 已注册用户, I want 使用邮箱密码登录, So that 访问个人账户 |
| US-002 | As a 回访用户, I want 保持登录状态, So that 快速访问 |
| US-003 | As a 安全团队, I want 锁定频繁失败的账户, So that 防止暴力攻击 |
API设计示例
POST /api/v1/auth/login
Request: { "email": "user@example.com", "password": "xxx", "remember_me": true }
Response (200): { "token": "eyJhbG...", "expires_in": 604800 }
Response (401): { "detail": "邮箱或密码错误" }
Response (429): { "detail": "账户已锁定,请15分钟后重试" }最佳实践
| 实践 | 说明 |
|---|---|
| 从简单开始 | 先创建纯指令型技能,熟悉流程 |
| 逐步添加脚本 | 需要自动化执行时添加scripts/ |
| 流水线编排 | 多个技能形成完整工作流 |
| 团队协作 | 共享技能目录,统一开发规范 |
总结
通过skill-creator构建AI开发工作流水线:
| 优势 | 说明 |
|---|---|
| ✅ 快速构建 | 引导式创建,无需从零开始 |
| ✅ 模块化设计 | 六大技能各司其职 |
| ✅ 流水线编排 | 主技能协调全流程 |
| ✅ 质量保障 | 测试+审核双重把关 |
学习路径:简单技能 → 添加脚本 → 构建流水线 → 团队协作
