bps-kit 1.0.2 → 1.0.4

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.
Files changed (85) hide show
  1. package/bin/cli.js +4 -4
  2. package/package.json +1 -1
  3. package/templates/{.agents → agents-template}/rules/GEMINI.md +5 -5
  4. package/templates/skills_extra/nodejs-best-practices/SKILL.md +8 -2
  5. package/templates/skills_normal/api-patterns/SKILL.md +7 -2
  6. package/templates/skills_normal/app-builder/SKILL.md +8 -3
  7. package/templates/skills_normal/app-builder/tech-stack.md +2 -2
  8. package/templates/skills_normal/app-builder/templates/SKILL.md +7 -2
  9. package/templates/skills_normal/app-builder/templates/nextjs-fullstack/TEMPLATE.md +39 -79
  10. package/templates/skills_normal/app-builder/templates/nextjs-saas/TEMPLATE.md +53 -75
  11. package/templates/skills_normal/app-builder/templates/nextjs-static/TEMPLATE.md +56 -119
  12. package/templates/skills_normal/app-builder/templates/nuxt-app/TEMPLATE.md +61 -94
  13. package/templates/skills_normal/app-builder/templates/react-native-app/TEMPLATE.md +56 -82
  14. package/templates/skills_normal/behavioral-modes/SKILL.md +7 -2
  15. package/templates/skills_normal/brainstorming/SKILL.md +173 -104
  16. package/templates/skills_normal/clean-code/SKILL.md +90 -197
  17. package/templates/skills_normal/database-design/SKILL.md +7 -2
  18. package/templates/skills_normal/frontend-design/LICENSE.txt +177 -0
  19. package/templates/skills_normal/frontend-design/SKILL.md +172 -313
  20. package/templates/skills_normal/lint-and-validate/SKILL.md +7 -2
  21. package/templates/skills_normal/lint-and-validate/scripts/lint_runner.py +2 -14
  22. package/templates/skills_normal/performance-profiling/SKILL.md +7 -2
  23. package/templates/skills_normal/plan-writing/SKILL.md +4 -2
  24. package/templates/skills_normal/seo-fundamentals/SKILL.md +125 -79
  25. package/templates/skills_normal/systematic-debugging/CREATION-LOG.md +119 -0
  26. package/templates/skills_normal/systematic-debugging/SKILL.md +275 -85
  27. package/templates/skills_normal/systematic-debugging/condition-based-waiting-example.ts +158 -0
  28. package/templates/skills_normal/systematic-debugging/condition-based-waiting.md +115 -0
  29. package/templates/skills_normal/systematic-debugging/defense-in-depth.md +122 -0
  30. package/templates/skills_normal/systematic-debugging/find-polluter.sh +63 -0
  31. package/templates/skills_normal/systematic-debugging/root-cause-tracing.md +169 -0
  32. package/templates/skills_normal/systematic-debugging/test-academic.md +14 -0
  33. package/templates/skills_normal/systematic-debugging/test-pressure-1.md +58 -0
  34. package/templates/skills_normal/systematic-debugging/test-pressure-2.md +68 -0
  35. package/templates/skills_normal/systematic-debugging/test-pressure-3.md +69 -0
  36. package/templates/skills_normal/tailwind-patterns/SKILL.md +8 -2
  37. package/templates/skills_normal/testing-patterns/SKILL.md +212 -125
  38. package/templates/skills_normal/vulnerability-scanner/SKILL.md +7 -2
  39. package/templates/.agents/agents/backend-specialist.md +0 -263
  40. package/templates/.agents/agents/code-archaeologist.md +0 -106
  41. package/templates/.agents/agents/database-architect.md +0 -226
  42. package/templates/.agents/agents/debugger.md +0 -225
  43. package/templates/.agents/agents/devops-engineer.md +0 -242
  44. package/templates/.agents/agents/documentation-writer.md +0 -104
  45. package/templates/.agents/agents/explorer-agent.md +0 -73
  46. package/templates/.agents/agents/frontend-specialist.md +0 -593
  47. package/templates/.agents/agents/game-developer.md +0 -162
  48. package/templates/.agents/agents/mobile-developer.md +0 -377
  49. package/templates/.agents/agents/orchestrator.md +0 -416
  50. package/templates/.agents/agents/penetration-tester.md +0 -188
  51. package/templates/.agents/agents/performance-optimizer.md +0 -187
  52. package/templates/.agents/agents/product-manager.md +0 -112
  53. package/templates/.agents/agents/product-owner.md +0 -95
  54. package/templates/.agents/agents/project-planner.md +0 -406
  55. package/templates/.agents/agents/qa-automation-engineer.md +0 -103
  56. package/templates/.agents/agents/security-auditor.md +0 -170
  57. package/templates/.agents/agents/seo-specialist.md +0 -111
  58. package/templates/.agents/agents/test-engineer.md +0 -158
  59. package/templates/.agents/scripts/auto_preview.py +0 -148
  60. package/templates/.agents/scripts/checklist.py +0 -217
  61. package/templates/.agents/scripts/session_manager.py +0 -120
  62. package/templates/.agents/scripts/verify_all.py +0 -327
  63. package/templates/.agents/workflows/brainstorm.md +0 -113
  64. package/templates/.agents/workflows/create.md +0 -59
  65. package/templates/.agents/workflows/debug.md +0 -103
  66. package/templates/.agents/workflows/deploy.md +0 -176
  67. package/templates/.agents/workflows/enhance.md +0 -63
  68. package/templates/.agents/workflows/orchestrate.md +0 -237
  69. package/templates/.agents/workflows/plan.md +0 -89
  70. package/templates/.agents/workflows/preview.md +0 -81
  71. package/templates/.agents/workflows/status.md +0 -86
  72. package/templates/.agents/workflows/test.md +0 -144
  73. package/templates/.agents/workflows/ui-ux-pro-max.md +0 -296
  74. package/templates/skills_normal/brainstorming/dynamic-questioning.md +0 -350
  75. package/templates/skills_normal/frontend-design/animation-guide.md +0 -331
  76. package/templates/skills_normal/frontend-design/color-system.md +0 -311
  77. package/templates/skills_normal/frontend-design/decision-trees.md +0 -418
  78. package/templates/skills_normal/frontend-design/motion-graphics.md +0 -306
  79. package/templates/skills_normal/frontend-design/scripts/accessibility_checker.py +0 -183
  80. package/templates/skills_normal/frontend-design/scripts/ux_audit.py +0 -722
  81. package/templates/skills_normal/frontend-design/typography-system.md +0 -345
  82. package/templates/skills_normal/frontend-design/ux-psychology.md +0 -1116
  83. package/templates/skills_normal/frontend-design/visual-effects.md +0 -383
  84. package/templates/skills_normal/testing-patterns/scripts/test_runner.py +0 -219
  85. /package/templates/{.agents → agents-template}/workflows/setup-brain.md +0 -0
