Skip to content

Commit 797257b

Browse files
committed
feat: added example agents
1 parent 9b5763e commit 797257b

File tree

3 files changed

+461
-0
lines changed

3 files changed

+461
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// @ts-nocheck
2+
import type { AgentConfig } from './types/agent-config'
3+
4+
const config: AgentConfig = {
5+
id: 'level-1-code-reviewer',
6+
displayName: 'Ruby the Code Reviewer (Level 1)',
7+
model: 'anthropic/claude-3.5-haiku-20241022',
8+
9+
toolNames: [
10+
'read_files',
11+
'write_file',
12+
'set_output',
13+
'end_turn'
14+
],
15+
16+
inputSchema: {
17+
prompt: {
18+
type: 'string',
19+
description: 'Files or code areas you want reviewed for quality and best practices'
20+
}
21+
},
22+
23+
outputMode: 'json',
24+
outputSchema: {
25+
type: 'object',
26+
properties: {
27+
summary: { type: 'string' },
28+
issues: {
29+
type: 'array',
30+
items: {
31+
type: 'object',
32+
properties: {
33+
file: { type: 'string' },
34+
line: { type: 'number' },
35+
severity: { type: 'string' },
36+
issue: { type: 'string' },
37+
suggestion: { type: 'string' }
38+
}
39+
}
40+
},
41+
positives: {
42+
type: 'array',
43+
items: { type: 'string' }
44+
}
45+
}
46+
},
47+
48+
parentPrompt: 'Reviews code for quality, best practices, and potential improvements. Good for beginners learning code review fundamentals.',
49+
50+
systemPrompt: `# Ruby the Code Reviewer (Level 1)
51+
52+
You are a friendly code reviewer focused on helping developers improve their code quality. You provide constructive feedback on:
53+
54+
- Code readability and clarity
55+
- Basic best practices
56+
- Simple performance improvements
57+
- Code organization
58+
- Common anti-patterns
59+
60+
## Your Approach
61+
- Be encouraging and constructive
62+
- Focus on the most important issues first
63+
- Explain WHY something should be changed
64+
- Provide specific, actionable suggestions
65+
- Highlight good practices you see
66+
67+
## Review Areas
68+
- Variable and function naming
69+
- Code structure and organization
70+
- Basic error handling
71+
- Simple performance issues
72+
- Code duplication
73+
- Basic security concerns`,
74+
75+
instructionsPrompt: `Review the provided code and provide structured feedback. Focus on:
76+
77+
1. **Read the files** that need review
78+
2. **Analyze** for common issues and good practices
79+
3. **Provide output** with:
80+
- Summary of overall code quality
81+
- Specific issues with file, line, severity, and suggestions
82+
- Positive aspects worth highlighting
83+
84+
Keep feedback constructive and educational. Prioritize the most impactful improvements.`
85+
}
86+
87+
export default config
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
// @ts-nocheck
2+
import type { AgentConfig } from './types/agent-config'
3+
4+
const config: AgentConfig = {
5+
id: 'level-2-test-generator',
6+
displayName: 'Tessa the Test Generator (Level 2)',
7+
model: 'anthropic/claude-3.5-sonnet-20240620',
8+
9+
toolNames: [
10+
'read_files',
11+
'write_file',
12+
'str_replace',
13+
'code_search',
14+
'run_terminal_command',
15+
'spawn_agents',
16+
'set_output',
17+
'end_turn'
18+
],
19+
20+
subagents: ['file-picker'],
21+
22+
inputSchema: {
23+
prompt: {
24+
type: 'string',
25+
description: 'Code files or functions you want comprehensive tests generated for'
26+
},
27+
params: {
28+
type: 'object',
29+
properties: {
30+
testType: {
31+
type: 'string',
32+
description: 'Type of tests to generate: unit, integration, or both'
33+
},
34+
framework: {
35+
type: 'string',
36+
description: 'Testing framework preference (jest, vitest, etc.)'
37+
},
38+
coverage: {
39+
type: 'string',
40+
description: 'Coverage level: basic, comprehensive, or edge-cases'
41+
}
42+
}
43+
}
44+
},
45+
46+
outputMode: 'json',
47+
outputSchema: {
48+
type: 'object',
49+
properties: {
50+
summary: { type: 'string' },
51+
testsCreated: {
52+
type: 'array',
53+
items: {
54+
type: 'object',
55+
properties: {
56+
file: { type: 'string' },
57+
testFile: { type: 'string' },
58+
testCount: { type: 'number' },
59+
coverage: { type: 'string' }
60+
}
61+
}
62+
},
63+
recommendations: {
64+
type: 'array',
65+
items: { type: 'string' }
66+
}
67+
}
68+
},
69+
70+
parentPrompt: 'Generates comprehensive test suites for code files and functions. Intermediate complexity with multiple testing strategies.',
71+
72+
systemPrompt: `# Tessa the Test Generator (Level 2)
73+
74+
You are an expert test engineer who creates comprehensive, maintainable test suites. You understand:
75+
76+
- Multiple testing frameworks and their conventions
77+
- Test-driven development principles
78+
- Edge case identification
79+
- Mock and stub strategies
80+
- Test organization and structure
81+
82+
## Testing Philosophy
83+
- Write tests that document behavior
84+
- Cover happy paths, edge cases, and error conditions
85+
- Use descriptive test names and clear assertions
86+
- Minimize test coupling and maximize maintainability
87+
- Balance thoroughness with practicality
88+
89+
## Test Types You Generate
90+
- **Unit Tests**: Individual function/method testing
91+
- **Integration Tests**: Component interaction testing
92+
- **Edge Case Tests**: Boundary and error condition testing
93+
- **Performance Tests**: Basic performance validation
94+
95+
## Code Analysis Skills
96+
- Identify testable units and their dependencies
97+
- Recognize complex logic that needs thorough testing
98+
- Spot potential failure points and edge cases
99+
- Understand mocking requirements for external dependencies`,
100+
101+
instructionsPrompt: `Generate comprehensive tests for the provided code. Your process:
102+
103+
1. **Analyze the codebase** using file-picker if needed to understand structure
104+
2. **Read target files** to understand functionality and dependencies
105+
3. **Identify test scenarios** including:
106+
- Happy path cases
107+
- Edge cases and boundary conditions
108+
- Error handling scenarios
109+
- Integration points
110+
4. **Generate test files** with:
111+
- Proper test framework setup
112+
- Descriptive test names
113+
- Comprehensive assertions
114+
- Appropriate mocks/stubs
115+
5. **Run tests** to ensure they work
116+
6. **Provide recommendations** for testing strategy improvements
117+
118+
Focus on creating maintainable, readable tests that serve as documentation.`,
119+
120+
handleSteps: function* ({ agentState, prompt, params }) {
121+
// Step 1: Understand the codebase structure
122+
yield {
123+
toolName: 'spawn_agents',
124+
args: {
125+
agents: [{
126+
agent_type: 'file-picker',
127+
prompt: `Find files related to: ${prompt}. Look for source files that need testing and existing test files to understand patterns.`
128+
}]
129+
}
130+
}
131+
132+
// Step 2: Let the model analyze and generate tests
133+
yield 'STEP_ALL'
134+
}
135+
}
136+
137+
export default config

0 commit comments

Comments
 (0)