@neyugn/agent-kits 0.1.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 (158) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +514 -0
  3. package/README.vi.md +410 -0
  4. package/README.zh.md +410 -0
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +422 -0
  7. package/kits/coder/ARCHITECTURE.md +289 -0
  8. package/kits/coder/agents/ai-engineer.md +344 -0
  9. package/kits/coder/agents/backend-specialist.md +270 -0
  10. package/kits/coder/agents/cloud-architect.md +363 -0
  11. package/kits/coder/agents/code-reviewer.md +284 -0
  12. package/kits/coder/agents/data-engineer.md +401 -0
  13. package/kits/coder/agents/database-specialist.md +251 -0
  14. package/kits/coder/agents/debugger.md +209 -0
  15. package/kits/coder/agents/devops-engineer.md +281 -0
  16. package/kits/coder/agents/documentation-writer.md +296 -0
  17. package/kits/coder/agents/frontend-specialist.md +298 -0
  18. package/kits/coder/agents/i18n-specialist.md +348 -0
  19. package/kits/coder/agents/integration-specialist.md +314 -0
  20. package/kits/coder/agents/mobile-developer.md +271 -0
  21. package/kits/coder/agents/multi-tenant-architect.md +281 -0
  22. package/kits/coder/agents/orchestrator.md +263 -0
  23. package/kits/coder/agents/performance-analyst.md +327 -0
  24. package/kits/coder/agents/project-planner.md +277 -0
  25. package/kits/coder/agents/queue-specialist.md +282 -0
  26. package/kits/coder/agents/realtime-specialist.md +267 -0
  27. package/kits/coder/agents/security-auditor.md +253 -0
  28. package/kits/coder/agents/test-engineer.md +315 -0
  29. package/kits/coder/agents/ux-researcher.md +388 -0
  30. package/kits/coder/rules/.cursorrules +287 -0
  31. package/kits/coder/rules/CLAUDE.md +287 -0
  32. package/kits/coder/rules/CODEX.md +287 -0
  33. package/kits/coder/rules/GEMINI.md +287 -0
  34. package/kits/coder/scripts/checklist.py +318 -0
  35. package/kits/coder/scripts/kit_status.py +292 -0
  36. package/kits/coder/scripts/skills_manager.py +243 -0
  37. package/kits/coder/scripts/verify_all.py +391 -0
  38. package/kits/coder/skills/accessibility-patterns/SKILL.md +372 -0
  39. package/kits/coder/skills/accessibility-patterns/scripts/a11y_checker.py +211 -0
  40. package/kits/coder/skills/ai-rag-patterns/SKILL.md +444 -0
  41. package/kits/coder/skills/api-patterns/SKILL.md +316 -0
  42. package/kits/coder/skills/api-patterns/assets/.gitkeep +1 -0
  43. package/kits/coder/skills/api-patterns/references/deep-dive.md +21 -0
  44. package/kits/coder/skills/api-patterns/scripts/api_validator.py +253 -0
  45. package/kits/coder/skills/api-patterns/scripts/validate.py +56 -0
  46. package/kits/coder/skills/auth-patterns/SKILL.md +267 -0
  47. package/kits/coder/skills/aws-patterns/SKILL.md +576 -0
  48. package/kits/coder/skills/brainstorming/SKILL.md +370 -0
  49. package/kits/coder/skills/brainstorming/assets/.gitkeep +1 -0
  50. package/kits/coder/skills/brainstorming/references/deep-dive.md +21 -0
  51. package/kits/coder/skills/brainstorming/scripts/validate.py +56 -0
  52. package/kits/coder/skills/clean-code/SKILL.md +240 -0
  53. package/kits/coder/skills/clean-code/assets/.gitkeep +1 -0
  54. package/kits/coder/skills/clean-code/references/deep-dive.md +21 -0
  55. package/kits/coder/skills/clean-code/scripts/lint_runner.py +186 -0
  56. package/kits/coder/skills/clean-code/scripts/validate.py +56 -0
  57. package/kits/coder/skills/database-design/SKILL.md +255 -0
  58. package/kits/coder/skills/database-design/assets/.gitkeep +1 -0
  59. package/kits/coder/skills/database-design/references/deep-dive.md +21 -0
  60. package/kits/coder/skills/database-design/scripts/schema_validator.py +272 -0
  61. package/kits/coder/skills/database-design/scripts/validate.py +56 -0
  62. package/kits/coder/skills/docker-patterns/SKILL.md +240 -0
  63. package/kits/coder/skills/documentation-templates/SKILL.md +441 -0
  64. package/kits/coder/skills/e2e-testing/SKILL.md +457 -0
  65. package/kits/coder/skills/flutter-patterns/SKILL.md +330 -0
  66. package/kits/coder/skills/frontend-design/SKILL.md +127 -0
  67. package/kits/coder/skills/github-actions/SKILL.md +349 -0
  68. package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +466 -0
  69. package/kits/coder/skills/graphql-patterns/SKILL.md +558 -0
  70. package/kits/coder/skills/i18n-localization/SKILL.md +345 -0
  71. package/kits/coder/skills/i18n-localization/scripts/i18n_checker.py +267 -0
  72. package/kits/coder/skills/kubernetes-patterns/SKILL.md +357 -0
  73. package/kits/coder/skills/mermaid-diagrams/SKILL.md +351 -0
  74. package/kits/coder/skills/mobile-design/SKILL.md +305 -0
  75. package/kits/coder/skills/monitoring-observability/SKILL.md +458 -0
  76. package/kits/coder/skills/multi-tenancy/SKILL.md +317 -0
  77. package/kits/coder/skills/multi-tenancy/assets/.gitkeep +1 -0
  78. package/kits/coder/skills/multi-tenancy/references/deep-dive.md +21 -0
  79. package/kits/coder/skills/multi-tenancy/scripts/validate.py +56 -0
  80. package/kits/coder/skills/nodejs-best-practices/SKILL.md +220 -0
  81. package/kits/coder/skills/performance-profiling/SKILL.md +333 -0
  82. package/kits/coder/skills/performance-profiling/assets/.gitkeep +1 -0
  83. package/kits/coder/skills/performance-profiling/references/deep-dive.md +21 -0
  84. package/kits/coder/skills/performance-profiling/scripts/validate.py +56 -0
  85. package/kits/coder/skills/plan-writing/SKILL.md +360 -0
  86. package/kits/coder/skills/plan-writing/assets/.gitkeep +1 -0
  87. package/kits/coder/skills/plan-writing/references/deep-dive.md +21 -0
  88. package/kits/coder/skills/plan-writing/scripts/validate.py +56 -0
  89. package/kits/coder/skills/postgres-patterns/SKILL.md +361 -0
  90. package/kits/coder/skills/prompt-engineering/SKILL.md +277 -0
  91. package/kits/coder/skills/queue-patterns/SKILL.md +359 -0
  92. package/kits/coder/skills/queue-patterns/assets/.gitkeep +1 -0
  93. package/kits/coder/skills/queue-patterns/references/deep-dive.md +21 -0
  94. package/kits/coder/skills/queue-patterns/scripts/validate.py +56 -0
  95. package/kits/coder/skills/react-native-patterns/SKILL.md +393 -0
  96. package/kits/coder/skills/react-patterns/SKILL.md +319 -0
  97. package/kits/coder/skills/realtime-patterns/SKILL.md +506 -0
  98. package/kits/coder/skills/realtime-patterns/assets/.gitkeep +1 -0
  99. package/kits/coder/skills/realtime-patterns/references/deep-dive.md +21 -0
  100. package/kits/coder/skills/realtime-patterns/scripts/validate.py +56 -0
  101. package/kits/coder/skills/redis-patterns/SKILL.md +484 -0
  102. package/kits/coder/skills/security-fundamentals/SKILL.md +363 -0
  103. package/kits/coder/skills/security-fundamentals/assets/.gitkeep +1 -0
  104. package/kits/coder/skills/security-fundamentals/references/deep-dive.md +21 -0
  105. package/kits/coder/skills/security-fundamentals/scripts/security_scan.py +326 -0
  106. package/kits/coder/skills/security-fundamentals/scripts/validate.py +56 -0
  107. package/kits/coder/skills/seo-patterns/SKILL.md +262 -0
  108. package/kits/coder/skills/seo-patterns/scripts/seo_checker.py +211 -0
  109. package/kits/coder/skills/systematic-debugging/SKILL.md +478 -0
  110. package/kits/coder/skills/systematic-debugging/assets/.gitkeep +1 -0
  111. package/kits/coder/skills/systematic-debugging/references/deep-dive.md +21 -0
  112. package/kits/coder/skills/systematic-debugging/scripts/validate.py +56 -0
  113. package/kits/coder/skills/tailwind-patterns/SKILL.md +395 -0
  114. package/kits/coder/skills/terraform-patterns/SKILL.md +470 -0
  115. package/kits/coder/skills/testing-patterns/SKILL.md +285 -0
  116. package/kits/coder/skills/testing-patterns/assets/.gitkeep +1 -0
  117. package/kits/coder/skills/testing-patterns/references/deep-dive.md +21 -0
  118. package/kits/coder/skills/testing-patterns/scripts/test_runner.py +219 -0
  119. package/kits/coder/skills/testing-patterns/scripts/validate.py +56 -0
  120. package/kits/coder/skills/typescript-patterns/SKILL.md +417 -0
  121. package/kits/coder/skills/ui-ux-pro-max/SKILL.md +364 -0
  122. package/kits/coder/skills/ui-ux-pro-max/data/charts.csv +26 -0
  123. package/kits/coder/skills/ui-ux-pro-max/data/colors.csv +97 -0
  124. package/kits/coder/skills/ui-ux-pro-max/data/icons.csv +101 -0
  125. package/kits/coder/skills/ui-ux-pro-max/data/landing.csv +31 -0
  126. package/kits/coder/skills/ui-ux-pro-max/data/products.csv +97 -0
  127. package/kits/coder/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  128. package/kits/coder/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  129. package/kits/coder/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  130. package/kits/coder/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  131. package/kits/coder/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  132. package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  133. package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  134. package/kits/coder/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  135. package/kits/coder/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  136. package/kits/coder/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  137. package/kits/coder/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  138. package/kits/coder/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  139. package/kits/coder/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  140. package/kits/coder/skills/ui-ux-pro-max/data/styles.csv +59 -0
  141. package/kits/coder/skills/ui-ux-pro-max/data/typography.csv +58 -0
  142. package/kits/coder/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  143. package/kits/coder/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  144. package/kits/coder/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  145. package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
  146. package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
  147. package/kits/coder/skills/ui-ux-pro-max/scripts/core.py +257 -0
  148. package/kits/coder/skills/ui-ux-pro-max/scripts/design_system.py +488 -0
  149. package/kits/coder/skills/ui-ux-pro-max/scripts/search.py +76 -0
  150. package/kits/coder/workflows/.gitkeep +20 -0
  151. package/kits/coder/workflows/create.md +152 -0
  152. package/kits/coder/workflows/debug.md +223 -0
  153. package/kits/coder/workflows/deploy.md +283 -0
  154. package/kits/coder/workflows/orchestrate.md +243 -0
  155. package/kits/coder/workflows/plan.md +134 -0
  156. package/kits/coder/workflows/test.md +237 -0
  157. package/kits/coder/workflows/ui-ux-pro-max.md +109 -0
  158. package/package.json +49 -0