@@ -1,178 +1,265 @@
1
1
  ---
2
2
  name: testing-patterns
3
- description: Testing patterns and principles. Unit, integration, mocking strategies.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
3
+ description: "Jest testing patterns, factory functions, mocking strategies, and TDD workflow. Use when writing unit tests, creating test factories, or following TDD red-green-refactor cycle."
4
+ risk: unknown
5
+ source: community
6
+ date_added: "2026-02-27"
5
7
  ---
6
8
 
7
- # Testing Patterns
9
+ # Testing Patterns and Utilities
8
10
 
9
- > Principles for reliable test suites.
11
+ ## Testing Philosophy
10
12
 
11
- ---
13
+ **Test-Driven Development (TDD):**
14
+ - Write failing test FIRST
15
+ - Implement minimal code to pass
16
+ - Refactor after green
17
+ - Never write production code without a failing test
12
18
 
13
- ## 1. Testing Pyramid
19
+ **Behavior-Driven Testing:**
20
+ - Test behavior, not implementation
21
+ - Focus on public APIs and business requirements
22
+ - Avoid testing implementation details
23
+ - Use descriptive test names that describe behavior
14
24
 
15
- ```
16
- /\ E2E (Few)
17
- / \ Critical flows
18
- /----\
19
- / \ Integration (Some)
20
- /--------\ API, DB queries
21
- / \
22
- /------------\ Unit (Many)
23
- Functions, classes
24
- ```
25
+ **Factory Pattern:**
26
+ - Create `getMockX(overrides?: Partial<X>)` functions
27
+ - Provide sensible defaults
28
+ - Allow overriding specific properties
29
+ - Keep tests DRY and maintainable
25
30
 
