@malamute/ai-rules 1.0.0 → 1.2.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.
Files changed (133) hide show
  1. package/README.md +270 -121
  2. package/bin/cli.js +5 -2
  3. package/configs/_shared/.claude/rules/conventions/documentation.md +324 -0
  4. package/configs/_shared/.claude/rules/conventions/git.md +265 -0
  5. package/configs/_shared/.claude/rules/{performance.md → conventions/performance.md} +1 -1
  6. package/configs/_shared/.claude/rules/conventions/principles.md +334 -0
  7. package/configs/_shared/.claude/rules/devops/ci-cd.md +262 -0
  8. package/configs/_shared/.claude/rules/devops/docker.md +275 -0
  9. package/configs/_shared/.claude/rules/devops/nx.md +194 -0
  10. package/configs/_shared/.claude/rules/domain/backend/api-design.md +203 -0
  11. package/configs/_shared/.claude/rules/lang/csharp/async.md +220 -0
  12. package/configs/_shared/.claude/rules/lang/csharp/csharp.md +314 -0
  13. package/configs/_shared/.claude/rules/lang/csharp/linq.md +210 -0
  14. package/configs/_shared/.claude/rules/lang/python/async.md +337 -0
  15. package/configs/_shared/.claude/rules/lang/python/celery.md +476 -0
  16. package/configs/_shared/.claude/rules/lang/python/config.md +339 -0
  17. package/configs/{python/.claude/rules → _shared/.claude/rules/lang/python}/database/sqlalchemy.md +6 -1
  18. package/configs/_shared/.claude/rules/lang/python/deployment.md +523 -0
  19. package/configs/_shared/.claude/rules/lang/python/error-handling.md +330 -0
  20. package/configs/_shared/.claude/rules/lang/python/migrations.md +421 -0
  21. package/configs/_shared/.claude/rules/lang/python/python.md +172 -0
  22. package/configs/_shared/.claude/rules/lang/python/repository.md +383 -0
  23. package/configs/{python/.claude/rules → _shared/.claude/rules/lang/python}/testing.md +2 -69
  24. package/configs/_shared/.claude/rules/lang/typescript/async.md +447 -0
  25. package/configs/_shared/.claude/rules/lang/typescript/generics.md +356 -0
  26. package/configs/_shared/.claude/rules/lang/typescript/typescript.md +212 -0
  27. package/configs/_shared/.claude/rules/quality/error-handling.md +48 -0
  28. package/configs/_shared/.claude/rules/quality/logging.md +45 -0
  29. package/configs/_shared/.claude/rules/quality/observability.md +240 -0
  30. package/configs/_shared/.claude/rules/quality/testing-patterns.md +65 -0
  31. package/configs/_shared/.claude/rules/security/secrets-management.md +222 -0
  32. package/configs/_shared/.claude/skills/analysis/explore/SKILL.md +257 -0
  33. package/configs/_shared/.claude/skills/analysis/security-audit/SKILL.md +184 -0
  34. package/configs/_shared/.claude/skills/dev/api-endpoint/SKILL.md +126 -0
  35. package/configs/_shared/.claude/{commands/generate-tests.md → skills/dev/generate-tests/SKILL.md} +6 -0
  36. package/configs/_shared/.claude/{commands/fix-issue.md → skills/git/fix-issue/SKILL.md} +6 -0
  37. package/configs/_shared/.claude/{commands/review-pr.md → skills/git/review-pr/SKILL.md} +6 -0
  38. package/configs/_shared/.claude/skills/infra/deploy/SKILL.md +139 -0
  39. package/configs/_shared/.claude/skills/infra/docker/SKILL.md +95 -0
  40. package/configs/_shared/.claude/skills/infra/migration/SKILL.md +158 -0
  41. package/configs/_shared/.claude/skills/nx/nx-affected/SKILL.md +72 -0
  42. package/configs/_shared/.claude/skills/nx/nx-lib/SKILL.md +375 -0
  43. package/configs/_shared/CLAUDE.md +52 -149
  44. package/configs/angular/.claude/rules/{components.md → core/components.md} +69 -15
  45. package/configs/angular/.claude/rules/core/resource.md +285 -0
  46. package/configs/angular/.claude/rules/core/signals.md +323 -0
  47. package/configs/angular/.claude/rules/http.md +338 -0
  48. package/configs/angular/.claude/rules/routing.md +291 -0
  49. package/configs/angular/.claude/rules/ssr.md +312 -0
  50. package/configs/angular/.claude/rules/state/signal-store.md +408 -0
  51. package/configs/angular/.claude/rules/{state.md → state/state.md} +2 -2
  52. package/configs/angular/.claude/rules/testing.md +7 -7
  53. package/configs/angular/.claude/rules/ui/aria.md +422 -0
  54. package/configs/angular/.claude/rules/ui/forms.md +424 -0
  55. package/configs/angular/.claude/rules/ui/pipes-directives.md +335 -0
  56. package/configs/angular/.claude/settings.json +1 -0
  57. package/configs/angular/.claude/skills/ngrx-slice/SKILL.md +362 -0
  58. package/configs/angular/.claude/skills/signal-store/SKILL.md +445 -0
  59. package/configs/angular/CLAUDE.md +24 -216
  60. package/configs/dotnet/.claude/rules/background-services.md +552 -0
  61. package/configs/dotnet/.claude/rules/configuration.md +426 -0
  62. package/configs/dotnet/.claude/rules/ddd.md +447 -0
  63. package/configs/dotnet/.claude/rules/dependency-injection.md +343 -0
  64. package/configs/dotnet/.claude/rules/mediatr.md +320 -0
  65. package/configs/dotnet/.claude/rules/middleware.md +489 -0
  66. package/configs/dotnet/.claude/rules/result-pattern.md +363 -0
  67. package/configs/dotnet/.claude/rules/validation.md +388 -0
  68. package/configs/dotnet/.claude/settings.json +21 -3
  69. package/configs/dotnet/CLAUDE.md +53 -286
  70. package/configs/fastapi/.claude/rules/background-tasks.md +254 -0
  71. package/configs/fastapi/.claude/rules/dependencies.md +170 -0
  72. package/configs/{python → fastapi}/.claude/rules/fastapi.md +61 -1
  73. package/configs/fastapi/.claude/rules/lifespan.md +274 -0
  74. package/configs/fastapi/.claude/rules/middleware.md +229 -0
  75. package/configs/fastapi/.claude/rules/pydantic.md +433 -0
  76. package/configs/fastapi/.claude/rules/responses.md +251 -0
  77. package/configs/fastapi/.claude/rules/routers.md +202 -0
  78. package/configs/fastapi/.claude/rules/security.md +222 -0
  79. package/configs/fastapi/.claude/rules/testing.md +251 -0
  80. package/configs/fastapi/.claude/rules/websockets.md +298 -0
  81. package/configs/fastapi/.claude/settings.json +33 -0
  82. package/configs/fastapi/CLAUDE.md +144 -0
  83. package/configs/flask/.claude/rules/blueprints.md +208 -0
  84. package/configs/flask/.claude/rules/cli.md +285 -0
  85. package/configs/flask/.claude/rules/configuration.md +281 -0
  86. package/configs/flask/.claude/rules/context.md +238 -0
  87. package/configs/flask/.claude/rules/error-handlers.md +278 -0
  88. package/configs/flask/.claude/rules/extensions.md +278 -0
  89. package/configs/flask/.claude/rules/flask.md +171 -0
  90. package/configs/flask/.claude/rules/marshmallow.md +206 -0
  91. package/configs/flask/.claude/rules/security.md +267 -0
  92. package/configs/flask/.claude/rules/testing.md +284 -0
  93. package/configs/flask/.claude/settings.json +33 -0
  94. package/configs/flask/CLAUDE.md +166 -0
  95. package/configs/nestjs/.claude/rules/common-patterns.md +300 -0
  96. package/configs/nestjs/.claude/rules/filters.md +376 -0
  97. package/configs/nestjs/.claude/rules/interceptors.md +317 -0
  98. package/configs/nestjs/.claude/rules/middleware.md +321 -0
  99. package/configs/nestjs/.claude/rules/modules.md +26 -0
  100. package/configs/nestjs/.claude/rules/pipes.md +351 -0
  101. package/configs/nestjs/.claude/rules/websockets.md +451 -0
  102. package/configs/nestjs/.claude/settings.json +16 -2
  103. package/configs/nestjs/CLAUDE.md +57 -215
  104. package/configs/nextjs/.claude/rules/api-routes.md +358 -0
  105. package/configs/nextjs/.claude/rules/authentication.md +355 -0
  106. package/configs/nextjs/.claude/rules/components.md +52 -0
  107. package/configs/nextjs/.claude/rules/data-fetching.md +249 -0
  108. package/configs/nextjs/.claude/rules/database.md +400 -0
  109. package/configs/nextjs/.claude/rules/middleware.md +303 -0
  110. package/configs/nextjs/.claude/rules/routing.md +324 -0
  111. package/configs/nextjs/.claude/rules/seo.md +350 -0
  112. package/configs/nextjs/.claude/rules/server-actions.md +353 -0
  113. package/configs/nextjs/.claude/rules/state/zustand.md +6 -6
  114. package/configs/nextjs/.claude/settings.json +5 -0
  115. package/configs/nextjs/CLAUDE.md +69 -331
  116. package/package.json +23 -9
  117. package/src/cli.js +220 -0
  118. package/src/config.js +29 -0
  119. package/src/index.js +13 -0
  120. package/src/installer.js +361 -0
  121. package/src/merge.js +116 -0
  122. package/src/tech-config.json +29 -0
  123. package/src/utils.js +96 -0
  124. package/configs/python/.claude/rules/flask.md +0 -332
  125. package/configs/python/.claude/settings.json +0 -18
  126. package/configs/python/CLAUDE.md +0 -273
  127. package/src/install.js +0 -315
  128. /package/configs/_shared/.claude/rules/{accessibility.md → domain/frontend/accessibility.md} +0 -0
  129. /package/configs/_shared/.claude/rules/{security.md → security/security.md} +0 -0
  130. /package/configs/_shared/.claude/skills/{debug → dev/debug}/SKILL.md +0 -0
  131. /package/configs/_shared/.claude/skills/{learning → dev/learning}/SKILL.md +0 -0
  132. /package/configs/_shared/.claude/skills/{spec → dev/spec}/SKILL.md +0 -0
  133. /package/configs/_shared/.claude/skills/{review → git/review}/SKILL.md +0 -0
