@silverassist/agents-toolkit 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +135 -0
- package/README.md +388 -0
- package/bin/cli.js +940 -0
- package/package.json +52 -0
- package/src/index.js +58 -0
- package/templates/agents/AGENTS.codex.md +195 -0
- package/templates/agents/AGENTS.md +195 -0
- package/templates/agents/CLAUDE.md +213 -0
- package/templates/agents/copilot-instructions.md +83 -0
- package/templates/shared/instructions/css-styling.instructions.md +142 -0
- package/templates/shared/instructions/documentation-language.instructions.md +216 -0
- package/templates/shared/instructions/github-workflow.instructions.md +245 -0
- package/templates/shared/instructions/php-standards.instructions.md +293 -0
- package/templates/shared/instructions/react-components.instructions.md +196 -0
- package/templates/shared/instructions/server-actions.instructions.md +429 -0
- package/templates/shared/instructions/testing-standards.instructions.md +264 -0
- package/templates/shared/instructions/tests.instructions.md +103 -0
- package/templates/shared/instructions/typescript.instructions.md +106 -0
- package/templates/shared/instructions/wordpress-plugin-architecture.instructions.md +238 -0
- package/templates/shared/prompts/README.md +129 -0
- package/templates/shared/prompts/_partials/README.md +57 -0
- package/templates/shared/prompts/_partials/documentation.md +203 -0
- package/templates/shared/prompts/_partials/git-operations.md +171 -0
- package/templates/shared/prompts/_partials/github-integration.md +100 -0
- package/templates/shared/prompts/_partials/jira-integration.md +155 -0
- package/templates/shared/prompts/_partials/pr-template.md +216 -0
- package/templates/shared/prompts/_partials/validations.md +87 -0
- package/templates/shared/prompts/add-tests.prompt.md +151 -0
- package/templates/shared/prompts/analyze-github-issue.prompt.md +73 -0
- package/templates/shared/prompts/analyze-ticket.prompt.md +63 -0
- package/templates/shared/prompts/create-plan.prompt.md +118 -0
- package/templates/shared/prompts/create-pr.prompt.md +139 -0
- package/templates/shared/prompts/finalize-pr.prompt.md +150 -0
- package/templates/shared/prompts/fix-issues.prompt.md +92 -0
- package/templates/shared/prompts/new-wp-component.prompt.md +51 -0
- package/templates/shared/prompts/new-wp-plugin.prompt.md +46 -0
- package/templates/shared/prompts/prepare-pr.prompt.md +123 -0
- package/templates/shared/prompts/prepare-release.prompt.md +74 -0
- package/templates/shared/prompts/quality-check.prompt.md +45 -0
- package/templates/shared/prompts/review-code.prompt.md +81 -0
- package/templates/shared/prompts/work-github-issue.prompt.md +96 -0
- package/templates/shared/prompts/work-ticket.prompt.md +98 -0
- package/templates/shared/skills/README.md +53 -0
- package/templates/shared/skills/component-architecture/SKILL.md +321 -0
- package/templates/shared/skills/create-component/SKILL.md +714 -0
- package/templates/shared/skills/domain-driven-design/SKILL.md +277 -0
- package/templates/shared/skills/plugin-creation/SKILL.md +1094 -0
- package/templates/shared/skills/quality-checks/SKILL.md +493 -0
- package/templates/shared/skills/release-management/SKILL.md +649 -0
- package/templates/shared/skills/testing/SKILL.md +682 -0
- package/templates/shared/skills/testing-patterns/SKILL.md +243 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Jira Integration Partial
|
|
2
|
+
|
|
3
|
+
Reusable Jira/Atlassian MCP operations for prompts.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Include these steps in prompts that require Jira integration.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Ticket Operations
|
|
12
|
+
|
|
13
|
+
### Step: Verify Jira Access
|
|
14
|
+
|
|
15
|
+
1. **Test MCP connectivity**:
|
|
16
|
+
- Use Atlassian MCP `getAccessibleAtlassianResources` to verify access
|
|
17
|
+
- Confirm the correct cloud ID is available
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### Step: Read Jira Ticket
|
|
22
|
+
|
|
23
|
+
1. **Fetch ticket details**:
|
|
24
|
+
- Use `getJiraIssue` with the ticket ID
|
|
25
|
+
- Request fields: `summary`, `description`, `status`, `issuetype`, `priority`
|
|
26
|
+
|
|
27
|
+
2. **Extract key information**:
|
|
28
|
+
- **Summary**: Main ticket title
|
|
29
|
+
- **Description**: Full details and context
|
|
30
|
+
- **Issue Type**: Feature, Bug, Task, etc.
|
|
31
|
+
- **Priority**: Critical, High, Medium, Low
|
|
32
|
+
- **Status**: Current workflow state
|
|
33
|
+
|
|
34
|
+
3. **Read ticket comments**:
|
|
35
|
+
- Fetch all comments for additional context
|
|
36
|
+
- Note any clarifications or updates
|
|
37
|
+
|
|
38
|
+
4. **Identify acceptance criteria**:
|
|
39
|
+
- Look in description for "Acceptance Criteria" section
|
|
40
|
+
- List all checkable requirements
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Step: Search Jira
|
|
45
|
+
|
|
46
|
+
1. **Search using Rovo**:
|
|
47
|
+
- Use `search` tool for natural language queries
|
|
48
|
+
- Find related tickets or documentation
|
|
49
|
+
|
|
50
|
+
2. **Search using JQL** (advanced):
|
|
51
|
+
- Use `searchJiraIssuesUsingJql` for specific queries
|
|
52
|
+
- Example: `project = WEB AND status = "In Progress"`
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Update Operations
|
|
57
|
+
|
|
58
|
+
### Step: Add Comment to Ticket
|
|
59
|
+
|
|
60
|
+
1. **Add progress comment**:
|
|
61
|
+
- Use `addCommentToJiraIssue`
|
|
62
|
+
- Include relevant links (PR, branch, etc.)
|
|
63
|
+
- Use Markdown formatting for readability
|
|
64
|
+
|
|
65
|
+
2. **Comment templates**:
|
|
66
|
+
```markdown
|
|
67
|
+
## Development Started
|
|
68
|
+
- Branch: `feature/WEB-XXX-description`
|
|
69
|
+
- PR: [Link to PR]
|
|
70
|
+
|
|
71
|
+
## Progress
|
|
72
|
+
- [x] Initial implementation
|
|
73
|
+
- [ ] Tests
|
|
74
|
+
- [ ] Documentation
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### Step: Transition Ticket Status
|
|
80
|
+
|
|
81
|
+
1. **Get available transitions**:
|
|
82
|
+
- Use `getTransitionsForJiraIssue` to see valid next states
|
|
83
|
+
|
|
84
|
+
2. **Transition ticket**:
|
|
85
|
+
- Use `transitionJiraIssue` with the transition ID
|
|
86
|
+
- Common transitions:
|
|
87
|
+
- "In Progress" → Development started
|
|
88
|
+
- "In Review" → PR created
|
|
89
|
+
- "Ready for QA" → PR merged
|
|
90
|
+
- "Done" → Verified and complete
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### Step: Link PR to Ticket
|
|
95
|
+
|
|
96
|
+
1. **Add PR comment**:
|
|
97
|
+
```markdown
|
|
98
|
+
## Pull Request
|
|
99
|
+
- PR Link: [PR Title](PR_URL)
|
|
100
|
+
- Target: `dev` branch
|
|
101
|
+
- Reviewers: @team-member
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
2. **The Bitbucket-Jira integration** will automatically link PRs if:
|
|
105
|
+
- Ticket ID is in branch name
|
|
106
|
+
- Ticket ID is in PR title
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Ticket Analysis
|
|
111
|
+
|
|
112
|
+
### Step: Analyze Ticket Impact
|
|
113
|
+
|
|
114
|
+
1. **Identify affected areas**:
|
|
115
|
+
- Components that need changes
|
|
116
|
+
- Files likely to be modified
|
|
117
|
+
- Dependencies and integrations
|
|
118
|
+
|
|
119
|
+
2. **Estimate complexity**:
|
|
120
|
+
- **Simple**: 1-2 files, straightforward change
|
|
121
|
+
- **Medium**: 3-5 files, some logic changes
|
|
122
|
+
- **Complex**: 6+ files, architectural changes
|
|
123
|
+
|
|
124
|
+
3. **Identify risks**:
|
|
125
|
+
- Breaking changes
|
|
126
|
+
- Migration requirements
|
|
127
|
+
- External dependencies
|
|
128
|
+
- Testing complexity
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Common JQL Queries
|
|
133
|
+
|
|
134
|
+
| Purpose | JQL Query |
|
|
135
|
+
|---------|-----------|
|
|
136
|
+
| My open tickets | `assignee = currentUser() AND status != Done` |
|
|
137
|
+
| Sprint tickets | `project = WEB AND sprint in openSprints()` |
|
|
138
|
+
| Recently updated | `project = WEB AND updated >= -7d` |
|
|
139
|
+
| Blockers | `project = WEB AND priority = Highest` |
|
|
140
|
+
| PR ready | `project = WEB AND status = "In Review"` |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Ticket Workflow States
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
┌──────────┐ ┌─────────────┐ ┌───────────┐
|
|
148
|
+
│ Open │───▶│ In Progress │───▶│ In Review │
|
|
149
|
+
└──────────┘ └─────────────┘ └───────────┘
|
|
150
|
+
│
|
|
151
|
+
▼
|
|
152
|
+
┌──────────┐ ┌──────────────┐
|
|
153
|
+
│ Done │◀────│ Ready for QA │
|
|
154
|
+
└──────────┘ └──────────────┘
|
|
155
|
+
```
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Pull Request Template Partial
|
|
2
|
+
|
|
3
|
+
Reusable PR templates and steps for prompts.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Include these templates when creating or reviewing pull requests. Choose the format matching your project's issue tracker.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Format A: GitHub Issues (Conventional Commits)
|
|
12
|
+
|
|
13
|
+
### PR Title Format
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
type: Short description of changes
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
- `feat: Add rate limiting middleware`
|
|
21
|
+
- `fix: Resolve CORS headers for image requests`
|
|
22
|
+
- `refactor: Extract validation into middleware`
|
|
23
|
+
|
|
24
|
+
### PR Description Template
|
|
25
|
+
|
|
26
|
+
```markdown
|
|
27
|
+
## Description
|
|
28
|
+
Brief summary of what this PR accomplishes.
|
|
29
|
+
|
|
30
|
+
## Related Issue
|
|
31
|
+
Closes #ISSUE_NUMBER
|
|
32
|
+
|
|
33
|
+
## Changes Made
|
|
34
|
+
- Change 1: Description
|
|
35
|
+
- Change 2: Description
|
|
36
|
+
- Change 3: Description
|
|
37
|
+
|
|
38
|
+
## Type of Change
|
|
39
|
+
- [ ] Bug fix (non-breaking change fixing an issue)
|
|
40
|
+
- [ ] New feature (non-breaking change adding functionality)
|
|
41
|
+
- [ ] Breaking change (fix or feature causing existing functionality to break)
|
|
42
|
+
- [ ] Documentation update
|
|
43
|
+
- [ ] Refactoring (no functional changes)
|
|
44
|
+
|
|
45
|
+
## Testing
|
|
46
|
+
- [ ] Unit tests added/updated
|
|
47
|
+
- [ ] Manual testing performed
|
|
48
|
+
- [ ] Integration tests added/updated
|
|
49
|
+
|
|
50
|
+
## Checklist
|
|
51
|
+
- [ ] Code follows project style guidelines
|
|
52
|
+
- [ ] Self-review completed
|
|
53
|
+
- [ ] Documentation updated
|
|
54
|
+
- [ ] Tests pass locally
|
|
55
|
+
- [ ] No new warnings introduced
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Format B: Jira Ticket Reference
|
|
61
|
+
|
|
62
|
+
### PR Title Format
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
{TICKET-ID}: Short description of changes
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Examples:
|
|
69
|
+
- `WEB-726: Add font size accessibility controls`
|
|
70
|
+
- `WEB-734: Fix responsive logo sizing in mobile header`
|
|
71
|
+
- `WEB-800: Refactor contact form validation`
|
|
72
|
+
|
|
73
|
+
### PR Description Template
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
## Summary
|
|
77
|
+
Brief description of what this PR accomplishes.
|
|
78
|
+
|
|
79
|
+
## Jira Ticket
|
|
80
|
+
[{TICKET-ID}](https://your-org.atlassian.net/browse/{TICKET-ID})
|
|
81
|
+
|
|
82
|
+
## Changes Made
|
|
83
|
+
- Change 1: Description
|
|
84
|
+
- Change 2: Description
|
|
85
|
+
- Change 3: Description
|
|
86
|
+
|
|
87
|
+
## Type of Change
|
|
88
|
+
- [ ] 🐛 Bug fix (non-breaking change fixing an issue)
|
|
89
|
+
- [ ] ✨ New feature (non-breaking change adding functionality)
|
|
90
|
+
- [ ] 💥 Breaking change (fix or feature causing existing functionality to break)
|
|
91
|
+
- [ ] 📝 Documentation update
|
|
92
|
+
- [ ] 🔧 Refactoring (no functional changes)
|
|
93
|
+
- [ ] 🧪 Test addition or update
|
|
94
|
+
|
|
95
|
+
## Testing
|
|
96
|
+
Describe how changes were tested:
|
|
97
|
+
- [ ] Unit tests added/updated
|
|
98
|
+
- [ ] Manual testing performed
|
|
99
|
+
- [ ] E2E tests added/updated
|
|
100
|
+
|
|
101
|
+
## Checklist
|
|
102
|
+
- [ ] Code follows project style guidelines
|
|
103
|
+
- [ ] Self-review completed
|
|
104
|
+
- [ ] Comments added for complex logic
|
|
105
|
+
- [ ] Documentation updated
|
|
106
|
+
- [ ] No new warnings introduced
|
|
107
|
+
- [ ] Tests pass locally
|
|
108
|
+
|
|
109
|
+
## Deployment Notes
|
|
110
|
+
Any special deployment considerations:
|
|
111
|
+
- Database migrations needed
|
|
112
|
+
- Environment variables to add
|
|
113
|
+
- Cache invalidation required
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## PR Checklist Steps
|
|
119
|
+
|
|
120
|
+
### Step: Prepare PR Description
|
|
121
|
+
|
|
122
|
+
1. **Gather information**:
|
|
123
|
+
- Get issue/ticket title and description
|
|
124
|
+
- List all changed files
|
|
125
|
+
- Identify type of change
|
|
126
|
+
|
|
127
|
+
2. **Fill template sections**:
|
|
128
|
+
- Summary from issue description
|
|
129
|
+
- Link to issue (GitHub `Closes #N` or Jira URL)
|
|
130
|
+
- List key changes made
|
|
131
|
+
- Describe testing performed
|
|
132
|
+
|
|
133
|
+
3. **Add context**:
|
|
134
|
+
- Screenshots for UI changes
|
|
135
|
+
- Before/after comparisons
|
|
136
|
+
- Architecture diagrams if complex
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Step: Set PR Metadata
|
|
141
|
+
|
|
142
|
+
1. **Title**: `type: description` (GitHub) or `{TICKET-ID}: description` (Jira)
|
|
143
|
+
2. **Source branch**: Your feature/fix branch
|
|
144
|
+
3. **Target branch**: `main` (or project default from `.agents-toolkit.json`)
|
|
145
|
+
4. **Reviewers**: Based on code owners or changed files
|
|
146
|
+
5. **Labels**: Match issue labels where appropriate
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## PR Size Guidelines
|
|
151
|
+
|
|
152
|
+
| Size | Files Changed | Recommendation |
|
|
153
|
+
|------|---------------|----------------|
|
|
154
|
+
| Small | 1-5 files | ✅ Ideal |
|
|
155
|
+
| Medium | 6-15 files | ⚠️ Acceptable |
|
|
156
|
+
| Large | 16+ files | ❌ Consider splitting |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## PR Merge Checklist
|
|
161
|
+
|
|
162
|
+
Before merging:
|
|
163
|
+
- [ ] All review comments addressed
|
|
164
|
+
- [ ] CI/CD pipeline passes
|
|
165
|
+
- [ ] Branch is up-to-date with target
|
|
166
|
+
- [ ] No merge conflicts
|
|
167
|
+
- [ ] Documentation complete
|
|
168
|
+
- [ ] Issue linked and will auto-close
|
|
169
|
+
|
|
170
|
+
## PR Size Guidelines
|
|
171
|
+
|
|
172
|
+
| Size | Files Changed | Recommendation |
|
|
173
|
+
|------|---------------|----------------|
|
|
174
|
+
| Small | 1-5 files | ✅ Ideal |
|
|
175
|
+
| Medium | 6-15 files | ⚠️ Acceptable |
|
|
176
|
+
| Large | 16+ files | ❌ Consider splitting |
|
|
177
|
+
|
|
178
|
+
**Tips for large PRs**:
|
|
179
|
+
- Split into multiple smaller PRs
|
|
180
|
+
- Create base branch for related changes
|
|
181
|
+
- Use feature flags for partial releases
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Common PR Comments
|
|
186
|
+
|
|
187
|
+
### Request Changes
|
|
188
|
+
```markdown
|
|
189
|
+
**Suggestion:** Consider using X instead of Y because...
|
|
190
|
+
|
|
191
|
+
**Issue:** This could cause Z problem in edge case...
|
|
192
|
+
|
|
193
|
+
**Question:** What happens when...?
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Approval
|
|
197
|
+
```markdown
|
|
198
|
+
✅ LGTM!
|
|
199
|
+
|
|
200
|
+
Reviewed:
|
|
201
|
+
- Code quality
|
|
202
|
+
- Test coverage
|
|
203
|
+
- Documentation
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## PR Merge Checklist
|
|
209
|
+
|
|
210
|
+
Before merging:
|
|
211
|
+
- [ ] All review comments addressed
|
|
212
|
+
- [ ] CI/CD pipeline passes
|
|
213
|
+
- [ ] Branch is up-to-date with target
|
|
214
|
+
- [ ] No merge conflicts
|
|
215
|
+
- [ ] Documentation complete
|
|
216
|
+
- [ ] Jira ticket updated
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Validations Partial
|
|
2
|
+
|
|
3
|
+
Reusable validation steps for code quality checks.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Include these steps in prompts that require code validation before proceeding.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Code Quality Validation Steps
|
|
12
|
+
|
|
13
|
+
### Step: Run Validations
|
|
14
|
+
|
|
15
|
+
Before running checks, inspect `package.json` scripts and use project-supported commands.
|
|
16
|
+
|
|
17
|
+
Use this order:
|
|
18
|
+
- Lint: `npm run lint` (if script exists)
|
|
19
|
+
- TypeScript: `npm run type-check` (if script exists), otherwise `npx tsc --noEmit` when `tsconfig.json` exists
|
|
20
|
+
- Tests: `npm run test` (if script exists)
|
|
21
|
+
- Build (recommended before PR to protected branches): `npm run build` (if script exists)
|
|
22
|
+
|
|
23
|
+
**Run all code quality checks:**
|
|
24
|
+
|
|
25
|
+
1. **Lint check**:
|
|
26
|
+
- Run `npm run lint --if-present` to check for linting errors
|
|
27
|
+
- Fix any auto-fixable issues with `npm run lint --if-present -- --fix`
|
|
28
|
+
- Report any remaining issues that need manual attention
|
|
29
|
+
|
|
30
|
+
2. **Type check**:
|
|
31
|
+
- Run `npm run type-check --if-present` if available
|
|
32
|
+
- If there is no `type-check` script and `tsconfig.json` exists, run `npx tsc --noEmit`
|
|
33
|
+
- Identify and fix any type errors
|
|
34
|
+
- Ensure no `any` types were introduced
|
|
35
|
+
|
|
36
|
+
3. **Test suite**:
|
|
37
|
+
- Run `npm run test --if-present` to execute all unit tests
|
|
38
|
+
- Review test coverage if available
|
|
39
|
+
- Identify any failing tests and suggest fixes
|
|
40
|
+
- Ensure no regressions were introduced
|
|
41
|
+
|
|
42
|
+
4. **Build check**:
|
|
43
|
+
- Run `npm run build --if-present` before PR/push to protected branches
|
|
44
|
+
- Ensure no build-time regressions
|
|
45
|
+
|
|
46
|
+
5. **Report results**:
|
|
47
|
+
- ✅ List all passed checks
|
|
48
|
+
- ⚠️ List warnings that should be addressed
|
|
49
|
+
- ❌ List blockers that must be fixed before proceeding
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Quick Validation (Minimal)
|
|
54
|
+
|
|
55
|
+
For quick checks without full test suite:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run lint --if-present
|
|
59
|
+
npm run type-check --if-present
|
|
60
|
+
if [ -f tsconfig.json ]; then npx tsc --noEmit; fi
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Full Validation (Comprehensive)
|
|
66
|
+
|
|
67
|
+
For complete validation before PR:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run lint --if-present
|
|
71
|
+
npm run type-check --if-present
|
|
72
|
+
if [ -f tsconfig.json ]; then npx tsc --noEmit; fi
|
|
73
|
+
npm run test --if-present
|
|
74
|
+
npm run build --if-present
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Validation Checklist
|
|
80
|
+
|
|
81
|
+
- [ ] No linting errors
|
|
82
|
+
- [ ] No TypeScript errors
|
|
83
|
+
- [ ] All tests pass
|
|
84
|
+
- [ ] No `console.log` or debug statements
|
|
85
|
+
- [ ] No sensitive data exposed (API keys, secrets)
|
|
86
|
+
- [ ] No `any` types introduced
|
|
87
|
+
- [ ] JSDoc comments on new functions
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: agent
|
|
3
|
+
description: Add tests for a component or function
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add Tests
|
|
7
|
+
|
|
8
|
+
Add tests for **{target-file}** or **{component-name}**.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
- Reference: `.github/instructions/tests.instructions.md`
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
### 1. Analyze Target
|
|
16
|
+
|
|
17
|
+
Read the target file to understand:
|
|
18
|
+
- Exported functions/components
|
|
19
|
+
- Props and interfaces
|
|
20
|
+
- Dependencies and imports
|
|
21
|
+
- Edge cases to test
|
|
22
|
+
|
|
23
|
+
### 2. Determine Test Location
|
|
24
|
+
|
|
25
|
+
Based on project structure:
|
|
26
|
+
- Components: `src/components/{name}/__tests__/{name}.test.tsx`
|
|
27
|
+
- Hooks: `src/hooks/__tests__/{hook-name}.test.ts`
|
|
28
|
+
- Utils: `src/lib/__tests__/{util-name}.test.ts`
|
|
29
|
+
- Actions: `src/actions/__tests__/{action-name}.test.ts`
|
|
30
|
+
|
|
31
|
+
### 3. Create Test File
|
|
32
|
+
|
|
33
|
+
Use this template:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { render, screen } from '@testing-library/react';
|
|
37
|
+
import userEvent from '@testing-library/user-event';
|
|
38
|
+
import ComponentName from '../index';
|
|
39
|
+
|
|
40
|
+
describe('ComponentName', () => {
|
|
41
|
+
// Setup
|
|
42
|
+
const defaultProps = {
|
|
43
|
+
// default test props
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Rendering tests
|
|
47
|
+
describe('rendering', () => {
|
|
48
|
+
it('renders without crashing', () => {
|
|
49
|
+
render(<ComponentName {...defaultProps} />);
|
|
50
|
+
expect(screen.getByRole('...')).toBeInTheDocument();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('renders with custom props', () => {
|
|
54
|
+
render(<ComponentName {...defaultProps} customProp="value" />);
|
|
55
|
+
expect(screen.getByText('value')).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Behavior tests
|
|
60
|
+
describe('behavior', () => {
|
|
61
|
+
it('handles click events', async () => {
|
|
62
|
+
const user = userEvent.setup();
|
|
63
|
+
const handleClick = jest.fn();
|
|
64
|
+
|
|
65
|
+
render(<ComponentName {...defaultProps} onClick={handleClick} />);
|
|
66
|
+
await user.click(screen.getByRole('button'));
|
|
67
|
+
|
|
68
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Edge cases
|
|
73
|
+
describe('edge cases', () => {
|
|
74
|
+
it('handles empty data', () => {
|
|
75
|
+
render(<ComponentName {...defaultProps} data={[]} />);
|
|
76
|
+
expect(screen.getByText('No data')).toBeInTheDocument();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('handles null values', () => {
|
|
80
|
+
render(<ComponentName {...defaultProps} value={null} />);
|
|
81
|
+
expect(screen.queryByText('error')).not.toBeInTheDocument();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 4. Test Categories
|
|
88
|
+
|
|
89
|
+
Include tests for:
|
|
90
|
+
|
|
91
|
+
#### Rendering
|
|
92
|
+
- [ ] Renders without crashing
|
|
93
|
+
- [ ] Renders all expected elements
|
|
94
|
+
- [ ] Conditional rendering works
|
|
95
|
+
|
|
96
|
+
#### Props
|
|
97
|
+
- [ ] Default props work
|
|
98
|
+
- [ ] Custom props applied correctly
|
|
99
|
+
- [ ] Required props validated
|
|
100
|
+
|
|
101
|
+
#### User Interactions
|
|
102
|
+
- [ ] Click handlers work
|
|
103
|
+
- [ ] Form inputs update
|
|
104
|
+
- [ ] Keyboard navigation
|
|
105
|
+
|
|
106
|
+
#### State Changes
|
|
107
|
+
- [ ] Initial state correct
|
|
108
|
+
- [ ] State updates properly
|
|
109
|
+
- [ ] Side effects trigger
|
|
110
|
+
|
|
111
|
+
#### Edge Cases
|
|
112
|
+
- [ ] Empty data handled
|
|
113
|
+
- [ ] Null/undefined handled
|
|
114
|
+
- [ ] Error states displayed
|
|
115
|
+
|
|
116
|
+
### 5. Run Tests
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Preferred when test runner supports file filters (Jest/Vitest):
|
|
120
|
+
npm run test -- --testPathPattern="{test-file}"
|
|
121
|
+
|
|
122
|
+
# Fallback for projects without file-filter flags:
|
|
123
|
+
npm run test --if-present
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### 6. Check Coverage
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# If coverage is configured in the project:
|
|
130
|
+
npm run test -- --coverage
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Output
|
|
134
|
+
|
|
135
|
+
### Test Summary
|
|
136
|
+
- Tests created: N
|
|
137
|
+
- Passing: N
|
|
138
|
+
- Coverage: X%
|
|
139
|
+
|
|
140
|
+
### Test Cases
|
|
141
|
+
1. ✅ Test case 1
|
|
142
|
+
2. ✅ Test case 2
|
|
143
|
+
3. ✅ Test case 3
|
|
144
|
+
|
|
145
|
+
### Coverage Report
|
|
146
|
+
| Metric | Coverage |
|
|
147
|
+
|--------|----------|
|
|
148
|
+
| Statements | X% |
|
|
149
|
+
| Branches | X% |
|
|
150
|
+
| Functions | X% |
|
|
151
|
+
| Lines | X% |
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
agent: agent
|
|
3
|
+
description: Analyze a GitHub issue without creating branches or making changes
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Analyze GitHub Issue
|
|
7
|
+
|
|
8
|
+
Analyze GitHub issue **#{issue-number}** in repository **{owner}/{repo}** and provide a comprehensive assessment without making any code changes.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- GitHub MCP connection or `gh` CLI required
|
|
13
|
+
- Reference: `.github/prompts/_partials/github-integration.md`
|
|
14
|
+
|
|
15
|
+
## Steps
|
|
16
|
+
|
|
17
|
+
### 1. Fetch Issue Details
|
|
18
|
+
|
|
19
|
+
- Use `mcp_github_github_issue_read` with the issue number, or `gh issue view {issue-number} | cat`
|
|
20
|
+
- Read: title, body, labels, assignees, milestone, and linked pull requests
|
|
21
|
+
- Read all comments for additional context and discussion
|
|
22
|
+
|
|
23
|
+
### 2. Analyze Codebase Impact
|
|
24
|
+
|
|
25
|
+
- Search the codebase for related components, files, and patterns
|
|
26
|
+
- Identify files likely to be created or modified
|
|
27
|
+
- Check for existing implementations or patterns that should be followed
|
|
28
|
+
- Review project conventions (README, copilot-instructions.md, existing architecture)
|
|
29
|
+
|
|
30
|
+
### 3. Check Related Issues
|
|
31
|
+
|
|
32
|
+
- Search for related or dependent issues using labels or keywords
|
|
33
|
+
- Identify blockers or prerequisites
|
|
34
|
+
- Note any duplicate or overlapping issues
|
|
35
|
+
|
|
36
|
+
### 4. Generate Report
|
|
37
|
+
|
|
38
|
+
Provide the following structured analysis:
|
|
39
|
+
|
|
40
|
+
#### Summary
|
|
41
|
+
Brief overview of what needs to be done.
|
|
42
|
+
|
|
43
|
+
#### Acceptance Criteria
|
|
44
|
+
- [ ] Criterion 1
|
|
45
|
+
- [ ] Criterion 2
|
|
46
|
+
- [ ] Criterion 3
|
|
47
|
+
|
|
48
|
+
(Extract from issue body if present, or derive from the description)
|
|
49
|
+
|
|
50
|
+
#### Technical Impact
|
|
51
|
+
| Area | Files/Components | Impact Level |
|
|
52
|
+
|------|------------------|--------------|
|
|
53
|
+
| Components | list | High/Medium/Low |
|
|
54
|
+
| Tests | list | High/Medium/Low |
|
|
55
|
+
| Config | list | High/Medium/Low |
|
|
56
|
+
|
|
57
|
+
#### Complexity Estimate
|
|
58
|
+
- **Level**: Simple / Medium / Complex
|
|
59
|
+
- **Estimated effort**: X hours/days
|
|
60
|
+
- **Reasoning**: Why this complexity level
|
|
61
|
+
|
|
62
|
+
#### Risks & Blockers
|
|
63
|
+
- Risk 1: Description and mitigation
|
|
64
|
+
- Risk 2: Description and mitigation
|
|
65
|
+
|
|
66
|
+
#### Dependencies
|
|
67
|
+
- Related issues: #X, #Y
|
|
68
|
+
- External dependencies: packages, services
|
|
69
|
+
- Prerequisites that must be completed first
|
|
70
|
+
|
|
71
|
+
## Output Format
|
|
72
|
+
|
|
73
|
+
Present findings in a clear, structured format that can be referenced during implementation. Do NOT create branches, write code, or make any changes — analysis only.
|