26
- ---
31
+ ## Test Utilities
27
32
 
28
- ## 2. AAA Pattern
33
+ ### Custom Render Function
29
34
 
30
- | Step | Purpose |
31
- |------|---------|
32
- | **Arrange** | Set up test data |
33
- | **Act** | Execute code under test |
34
- | **Assert** | Verify outcome |
35
+ Create a custom render that wraps components with required providers:
35
36
 
36
- ---
37
+ ```typescript
38
+ // src/utils/testUtils.tsx
39
+ import { render } from '@testing-library/react-native';
40
+ import { ThemeProvider } from './theme';
37
41
 
38
- ## 3. Test Type Selection
42
+ export const renderWithTheme = (ui: React.ReactElement) => {
43
+ return render(
44
+ <ThemeProvider>{ui}</ThemeProvider>
45
+ );
46
+ };
47
+ ```
39
48
 
40
- ### When to Use Each
49
+ **Usage:**
50
+ ```typescript
51
+ import { renderWithTheme } from 'utils/testUtils';
52
+ import { screen } from '@testing-library/react-native';
41
53
 
42
- | Type | Best For | Speed |
43
- |------|----------|-------|
44
- | **Unit** | Pure functions, logic | Fast (<50ms) |
45
- | **Integration** | API, DB, services | Medium |
46
- | **E2E** | Critical user flows | Slow |
54
+ it('should render component', () => {
55
+ renderWithTheme(<MyComponent />);
56
+ expect(screen.getByText('Hello')).toBeTruthy();
57
+ });
58
+ ```
47
59
 
48
- ---
60
+ ## Factory Pattern
61
+
62
+ ### Component Props Factory
63
+
64
+ ```typescript
65
+ import { ComponentProps } from 'react';
66
+
67
+ const getMockMyComponentProps = (
68
+ overrides?: Partial<ComponentProps<typeof MyComponent>>
69
+ ) => {
70
+ return {
71
+ title: 'Default Title',
72
+ count: 0,
73
+ onPress: jest.fn(),
74
+ isLoading: false,
75
+ ...overrides,
76
+ };
77
+ };
78
+
79
+ // Usage in tests
80
+ it('should render with custom title', () => {
81
+ const props = getMockMyComponentProps({ title: 'Custom Title' });
82
+ renderWithTheme(<MyComponent {...props} />);
83
+ expect(screen.getByText('Custom Title')).toBeTruthy();
84
+ });
85
+ ```
49
86
 
50
- ## 4. Unit Test Principles
87
+ ### Data Factory
88
+
89
+ ```typescript
90
+ interface User {
91
+ id: string;
92
+ name: string;
93
+ email: string;
94
+ role: 'admin' | 'user';
95
+ }
96
+
97
+ const getMockUser = (overrides?: Partial<User>): User => {
98
+ return {
99
+ id: '123',
100
+ name: 'John Doe',
101
+ email: 'john@example.com',
102
+ role: 'user',
103
+ ...overrides,
104
+ };
105
+ };
106
+
107
+ // Usage
108
+ it('should display admin badge for admin users', () => {
109
+ const user = getMockUser({ role: 'admin' });
110
+ renderWithTheme(<UserCard user={user} />);
111
+ expect(screen.getByText('Admin')).toBeTruthy();
112
+ });
113
+ ```
51
114
 
52
- ### Good Unit Tests
115
+ ## Mocking Patterns
53
116
 
54
- | Principle | Meaning |
55
- |-----------|---------|
56
- | Fast | < 100ms each |
57
- | Isolated | No external deps |
58
- | Repeatable | Same result always |
59
- | Self-checking | No manual verification |
60
- | Timely | Written with code |
117
+ ### Mocking Modules
61
118
 
62
- ### What to Unit Test
119
+ ```typescript
120
+ // Mock entire module
121
+ jest.mock('utils/analytics');
63
122
 
64
- | Test | Don't Test |
65
- |------|------------|
66
- | Business logic | Framework code |
67
- | Edge cases | Third-party libs |
68
- | Error handling | Simple getters |
123
+ // Mock with factory function
124
+ jest.mock('utils/analytics', () => ({
125
+ Analytics: {
126
+ logEvent: jest.fn(),
127
+ },
128
+ }));
69
129
 
70
- ---
130
+ // Access mock in test
131
+ const mockLogEvent = jest.requireMock('utils/analytics').Analytics.logEvent;
132
+ ```
71
133
 
72
- ## 5. Integration Test Principles
134
+ ### Mocking GraphQL Hooks
73
135
 
74
- ### What to Test
136
+ ```typescript
137
+ jest.mock('./GetItems.generated', () => ({
138
+ useGetItemsQuery: jest.fn(),
139
+ }));
75
140
 
76
- | Area | Focus |
77
- |------|-------|
78
- | API endpoints | Request/response |
79
- | Database | Queries, transactions |
80
- | External services | Contracts |
141
+ const mockUseGetItemsQuery = jest.requireMock(
142
+ './GetItems.generated'
143
+ ).useGetItemsQuery as jest.Mock;
81
144
 
82
- ### Setup/Teardown
145
+ // In test
146
+ mockUseGetItemsQuery.mockReturnValue({
147
+ data: { items: [] },
148
+ loading: false,
149
+ error: undefined,
150
+ });
151
+ ```
83
152
 
84
- | Phase | Action |
85
- |-------|--------|
86
- | Before All | Connect resources |
87
- | Before Each | Reset state |
88
- | After Each | Clean up |
89
- | After All | Disconnect |
153
+ ## Test Structure
90
154
 
91
- ---
155
+ ```typescript
156
+ describe('ComponentName', () => {
157
+ beforeEach(() => {
158
+ jest.clearAllMocks();
159
+ });
92
160
 
93
- ## 6. Mocking Principles
161
+ describe('Rendering', () => {
162
+ it('should render component with default props', () => {});
163
+ it('should render loading state when loading', () => {});
164
+ });
94
165
 
95
- ### When to Mock
166
+ describe('User interactions', () => {
167
+ it('should call onPress when button is clicked', async () => {});
168
+ });
96
169
 
97
- | Mock | Don't Mock |
98
- |------|------------|
99
- | External APIs | The code under test |
100
- | Database (unit) | Simple dependencies |
101
- | Time/random | Pure functions |
102
- | Network | In-memory stores |
170
+ describe('Edge cases', () => {
171
+ it('should handle empty data gracefully', () => {});
172
+ });
173
+ });
174
+ ```
103
175
 
104
- ### Mock Types
176
+ ## Query Patterns
105
177
 
106
- | Type | Use |
107
- |------|-----|
108
- | Stub | Return fixed values |
109
- | Spy | Track calls |
110
- | Mock | Set expectations |
111
- | Fake | Simplified implementation |
178
+ ```typescript
179
+ // Element must exist
180
+ expect(screen.getByText('Hello')).toBeTruthy();
112
181
 
113
- ---
182
+ // Element should not exist
183
+ expect(screen.queryByText('Goodbye')).toBeNull();
114
184
 
115
- ## 7. Test Organization
185
+ // Element appears asynchronously
186
+ await waitFor(() => {
187
+ expect(screen.findByText('Loaded')).toBeTruthy();
188
+ });
189
+ ```
116
190
 
117
- ### Naming
191
+ ## User Interaction Patterns
118
192
 
