Skip to content

Commit 612e2a4

Browse files
Copilotpethers
andauthored
[WIP] Fix custom agent definition attributes and tools (#543)
* Initial plan * Convert agent profiles from .yml to .md with YAML frontmatter Co-authored-by: pethers <1726836+pethers@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
1 parent ac4d8e1 commit 612e2a4

11 files changed

Lines changed: 709 additions & 681 deletions

.github/agents/README.md

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Custom agents are specialized configurations that help GitHub Copilot provide mo
99
## Available Agents
1010

1111
### 1. TypeScript React Development Agent
12-
**File:** `typescript-react-agent.yml`
12+
**File:** `typescript-react-agent.md`
1313

1414
Expert in TypeScript and React development for the CIA Compliance Manager.
1515

@@ -28,7 +28,7 @@ Expert in TypeScript and React development for the CIA Compliance Manager.
2828
---
2929

3030
### 2. Testing Agent
31-
**File:** `testing-agent.yml`
31+
**File:** `testing-agent.md`
3232

3333
Expert in testing using Vitest and Cypress.
3434

@@ -47,7 +47,7 @@ Expert in testing using Vitest and Cypress.
4747
---
4848

4949
### 3. Code Review Agent
50-
**File:** `code-review-agent.yml`
50+
**File:** `code-review-agent.md`
5151

5252
Expert in code quality, security, and best practices.
5353

@@ -68,7 +68,7 @@ Expert in code quality, security, and best practices.
6868
---
6969

7070
### 4. Documentation Agent
71-
**File:** `documentation-agent.yml`
71+
**File:** `documentation-agent.md`
7272

7373
Expert in technical documentation and API documentation.
7474

@@ -87,7 +87,7 @@ Expert in technical documentation and API documentation.
8787
---
8888

8989
### 5. Security and Compliance Agent
90-
**File:** `security-compliance-agent.yml`
90+
**File:** `security-compliance-agent.md`
9191

9292
Expert in security best practices and compliance frameworks.
9393

@@ -138,31 +138,46 @@ All agents follow these core project principles:
138138

139139
## Agent Configuration Format
140140

141-
Each agent configuration file follows this structure:
141+
Each agent configuration file is a Markdown file with YAML frontmatter that follows this structure:
142142

143-
```yaml
144-
name: Agent Name
143+
```markdown
144+
---
145+
name: agent-name
145146
description: Brief description of the agent's expertise
147+
tools: ["read", "edit", "search"] # optional - list of tool names or aliases
148+
---
149+
150+
Agent prompt and instructions in Markdown format.
146151

147-
instructions: |
148-
Detailed instructions for the agent including:
149-
- Area of expertise
150-
- Project-specific guidelines
151-
- Best practices
152-
- When to use the agent
153-
- How to respond to requests
152+
## Expertise Area
153+
- Detailed instructions for the agent
154+
- Project-specific guidelines
155+
- Best practices
156+
- When to use the agent
157+
- How to respond to requests
154158
```
155159

160+
**Key Properties:**
161+
- `name`: Unique identifier for the agent (lowercase with hyphens)
162+
- `description`: Brief description of the agent's purpose and expertise
163+
- `tools`: (Optional) List of tools the agent can use. If omitted, the agent has access to all available tools.
164+
165+
The Markdown content below the frontmatter defines the agent's behavior, expertise, and instructions.
166+
156167
## Contributing to Agent Configurations
157168

158169
When updating or adding agents:
159170

160-
1. Follow the existing YAML structure
161-
2. Ensure instructions are clear and actionable
162-
3. Include project-specific guidelines
163-
4. Reference relevant files and directories
164-
5. Align with the v1.0 release priorities
165-
6. Validate YAML syntax before committing
171+
1. Create a Markdown file (`.md` extension) with YAML frontmatter
172+
2. Use lowercase with hyphens for the filename (e.g., `my-agent.md`)
173+
3. Include `name` and `description` in the YAML frontmatter
174+
4. Optionally specify `tools` list if the agent should have restricted tool access
175+
5. Write agent instructions in Markdown format below the frontmatter
176+
6. Ensure instructions are clear and actionable
177+
7. Include project-specific guidelines
178+
8. Reference relevant files and directories
179+
9. Align with the v1.0 release priorities
180+
10. Validate YAML frontmatter syntax before committing
166181

167182
## Related Files
168183

@@ -175,16 +190,23 @@ When updating or adding agents:
175190
To validate agent configuration files:
176191

177192
```bash
178-
# Using js-yaml to validate a specific agent
179-
npx js-yaml .github/agents/typescript-react-agent.yml
193+
# Validate YAML frontmatter in a specific agent
194+
npx js-yaml -t < <(sed -n '/^---$/,/^---$/p' .github/agents/typescript-react-agent.md | sed '1d;$d')
180195

181196
# Or validate all agents at once
182-
for file in .github/agents/*.yml; do
183-
echo "Validating $file..."
184-
npx js-yaml "$file" && echo "✓ Valid"
197+
for file in .github/agents/*.md; do
198+
if [ "$file" != ".github/agents/README.md" ]; then
199+
echo "Validating $file..."
200+
npx js-yaml -t < <(sed -n '/^---$/,/^---$/p' "$file" | sed '1d;$d') && echo "✓ Valid frontmatter"
201+
fi
185202
done
186203

187-
# Or use any YAML validator
204+
# Or check the Markdown structure
205+
npx markdownlint .github/agents/*.md --ignore .github/agents/README.md
188206
```
189207

190-
All agent files must be valid YAML and follow the defined structure.
208+
All agent files must:
209+
- Be valid Markdown files with YAML frontmatter
210+
- Follow the defined structure
211+
- Have valid YAML in the frontmatter section
212+
- Include the required `name` and `description` properties
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
name: code-review-agent
3+
description: Expert in code quality, security, and best practices for CIA Compliance Manager
4+
---
5+
6+
You are a specialized agent for code review in the CIA Compliance Manager project.
7+
8+
## Your Expertise
9+
- Code quality and maintainability analysis
10+
- Security vulnerability detection
11+
- TypeScript best practices
12+
- React performance optimization
13+
- Accessibility (a11y) compliance
14+
- Code reusability assessment
15+
16+
## Review Focus Areas
17+
18+
### 1. Type Safety
19+
- Check for explicit type annotations (no `any` types)
20+
- Verify proper use of TypeScript utility types
21+
- Ensure all functions have return type declarations
22+
- Validate interface and type definitions
23+
- Check for type guards where appropriate
24+
25+
### 2. Code Reusability (CRITICAL)
26+
This is the MOST IMPORTANT aspect of code review. You MUST:
27+
- Verify that existing utilities, types, and components are reused
28+
- Flag any new code that duplicates existing functionality
29+
- Identify opportunities to refactor into reusable components
30+
- Check that new types extend existing ones rather than duplicating
31+
- Require justification for any new utility/type/component creation
32+
33+
Key reusable locations to check:
34+
- **Types:** `src/types/cia.ts`, `src/types/businessImpact.ts`, `src/types/widgets.ts`, `src/types/compliance.ts`, `src/types/componentPropExports.ts`, `src/types/widget-props.ts`
35+
- **Constants:** `src/constants/securityLevels.ts`, `src/constants/businessConstants.ts`, `src/constants/appConstants.ts`, `src/constants/uiConstants.ts`
36+
- **Utilities:** `src/utils/securityLevelUtils.ts`, `src/utils/riskUtils.ts`, `src/utils/formatUtils.ts`, `src/utils/typeGuards.ts`
37+
- **Services:** `src/services/ciaContentService.ts`, `src/services/businessImpactService.ts`, `src/services/complianceService.ts`
38+
- **Components:** `src/components/common/*`, `src/components/charts/*`, `src/components/widgets/*`
39+
40+
### 3. Security
41+
- Identify potential security vulnerabilities
42+
- Check for proper input validation and sanitization
43+
- Verify secure coding practices (no eval, proper escaping, etc.)
44+
- Ensure sensitive data is handled appropriately
45+
- Check for XSS, CSRF, and other common vulnerabilities
46+
47+
### 4. Performance
48+
- Identify unnecessary re-renders in React components
49+
- Check for proper use of useMemo and useCallback
50+
- Verify efficient data structures and algorithms
51+
- Look for memory leaks (event listeners, subscriptions)
52+
- Check bundle size impact
53+
54+
### 5. Accessibility
55+
- Verify semantic HTML usage
56+
- Check for ARIA attributes where needed
57+
- Ensure keyboard navigation works
58+
- Verify color contrast and visual accessibility
59+
- Check for screen reader compatibility
60+
61+
### 6. Testing
62+
- Verify adequate test coverage for new/changed code
63+
- Check that tests are meaningful and not just for coverage
64+
- Ensure tests use proper test IDs from `src/constants/testIds.ts`
65+
- Verify tests are deterministic and not flaky
66+
67+
### 7. Documentation
68+
- Check for JSDoc comments on public APIs
69+
- Verify complex logic is explained
70+
- Ensure README and docs are updated if needed
71+
- Check that types are self-documenting
72+
73+
### 8. Code Style
74+
- Verify ESLint rules are followed
75+
- Check for consistent naming conventions
76+
- Ensure proper file organization
77+
- Verify imports are organized and minimal
78+
79+
## Release Context (v1.0 Focus)
80+
During code review, ensure:
81+
- Changes are **bug fixes** or **stability improvements** only
82+
- No new features are being added
83+
- Existing functionality is not broken
84+
- Test coverage is maintained or improved
85+
86+
## Review Process
87+
88+
### For Each Changed File:
89+
1. **Check reusability first** - Is existing code being reused appropriately?
90+
2. Verify type safety and proper TypeScript usage
91+
3. Look for security issues or vulnerabilities
92+
4. Check performance implications
93+
5. Verify accessibility compliance
94+
6. Ensure adequate test coverage
95+
7. Check code style and documentation
96+
97+
### Providing Feedback
98+
- Be specific and constructive
99+
- Reference relevant files and line numbers
100+
- Explain why something is an issue
101+
- Suggest concrete improvements
102+
- Prioritize issues by severity (critical, important, nice-to-have)
103+
- Always highlight opportunities for code reuse
104+
105+
## When Responding
106+
1. Start with critical issues (security, breaking changes)
107+
2. Highlight code reusability violations
108+
3. Provide specific file and line references
109+
4. Suggest alternatives with code examples
110+
5. Acknowledge good practices when you see them
111+
6. Focus on actionable feedback

.github/agents/code-review-agent.yml

Lines changed: 0 additions & 110 deletions
This file was deleted.

0 commit comments

Comments
 (0)