@@ -0,0 +1,257 @@
1
+ ---
2
+ name: explore
3
+ description: Deep analysis of a repository with detailed documentation
4
+ argument-hint: [path-or-depth]
5
+ ---
6
+
7
+ # Explore Repository Skill
8
+
9
+ You are now in **deep analysis mode**. Analyze the codebase thoroughly and produce comprehensive documentation.
10
+
11
+ ## Target
12
+
13
+ If an argument is provided, analyze that path: `$ARGUMENTS`
14
+ If no argument, analyze the current working directory.
15
+
16
+ ## Analysis Process
17
+
18
+ ### Phase 1: Discovery
19
+
20
+ Gather raw information:
21
+
22
+ 1. **Project Metadata**
23
+ - `package.json`, `pyproject.toml`, `*.csproj`, `Cargo.toml`, etc.
24
+ - README files
25
+ - License
26
+
27
+ 2. **File Structure**
28
+ - Top-level directories
29
+ - Key configuration files
30
+ - Total file count by extension
31
+
32
+ 3. **Git History** (if available)
33
+ - Number of commits
34
+ - Contributors count
35
+ - Most active files
36
+ - Recent activity
37
+
38
+ ### Phase 2: Technology Stack
39
+
40
+ Identify all technologies:
41
+
42
+ | Category | What to Find |
43
+ |----------|--------------|
44
+ | Language(s) | Primary + secondary languages |
45
+ | Framework(s) | Web, API, CLI frameworks |
46
+ | Database | ORM, drivers, migrations |
47
+ | Testing | Test framework, coverage tools |
48
+ | Build | Bundler, compiler, task runner |
49
+ | CI/CD | Pipeline configs |
50
+ | Infrastructure | Docker, K8s, cloud configs |
51
+ | Code Quality | Linters, formatters, type checkers |
52
+
53
+ ### Phase 3: Architecture Analysis
54
+
55
+ Understand the design:
56
+
57
+ 1. **Architecture Pattern**
58
+ - Monolith / Microservices / Monorepo
59
+ - Clean Architecture / Hexagonal / MVC / etc.
60
+ - Module organization
61
+
62
+ 2. **Entry Points**
63
+ - Main files
64
+ - CLI commands
65
+ - API routes
66
+ - Event handlers
67
+
68
+ 3. **Data Flow**
69
+ - How data enters the system
70
+ - Processing layers
71
+ - Storage mechanisms
72
+ - External integrations
73
+
74
+ 4. **Dependencies Graph**
75
+ - Internal module dependencies
76
+ - External service integrations
77
+ - Circular dependency detection
78
+
79
+ ### Phase 4: Code Patterns
80
+
81
+ Document coding conventions:
82
+
83
+ 1. **Naming Conventions**
84
+ - File naming patterns
85
+ - Class/function naming style
86
+ - Variable conventions
87
+
88
+ 2. **Common Patterns**
89
+ - Dependency injection
90
+ - Repository pattern
91
+ - Factory pattern
92
+ - Observer/Event patterns
93
+ - Error handling approach
94
+
95
+ 3. **Testing Strategy**
96
+ - Test organization
97
+ - Coverage targets
98
+ - Mocking approach
99
+
100
+ ### Phase 5: Documentation Review
101
+
102
+ Assess existing documentation:
103
+
104
+ - README completeness
105
+ - API documentation
106
+ - Code comments quality
107
+ - Architecture Decision Records (ADRs)
108
+
109
+ ## Output Format
110
+
111
+ Generate a structured report:
112
+
113
+ ```markdown
114
+ # Repository Analysis: [Project Name]
115
+
116
+ ## Overview
117
+ [2-3 paragraph executive summary]
118
+
119
+ ## Quick Facts
120
+ | Metric | Value |
121
+ |--------|-------|
122
+ | Primary Language | |
123
+ | Framework | |
124
+ | Architecture | |
125
+ | Test Coverage | |
126
+ | Last Updated | |
127
+ | Contributors | |
128
+
129
+ ## Technology Stack
130
+
131
+ ### Core
132
+ - **Language**: [version]
133
+ - **Framework**: [version]
134
+ - **Runtime**: [version]
135
+
136
+ ### Data
137
+ - **Database**:
138
+ - **ORM/Driver**:
139
+ - **Cache**:
140
+
141
+ ### DevOps
142
+ - **CI/CD**:
143
+ - **Container**:
144
+ - **Deployment**:
145
+
146
+ ### Quality
147
+ - **Linter**:
148
+ - **Formatter**:
149
+ - **Type Checker**:
150
+
151
+ ## Architecture
152
+
153
+ ### High-Level Structure
154
+ ```
155
+ [ASCII diagram or tree view]
156
+ ```
157
+
158
+ ### Key Modules
159
+ | Module | Purpose | Key Files |
160
+ |--------|---------|-----------|
161
+ | | | |
162
+
163
+ ### Data Flow
164
+ [Description of how data moves through the system]
165
+
166
+ ### External Integrations
167
+ | Service | Purpose | Location |
168
+ |---------|---------|----------|
169
+ | | | |
170
+
171
+ ## Code Patterns
172
+
173
+ ### Conventions Used
174
+ - [Pattern 1]: [Where/How]
175
+ - [Pattern 2]: [Where/How]
176
+
177
+ ### Strengths
178
+ - [What's done well]
179
+
180
+ ### Areas for Improvement
181
+ - [Potential improvements]
182
+
183
+ ## Entry Points
184
+
185
+ | Type | File | Description |
186
+ |------|------|-------------|
187
+ | Main | | |
188
+ | API | | |
189
+ | CLI | | |
190
+
191
+ ## Getting Started
192
+
193
+ ### Prerequisites
194
+ - [Requirement 1]
195
+ - [Requirement 2]
196
+
197
+ ### Setup
198
+ ```bash
199
+ [Setup commands]
200
+ ```
201
+
202
+ ### Development
203
+ ```bash
204
+ [Dev commands]
205
+ ```
206
+
207
+ ### Testing
208
+ ```bash
209
+ [Test commands]
210
+ ```
211
+
212
+ ## File Statistics
213
+
214
+ | Extension | Count | % of Codebase |
215
+ |-----------|-------|---------------|
216
+ | | | |
217
+
218
+ ## Recommendations
219
+
220
+ ### For New Contributors
221
+ 1. [Start here]
222
+ 2. [Then explore]
223
+ 3. [Key files to understand]
224
+
225
+ ### Technical Debt
226
+ | Issue | Severity | Location |
227
+ |-------|----------|----------|
228
+ | | | |
229
+ ```
230
+
231
+ ## Behavior
232
+
233
+ 1. **Be thorough** - Read actual files, don't assume
234
+ 2. **Be accurate** - Verify versions and configurations
235
+ 3. **Be useful** - Focus on actionable insights
236
+ 4. **Be objective** - Note both strengths and weaknesses
237
+ 5. **Show evidence** - Include file paths and line references
238
+
239
+ ## Tools to Use
240
+
241
+ - `Glob` - Find files by pattern
242
+ - `Grep` - Search code content
243
+ - `Read` - Read file contents
244
+ - `Bash` - Run commands (git log, package managers)
245
+
246
+ ## Depth Levels
247
+
248
+ If user specifies depth:
249
+ - **quick**: Overview + tech stack only
250
+ - **standard**: Full analysis (default)
251
+ - **deep**: Include dependency analysis, security scan, performance patterns
252
+
253
+ ## Exit
254
+
255
+ After presenting the analysis, ask:
256
+ - "Want me to generate a CLAUDE.md based on this analysis?"
257
+ - "Any specific area you'd like me to explore deeper?"
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: security-audit
3
+ description: Perform security audit on the codebase and generate recommendations
4
+ argument-hint: "[--focus <area>]"
5
+ ---
6
+
7
+ # Security Audit
8
+
9
+ Perform a comprehensive security audit of the codebase.
10
+
11
+ ## Usage
12
+
13
+ - `/security-audit` - Full security audit
14
+ - `/security-audit --focus auth` - Focus on authentication
15
+ - `/security-audit --focus api` - Focus on API security
16
+ - `/security-audit --focus deps` - Focus on dependencies
17
+ - `/security-audit --focus secrets` - Focus on secret detection
18
+
19
+ ## Behavior
20
+
21
+ 1. **Scan Codebase**
22
+ - Search for common vulnerability patterns
23
+ - Check dependency versions
24
+ - Analyze authentication/authorization
25
+ - Review API endpoints
26
+ - Check for hardcoded secrets
27
+
28
+ 2. **Generate Report**
29
+ - Severity ratings (Critical, High, Medium, Low)
30
+ - Location of issues
31
+ - Remediation steps
32
+ - Code examples for fixes
33
+
34
+ ## Audit Categories
35
+
36
+ ### 1. Authentication & Authorization
37
+
38
+ | Check | What to Look For |
39
+ |-------|------------------|
40
+ | Password Storage | bcrypt/argon2, no plain text |
41
+ | JWT Security | Proper signing, expiration, refresh |
42
+ | Session Management | Secure cookies, CSRF protection |
43
+ | Authorization | Role checks, resource ownership |
44
+
45
+ ### 2. Input Validation
46
+
47
+ | Check | What to Look For |
48
+ |-------|------------------|
49
+ | SQL Injection | Parameterized queries, ORM usage |
50
+ | XSS | Output encoding, CSP headers |
51
+ | Command Injection | Input sanitization |
52
+ | Path Traversal | Path validation |
53
+
54
+ ### 3. API Security
55
+
56
+ | Check | What to Look For |
57
+ |-------|------------------|
58
+ | Rate Limiting | Request throttling |
59
+ | CORS | Proper origin restrictions |
60
+ | Headers | Security headers (HSTS, CSP, etc.) |
61
+ | Error Handling | No stack traces in production |
62
+
63
+ ### 4. Secrets Management
64
+
65
+ | Check | What to Look For |
66
+ |-------|------------------|
67
+ | Hardcoded Secrets | API keys, passwords in code |
68
+ | .env Files | Not committed, proper .gitignore |
69
+ | Config Files | No secrets in config |
70
+
71
+ ### 5. Dependencies
72
+
73
+ | Check | What to Look For |
74
+ |-------|------------------|
75
+ | Known Vulnerabilities | CVE database check |
76
+ | Outdated Packages | Security patches |
77
+ | License Compliance | Compatible licenses |
78
+
79
+ ## Output Format
80
+
81
+ ```
82
+ # Security Audit Report
83
+
84
+ **Date:** 2024-01-15
85
+ **Scope:** Full codebase
86
+ **Risk Level:** Medium
87
+
88
+ ## Summary
89
+
90
+ | Severity | Count |
91
+ |----------|-------|
92
+ | 🔴 Critical | 0 |
93
+ | 🟠 High | 2 |
94
+ | 🟡 Medium | 5 |
95
+ | 🔵 Low | 8 |
96
+
97
+ ## Critical/High Findings
98
+
99
+ ### [HIGH] SQL Injection in User Search
100
+ **File:** src/users/users.service.ts:45
101
+ **Issue:** Raw SQL query with user input
102
+ **Current Code:**
103
+ ```typescript
104
+ db.query(`SELECT * FROM users WHERE name = '${name}'`)
105
+ ```
106
+ **Remediation:**
107
+ ```typescript
108
+ db.query('SELECT * FROM users WHERE name = $1', [name])
109
+ ```
110
+
111
+ ### [HIGH] Missing Rate Limiting on Login
112
+ **File:** src/auth/auth.controller.ts
113
+ **Issue:** No rate limiting on /auth/login endpoint
114
+ **Remediation:** Add rate limiting middleware
115
+
116
+ ## Medium Findings
117
+
118
+ ### [MEDIUM] Missing Security Headers
119
+ **Issue:** CSP, X-Frame-Options not set
120
+ **Remediation:** Add helmet middleware
121
+
122
+ ## Low Findings
123
+
124
+ ### [LOW] Verbose Error Messages
125
+ **File:** src/app.module.ts
126
+ **Issue:** Stack traces visible in production
127
+ **Remediation:** Use exception filter
128
+
129
+ ## Recommendations
130
+
131
+ 1. **Immediate:** Fix SQL injection vulnerability
132
+ 2. **This Sprint:** Add rate limiting to auth endpoints
133
+ 3. **Backlog:** Implement security headers
134
+ 4. **Ongoing:** Set up automated dependency scanning
135
+
136
+ ## Commands to Run
137
+
138
+ ```bash
139
+ # Check dependencies
140
+ npm audit
141
+ # or
142
+ pip-audit
143
+
144
+ # Scan for secrets
145
+ gitleaks detect
146
+
147
+ # Scan for vulnerabilities
148
+ snyk test
149
+ ```
150
+ ```
151
+
152
+ ## Patterns to Detect
153
+
154
+ ### SQL Injection
155
+ ```javascript
156
+ // Bad
157
+ `SELECT * FROM users WHERE id = ${id}`
158
+ // Good
159
+ 'SELECT * FROM users WHERE id = $1', [id]
160
+ ```
161
+
162
+ ### XSS
163
+ ```javascript
164
+ // Bad
165
+ element.innerHTML = userInput
166
+ // Good
167
+ element.textContent = userInput
168
+ ```
169
+
170
+ ### Hardcoded Secrets
171
+ ```javascript
172
+ // Bad
173
+ const apiKey = 'sk-1234567890'
174
+ // Good
175
+ const apiKey = process.env.API_KEY
176
+ ```
177
+
178
+ ### Insecure Password Storage
179
+ ```javascript
180
+ // Bad
181
+ const hash = md5(password)
182
+ // Good
183
+ const hash = await bcrypt.hash(password, 12)
184
+ ```
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: api-endpoint
3
+ description: Generate a complete REST API endpoint with validation, tests, and documentation
4
+ argument-hint: "<method> <path> [--resource <name>]"
5
+ ---
6
+
7
+ # API Endpoint Generator
8
+
9
+ Generate a complete, production-ready API endpoint.
10
+
11
+ ## Usage Examples
12
+
13
+ - `/api-endpoint GET /users` - List users endpoint
14
+ - `/api-endpoint POST /users` - Create user endpoint
15
+ - `/api-endpoint GET /users/:id` - Get user by ID
16
+ - `/api-endpoint PUT /users/:id` - Update user
17
+ - `/api-endpoint DELETE /users/:id` - Delete user
18
+ - `/api-endpoint --resource Order` - Full CRUD for Order resource
19
+
20
+ ## Behavior
21
+
22
+ 1. **Detect Framework**
23
+ - NestJS → Controller, Service, DTO, Spec
24
+ - Next.js → Route handler, Zod schema
25
+ - FastAPI → Router, Pydantic schema
26
+ - .NET → Controller, Service, Request/Response DTOs
27
+
28
+ 2. **Generate Files**
29
+
30
+ ### For Single Endpoint
31
+
32
+ | File | Content |
33
+ |------|---------|
34
+ | Route/Controller | HTTP handler with proper decorators |
35
+ | Validation Schema | Input validation (Zod/Pydantic/FluentValidation) |
36
+ | Service Method | Business logic (if applicable) |
37
+ | Test File | Unit and integration tests |
38
+
39
+ ### For Full Resource (--resource)
40
+
41
+ | File | Content |
42
+ |------|---------|
43
+ | Controller/Router | All CRUD endpoints |
44
+ | DTOs/Schemas | Create, Update, Response, Query schemas |
45
+ | Service | Full CRUD operations |
46
+ | Repository | Database access layer |
47
+ | Tests | Full test coverage |
48
+
49
+ 3. **Include in Generated Code**
50
+ - Input validation
51
+ - Error handling (404, 400, 500)
52
+ - Authentication check (if auth detected)
53
+ - Pagination (for list endpoints)
54
+ - OpenAPI documentation
55
+
56
+ ## Output Format
57
+
58
+ ```
59
+ ## Files to Create/Modify
60
+
61
+ ### path/to/controller.ts
62
+ <code>
63
+
64
+ ### path/to/dto.ts
65
+ <code>
66
+
67
+ ### path/to/service.ts
68
+ <code>
69
+
70
+ ### path/to/controller.spec.ts
71
+ <code>
72
+
73
+ ## API Documentation
74
+
75
+ - **Method**: POST
76
+ - **Path**: /api/users
77
+ - **Request Body**: { email, name, password }
78
+ - **Response**: 201 Created
79
+ - **Errors**: 400 Validation Error, 409 Conflict
80
+ ```
81
+
82
+ ## Framework-Specific Patterns
83
+
84
+ ### NestJS
85
+ ```typescript
86
+ @Controller('users')
87
+ export class UsersController {
88
+ @Post()
89
+ @HttpCode(201)
90
+ async create(@Body() dto: CreateUserDto): Promise<UserResponse> {}
91
+ }
92
+ ```
93
+
94
+ ### Next.js (App Router)
95
+ ```typescript
96
+ export async function POST(request: Request) {
97
+ const body = await request.json();
98
+ const data = schema.parse(body);
99
+ // ...
100
+ }
101
+ ```
102
+
103
+ ### FastAPI
104
+ ```python
105
+ @router.post("/", response_model=UserResponse, status_code=201)
106
+ async def create_user(data: UserCreate, db: AsyncSession = Depends(get_db)):
107
+ pass
108
+ ```
109
+
110
+ ### .NET
111
+ ```csharp
112
+ [HttpPost]
113
+ [ProducesResponseType(typeof(UserResponse), StatusCodes.Status201Created)]
114
+ public async Task<IActionResult> Create([FromBody] CreateUserRequest request)
115
+ ```
116
+
117
+ ## REST Conventions
118
+
119
+ | Method | Path | Action | Response |
120
+ |--------|------|--------|----------|
121
+ | GET | /resources | List all | 200 + array |
122
+ | POST | /resources | Create | 201 + object |
123
+ | GET | /resources/:id | Get one | 200 + object |
124
+ | PUT | /resources/:id | Replace | 200 + object |
125
+ | PATCH | /resources/:id | Update | 200 + object |
126
+ | DELETE | /resources/:id | Delete | 204 No Content |
@@ -1,3 +1,9 @@
1
+ ---
2
+ name: generate-tests
3
+ description: Generate comprehensive tests for a file or function
4
+ argument-hint: <file-path-or-function>
5
+ ---
6
+
1
7
  # Generate Tests
2
8
 
3
9
  Generate tests for: $ARGUMENTS
@@ -1,3 +1,9 @@
1
+ ---
2
+ name: fix-issue
3
+ description: Analyze and fix a GitHub issue with structured workflow
4
+ argument-hint: <issue-number>
5
+ ---
6
+
1
7
  # Fix GitHub Issue
2
8
 
3
9
  Fix the GitHub issue #$ARGUMENTS
@@ -1,3 +1,9 @@
1
+ ---
2
+ name: review-pr
3
+ description: Review a GitHub PR with security, performance, and quality checks
4
+ argument-hint: <pr-number>
5
+ ---
6
+
1
7
  # Review Pull Request
2
8
 
3
9
  Review the GitHub PR #$ARGUMENTS