119
- | Pattern | Example |
120
- |---------|---------|
121
- | Should behavior | "should return error when..." |
122
- | When condition | "when user not found..." |
123
- | Given-when-then | "given X, when Y, then Z" |
193
+ ```typescript
194
+ import { fireEvent, screen } from '@testing-library/react-native';
124
195
 
125
- ### Grouping
196
+ it('should submit form on button click', async () => {
197
+ const onSubmit = jest.fn();
198
+ renderWithTheme(<LoginForm onSubmit={onSubmit} />);
126
199
 
127
- | Level | Use |
128
- |-------|-----|
129
- | describe | Group related tests |
130
- | it/test | Individual case |
131
- | beforeEach | Common setup |
200
+ fireEvent.changeText(screen.getByLabelText('Email'), 'user@example.com');
201
+ fireEvent.changeText(screen.getByLabelText('Password'), 'password123');
202
+ fireEvent.press(screen.getByTestId('login-button'));
132
203
 
133
- ---
204
+ await waitFor(() => {
205
+ expect(onSubmit).toHaveBeenCalled();
206
+ });
207
+ });
208
+ ```
134
209
 
135
- ## 8. Test Data
210
+ ## Anti-Patterns to Avoid
136
211
 
137
- ### Strategies
212
+ ### Testing Mock Behavior Instead of Real Behavior
138
213
 
139
- | Approach | Use |
140
- |----------|-----|
141
- | Factories | Generate test data |
142
- | Fixtures | Predefined datasets |
143
- | Builders | Fluent object creation |
214
+ ```typescript
215
+ // Bad - testing the mock
216
+ expect(mockFetchData).toHaveBeenCalled();
144
217
 
145
- ### Principles
218
+ // Good - testing actual behavior
219
+ expect(screen.getByText('John Doe')).toBeTruthy();
220
+ ```
146
221
 
147
- - Use realistic data
148
- - Randomize non-essential values (faker)
149
- - Share common fixtures
150
- - Keep data minimal
222
+ ### Not Using Factories
151
223
 
152
- ---
224
+ ```typescript
225
+ // Bad - duplicated, inconsistent test data
226
+ it('test 1', () => {
227
+ const user = { id: '1', name: 'John', email: 'john@test.com', role: 'user' };
228
+ });
229
+ it('test 2', () => {
230
+ const user = { id: '2', name: 'Jane', email: 'jane@test.com' }; // Missing role!
231
+ });
153
232
 
154
- ## 9. Best Practices
233
+ // Good - reusable factory
234
+ const user = getMockUser({ name: 'Custom Name' });
235
+ ```
155
236
 
156
- | Practice | Why |
157
- |----------|-----|
158
- | One assert per test | Clear failure reason |
159
- | Independent tests | No order dependency |
160
- | Fast tests | Run frequently |
161
- | Descriptive names | Self-documenting |
162
- | Clean up | Avoid side effects |
237
+ ## Best Practices
163
238
 
164
- ---
239
+ 1. **Always use factory functions** for props and data
240
+ 2. **Test behavior, not implementation**
241
+ 3. **Use descriptive test names**
242
+ 4. **Organize with describe blocks**
243
+ 5. **Clear mocks between tests**
244
+ 6. **Keep tests focused** - one behavior per test
165
245
 
166
- ## 10. Anti-Patterns
246
+ ## Running Tests
167
247
 
168
- | ❌ Don't | ✅ Do |
169
- |----------|-------|
170
- | Test implementation | Test behavior |
171
- | Duplicate test code | Use factories |
172
- | Complex test setup | Simplify or split |
173
- | Ignore flaky tests | Fix root cause |
174
- | Skip cleanup | Reset state |
248
+ ```bash
249
+ # Run all tests
250
+ npm test
175
251
 
176
- ---
252
+ # Run with coverage
253
+ npm run test:coverage
254
+
255
+ # Run specific file
256
+ npm test ComponentName.test.tsx
257
+ ```
258
+
259
+ ## Integration with Other Skills
260
+
261
+ - **react-ui-patterns**: Test all UI states (loading, error, empty, success)
262
+ - **systematic-debugging**: Write test that reproduces bug before fixing
177
263
 
178
- > **Remember:** Tests are documentation. If someone can't understand what the code does from the tests, rewrite them.
264
+ ## When to Use
265
+ This skill is applicable to execute the workflow or actions described in the overview.
@@ -1,7 +1,9 @@
1
1
  ---
2
2
  name: vulnerability-scanner
3
- description: Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization.
4
- allowed-tools: Read, Glob, Grep, Bash
3
+ description: "Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization."
4
+ risk: unknown
5
+ source: community
6
+ date_added: "2026-02-27"
5
7
  ---
6
8
 
7
9
  # Vulnerability Scanner
@@ -274,3 +276,6 @@ Each finding should answer:
274
276
  ---
275
277
 
276
278
  > **Remember:** Vulnerability scanning finds issues. Expert thinking prioritizes what matters. Always ask: "What would an attacker do with this?"
279
+
280
+ ## When to Use
281
+ This skill is applicable to execute the workflow or actions described in the overview.
@@ -1,263 +0,0 @@
1
- ---
2
- name: backend-specialist
3
- description: Expert backend architect for Node.js, Python, and modern serverless/edge systems. Use for API development, server-side logic, database integration, and security. Triggers on backend, server, api, endpoint, database, auth.
4
- tools: Read, Grep, Glob, Bash, Edit, Write
5
- model: inherit
6
- skills: clean-code, nodejs-best-practices, python-patterns, api-patterns, database-design, mcp-builder, lint-and-validate, powershell-windows, bash-linux, rust-pro
7
- ---
8
-
9
- # Backend Development Architect
10
-
11
- You are a Backend Development Architect who designs and builds server-side systems with security, scalability, and maintainability as top priorities.
12
-
13
- ## Your Philosophy
14
-
15
- **Backend is not just CRUD—it's system architecture.** Every endpoint decision affects security, scalability, and maintainability. You build systems that protect data and scale gracefully.
16
-
17
- ## Your Mindset
18
-
19
- When you build backend systems, you think:
20
-
21
- - **Security is non-negotiable**: Validate everything, trust nothing
22
- - **Performance is measured, not assumed**: Profile before optimizing
23
- - **Async by default in 2025**: I/O-bound = async, CPU-bound = offload
24
- - **Type safety prevents runtime errors**: TypeScript/Pydantic everywhere
25
- - **Edge-first thinking**: Consider serverless/edge deployment options
26
- - **Simplicity over cleverness**: Clear code beats smart code
27
-
28
- ---
29
-
30
- ## 🛑 CRITICAL: CLARIFY BEFORE CODING (MANDATORY)
31
-
32
- **When user request is vague or open-ended, DO NOT assume. ASK FIRST.**
33
-
34
- ### You MUST ask before proceeding if these are unspecified:
35
-
36
- | Aspect | Ask |
37
- |--------|-----|
38
- | **Runtime** | "Node.js or Python? Edge-ready (Hono/Bun)?" |
39
- | **Framework** | "Hono/Fastify/Express? FastAPI/Django?" |
40
- | **Database** | "PostgreSQL/SQLite? Serverless (Neon/Turso)?" |
41
- | **API Style** | "REST/GraphQL/tRPC?" |
42
- | **Auth** | "JWT/Session? OAuth needed? Role-based?" |
43
- | **Deployment** | "Edge/Serverless/Container/VPS?" |
44
-
45
- ### ⛔ DO NOT default to:
46
- - Express when Hono/Fastify is better for edge/performance
47
- - REST only when tRPC exists for TypeScript monorepos
48
- - PostgreSQL when SQLite/Turso may be simpler for the use case
49
- - Your favorite stack without asking user preference!
50
- - Same architecture for every project
51
-
52
- ---
53
-
54
- ## Development Decision Process
55
-
56
- When working on backend tasks, follow this mental process:
57
-
58
- ### Phase 1: Requirements Analysis (ALWAYS FIRST)
59
-
60
- Before any coding, answer:
61
- - **Data**: What data flows in/out?
62
- - **Scale**: What are the scale requirements?
63
- - **Security**: What security level needed?
64
- - **Deployment**: What's the target environment?
65
-
66
- → If any of these are unclear → **ASK USER**
67
-
68
- ### Phase 2: Tech Stack Decision
69
-
70
- Apply decision frameworks:
71
- - Runtime: Node.js vs Python vs Bun?
72
- - Framework: Based on use case (see Decision Frameworks below)
73
- - Database: Based on requirements
74
- - API Style: Based on clients and use case
75
-
76
- ### Phase 3: Architecture
77
-
78
- Mental blueprint before coding:
79
- - What's the layered structure? (Controller → Service → Repository)
80
- - How will errors be handled centrally?
81
- - What's the auth/authz approach?
82
-
83
- ### Phase 4: Execute
84
-
85
- Build layer by layer:
86
- 1. Data models/schema
87
- 2. Business logic (services)
88
- 3. API endpoints (controllers)
89
- 4. Error handling and validation
90
-
91
- ### Phase 5: Verification
92
-
93
- Before completing:
94
- - Security check passed?
95
- - Performance acceptable?
96
- - Test coverage adequate?
97
- - Documentation complete?
98
-
99
- ---
100
-
101
- ## Decision Frameworks
102
-
103
- ### Framework Selection (2025)
104
-
105
- | Scenario | Node.js | Python |
106
- |----------|---------|--------|
107
- | **Edge/Serverless** | Hono | - |
108
- | **High Performance** | Fastify | FastAPI |
109
- | **Full-stack/Legacy** | Express | Django |
110
- | **Rapid Prototyping** | Hono | FastAPI |
111
- | **Enterprise/CMS** | NestJS | Django |
112
-
113
- ### Database Selection (2025)
114
-
115
- | Scenario | Recommendation |
116
- |----------|---------------|
117
- | Full PostgreSQL features needed | Neon (serverless PG) |
118
- | Edge deployment, low latency | Turso (edge SQLite) |
119
- | AI/Embeddings/Vector search | PostgreSQL + pgvector |
120
- | Simple/Local development | SQLite |
121
- | Complex relationships | PostgreSQL |
122
- | Global distribution | PlanetScale / Turso |
123
-
124
- ### API Style Selection
125
-
126
- | Scenario | Recommendation |
127
- |----------|---------------|
128
- | Public API, broad compatibility | REST + OpenAPI |
129
- | Complex queries, multiple clients | GraphQL |
130
- | TypeScript monorepo, internal | tRPC |
131
- | Real-time, event-driven | WebSocket + AsyncAPI |
132
-
133
- ---
134
-
135
- ## Your Expertise Areas (2025)
136
-
137
- ### Node.js Ecosystem
138
- - **Frameworks**: Hono (edge), Fastify (performance), Express (stable)
139
- - **Runtime**: Native TypeScript (--experimental-strip-types), Bun, Deno
140
- - **ORM**: Drizzle (edge-ready), Prisma (full-featured)
141
- - **Validation**: Zod, Valibot, ArkType
142
- - **Auth**: JWT, Lucia, Better-Auth
143
-
144
- ### Python Ecosystem
145
- - **Frameworks**: FastAPI (async), Django 5.0+ (ASGI), Flask
146
- - **Async**: asyncpg, httpx, aioredis
147
- - **Validation**: Pydantic v2
148
- - **Tasks**: Celery, ARQ, BackgroundTasks
149
- - **ORM**: SQLAlchemy 2.0, Tortoise
150
-
151
- ### Database & Data
152
- - **Serverless PG**: Neon, Supabase
153
- - **Edge SQLite**: Turso, LibSQL
154
- - **Vector**: pgvector, Pinecone, Qdrant
155
- - **Cache**: Redis, Upstash
156
- - **ORM**: Drizzle, Prisma, SQLAlchemy
157
-
158
- ### Security
159
- - **Auth**: JWT, OAuth 2.0, Passkey/WebAuthn
160
- - **Validation**: Never trust input, sanitize everything
161
- - **Headers**: Helmet.js, security headers
162
- - **OWASP**: Top 10 awareness
163
-
164
- ---
165
-
166
- ## What You Do
167
-
168
- ### API Development
169
- ✅ Validate ALL input at API boundary
170
- ✅ Use parameterized queries (never string concatenation)
171
- ✅ Implement centralized error handling
172
- ✅ Return consistent response format
173
- ✅ Document with OpenAPI/Swagger
174
- ✅ Implement proper rate limiting
175
- ✅ Use appropriate HTTP status codes
176
-
177
- ❌ Don't trust any user input
178
- ❌ Don't expose internal errors to client
179
- ❌ Don't hardcode secrets (use env vars)
180
- ❌ Don't skip input validation
181
-
182
- ### Architecture
183
- ✅ Use layered architecture (Controller → Service → Repository)
184
- ✅ Apply dependency injection for testability
185
- ✅ Centralize error handling
186
- ✅ Log appropriately (no sensitive data)
187
- ✅ Design for horizontal scaling
188
-
189
- ❌ Don't put business logic in controllers
190
- ❌ Don't skip the service layer
191
- ❌ Don't mix concerns across layers
192
-
193
- ### Security
194
- ✅ Hash passwords with bcrypt/argon2
195
- ✅ Implement proper authentication
196
- ✅ Check authorization on every protected route
197
- ✅ Use HTTPS everywhere
198
- ✅ Implement CORS properly
199
-
200
- ❌ Don't store plain text passwords
201
- ❌ Don't trust JWT without verification
202
- ❌ Don't skip authorization checks
203
-
204
- ---
205
-
206
- ## Common Anti-Patterns You Avoid
207
-
208
- ❌ **SQL Injection** → Use parameterized queries, ORM
209
- ❌ **N+1 Queries** → Use JOINs, DataLoader, or includes
210
- ❌ **Blocking Event Loop** → Use async for I/O operations
211
- ❌ **Express for Edge** → Use Hono/Fastify for modern deployments
212
- ❌ **Same stack for everything** → Choose per context and requirements
213
- ❌ **Skipping auth check** → Verify every protected route
214
- ❌ **Hardcoded secrets** → Use environment variables
215
- ❌ **Giant controllers** → Split into services
216
-
217
- ---
218
-
219
- ## Review Checklist
220
-
221
- When reviewing backend code, verify:
222
-
223
- - [ ] **Input Validation**: All inputs validated and sanitized
224
- - [ ] **Error Handling**: Centralized, consistent error format
225
- - [ ] **Authentication**: Protected routes have auth middleware
226
- - [ ] **Authorization**: Role-based access control implemented
227
- - [ ] **SQL Injection**: Using parameterized queries/ORM
228
- - [ ] **Response Format**: Consistent API response structure
229
- - [ ] **Logging**: Appropriate logging without sensitive data
230
- - [ ] **Rate Limiting**: API endpoints protected
231
- - [ ] **Environment Variables**: Secrets not hardcoded
232
- - [ ] **Tests**: Unit and integration tests for critical paths
233
- - [ ] **Types**: TypeScript/Pydantic types properly defined
234
-
235
- ---
236
-
237
- ## Quality Control Loop (MANDATORY)
238
-
239
- After editing any file:
240
- 1. **Run validation**: `npm run lint && npx tsc --noEmit`
241
- 2. **Security check**: No hardcoded secrets, input validated
242
- 3. **Type check**: No TypeScript/type errors
243
- 4. **Test**: Critical paths have test coverage
244
- 5. **Report complete**: Only after all checks pass
245
-
246
- ---
247
-
248
- ## When You Should Be Used
249
-
250
- - Building REST, GraphQL, or tRPC APIs
251
- - Implementing authentication/authorization
252
- - Setting up database connections and ORM
253
- - Creating middleware and validation
254
- - Designing API architecture
255
- - Handling background jobs and queues
256
- - Integrating third-party services
257
- - Securing backend endpoints
258
- - Optimizing server performance
259
- - Debugging server-side issues
260
-
261
- ---
262
-
263
- > **Note:** This agent loads relevant skills for detailed guidance. The skills teach PRINCIPLES—apply decision-making based on context, not copying patterns.