@@ -0,0 +1,267 @@
1
+ ---
2
+ name: auth-patterns
3
+ description: Authentication and authorization principles. Use when implementing JWT, OAuth2, session management, RBAC, or securing APIs. Covers token flows, password security, access control patterns.
4
+ allowed-tools: Read, Write, Edit
5
+ version: 1.0
6
+ priority: HIGH
7
+ ---
8
+
9
+ # Auth Patterns - Security-First Access Control
10
+
11
+ > **Philosophy:** Authentication answers "Who are you?" Authorization answers "What can you do?" Both must be **server-validated**, never trust the client.
12
+
13
+ ---
14
+
15
+ ## Core Principles
16
+
17
+ | Principle | Rule |
18
+ | -------------------- | --------------------------------------------------------- |
19
+ | **Server-side** | All auth checks happen on server, never just client |
20
+ | **Defense in depth** | Multiple layers: HTTPS + tokens + validation + rate limit |
21
+ | **Least privilege** | Grant minimum permissions needed |
22
+ | **Secure defaults** | Default deny, explicitly grant access |
23
+ | **Audit everything** | Log auth events for security monitoring |
24
+
25
+ ---
26
+
27
+ ## Authentication Strategy Selection
28
+
29
+ | Strategy | Use When | Trade-offs |
30
+ | --------------- | ------------------------------------------ | ------------------------------- |
31
+ | **JWT** | Stateless APIs, microservices, mobile apps | Token size, can't revoke easily |
32
+ | **Session** | Traditional web apps, SSR | Stateful, needs session store |
33
+ | **OAuth2/OIDC** | Social login, SSO, third-party auth | Complex, external dependency |
34
+ | **API Keys** | Service-to-service, public APIs | No user context, rotation |
35
+
36
+ ---
37
+
38
+ ## JWT Token Flow
39
+
40
+ ### Token Structure
41
+
42
+ ```
43
+ Header.Payload.Signature
44
+ ```
45
+
46
+ | Part | Contains | Purpose |
47
+ | ------------- | ---------------------- | ---------------------- |
48
+ | **Header** | Algorithm, type | How to verify |
49
+ | **Payload** | userId, role, exp, iat | Claims about user |
50
+ | **Signature** | HMAC or RSA signature | Integrity verification |
51
+
52
+ ### Access + Refresh Pattern
53
+
54
+ ```typescript
55
+ // Short-lived access token: 15 minutes
56
+ const accessToken = jwt.sign({ userId, email, role }, process.env.JWT_SECRET, {
57
+ expiresIn: "15m",
58
+ });
59
+
60
+ // Long-lived refresh token: 7 days
61
+ const refreshToken = jwt.sign({ userId }, process.env.JWT_REFRESH_SECRET, {
62
+ expiresIn: "7d",
63
+ });
64
+ ```
65
+
66
+ | Token Type | Lifetime | Storage | Purpose |
67
+ | ----------- | -------- | ------------------------ | -------------------- |
68
+ | **Access** | 15 min | Memory / httpOnly cookie | API authorization |
69
+ | **Refresh** | 7 days | httpOnly cookie + DB | Get new access token |
70
+
71
+ ---
72
+
73
+ ## Authorization Patterns
74
+
75
+ ### RBAC (Role-Based)
76
+
77
+ ```typescript
78
+ enum Role {
79
+ USER = "user",
80
+ MODERATOR = "moderator",
81
+ ADMIN = "admin",
82
+ }
83
+
84
+ // Middleware
85
+ function requireRole(...roles: Role[]) {
86
+ return (req, res, next) => {
87
+ if (!roles.includes(req.user.role)) {
88
+ return res.status(403).json({ error: "Forbidden" });
89
+ }
90
+ next();
91
+ };
92
+ }
93
+
94
+ // Usage
95
+ app.delete("/users/:id", authenticate, requireRole(Role.ADMIN), handler);
96
+ ```
97
+
98
+ ### Permission-Based (Fine-grained)
99
+
100
+ | Permission Pattern | Example | Description |
101
+ | ------------------ | -------------- | --------------------------- |
102
+ | `resource:action` | `users:read` | Can read users |
103
+ | `resource:*` | `posts:*` | All actions on posts |
104
+ | `*:*` | Admin wildcard | Full access (use sparingly) |
105
+
106
+ ### Resource Ownership
107
+
108
+ ```typescript
109
+ // Check: user owns this resource OR is admin
110
+ async function requireOwnership(req, res, next) {
111
+ const resource = await db.posts.findById(req.params.id);
112
+
113
+ if (!resource) return res.status(404).json({ error: "Not found" });
114
+
115
+ if (resource.userId !== req.user.id && req.user.role !== "admin") {
116
+ return res.status(403).json({ error: "Not your resource" });
117
+ }
118
+
119
+ next();
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Password Security
126
+
127
+ | Rule | Implementation |
128
+ | ----------------------- | ------------------------------------------ |
129
+ | **Hash with bcrypt** | Salt rounds: 12+ |
130
+ | **Min 12 characters** | + uppercase + lowercase + number + special |
131
+ | **Rate limit attempts** | 5 attempts per 15 min |
132
+ | **Never log passwords** | Not even errors |
133
+ | **Secure reset flow** | Time-limited token via email |
134
+
135
+ ### Password Flow
136
+
137
+ ```typescript
138
+ // Hash on registration
139
+ const hash = await bcrypt.hash(password, 12);
140
+
141
+ // Verify on login
142
+ const valid = await bcrypt.compare(password, hash);
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Cookie Security
148
+
149
+ | Flag | Value | Purpose |
150
+ | ------------ | ---------- | ----------------------------- |
151
+ | **httpOnly** | `true` | Not accessible via JavaScript |
152
+ | **secure** | `true` | HTTPS only (production) |
153
+ | **sameSite** | `'strict'` | CSRF protection |
154
+ | **maxAge** | 86400000 | Expiration (24h in ms) |
155
+
156
+ ```typescript
157
+ res.cookie("token", accessToken, {
158
+ httpOnly: true,
159
+ secure: process.env.NODE_ENV === "production",
160
+ sameSite: "strict",
161
+ maxAge: 24 * 60 * 60 * 1000,
162
+ });
163
+ ```
164
+
165
+ ---
166
+
167
+ ## OAuth2 Simplified
168
+
169
+ | Flow | Use Case |
170
+ | ---------------------- | ---------------------------------- |
171
+ | **Authorization Code** | Web apps with backend |
172
+ | **PKCE** | SPAs, mobile apps (public clients) |
173
+ | **Client Credentials** | Service-to-service |
174
+
175
+ ### Basic OAuth2 Flow
176
+
177
+ ```
178
+ 1. User clicks "Login with Google"
179
+ 2. Redirect to Google with client_id + redirect_uri
180
+ 3. User authorizes
181
+ 4. Google redirects back with code
182
+ 5. Backend exchanges code for tokens
183
+ 6. Backend creates/finds user, issues own JWT
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Decision Trees
189
+
190
+ ### Which Auth Strategy?
191
+
192
+ ```
193
+ Building a SPA or mobile app?
194
+ ├── Yes → JWT with refresh tokens
195
+ └── No → Server-rendered web app?
196
+ ├── Yes → Session-based (Redis store)
197
+ └── No → API for other services?
198
+ ├── Yes → API Keys or OAuth2
199
+ └── No → Re-evaluate requirements
200
+ ```
201
+
202
+ ### Where to Store Tokens?
203
+
204
+ ```
205
+ Need access from JavaScript?
206
+ ├── No → httpOnly cookie (preferred)
207
+ └── Yes → Really need it?
208
+ ├── No → httpOnly cookie
209
+ └── Yes (API calls from JS) → Memory only
210
+ ⚠️ Never localStorage (XSS vulnerable)
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Anti-Patterns (DON'T)
216
+
217
+ | ❌ Anti-Pattern | ✅ Correct Approach |
218
+ | -------------------------------- | ------------------------------ |
219
+ | Store JWT in localStorage | httpOnly cookie or memory |
220
+ | Plain text passwords in DB | bcrypt hash with salt |
221
+ | Long-lived access tokens (24h+) | 15 min access + 7d refresh |
222
+ | Client-only auth checks | Server validates every request |
223
+ | Same secret for access & refresh | Separate secrets |
224
+ | No rate limiting on login | 5 attempts / 15 min |
225
+ | JWT without expiration | Always set `exp` claim |
226
+ | Hardcoded secrets in code | Environment variables |
227
+
228
+ ---
229
+
230
+ ## Security Checklist
231
+
232
+ | Category | Check |
233
+ | -------------- | ------------------------------------- |
234
+ | **Transport** | HTTPS everywhere, HSTS enabled |
235
+ | **Passwords** | bcrypt 12+, strong policy enforced |
236
+ | **Tokens** | Short-lived, httpOnly, secure cookies |
237
+ | **Rate Limit** | Login, registration, password reset |
238
+ | **Headers** | CSP, X-Frame-Options, X-Content-Type |
239
+ | **Logging** | Auth events logged, no sensitive data |
240
+ | **CORS** | Strict origin whitelist |
241
+
242
+ ---
243
+
244
+ ## 🔴 Self-Check Before Completing
245
+
246
+ | Check | Question |
247
+ | -------------------------- | ------------------------------ |
248
+ | ✅ **Server validated?** | All auth happens server-side? |
249
+ | ✅ **Tokens secure?** | httpOnly, secure, short-lived? |
250
+ | ✅ **Passwords hashed?** | bcrypt with 12+ rounds? |
251
+ | ✅ **Rate limited?** | Login endpoint protected? |
252
+ | ✅ **HTTPS?** | All traffic encrypted? |
253
+ | ✅ **No secrets in code?** | Environment variables only? |
254
+
255
+ ---
256
+
257
+ ## Related Skills
258
+
259
+ | Need | Skill |
260
+ | ----------------- | ----------------------- |
261
+ | API design | `api-patterns` |
262
+ | Security auditing | `security-fundamentals` |
263
+ | Database design | `database-design` |
264
+
265
+ ---
266
+
267
+ > **Remember:** Security is not a feature - it's a requirement. The cost of getting auth wrong is data breaches, legal liability, and lost trust. When in doubt, use battle-tested libraries.