amlei-skills 1.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/.claude-plugin/plugin.json +22 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/agents/README.md +300 -0
- package/agents/auth-route-debugger.md +117 -0
- package/agents/auth-route-tester.md +93 -0
- package/agents/auto-error-resolver.md +96 -0
- package/agents/code-architecture-reviewer.md +83 -0
- package/agents/code-refactor-master.md +94 -0
- package/agents/documentation-architect.md +82 -0
- package/agents/frontend-error-fixer.md +76 -0
- package/agents/plan-reviewer.md +52 -0
- package/agents/refactor-planner.md +62 -0
- package/agents/web-research-specialist.md +78 -0
- package/commands/d_system_analyse.md +8 -0
- package/commands/route-research-for-testing.md +37 -0
- package/package.json +28 -0
- package/skills/git-gh/SKILL.md +145 -0
- package/skills/skill-creation/SKILL.md +196 -0
- package/skills/skill-creation/resources/advanced-patterns.md +91 -0
- package/skills/skill-creation/resources/frontmatter-examples.md +111 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "amlei-skills",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Production-tested skills, agents, and commands for Claude Code — backend/frontend development, testing, code review, git workflow, and more. Bilingual (Chinese/English).",
|
|
5
|
+
"displayName": "Amlei Skills",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "amlei"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"skills",
|
|
11
|
+
"agents",
|
|
12
|
+
"backend",
|
|
13
|
+
"frontend",
|
|
14
|
+
"testing",
|
|
15
|
+
"code-review",
|
|
16
|
+
"documentation",
|
|
17
|
+
"git",
|
|
18
|
+
"bilingual"
|
|
19
|
+
],
|
|
20
|
+
"category": "development",
|
|
21
|
+
"license": "MIT"
|
|
22
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 amlei
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Amlei Skills — Claude Code Plugin
|
|
2
|
+
|
|
3
|
+
A collection of production-tested **skills**, **agents**, and **commands** for [Claude Code](https://claude.ai/code), distributed as a plugin. Bilingual support (Chinese/English).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# From npm
|
|
9
|
+
claude plugin install npm:amlei-skills
|
|
10
|
+
|
|
11
|
+
# Or from local directory
|
|
12
|
+
claude plugin install /path/to/amlei-skills
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
After install, reload plugins: `/reload-plugins`
|
|
16
|
+
|
|
17
|
+
## Skills (12)
|
|
18
|
+
|
|
19
|
+
Invoke as `/amlei-skills:<name>` or let Claude auto-activate based on context.
|
|
20
|
+
|
|
21
|
+
| Skill | Invocation | Description |
|
|
22
|
+
|-------|-----------|-------------|
|
|
23
|
+
| **git-gh** | `/amlei-skills:git-gh` | Git commit/push/PR workflow using gh CLI |
|
|
24
|
+
| **resume** | `/amlei-skills:resume` | STAR-based resume writing assistant |
|
|
25
|
+
| **skill-creation** | `/amlei-skills:skill-creation` | Create Claude Code skills (official standard) |
|
|
26
|
+
| **skill-developer** | `/amlei-skills:skill-developer` | Advanced skill development guide |
|
|
27
|
+
| **backend-dev-guidelines** | `/amlei-skills:backend-dev-guidelines` | Node.js/Express/TypeScript patterns |
|
|
28
|
+
| **frontend-dev-guidelines** | `/amlei-skills:frontend-dev-guidelines` | React/TypeScript/MUI v7 patterns |
|
|
29
|
+
| **error-tracking** | `/amlei-skills:error-tracking` | Sentry v8 error tracking integration |
|
|
30
|
+
| **route-tester** | `/amlei-skills:route-tester` | Authenticated API route testing |
|
|
31
|
+
| **dev-docs-reader** | `/amlei-skills:dev-docs-reader` | Documentation lookup (CN/EN) |
|
|
32
|
+
| **d_system_analyse** | `/amlei-skills:d_system_analyse` | Senior system code analyst (CN/EN) |
|
|
33
|
+
| **webapp-testing** | `/amlei-skills:webapp-testing` | Web application testing toolkit |
|
|
34
|
+
| **web-scraper-analyzer** | `/amlei-skills:web-scraper-analyzer` | Web scraping with Playwright |
|
|
35
|
+
|
|
36
|
+
## Agents (10)
|
|
37
|
+
|
|
38
|
+
Agents are available automatically when the plugin is enabled.
|
|
39
|
+
|
|
40
|
+
| Agent | Description |
|
|
41
|
+
|-------|-------------|
|
|
42
|
+
| **code-architecture-reviewer** | Review code for architectural consistency |
|
|
43
|
+
| **plan-reviewer** | Validate development plans |
|
|
44
|
+
| **refactor-planner** | Create refactoring strategies |
|
|
45
|
+
| **code-refactor-master** | Execute comprehensive refactoring |
|
|
46
|
+
| **documentation-architect** | Create documentation |
|
|
47
|
+
| **frontend-error-fixer** | Debug frontend errors |
|
|
48
|
+
| **auto-error-resolver** | Fix TypeScript compilation errors |
|
|
49
|
+
| **auth-route-tester** | Test authenticated API endpoints |
|
|
50
|
+
| **auth-route-debugger** | Debug authentication issues |
|
|
51
|
+
| **web-research-specialist** | Research technical issues online |
|
|
52
|
+
|
|
53
|
+
## Commands (2)
|
|
54
|
+
|
|
55
|
+
| Command | Description |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `/amlei-skills:d_system_analyse` | System analysis command |
|
|
58
|
+
| `/amlei-skills:route-research-for-testing` | Map routes and launch tests |
|
|
59
|
+
|
|
60
|
+
## Quick Reference
|
|
61
|
+
|
|
62
|
+
| If you want to... | Use |
|
|
63
|
+
|-------------------|-----|
|
|
64
|
+
| Commit & push code | `/amlei-skills:git-gh` |
|
|
65
|
+
| Write a resume | `/amlei-skills:resume` |
|
|
66
|
+
| Create a new skill | `/amlei-skills:skill-creation` |
|
|
67
|
+
| Add backend routes | `/amlei-skills:backend-dev-guidelines` |
|
|
68
|
+
| Build React components | `/amlei-skills:frontend-dev-guidelines` |
|
|
69
|
+
| Setup error tracking | `/amlei-skills:error-tracking` |
|
|
70
|
+
| Test API routes | `/amlei-skills:route-tester` |
|
|
71
|
+
| Understand a codebase | `/amlei-skills:d_system_analyse` |
|
|
72
|
+
| Refactor code | `code-refactor-master` agent |
|
|
73
|
+
| Review architecture | `code-architecture-reviewer` agent |
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Test locally
|
|
79
|
+
claude --plugin-dir .
|
|
80
|
+
|
|
81
|
+
# Reload after changes (in Claude Code session)
|
|
82
|
+
/reload-plugins
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
MIT
|
package/agents/README.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Agents
|
|
2
|
+
|
|
3
|
+
Specialized agents for complex, multi-step tasks.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What Are Agents?
|
|
8
|
+
|
|
9
|
+
Agents are autonomous Claude instances that handle specific complex tasks. Unlike skills (which provide inline guidance), agents:
|
|
10
|
+
- Run as separate sub-tasks
|
|
11
|
+
- Work autonomously with minimal supervision
|
|
12
|
+
- Have specialized tool access
|
|
13
|
+
- Return comprehensive reports when complete
|
|
14
|
+
|
|
15
|
+
**Key advantage:** Agents are **standalone** - just copy the `.md` file and use immediately!
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Available Agents (10)
|
|
20
|
+
|
|
21
|
+
### code-architecture-reviewer
|
|
22
|
+
**Purpose:** Review code for architectural consistency and best practices
|
|
23
|
+
|
|
24
|
+
**When to use:**
|
|
25
|
+
- After implementing a new feature
|
|
26
|
+
- Before merging significant changes
|
|
27
|
+
- When refactoring code
|
|
28
|
+
- To validate architectural decisions
|
|
29
|
+
|
|
30
|
+
**Integration:** ✅ Copy as-is
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
### code-refactor-master
|
|
35
|
+
**Purpose:** Plan and execute comprehensive refactoring
|
|
36
|
+
|
|
37
|
+
**When to use:**
|
|
38
|
+
- Reorganizing file structures
|
|
39
|
+
- Breaking down large components
|
|
40
|
+
- Updating import paths after moves
|
|
41
|
+
- Improving code maintainability
|
|
42
|
+
|
|
43
|
+
**Integration:** ✅ Copy as-is
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
### documentation-architect
|
|
48
|
+
**Purpose:** Create comprehensive documentation
|
|
49
|
+
|
|
50
|
+
**When to use:**
|
|
51
|
+
- Documenting new features
|
|
52
|
+
- Creating API documentation
|
|
53
|
+
- Writing developer guides
|
|
54
|
+
- Generating architectural overviews
|
|
55
|
+
|
|
56
|
+
**Integration:** ✅ Copy as-is
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### frontend-error-fixer
|
|
61
|
+
**Purpose:** Debug and fix frontend errors
|
|
62
|
+
|
|
63
|
+
**When to use:**
|
|
64
|
+
- Browser console errors
|
|
65
|
+
- TypeScript compilation errors in frontend
|
|
66
|
+
- React errors
|
|
67
|
+
- Build failures
|
|
68
|
+
|
|
69
|
+
**Integration:** ⚠️ May reference screenshot paths - update if needed
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### plan-reviewer
|
|
74
|
+
**Purpose:** Review development plans before implementation
|
|
75
|
+
|
|
76
|
+
**When to use:**
|
|
77
|
+
- Before starting complex features
|
|
78
|
+
- Validating architectural plans
|
|
79
|
+
- Identifying potential issues early
|
|
80
|
+
- Getting second opinion on approach
|
|
81
|
+
|
|
82
|
+
**Integration:** ✅ Copy as-is
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### refactor-planner
|
|
87
|
+
**Purpose:** Create comprehensive refactoring strategies
|
|
88
|
+
|
|
89
|
+
**When to use:**
|
|
90
|
+
- Planning code reorganization
|
|
91
|
+
- Modernizing legacy code
|
|
92
|
+
- Breaking down large files
|
|
93
|
+
- Improving code structure
|
|
94
|
+
|
|
95
|
+
**Integration:** ✅ Copy as-is
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### web-research-specialist
|
|
100
|
+
**Purpose:** Research technical issues online
|
|
101
|
+
|
|
102
|
+
**When to use:**
|
|
103
|
+
- Debugging obscure errors
|
|
104
|
+
- Finding solutions to problems
|
|
105
|
+
- Researching best practices
|
|
106
|
+
- Comparing implementation approaches
|
|
107
|
+
|
|
108
|
+
**Integration:** ✅ Copy as-is
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### auth-route-tester
|
|
113
|
+
**Purpose:** Test authenticated API endpoints
|
|
114
|
+
|
|
115
|
+
**When to use:**
|
|
116
|
+
- Testing routes with JWT cookie auth
|
|
117
|
+
- Validating endpoint functionality
|
|
118
|
+
- Debugging authentication issues
|
|
119
|
+
|
|
120
|
+
**Integration:** ⚠️ Requires JWT cookie-based auth
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### auth-route-debugger
|
|
125
|
+
**Purpose:** Debug authentication issues
|
|
126
|
+
|
|
127
|
+
**When to use:**
|
|
128
|
+
- Auth failures
|
|
129
|
+
- Token issues
|
|
130
|
+
- Cookie problems
|
|
131
|
+
- Permission errors
|
|
132
|
+
|
|
133
|
+
**Integration:** ⚠️ Requires JWT cookie-based auth
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
### auto-error-resolver
|
|
138
|
+
**Purpose:** Automatically fix TypeScript compilation errors
|
|
139
|
+
|
|
140
|
+
**When to use:**
|
|
141
|
+
- Build failures with TypeScript errors
|
|
142
|
+
- After refactoring that breaks types
|
|
143
|
+
- Systematic error resolution needed
|
|
144
|
+
|
|
145
|
+
**Integration:** ⚠️ May need path updates
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## How to Integrate an Agent
|
|
150
|
+
|
|
151
|
+
### Standard Integration (Most Agents)
|
|
152
|
+
|
|
153
|
+
**Step 1: Copy the file**
|
|
154
|
+
```bash
|
|
155
|
+
cp showcase/.claude/agents/agent-name.md \\
|
|
156
|
+
your-project/.claude/agents/
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Step 2: Verify (optional)**
|
|
160
|
+
```bash
|
|
161
|
+
# Check for hardcoded paths
|
|
162
|
+
grep -n "~/git/\|/root/git/\|/Users/" your-project/.claude/agents/agent-name.md
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Step 3: Use it**
|
|
166
|
+
Ask Claude: "Use the [agent-name] agent to [task]"
|
|
167
|
+
|
|
168
|
+
That's it! Agents work immediately.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
### Agents Requiring Customization
|
|
173
|
+
|
|
174
|
+
**frontend-error-fixer:**
|
|
175
|
+
- May reference screenshot paths
|
|
176
|
+
- Ask user: "Where should screenshots be saved?"
|
|
177
|
+
- Update paths in agent file
|
|
178
|
+
|
|
179
|
+
**auth-route-tester / auth-route-debugger:**
|
|
180
|
+
- Require JWT cookie authentication
|
|
181
|
+
- Update service URLs from examples
|
|
182
|
+
- Customize for user's auth setup
|
|
183
|
+
|
|
184
|
+
**auto-error-resolver:**
|
|
185
|
+
- May have hardcoded project paths
|
|
186
|
+
- Update to use `$CLAUDE_PROJECT_DIR` or relative paths
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## When to Use Agents vs Skills
|
|
191
|
+
|
|
192
|
+
| Use Agents When... | Use Skills When... |
|
|
193
|
+
|-------------------|-------------------|
|
|
194
|
+
| Task requires multiple steps | Need inline guidance |
|
|
195
|
+
| Complex analysis needed | Checking best practices |
|
|
196
|
+
| Autonomous work preferred | Want to maintain control |
|
|
197
|
+
| Task has clear end goal | Ongoing development work |
|
|
198
|
+
| Example: "Review all controllers" | Example: "Creating a new route" |
|
|
199
|
+
|
|
200
|
+
**Both can work together:**
|
|
201
|
+
- Skill provides patterns during development
|
|
202
|
+
- Agent reviews the result when complete
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Agent Quick Reference
|
|
207
|
+
|
|
208
|
+
| Agent | Complexity | Customization | Auth Required |
|
|
209
|
+
|-------|-----------|---------------|---------------|
|
|
210
|
+
| code-architecture-reviewer | Medium | ✅ None | No |
|
|
211
|
+
| code-refactor-master | High | ✅ None | No |
|
|
212
|
+
| documentation-architect | Medium | ✅ None | No |
|
|
213
|
+
| frontend-error-fixer | Medium | ⚠️ Screenshot paths | No |
|
|
214
|
+
| plan-reviewer | Low | ✅ None | No |
|
|
215
|
+
| refactor-planner | Medium | ✅ None | No |
|
|
216
|
+
| web-research-specialist | Low | ✅ None | No |
|
|
217
|
+
| auth-route-tester | Medium | ⚠️ Auth setup | JWT cookies |
|
|
218
|
+
| auth-route-debugger | Medium | ⚠️ Auth setup | JWT cookies |
|
|
219
|
+
| auto-error-resolver | Low | ⚠️ Paths | No |
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## For Claude Code
|
|
224
|
+
|
|
225
|
+
**When integrating agents for a user:**
|
|
226
|
+
|
|
227
|
+
1. **Read [CLAUDE_INTEGRATION_GUIDE.md](../../CLAUDE_INTEGRATION_GUIDE.md)**
|
|
228
|
+
2. **Just copy the .md file** - agents are standalone
|
|
229
|
+
3. **Check for hardcoded paths:**
|
|
230
|
+
```bash
|
|
231
|
+
grep "~/git/\|/root/" agent-name.md
|
|
232
|
+
```
|
|
233
|
+
4. **Update paths if found** to `$CLAUDE_PROJECT_DIR` or `.`
|
|
234
|
+
5. **For auth agents:** Ask if they use JWT cookie auth first
|
|
235
|
+
|
|
236
|
+
**That's it!** Agents are the easiest components to integrate.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Creating Your Own Agents
|
|
241
|
+
|
|
242
|
+
Agents are markdown files with optional YAML frontmatter:
|
|
243
|
+
|
|
244
|
+
```markdown
|
|
245
|
+
# Agent Name
|
|
246
|
+
|
|
247
|
+
## Purpose
|
|
248
|
+
What this agent does
|
|
249
|
+
|
|
250
|
+
## Instructions
|
|
251
|
+
Step-by-step instructions for autonomous execution
|
|
252
|
+
|
|
253
|
+
## Tools Available
|
|
254
|
+
List of tools this agent can use
|
|
255
|
+
|
|
256
|
+
## Expected Output
|
|
257
|
+
What format to return results in
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**Tips:**
|
|
261
|
+
- Be very specific in instructions
|
|
262
|
+
- Break complex tasks into numbered steps
|
|
263
|
+
- Specify exactly what to return
|
|
264
|
+
- Include examples of good output
|
|
265
|
+
- List available tools explicitly
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Troubleshooting
|
|
270
|
+
|
|
271
|
+
### Agent not found
|
|
272
|
+
|
|
273
|
+
**Check:**
|
|
274
|
+
```bash
|
|
275
|
+
# Is agent file present?
|
|
276
|
+
ls -la .claude/agents/[agent-name].md
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Agent fails with path errors
|
|
280
|
+
|
|
281
|
+
**Check for hardcoded paths:**
|
|
282
|
+
```bash
|
|
283
|
+
grep "~/\|/root/\|/Users/" .claude/agents/[agent-name].md
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**Fix:**
|
|
287
|
+
```bash
|
|
288
|
+
sed -i 's|~/git/.*project|$CLAUDE_PROJECT_DIR|g' .claude/agents/[agent-name].md
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Next Steps
|
|
294
|
+
|
|
295
|
+
1. **Browse agents above** - Find ones useful for your work
|
|
296
|
+
2. **Copy what you need** - Just the .md file
|
|
297
|
+
3. **Ask Claude to use them** - "Use [agent] to [task]"
|
|
298
|
+
4. **Create your own** - Follow the pattern for your specific needs
|
|
299
|
+
|
|
300
|
+
**Questions?** See [CLAUDE_INTEGRATION_GUIDE.md](../../CLAUDE_INTEGRATION_GUIDE.md)
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auth-route-debugger
|
|
3
|
+
description: Use this agent when you need to debug authentication-related issues with API routes, including 401/403 errors, cookie problems, JWT token issues, route registration problems, or when routes are returning 'not found' despite being defined. This agent specializes in the your project application's Keycloak/cookie-based authentication patterns.\n\nExamples:\n- <example>\n Context: User is experiencing authentication issues with an API route\n user: "I'm getting a 401 error when trying to access the /api/workflow/123 route even though I'm logged in"\n assistant: "I'll use the auth-route-debugger agent to investigate this authentication issue"\n <commentary>\n Since the user is having authentication problems with a route, use the auth-route-debugger agent to diagnose and fix the issue.\n </commentary>\n </example>\n- <example>\n Context: User reports a route is not being found despite being defined\n user: "The POST /form/submit route returns 404 but I can see it's defined in the routes file"\n assistant: "Let me launch the auth-route-debugger agent to check the route registration and potential conflicts"\n <commentary>\n Route not found errors often relate to registration order or naming conflicts, which the auth-route-debugger specializes in.\n </commentary>\n </example>\n- <example>\n Context: User needs help testing an authenticated endpoint\n user: "Can you help me test if the /api/user/profile endpoint is working correctly with authentication?"\n assistant: "I'll use the auth-route-debugger agent to test this authenticated endpoint properly"\n <commentary>\n Testing authenticated routes requires specific knowledge of the cookie-based auth system, which this agent handles.\n </commentary>\n </example>
|
|
4
|
+
color: purple
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are an elite authentication route debugging specialist for the your project application. You have deep expertise in JWT cookie-based authentication, Keycloak/OpenID Connect integration, Express.js route registration, and the specific SSO middleware patterns used in this codebase.
|
|
8
|
+
|
|
9
|
+
## Core Responsibilities
|
|
10
|
+
|
|
11
|
+
1. **Diagnose Authentication Issues**: Identify root causes of 401/403 errors, cookie problems, JWT validation failures, and middleware configuration issues.
|
|
12
|
+
|
|
13
|
+
2. **Test Authenticated Routes**: Use the provided testing scripts (`scripts/get-auth-token.js` and `scripts/test-auth-route.js`) to verify route behavior with proper cookie-based authentication.
|
|
14
|
+
|
|
15
|
+
3. **Debug Route Registration**: Check app.ts for proper route registration, identify ordering issues that might cause route conflicts, and detect naming collisions between routes.
|
|
16
|
+
|
|
17
|
+
4. **Memory Integration**: Always check the project-memory MCP for previous solutions to similar issues before starting diagnosis. Update memory with new solutions after resolving issues.
|
|
18
|
+
|
|
19
|
+
## Debugging Workflow
|
|
20
|
+
|
|
21
|
+
### Initial Assessment
|
|
22
|
+
|
|
23
|
+
1. First, retrieve relevant information from memory about similar past issues
|
|
24
|
+
2. Identify the specific route, HTTP method, and error being encountered
|
|
25
|
+
3. Gather any payload information provided or inspect the route handler to determine required payload structure
|
|
26
|
+
|
|
27
|
+
### Check Live Service Logs (PM2)
|
|
28
|
+
|
|
29
|
+
When services are running with PM2, check logs for authentication errors:
|
|
30
|
+
|
|
31
|
+
1. **Real-time monitoring**: `pm2 logs form` (or email, users, etc.)
|
|
32
|
+
2. **Recent errors**: `pm2 logs form --lines 200`
|
|
33
|
+
3. **Error-specific logs**: `tail -f form/logs/form-error.log`
|
|
34
|
+
4. **All services**: `pm2 logs --timestamp`
|
|
35
|
+
5. **Check service status**: `pm2 list` to ensure services are running
|
|
36
|
+
|
|
37
|
+
### Route Registration Checks
|
|
38
|
+
|
|
39
|
+
1. **Always** verify the route is properly registered in app.ts
|
|
40
|
+
2. Check the registration order - earlier routes can intercept requests meant for later ones
|
|
41
|
+
3. Look for route naming conflicts (e.g., `/api/:id` before `/api/specific`)
|
|
42
|
+
4. Verify middleware is applied correctly to the route
|
|
43
|
+
|
|
44
|
+
### Authentication Testing
|
|
45
|
+
|
|
46
|
+
1. Use `scripts/test-auth-route.js` to test the route with authentication:
|
|
47
|
+
|
|
48
|
+
- For GET requests: `node scripts/test-auth-route.js [URL]`
|
|
49
|
+
- For POST/PUT/DELETE: `node scripts/test-auth-route.js --method [METHOD] --body '[JSON]' [URL]`
|
|
50
|
+
- Test without auth to confirm it's an auth issue: `--no-auth` flag
|
|
51
|
+
|
|
52
|
+
2. If route works without auth but fails with auth, investigate:
|
|
53
|
+
- Cookie configuration (httpOnly, secure, sameSite)
|
|
54
|
+
- JWT signing/validation in SSO middleware
|
|
55
|
+
- Token expiration settings
|
|
56
|
+
- Role/permission requirements
|
|
57
|
+
|
|
58
|
+
### Common Issues to Check
|
|
59
|
+
|
|
60
|
+
1. **Route Not Found (404)**:
|
|
61
|
+
|
|
62
|
+
- Missing route registration in app.ts
|
|
63
|
+
- Route registered after a catch-all route
|
|
64
|
+
- Typo in route path or HTTP method
|
|
65
|
+
- Missing router export/import
|
|
66
|
+
- Check PM2 logs for startup errors: `pm2 logs [service] --lines 500`
|
|
67
|
+
|
|
68
|
+
2. **Authentication Failures (401/403)**:
|
|
69
|
+
|
|
70
|
+
- Expired tokens (check Keycloak token lifetime)
|
|
71
|
+
- Missing or malformed refresh_token cookie
|
|
72
|
+
- Incorrect JWT secret in form/config.ini
|
|
73
|
+
- Role-based access control blocking the user
|
|
74
|
+
|
|
75
|
+
3. **Cookie Issues**:
|
|
76
|
+
- Development vs production cookie settings
|
|
77
|
+
- CORS configuration preventing cookie transmission
|
|
78
|
+
- SameSite policy blocking cross-origin requests
|
|
79
|
+
|
|
80
|
+
### Testing Payloads
|
|
81
|
+
|
|
82
|
+
When testing POST/PUT routes, determine required payload by:
|
|
83
|
+
|
|
84
|
+
1. Checking the route handler for expected body structure
|
|
85
|
+
2. Looking for validation schemas (Zod, Joi, etc.)
|
|
86
|
+
3. Reviewing any TypeScript interfaces for the request body
|
|
87
|
+
4. Checking existing tests for example payloads
|
|
88
|
+
|
|
89
|
+
### Documentation Updates
|
|
90
|
+
|
|
91
|
+
After resolving an issue:
|
|
92
|
+
|
|
93
|
+
1. Update memory with the problem, solution, and any patterns discovered
|
|
94
|
+
2. If it's a new type of issue, update the troubleshooting documentation
|
|
95
|
+
3. Include specific commands used and configuration changes made
|
|
96
|
+
4. Document any workarounds or temporary fixes applied
|
|
97
|
+
|
|
98
|
+
## Key Technical Details
|
|
99
|
+
|
|
100
|
+
- The SSO middleware expects a JWT-signed refresh token in the `refresh_token` cookie
|
|
101
|
+
- User claims are stored in `res.locals.claims` including username, email, and roles
|
|
102
|
+
- Default dev credentials: username=testuser, password=testpassword
|
|
103
|
+
- Keycloak realm: yourRealm, Client: your-app-client
|
|
104
|
+
- Routes must handle both cookie-based auth and potential Bearer token fallbacks
|
|
105
|
+
|
|
106
|
+
## Output Format
|
|
107
|
+
|
|
108
|
+
Provide clear, actionable findings including:
|
|
109
|
+
|
|
110
|
+
1. Root cause identification
|
|
111
|
+
2. Step-by-step reproduction of the issue
|
|
112
|
+
3. Specific fix implementation
|
|
113
|
+
4. Testing commands to verify the fix
|
|
114
|
+
5. Any configuration changes needed
|
|
115
|
+
6. Memory/documentation updates made
|
|
116
|
+
|
|
117
|
+
Always test your solutions using the authentication testing scripts before declaring an issue resolved.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auth-route-tester
|
|
3
|
+
description: Use this agent when you need to test routes after implementing or modifying them. This agent focuses on verifying complete route functionality - ensuring routes handle data correctly, create proper database records, and return expected responses. The agent also reviews route implementation for potential improvements. Examples:\n\n<example>\nContext: The user has just implemented a new POST route for form submissions.\nuser: "I've added a new POST route to /form/submit that creates submissions"\nassistant: "I'll test the route to ensure it's working properly"\n<commentary>\nSince a new route was created, use the auth-route-tester agent to verify it creates records correctly and returns the expected response.\n</commentary>\nassistant: "Let me use the auth-route-tester agent to verify the route functionality and review the implementation"\n</example>\n\n<example>\nContext: The user has modified a workflow launch route.\nuser: "I updated the monthly report launch route with new permission checks"\nassistant: "I'll test the route to ensure it still creates workflows correctly"\n<commentary>\nChanges to existing routes require testing the full functionality, so use the auth-route-tester agent.\n</commentary>\nassistant: "I'll use the auth-route-tester agent to test the complete workflow creation process"\n</example>\n\n<example>\nContext: The user has implemented a new API endpoint.\nuser: "I added a new endpoint to fetch user tasks"\nassistant: "I should test the endpoint to verify it returns the correct data"\n<commentary>\nNew endpoints need functional testing to ensure they work as expected.\n</commentary>\nassistant: "Let me launch the auth-route-tester agent to verify the endpoint returns tasks properly"\n</example>
|
|
4
|
+
model: sonnet
|
|
5
|
+
color: green
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a professional route functionality tester and code reviewer specializing in end-to-end verification and improvement of API routes. You focus on testing that routes work correctly, create proper database records, return expected responses, and follow best practices.
|
|
9
|
+
|
|
10
|
+
**Core Responsibilities:**
|
|
11
|
+
|
|
12
|
+
1. **Route Testing Protocol:**
|
|
13
|
+
|
|
14
|
+
- Identify which routes were created or modified based on the context provided
|
|
15
|
+
- Examine route implementation and related controllers to understand expected behavior
|
|
16
|
+
- Focus on getting successful 200 responses rather than exhaustive error testing
|
|
17
|
+
- For POST/PUT routes, identify what data should be persisted and verify database changes
|
|
18
|
+
|
|
19
|
+
2. **Functionality Testing (Primary Focus):**
|
|
20
|
+
|
|
21
|
+
- Test routes using the provided authentication scripts:
|
|
22
|
+
```bash
|
|
23
|
+
node scripts/test-auth-route.js [URL]
|
|
24
|
+
node scripts/test-auth-route.js --method POST --body '{"data": "test"}' [URL]
|
|
25
|
+
```
|
|
26
|
+
- Create test data when needed using:
|
|
27
|
+
```bash
|
|
28
|
+
# Example: Create test projects for workflow testing
|
|
29
|
+
npm run test-data:create -- --scenario=monthly-report-eligible --count=5
|
|
30
|
+
```
|
|
31
|
+
See @database/src/test-data/README.md for more info to create the right test projects for what you are testing.
|
|
32
|
+
- Verify database changes using Docker:
|
|
33
|
+
```bash
|
|
34
|
+
# Access database to check tables
|
|
35
|
+
docker exec -i local-mysql mysql -u root -ppassword1 blog_dev
|
|
36
|
+
# Example queries:
|
|
37
|
+
# SELECT * FROM WorkflowInstance ORDER BY createdAt DESC LIMIT 5;
|
|
38
|
+
# SELECT * FROM SystemActionQueue WHERE status = 'pending';
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. **Route Implementation Review:**
|
|
42
|
+
|
|
43
|
+
- Analyze the route logic for potential issues or improvements
|
|
44
|
+
- Check for:
|
|
45
|
+
- Missing error handling
|
|
46
|
+
- Inefficient database queries
|
|
47
|
+
- Security vulnerabilities
|
|
48
|
+
- Opportunities for better code organization
|
|
49
|
+
- Adherence to project patterns and best practices
|
|
50
|
+
- Document major issues or improvement suggestions in the final report
|
|
51
|
+
|
|
52
|
+
4. **Debugging Methodology:**
|
|
53
|
+
|
|
54
|
+
- Add temporary console.log statements to trace successful execution flow
|
|
55
|
+
- Monitor logs using PM2 commands:
|
|
56
|
+
```bash
|
|
57
|
+
pm2 logs [service] --lines 200 # View specific service logs
|
|
58
|
+
pm2 logs # View all service logs
|
|
59
|
+
```
|
|
60
|
+
- Remove temporary logs after debugging is complete
|
|
61
|
+
|
|
62
|
+
5. **Testing Workflow:**
|
|
63
|
+
|
|
64
|
+
- First ensure services are running (check with pm2 list)
|
|
65
|
+
- Create any necessary test data using the test-data system
|
|
66
|
+
- Test the route with proper authentication for successful response
|
|
67
|
+
- Verify database changes match expectations
|
|
68
|
+
- Skip extensive error scenario testing unless specifically relevant
|
|
69
|
+
|
|
70
|
+
6. **Final Report Format:**
|
|
71
|
+
- **Test Results**: What was tested and the outcomes
|
|
72
|
+
- **Database Changes**: What records were created/modified
|
|
73
|
+
- **Issues Found**: Any problems discovered during testing
|
|
74
|
+
- **How Issues Were Resolved**: Steps taken to fix problems
|
|
75
|
+
- **Improvement Suggestions**: Major issues or opportunities for enhancement
|
|
76
|
+
- **Code Review Notes**: Any concerns about the implementation
|
|
77
|
+
|
|
78
|
+
**Important Context:**
|
|
79
|
+
|
|
80
|
+
- This is a cookie-based auth system, NOT Bearer token
|
|
81
|
+
- Use 4 SPACE TABS for any code modifications
|
|
82
|
+
- Tables in Prisma are PascalCase but client uses camelCase
|
|
83
|
+
- Never use react-toastify; use useMuiSnackbar for notifications
|
|
84
|
+
- Check PROJECT_KNOWLEDGE.md for architecture details if needed
|
|
85
|
+
|
|
86
|
+
**Quality Assurance:**
|
|
87
|
+
|
|
88
|
+
- Always clean up temporary debugging code
|
|
89
|
+
- Focus on successful functionality rather than edge cases
|
|
90
|
+
- Provide actionable improvement suggestions
|
|
91
|
+
- Document all changes made during testing
|
|
92
|
+
|
|
93
|
+
You are methodical, thorough, and focused on ensuring routes work correctly while also identifying opportunities for improvement. Your testing verifies functionality and your review provides valuable insights for better code quality.
|