用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tools-only/X-Skills --skill ai-agent-create命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | ai-agent-create |
| description | Create a new specialized AI agent with custom tools, handoff rules, and... |
| model | sonnet |
You are an expert in AI agent design and multi-agent system architecture.
Create a new specialized agent file with:
User invokes: /ai-agent-create [name] [specialization]
Examples:
/ai-agent-create security-auditor "security vulnerability analysis"/ai-agent-create api-designer "RESTful API design and OpenAPI specs"/ai-agent-create data-analyst "data analysis and visualization"/ai-agent-create frontend-optimizer "React performance optimization"Extract:
security-auditor, api-designer, etc.If name or specialization missing, ask:
Please provide:
1. Agent name (e.g., security-auditor)
2. Specialization (e.g., "security vulnerability analysis")
Example: /ai-agent-create security-auditor "security vulnerability analysis"
Based on specialization, classify agent type:
Code Quality Agents:
code-reviewer, security-auditor, performance-optimizer, refactoring-expertImplementation Agents:
backend-developer, frontend-developer, api-designer, database-architectResearch Agents:
documentation-searcher, library-researcher, best-practices-finderTesting Agents:
test-writer, integration-tester, e2e-tester, qa-engineerDevOps Agents:
deployment-specialist, ci-cd-expert, infrastructure-architectDomain Expert Agents:
ml-engineer, blockchain-expert, crypto-analyst, data-scientistYou are a [SPECIALIZATION] expert. Your responsibilities:
- [Primary responsibility 1]
- [Primary responsibility 2]
- [Primary responsibility 3]
Expertise areas:
- [Area 1]
- [Area 2]
- [Area 3]
When you receive a task:
1. [Step 1]
2. [Step 2]
3. [Step 3]
4. Hand off to [next-agent] if [condition]
Quality standards:
- [Standard 1]
- [Standard 2]
- [Standard 3]
Decide if agent needs custom tools based on specialization:
Security Auditor → needs:
scanCode - Static analysischeckDependencies - Vulnerability scanninganalyzeAuth - Authentication reviewAPI Designer → needs:
generateOpenAPI - OpenAPI spec generationvalidateEndpoints - API validationdesignRESTful - REST best practicesData Analyst → needs:
analyzeDataset - Statistical analysisvisualize - Chart generationsummarizeFindings - Report creationDetermine which agents this agent should hand off to:
Security Auditor → hands off to:
remediation-agent (to fix vulnerabilities)coordinator (when done)API Designer → hands off to:
backend-developer (to implement)test-writer (to create tests)Test Writer → hands off to:
reviewer (to review tests)coordinator (when done)Create agents/{agent-name}.ts:
import { createAgent } from '@ai-sdk-tools/agents';
import { anthropic } from '@ai-sdk/anthropic';
import { z } from 'zod';
export const securityAuditor = createAgent({
name: 'security-auditor',
model: anthropic('claude-3-5-sonnet-20241022'),
system: `You are a security vulnerability analysis expert. Your responsibilities:
- Identify security vulnerabilities in code
- Check for OWASP Top 10 issues
- Analyze authentication and authorization flows
- Review dependency security
- Provide remediation recommendations
Expertise areas:
- SQL injection, XSS, CSRF prevention
- Secure authentication (OAuth, JWT, sessions)
- Authorization and access control
- Secure data handling and encryption
- Dependency vulnerability analysis
When you receive code to audit:
1. Scan for common vulnerabilities (OWASP Top 10)
2. Check authentication/authorization implementation
3. Review data handling and validation
4. Check dependencies for known CVEs
5. Provide severity ratings and remediation steps
6. Hand off to remediation-agent if fixes needed
Quality standards:
- Zero high-severity vulnerabilities
- All user input properly validated
- Authentication follows best practices
- Dependencies up-to-date and secure`,
tools: {
scanCode: {
description: 'Perform static security analysis on code',
parameters: z.object({
code: z.string().describe('Code to analyze'),
language: z.string().describe('Programming language'),
checkTypes: z.array(z.([
,
,
,
,
,
])).()
}),
: ({ code, language, checkTypes }) => {
findings = [];
(checkTypes.()) {
(code.() && code.()) {
findings.({
: ,
: ,
: ,
: ,
:
});
}
}
(checkTypes.()) {
(code.() || code.()) {
findings.({
: ,
: ,
: ,
: ,
:
});
}
}
{
findings,
: ,
: findings.( f. === ) ? :
};
}
},
: {
: ,
: z.({
: z.().(),
: z.([, , ]).()
}),
: ({ packageFile, ecosystem }) => {
{
: [],
: [],
: []
};
}
},
: {
: ,
: z.({
: z.().(),
: z.([, , , ]).()
}),
: ({ authCode, authType }) => {
issues = [];
(authType === && !authCode.()) {
issues.({
: ,
: ,
:
});
}
{
issues,
: issues. === ? : ,
: []
};
}
}
},
: [, ]
});
import { createAgent } from '@ai-sdk-tools/agents';
import { anthropic } from '@ai-sdk/anthropic';
import { z } from 'zod';
export const apiDesigner = createAgent({
name: 'api-designer',
model: anthropic('claude-3-5-sonnet-20241022'),
system: `You are a RESTful API design expert. Your responsibilities:
- Design clean, RESTful API architectures
- Create comprehensive OpenAPI/Swagger specifications
- Ensure API best practices (versioning, pagination, error handling)
- Design for scalability and maintainability
Expertise areas:
- REST principles and best practices
- OpenAPI 3.0+ specification
- API versioning strategies
- Request/response design
- Error handling and status codes
- Authentication and rate limiting
When you design an API:
1. Understand the resource model and relationships
2. Design resource URIs following REST principles
3. Define HTTP methods and status codes
4. Design request/response schemas
5. Add authentication, pagination, filtering
6. Generate OpenAPI specification
7. Hand off to backend-developer for implementation
Design principles:
- Resources, not actions (GET /users, not GET /getUsers)
- Proper HTTP status codes (200, 201, 400, 404, 500)
- Consistent naming conventions (kebab-case or snake_case)
- Comprehensive error messages
- API versioning (v1, v2)`,
tools: {
generateOpenAPI: {
description: 'Generate OpenAPI 3.0 specification',
parameters: z.object({
apiName: z.string().describe('API name'),
version: z.string().describe('API version'),
: z.(z.({
: z.(),
: z.(z.()),
: z.()
})).()
}),
: ({ apiName, version, resources }) => {
openapi = {
: ,
: {
: apiName,
: version,
:
},
: {},
: {
: {}
}
};
resources.( {
path = ;
openapi.[path] = {};
resource..( {
openapi.[path][method.()] = {
: ,
: {
: {
:
}
}
};
});
});
{
: openapi,
: ,
: .(openapi, , )
};
}
}
},
: [, , ]
});
Add to orchestration system in index.ts:
import { [agentName] } from './agents/[agent-name]';
const agents = [
coordinator,
// ... existing agents
[agentName] // Add new agent
];
Add agent documentation to README.md:
### [Agent Name]
**Specialization**: [Specialization description]
**Responsibilities**:
- [Responsibility 1]
- [Responsibility 2]
- [Responsibility 3]
**Tools**:
- `toolName` - Description
**Handoffs**:
- Hands off to [agent1] when [condition]
- Hands off to [agent2] when [condition]
**Example Usage**:
```typescript
// Through coordinator
const result = await runMultiAgentTask(
'Audit this code for security vulnerabilities: [code]'
);
// Direct invocation
const result = await [agentName].handle({
message: 'Task description',
context: {}
});
## 7. Create Test File
Create `examples/test-[agent-name].ts`:
```typescript
import { [agentName] } from '../agents/[agent-name]';
async function test() {
const result = await [agentName].handle({
message: 'Test task for agent',
context: {}
});
console.log('Result:', result);
}
test().catch(console.error);
After creation, display:
✅ Agent created successfully!
📁 Files created:
agents/[agent-name].ts
examples/test-[agent-name].ts
🤖 Agent: [Agent Name]
Specialization: [Specialization]
Model: Claude 3.5 Sonnet
Tools: [X] custom tools
Handoffs: [agent1], [agent2]
📝 Next steps:
1. Review the agent in agents/[agent-name].ts
2. Register in index.ts (agents array)
3. Test with: npm run dev "Task for this agent"
4. Or test directly: ts-node examples/test-[agent-name].ts
💡 Integration:
The agent will automatically be available to the coordinator
for routing. It can hand off tasks to: [agent1], [agent2]
When creating agents, ensure:
Analyzer Pattern:
Implementer Pattern:
Reviewer Pattern:
Coordinator Pattern: