codemaxxing 0.1.14 → 0.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.
- package/dist/agent.d.ts +6 -0
- package/dist/agent.js +19 -1
- package/dist/index.js +271 -3
- package/dist/skills/registry.d.ts +13 -0
- package/dist/skills/registry.js +472 -0
- package/dist/utils/context.d.ts +1 -1
- package/dist/utils/context.js +6 -2
- package/dist/utils/skills.d.ts +60 -0
- package/dist/utils/skills.js +203 -0
- package/package.json +1 -1
- package/src/agent.ts +24 -1
- package/src/index.tsx +316 -1
- package/src/skills/registry.ts +482 -0
- package/src/utils/context.ts +8 -2
- package/src/utils/skills.ts +241 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in skills registry — hardcoded skill packs shipped with codemaxxing.
|
|
3
|
+
* No network needed — everything is local.
|
|
4
|
+
*/
|
|
5
|
+
export const REGISTRY = [
|
|
6
|
+
{
|
|
7
|
+
name: "react-expert",
|
|
8
|
+
description: "React/Next.js best practices, hooks, component patterns, performance",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
author: "codemaxxing",
|
|
11
|
+
tags: ["react", "nextjs", "frontend", "hooks", "components"],
|
|
12
|
+
prompt: `# React & Next.js Expert
|
|
13
|
+
|
|
14
|
+
## Component Design
|
|
15
|
+
- Prefer function components with hooks over class components
|
|
16
|
+
- Keep components small and focused — one responsibility per component
|
|
17
|
+
- Extract custom hooks when logic is reused across 2+ components
|
|
18
|
+
- Use composition over prop drilling — leverage children, render props, or context
|
|
19
|
+
- Co-locate related files: Component.tsx, Component.test.tsx, Component.module.css
|
|
20
|
+
|
|
21
|
+
## Hooks Best Practices
|
|
22
|
+
- Follow the Rules of Hooks — only call at the top level, only in React functions
|
|
23
|
+
- useMemo for expensive computations, useCallback for stable function references passed as props
|
|
24
|
+
- Don't over-memoize — profile first, optimize second
|
|
25
|
+
- useRef for values that don't trigger re-renders (timers, previous values, DOM refs)
|
|
26
|
+
- Custom hooks should start with "use" and encapsulate a single concern
|
|
27
|
+
|
|
28
|
+
## State Management
|
|
29
|
+
- Start with local state (useState) — lift only when needed
|
|
30
|
+
- useReducer for complex state logic with multiple sub-values
|
|
31
|
+
- Context for truly global state (theme, auth, locale) — not for frequently updating data
|
|
32
|
+
- Consider Zustand or Jotai for medium-complexity state before reaching for Redux
|
|
33
|
+
- Avoid storing derived state — compute it during render
|
|
34
|
+
|
|
35
|
+
## Performance
|
|
36
|
+
- React.memo only for components that re-render with same props frequently
|
|
37
|
+
- Virtualize long lists (react-window, @tanstack/virtual)
|
|
38
|
+
- Lazy load routes and heavy components with React.lazy + Suspense
|
|
39
|
+
- Use the React DevTools Profiler to identify actual bottlenecks
|
|
40
|
+
- Avoid creating new objects/arrays in render — define outside or memoize
|
|
41
|
+
|
|
42
|
+
## Next.js Patterns
|
|
43
|
+
- Use Server Components by default — add "use client" only when needed
|
|
44
|
+
- Prefer server actions for mutations over API routes
|
|
45
|
+
- Use next/image for automatic image optimization
|
|
46
|
+
- Implement loading.tsx and error.tsx for each route segment
|
|
47
|
+
- Use generateStaticParams for static generation of dynamic routes
|
|
48
|
+
|
|
49
|
+
## Anti-Patterns to Avoid
|
|
50
|
+
- Don't use useEffect for data that can be computed during render
|
|
51
|
+
- Don't sync state with useEffect when derived state works
|
|
52
|
+
- Don't use index as key for lists that reorder or filter
|
|
53
|
+
- Don't put everything in a single global store
|
|
54
|
+
- Don't fetch data in useEffect without cleanup/cancellation
|
|
55
|
+
- Avoid prop drilling more than 2 levels deep
|
|
56
|
+
`,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "python-pro",
|
|
60
|
+
description: "Pythonic code, type hints, async, testing, virtual envs",
|
|
61
|
+
version: "1.0.0",
|
|
62
|
+
author: "codemaxxing",
|
|
63
|
+
tags: ["python", "typing", "async", "testing", "backend"],
|
|
64
|
+
prompt: `# Python Professional
|
|
65
|
+
|
|
66
|
+
## Pythonic Code
|
|
67
|
+
- Use list/dict/set comprehensions over manual loops when readable
|
|
68
|
+
- Prefer f-strings over .format() or % formatting
|
|
69
|
+
- Use enumerate() instead of manual index tracking
|
|
70
|
+
- Use zip() to iterate multiple sequences in parallel
|
|
71
|
+
- Leverage unpacking: a, b = tuple_val; first, *rest = items
|
|
72
|
+
- Use pathlib.Path over os.path for file operations
|
|
73
|
+
- Context managers (with statements) for resource management
|
|
74
|
+
- Use dataclasses or Pydantic models over raw dicts for structured data
|
|
75
|
+
|
|
76
|
+
## Type Hints
|
|
77
|
+
- Add type hints to all function signatures (parameters and return types)
|
|
78
|
+
- Use | union syntax (Python 3.10+) over Union: \`def f(x: int | None)\`
|
|
79
|
+
- Use TypeVar and Generic for type-safe generic functions/classes
|
|
80
|
+
- Use Protocol for structural subtyping (duck typing with type safety)
|
|
81
|
+
- Annotate collections: list[str], dict[str, int], not just list, dict
|
|
82
|
+
- Use TypeAlias for complex types: \`UserMap: TypeAlias = dict[str, list[User]]\`
|
|
83
|
+
- Use @overload for functions with different return types based on input
|
|
84
|
+
|
|
85
|
+
## Async Python
|
|
86
|
+
- Use asyncio for I/O-bound concurrency, not CPU-bound work
|
|
87
|
+
- Use \`async with\` for async context managers (aiohttp sessions, db connections)
|
|
88
|
+
- Use asyncio.gather() for concurrent async tasks
|
|
89
|
+
- Never mix sync and async I/O — use run_in_executor for legacy sync code
|
|
90
|
+
- Use asyncio.TaskGroup (3.11+) for structured concurrency
|
|
91
|
+
- Always handle cancellation in long-running async tasks
|
|
92
|
+
|
|
93
|
+
## Testing
|
|
94
|
+
- Use pytest over unittest — it's simpler and more powerful
|
|
95
|
+
- Name tests descriptively: test_create_user_with_duplicate_email_raises_error
|
|
96
|
+
- Use fixtures for setup/teardown, conftest.py for shared fixtures
|
|
97
|
+
- Use parametrize for testing multiple inputs/outputs
|
|
98
|
+
- Mock external dependencies (APIs, databases) at the boundary
|
|
99
|
+
- Use freezegun or time-machine for time-dependent tests
|
|
100
|
+
- Aim for testing behavior, not implementation details
|
|
101
|
+
|
|
102
|
+
## Project Structure
|
|
103
|
+
- Use pyproject.toml for project metadata and tool configuration
|
|
104
|
+
- Virtual environments: always use one (venv, uv, or poetry)
|
|
105
|
+
- Use ruff for linting and formatting (replaces flake8, black, isort)
|
|
106
|
+
- Structure: src/package_name/ layout for installable packages
|
|
107
|
+
- Pin dependencies with lock files (uv.lock, poetry.lock)
|
|
108
|
+
`,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "typescript-strict",
|
|
112
|
+
description: "Strict TS patterns, generics, utility types, type guards",
|
|
113
|
+
version: "1.0.0",
|
|
114
|
+
author: "codemaxxing",
|
|
115
|
+
tags: ["typescript", "types", "generics", "strict", "javascript"],
|
|
116
|
+
prompt: `# TypeScript Strict Mode Expert
|
|
117
|
+
|
|
118
|
+
## Strict Configuration
|
|
119
|
+
- Enable all strict flags: strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes
|
|
120
|
+
- Never use \`any\` — use \`unknown\` and narrow with type guards
|
|
121
|
+
- Prefer \`as const\` assertions over widening literals
|
|
122
|
+
- Enable \`verbatimModuleSyntax\` for explicit type-only imports
|
|
123
|
+
|
|
124
|
+
## Type Design
|
|
125
|
+
- Use discriminated unions over optional properties for state variants
|
|
126
|
+
- Prefer interfaces for object shapes, type aliases for unions/intersections
|
|
127
|
+
- Use branded/opaque types for semantic distinction: \`type UserId = string & { __brand: "UserId" }\`
|
|
128
|
+
- Make impossible states unrepresentable with union types
|
|
129
|
+
- Use \`satisfies\` operator to validate types without widening
|
|
130
|
+
- Template literal types for string patterns: \`type Route = \`/\${string}\`\`
|
|
131
|
+
|
|
132
|
+
## Generics
|
|
133
|
+
- Name generic parameters descriptively: TItem over T when context helps
|
|
134
|
+
- Use constraints: \`<T extends Record<string, unknown>>\`
|
|
135
|
+
- Use conditional types for type-level branching: \`T extends string ? A : B\`
|
|
136
|
+
- Infer types in conditional types: \`T extends Promise<infer U> ? U : T\`
|
|
137
|
+
- Use mapped types for transformations: \`{ [K in keyof T]: Readonly<T[K]> }\`
|
|
138
|
+
- Use the \`NoInfer\` utility to prevent inference in specific positions
|
|
139
|
+
|
|
140
|
+
## Utility Types
|
|
141
|
+
- Partial<T>, Required<T>, Readonly<T> for property modifiers
|
|
142
|
+
- Pick<T, K>, Omit<T, K> for object subsets
|
|
143
|
+
- Record<K, V> for typed dictionaries
|
|
144
|
+
- Extract<T, U>, Exclude<T, U> for union manipulation
|
|
145
|
+
- ReturnType<T>, Parameters<T> for function type extraction
|
|
146
|
+
- NonNullable<T> to strip null/undefined from unions
|
|
147
|
+
|
|
148
|
+
## Type Guards & Narrowing
|
|
149
|
+
- Prefer \`in\` operator narrowing: \`if ("kind" in value)\`
|
|
150
|
+
- Write custom type guards: \`function isUser(v: unknown): v is User\`
|
|
151
|
+
- Use assertion functions: \`function assertDefined<T>(v: T | undefined): asserts v is T\`
|
|
152
|
+
- Exhaustive checks with \`never\`: \`const _exhaustive: never = value\`
|
|
153
|
+
- Use optional chaining (?.) and nullish coalescing (??) over manual checks
|
|
154
|
+
|
|
155
|
+
## Anti-Patterns
|
|
156
|
+
- Never use \`as\` casts to silence errors — fix the types instead
|
|
157
|
+
- Don't use \`!\` non-null assertion — use proper null checks
|
|
158
|
+
- Don't use \`object\` type — use \`Record<string, unknown>\` or a specific interface
|
|
159
|
+
- Don't use enums — use \`as const\` objects or union types
|
|
160
|
+
- Don't use \`Function\` type — use specific function signatures
|
|
161
|
+
- Avoid \`@ts-ignore\` — use \`@ts-expect-error\` with an explanation if truly needed
|
|
162
|
+
`,
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "api-designer",
|
|
166
|
+
description: "REST/GraphQL API design, OpenAPI, auth patterns, error handling",
|
|
167
|
+
version: "1.0.0",
|
|
168
|
+
author: "codemaxxing",
|
|
169
|
+
tags: ["api", "rest", "graphql", "openapi", "backend", "auth"],
|
|
170
|
+
prompt: `# API Design Expert
|
|
171
|
+
|
|
172
|
+
## REST Design Principles
|
|
173
|
+
- Use nouns for resources, HTTP verbs for actions: GET /users, POST /users, DELETE /users/:id
|
|
174
|
+
- Use plural nouns for collections: /users not /user
|
|
175
|
+
- Nest resources for relationships: /users/:id/posts (max 2 levels deep)
|
|
176
|
+
- Use query parameters for filtering, sorting, pagination: ?status=active&sort=-created_at&page=2
|
|
177
|
+
- Return appropriate HTTP status codes: 200 OK, 201 Created, 204 No Content, 400 Bad Request, 404 Not Found
|
|
178
|
+
- Use PATCH for partial updates, PUT for full replacements
|
|
179
|
+
- Version your API: /v1/users or Accept: application/vnd.api+json;version=1
|
|
180
|
+
|
|
181
|
+
## Response Design
|
|
182
|
+
- Consistent response envelope: { data, meta, errors }
|
|
183
|
+
- Pagination: cursor-based for real-time data, offset for simple lists
|
|
184
|
+
- Include total count in paginated responses: { data: [...], meta: { total: 142, page: 2 } }
|
|
185
|
+
- Use ISO 8601 for dates: "2024-01-15T10:30:00Z"
|
|
186
|
+
- Return created/updated resources in POST/PATCH responses
|
|
187
|
+
- HATEOAS links for discoverability when appropriate
|
|
188
|
+
|
|
189
|
+
## Error Handling
|
|
190
|
+
- Structured error responses: { error: { code: "VALIDATION_ERROR", message: "...", details: [...] } }
|
|
191
|
+
- Use machine-readable error codes alongside human-readable messages
|
|
192
|
+
- Include field-level errors for validation: { field: "email", message: "already taken" }
|
|
193
|
+
- Never expose stack traces or internal details in production
|
|
194
|
+
- Rate limit errors should include retry-after headers
|
|
195
|
+
- 422 for validation errors, 409 for conflicts, 429 for rate limiting
|
|
196
|
+
|
|
197
|
+
## Authentication & Security
|
|
198
|
+
- Use OAuth 2.0 / OIDC for user authentication
|
|
199
|
+
- API keys for service-to-service, JWTs for user sessions
|
|
200
|
+
- Short-lived access tokens (15min) + refresh tokens (7 days)
|
|
201
|
+
- Always validate and sanitize input — never trust the client
|
|
202
|
+
- CORS: whitelist specific origins, never use wildcard in production
|
|
203
|
+
- Rate limiting: per-user and per-IP, with appropriate headers
|
|
204
|
+
|
|
205
|
+
## OpenAPI / Documentation
|
|
206
|
+
- Write OpenAPI 3.1 specs for all endpoints
|
|
207
|
+
- Include request/response examples for every endpoint
|
|
208
|
+
- Document error responses, not just success cases
|
|
209
|
+
- Use $ref for reusable schemas (User, Error, Pagination)
|
|
210
|
+
- Generate client SDKs from OpenAPI specs when possible
|
|
211
|
+
|
|
212
|
+
## Anti-Patterns
|
|
213
|
+
- Don't use verbs in URLs: /getUsers → GET /users
|
|
214
|
+
- Don't return 200 for errors — use proper status codes
|
|
215
|
+
- Don't nest resources more than 2 levels deep
|
|
216
|
+
- Don't use POST for everything — use proper HTTP methods
|
|
217
|
+
- Don't expose database IDs if you can use UUIDs or slugs
|
|
218
|
+
- Don't return all fields by default — support field selection
|
|
219
|
+
`,
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "test-engineer",
|
|
223
|
+
description: "Unit/integration/e2e testing, TDD, mocking, coverage strategies",
|
|
224
|
+
version: "1.0.0",
|
|
225
|
+
author: "codemaxxing",
|
|
226
|
+
tags: ["testing", "tdd", "jest", "vitest", "e2e", "mocking"],
|
|
227
|
+
prompt: `# Test Engineering Expert
|
|
228
|
+
|
|
229
|
+
## Testing Philosophy
|
|
230
|
+
- Test behavior, not implementation — tests should survive refactors
|
|
231
|
+
- Follow the testing pyramid: many unit tests, fewer integration, fewest e2e
|
|
232
|
+
- Write the test first (TDD) when the interface is clear
|
|
233
|
+
- Each test should test one thing and have a descriptive name
|
|
234
|
+
- Tests are documentation — they should be readable without comments
|
|
235
|
+
|
|
236
|
+
## Unit Testing
|
|
237
|
+
- Test pure functions exhaustively — they're the easiest to test
|
|
238
|
+
- Use the Arrange-Act-Assert (AAA) pattern
|
|
239
|
+
- Test edge cases: empty inputs, null/undefined, boundary values, error paths
|
|
240
|
+
- Keep tests independent — no shared mutable state between tests
|
|
241
|
+
- Use test.each / parametrize for data-driven tests
|
|
242
|
+
- Prefer real implementations over mocks when feasible
|
|
243
|
+
|
|
244
|
+
## Mocking Strategy
|
|
245
|
+
- Mock at the boundary: external APIs, databases, file system, time
|
|
246
|
+
- Don't mock what you don't own — wrap third-party code and mock your wrapper
|
|
247
|
+
- Use dependency injection to make code testable
|
|
248
|
+
- Prefer stubs (return canned values) over spies (track calls) when possible
|
|
249
|
+
- Reset mocks between tests to prevent leakage
|
|
250
|
+
- Use MSW (Mock Service Worker) for API mocking in frontend tests
|
|
251
|
+
|
|
252
|
+
## Integration Testing
|
|
253
|
+
- Test the contract between components/services
|
|
254
|
+
- Use real databases with test containers (testcontainers)
|
|
255
|
+
- Test API endpoints with supertest or similar HTTP testing libraries
|
|
256
|
+
- Verify database state changes, not just response codes
|
|
257
|
+
- Test error scenarios: network failures, timeouts, invalid data
|
|
258
|
+
|
|
259
|
+
## E2E Testing
|
|
260
|
+
- Use Playwright or Cypress for browser-based e2e tests
|
|
261
|
+
- Test critical user journeys, not every feature
|
|
262
|
+
- Use data-testid attributes for stable selectors
|
|
263
|
+
- Implement retry logic for flaky network-dependent tests
|
|
264
|
+
- Run e2e tests in CI against a staging environment
|
|
265
|
+
- Keep e2e tests fast — parallelize and minimize setup
|
|
266
|
+
|
|
267
|
+
## Coverage & Quality
|
|
268
|
+
- Aim for 80%+ line coverage, but don't chase 100%
|
|
269
|
+
- Focus coverage on business logic, not boilerplate
|
|
270
|
+
- Use mutation testing (Stryker) to verify test effectiveness
|
|
271
|
+
- Track coverage trends — decreasing coverage should block PRs
|
|
272
|
+
- Snapshot tests: use sparingly, review carefully, update intentionally
|
|
273
|
+
|
|
274
|
+
## Anti-Patterns
|
|
275
|
+
- Don't test private methods directly — test through public interface
|
|
276
|
+
- Don't write tests that duplicate the implementation logic
|
|
277
|
+
- Don't use sleep/delays — use waitFor or polling utilities
|
|
278
|
+
- Don't share state between tests or depend on test execution order
|
|
279
|
+
- Don't mock everything — over-mocking makes tests meaningless
|
|
280
|
+
- Don't write flaky tests — fix or delete them
|
|
281
|
+
`,
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: "doc-writer",
|
|
285
|
+
description: "README, API docs, JSDoc/TSDoc, changelogs, clear writing",
|
|
286
|
+
version: "1.0.0",
|
|
287
|
+
author: "codemaxxing",
|
|
288
|
+
tags: ["documentation", "readme", "jsdoc", "tsdoc", "changelog", "writing"],
|
|
289
|
+
prompt: `# Documentation Expert
|
|
290
|
+
|
|
291
|
+
## README Structure
|
|
292
|
+
- Start with a one-line description of what the project does
|
|
293
|
+
- Include a quick-start section: install → configure → run (under 5 steps)
|
|
294
|
+
- Add badges: CI status, npm version, license, coverage
|
|
295
|
+
- Show a screenshot or GIF for visual projects
|
|
296
|
+
- List key features as bullet points (5-8 max)
|
|
297
|
+
- Include a "Contributing" section with setup instructions
|
|
298
|
+
- License section at the bottom
|
|
299
|
+
|
|
300
|
+
## Code Documentation (JSDoc/TSDoc)
|
|
301
|
+
- Document public APIs — skip obvious implementations
|
|
302
|
+
- Include @param, @returns, @throws, and @example tags
|
|
303
|
+
- Write descriptions that explain WHY, not WHAT (the code shows what)
|
|
304
|
+
- Use @deprecated with migration instructions
|
|
305
|
+
- Document non-obvious behavior, edge cases, and gotchas
|
|
306
|
+
- Keep descriptions concise — one sentence if possible
|
|
307
|
+
- Use @link to reference related functions or types
|
|
308
|
+
|
|
309
|
+
## API Documentation
|
|
310
|
+
- Document every endpoint with: method, path, description, parameters, response
|
|
311
|
+
- Include request/response examples with realistic data
|
|
312
|
+
- Document error responses and status codes
|
|
313
|
+
- Group endpoints by resource/domain
|
|
314
|
+
- Use tools: Swagger/OpenAPI, Redoc, or Stoplight
|
|
315
|
+
- Keep docs in sync with code — generate from source when possible
|
|
316
|
+
|
|
317
|
+
## Changelog
|
|
318
|
+
- Follow Keep a Changelog format (keepachangelog.com)
|
|
319
|
+
- Categories: Added, Changed, Deprecated, Removed, Fixed, Security
|
|
320
|
+
- Write entries from the user's perspective, not the developer's
|
|
321
|
+
- Link to relevant PRs and issues
|
|
322
|
+
- Include migration guides for breaking changes
|
|
323
|
+
- Use semantic versioning (semver.org)
|
|
324
|
+
|
|
325
|
+
## Writing Style
|
|
326
|
+
- Use active voice: "Configure the database" not "The database should be configured"
|
|
327
|
+
- Be direct and concise — cut filler words
|
|
328
|
+
- Use second person: "you" not "the user"
|
|
329
|
+
- Define acronyms on first use
|
|
330
|
+
- Use consistent terminology throughout
|
|
331
|
+
- Prefer bullet points over long paragraphs
|
|
332
|
+
- Include code examples for anything non-trivial
|
|
333
|
+
|
|
334
|
+
## Anti-Patterns
|
|
335
|
+
- Don't write docs that restate the function name: "getName gets the name"
|
|
336
|
+
- Don't leave TODO or placeholder docs in production code
|
|
337
|
+
- Don't document every line — trust readers to understand basic code
|
|
338
|
+
- Don't use jargon without explanation
|
|
339
|
+
- Don't write docs once and forget — keep them updated
|
|
340
|
+
- Don't put configuration details in comments — use docs or config files
|
|
341
|
+
`,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: "security-audit",
|
|
345
|
+
description: "OWASP, dependency scanning, secrets, auth vulnerabilities",
|
|
346
|
+
version: "1.0.0",
|
|
347
|
+
author: "codemaxxing",
|
|
348
|
+
tags: ["security", "owasp", "auth", "vulnerabilities", "audit"],
|
|
349
|
+
prompt: `# Security Audit Expert
|
|
350
|
+
|
|
351
|
+
## Input Validation
|
|
352
|
+
- Validate ALL user input on the server side — client validation is for UX only
|
|
353
|
+
- Use allowlists over denylists for input validation
|
|
354
|
+
- Sanitize HTML to prevent XSS — use DOMPurify or equivalent
|
|
355
|
+
- Parameterize all database queries — never concatenate user input into SQL
|
|
356
|
+
- Validate file uploads: check MIME type, size limits, and file content (not just extension)
|
|
357
|
+
- Rate limit all public endpoints, especially authentication
|
|
358
|
+
- Validate Content-Type headers to prevent CSRF via form submission
|
|
359
|
+
|
|
360
|
+
## Authentication & Authorization
|
|
361
|
+
- Hash passwords with bcrypt, scrypt, or Argon2 — never MD5/SHA
|
|
362
|
+
- Implement account lockout after N failed attempts
|
|
363
|
+
- Use CSRF tokens for state-changing requests in web apps
|
|
364
|
+
- Validate JWTs properly: check signature, expiration, issuer, audience
|
|
365
|
+
- Never store sensitive data in JWTs — they're base64 encoded, not encrypted
|
|
366
|
+
- Implement proper session invalidation on logout
|
|
367
|
+
- Use httpOnly, secure, sameSite flags on session cookies
|
|
368
|
+
- Apply principle of least privilege — check permissions on every request
|
|
369
|
+
|
|
370
|
+
## Secrets Management
|
|
371
|
+
- Never commit secrets to version control — use .env files and .gitignore
|
|
372
|
+
- Use environment variables or secret managers (Vault, AWS SSM, Doppler)
|
|
373
|
+
- Rotate secrets regularly and after any suspected compromise
|
|
374
|
+
- Scan repos for leaked secrets: gitleaks, truffleHog, git-secrets
|
|
375
|
+
- Use different credentials per environment (dev, staging, prod)
|
|
376
|
+
- Never log sensitive data (passwords, tokens, PII)
|
|
377
|
+
|
|
378
|
+
## Dependency Security
|
|
379
|
+
- Run npm audit / pip-audit / cargo audit regularly
|
|
380
|
+
- Pin dependency versions — use lockfiles
|
|
381
|
+
- Enable Dependabot or Renovate for automated updates
|
|
382
|
+
- Audit transitive dependencies, not just direct ones
|
|
383
|
+
- Remove unused dependencies to reduce attack surface
|
|
384
|
+
- Review dependency changelogs before major version updates
|
|
385
|
+
|
|
386
|
+
## OWASP Top 10 Checklist
|
|
387
|
+
- A01 Broken Access Control: verify authorization on every endpoint
|
|
388
|
+
- A02 Cryptographic Failures: use TLS everywhere, strong algorithms
|
|
389
|
+
- A03 Injection: parameterize queries, validate input, escape output
|
|
390
|
+
- A04 Insecure Design: threat model before building
|
|
391
|
+
- A05 Security Misconfiguration: disable debug mode, remove defaults
|
|
392
|
+
- A06 Vulnerable Components: keep dependencies updated
|
|
393
|
+
- A07 Auth Failures: strong passwords, MFA, proper session management
|
|
394
|
+
- A08 Data Integrity: verify software updates, use SRI for CDN scripts
|
|
395
|
+
- A09 Logging Failures: log security events, monitor for anomalies
|
|
396
|
+
- A10 SSRF: validate URLs, restrict outbound requests, use allowlists
|
|
397
|
+
|
|
398
|
+
## Anti-Patterns
|
|
399
|
+
- Don't roll your own crypto — use battle-tested libraries
|
|
400
|
+
- Don't trust client-side validation as your only defense
|
|
401
|
+
- Don't expose detailed error messages to end users
|
|
402
|
+
- Don't use GET requests for state-changing operations
|
|
403
|
+
- Don't store passwords in plaintext or reversible encryption
|
|
404
|
+
- Don't disable security features "for development" and forget to re-enable
|
|
405
|
+
`,
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "devops-toolkit",
|
|
409
|
+
description: "Docker, CI/CD, Terraform, K8s, monitoring, deployment",
|
|
410
|
+
version: "1.0.0",
|
|
411
|
+
author: "codemaxxing",
|
|
412
|
+
tags: ["docker", "cicd", "terraform", "kubernetes", "monitoring", "devops"],
|
|
413
|
+
prompt: `# DevOps Toolkit Expert
|
|
414
|
+
|
|
415
|
+
## Docker
|
|
416
|
+
- Use multi-stage builds to minimize image size
|
|
417
|
+
- Pin base image versions: node:20-slim not node:latest
|
|
418
|
+
- Order Dockerfile layers by change frequency (least → most frequent)
|
|
419
|
+
- COPY package*.json first, then npm install, then COPY source (layer caching)
|
|
420
|
+
- Use .dockerignore to exclude node_modules, .git, tests, docs
|
|
421
|
+
- Run as non-root user: USER node
|
|
422
|
+
- Use HEALTHCHECK for production containers
|
|
423
|
+
- One process per container — use docker compose for multi-service apps
|
|
424
|
+
|
|
425
|
+
## CI/CD Pipelines
|
|
426
|
+
- Fast feedback: lint → type check → unit tests → build → integration tests → deploy
|
|
427
|
+
- Parallelize independent jobs (lint + typecheck + test can run simultaneously)
|
|
428
|
+
- Cache dependencies between runs (npm cache, Docker layer cache)
|
|
429
|
+
- Use matrix builds for cross-platform/version testing
|
|
430
|
+
- Gate deployments on test passage — never deploy broken code
|
|
431
|
+
- Keep CI config DRY — use reusable workflows/templates
|
|
432
|
+
- Pin action/plugin versions for reproducibility
|
|
433
|
+
- Run security scans in CI: SAST, dependency audit, container scanning
|
|
434
|
+
|
|
435
|
+
## Infrastructure as Code (Terraform)
|
|
436
|
+
- Use modules for reusable infrastructure components
|
|
437
|
+
- Remote state with locking (S3 + DynamoDB, Terraform Cloud)
|
|
438
|
+
- Separate state files per environment (dev, staging, prod)
|
|
439
|
+
- Use terraform plan before apply — review changes carefully
|
|
440
|
+
- Tag all resources for cost tracking and ownership
|
|
441
|
+
- Use data sources to reference existing infrastructure
|
|
442
|
+
- Validate with terraform validate and tflint before applying
|
|
443
|
+
|
|
444
|
+
## Kubernetes
|
|
445
|
+
- Use Deployments for stateless apps, StatefulSets for stateful
|
|
446
|
+
- Set resource requests AND limits for all containers
|
|
447
|
+
- Use ConfigMaps for config, Secrets for sensitive data
|
|
448
|
+
- Implement readiness and liveness probes
|
|
449
|
+
- Use namespaces to isolate environments/teams
|
|
450
|
+
- HPA (Horizontal Pod Autoscaler) for auto-scaling
|
|
451
|
+
- Use Network Policies to restrict pod-to-pod communication
|
|
452
|
+
- Rolling update strategy with proper maxUnavailable/maxSurge
|
|
453
|
+
|
|
454
|
+
## Monitoring & Observability
|
|
455
|
+
- Three pillars: metrics (Prometheus), logs (Loki/ELK), traces (Jaeger/Tempo)
|
|
456
|
+
- Alert on symptoms (error rate, latency), not causes (CPU, memory)
|
|
457
|
+
- Use structured logging (JSON) with consistent fields
|
|
458
|
+
- Implement health check endpoints: /health, /ready
|
|
459
|
+
- Dashboard essentials: request rate, error rate, latency (p50/p95/p99), saturation
|
|
460
|
+
- Set up PagerDuty/Opsgenie for critical alerts, Slack for warnings
|
|
461
|
+
- Use SLOs/SLIs to measure reliability objectively
|
|
462
|
+
|
|
463
|
+
## Anti-Patterns
|
|
464
|
+
- Don't use :latest tags in production — pin versions
|
|
465
|
+
- Don't store state in containers — they're ephemeral
|
|
466
|
+
- Don't skip staging — always test in a production-like environment
|
|
467
|
+
- Don't hardcode config — use environment variables or config maps
|
|
468
|
+
- Don't ignore failed CI — fix or revert immediately
|
|
469
|
+
- Don't alert on everything — alert fatigue leads to ignored alerts
|
|
470
|
+
`,
|
|
471
|
+
},
|
|
472
|
+
];
|
package/dist/utils/context.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function buildProjectContext(cwd: string): Promise<string>;
|
|
|
5
5
|
/**
|
|
6
6
|
* Get the system prompt for the coding agent
|
|
7
7
|
*/
|
|
8
|
-
export declare function getSystemPrompt(projectContext: string): Promise<string>;
|
|
8
|
+
export declare function getSystemPrompt(projectContext: string, skillPrompts?: string): Promise<string>;
|
|
9
9
|
/**
|
|
10
10
|
* Synchronous version for backwards compatibility (without repo map)
|
|
11
11
|
* @deprecated Use async buildProjectContext instead
|
package/dist/utils/context.js
CHANGED
|
@@ -86,8 +86,8 @@ export async function buildProjectContext(cwd) {
|
|
|
86
86
|
/**
|
|
87
87
|
* Get the system prompt for the coding agent
|
|
88
88
|
*/
|
|
89
|
-
export async function getSystemPrompt(projectContext) {
|
|
90
|
-
|
|
89
|
+
export async function getSystemPrompt(projectContext, skillPrompts = "") {
|
|
90
|
+
const base = `You are CODEMAXXING, an AI coding assistant running in the terminal.
|
|
91
91
|
|
|
92
92
|
You help developers understand, write, debug, and refactor code. You have access to tools that let you read files, write files, list directories, search code, and run shell commands.
|
|
93
93
|
|
|
@@ -111,6 +111,10 @@ ${projectContext}
|
|
|
111
111
|
- Use code blocks with language tags
|
|
112
112
|
- Be direct and helpful
|
|
113
113
|
- If the user asks to "just do it", skip explanations and execute`;
|
|
114
|
+
if (skillPrompts) {
|
|
115
|
+
return base + "\n\n## Active Skills\n" + skillPrompts;
|
|
116
|
+
}
|
|
117
|
+
return base;
|
|
114
118
|
}
|
|
115
119
|
/**
|
|
116
120
|
* Synchronous version for backwards compatibility (without repo map)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type RegistrySkill } from "../skills/registry.js";
|
|
2
|
+
export interface SkillMeta {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
version: string;
|
|
6
|
+
author: string;
|
|
7
|
+
tags: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* List all installed skills by scanning ~/.codemaxxing/skills/
|
|
11
|
+
*/
|
|
12
|
+
export declare function listInstalledSkills(): SkillMeta[];
|
|
13
|
+
/**
|
|
14
|
+
* Install a skill from the built-in registry
|
|
15
|
+
*/
|
|
16
|
+
export declare function installSkill(name: string): {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
message: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Remove an installed skill
|
|
22
|
+
*/
|
|
23
|
+
export declare function removeSkill(name: string): {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Get the prompt.md content for an installed skill
|
|
29
|
+
*/
|
|
30
|
+
export declare function getSkillPrompt(name: string): string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Get skills that should be active for the given project directory.
|
|
33
|
+
* If .codemaxxing/skills.json exists in the project, only those skills are active.
|
|
34
|
+
* Otherwise, all installed skills are active.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getActiveSkills(cwd: string, sessionDisabled?: Set<string>): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Build the skill prompt blocks to inject into the system prompt
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildSkillPrompts(cwd: string, sessionDisabled?: Set<string>): string;
|
|
41
|
+
/**
|
|
42
|
+
* Create a scaffold for a new custom skill
|
|
43
|
+
*/
|
|
44
|
+
export declare function createSkillScaffold(name: string): {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
message: string;
|
|
47
|
+
path?: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Search the built-in registry by name, tags, or description
|
|
51
|
+
*/
|
|
52
|
+
export declare function searchRegistry(query: string): RegistrySkill[];
|
|
53
|
+
/**
|
|
54
|
+
* Return all skills from the built-in registry
|
|
55
|
+
*/
|
|
56
|
+
export declare function getRegistrySkills(): RegistrySkill[];
|
|
57
|
+
/**
|
|
58
|
+
* Get the count of active skills
|
|
59
|
+
*/
|
|
60
|
+
export declare function getActiveSkillCount(cwd: string, sessionDisabled?: Set<string>): number;
|