claude-code-templates 1.2.0 → 1.3.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 (43) hide show
  1. package/package.json +10 -8
  2. package/src/command-scanner.js +1 -1
  3. package/src/file-operations.js +44 -3
  4. package/src/hook-scanner.js +229 -52
  5. package/src/index.js +23 -3
  6. package/src/prompts.js +68 -2
  7. package/src/templates.js +31 -8
  8. package/scripts/sync-templates.js +0 -182
  9. package/templates/common/.claude/commands/git-workflow.md +0 -239
  10. package/templates/common/.claude/commands/project-setup.md +0 -316
  11. package/templates/common/CLAUDE.md +0 -109
  12. package/templates/common/README.md +0 -96
  13. package/templates/go/README.md +0 -25
  14. package/templates/javascript-typescript/.claude/commands/api-endpoint.md +0 -51
  15. package/templates/javascript-typescript/.claude/commands/debug.md +0 -52
  16. package/templates/javascript-typescript/.claude/commands/lint.md +0 -48
  17. package/templates/javascript-typescript/.claude/commands/npm-scripts.md +0 -48
  18. package/templates/javascript-typescript/.claude/commands/refactor.md +0 -55
  19. package/templates/javascript-typescript/.claude/commands/test.md +0 -61
  20. package/templates/javascript-typescript/.claude/commands/typescript-migrate.md +0 -51
  21. package/templates/javascript-typescript/.claude/settings.json +0 -142
  22. package/templates/javascript-typescript/.mcp.json +0 -13
  23. package/templates/javascript-typescript/CLAUDE.md +0 -185
  24. package/templates/javascript-typescript/README.md +0 -259
  25. package/templates/javascript-typescript/examples/angular-app/.claude/commands/components.md +0 -63
  26. package/templates/javascript-typescript/examples/angular-app/.claude/commands/services.md +0 -62
  27. package/templates/javascript-typescript/examples/node-api/.claude/commands/api-endpoint.md +0 -46
  28. package/templates/javascript-typescript/examples/node-api/.claude/commands/database.md +0 -56
  29. package/templates/javascript-typescript/examples/node-api/.claude/commands/middleware.md +0 -61
  30. package/templates/javascript-typescript/examples/node-api/.claude/commands/route.md +0 -57
  31. package/templates/javascript-typescript/examples/node-api/CLAUDE.md +0 -102
  32. package/templates/javascript-typescript/examples/react-app/.claude/commands/component.md +0 -29
  33. package/templates/javascript-typescript/examples/react-app/.claude/commands/hooks.md +0 -44
  34. package/templates/javascript-typescript/examples/react-app/.claude/commands/state-management.md +0 -45
  35. package/templates/javascript-typescript/examples/react-app/CLAUDE.md +0 -81
  36. package/templates/javascript-typescript/examples/vue-app/.claude/commands/components.md +0 -46
  37. package/templates/javascript-typescript/examples/vue-app/.claude/commands/composables.md +0 -51
  38. package/templates/python/.claude/commands/django-model.md +0 -124
  39. package/templates/python/.claude/commands/flask-route.md +0 -217
  40. package/templates/python/.claude/commands/lint.md +0 -111
  41. package/templates/python/.claude/commands/test.md +0 -73
  42. package/templates/python/CLAUDE.md +0 -276
  43. package/templates/rust/README.md +0 -26
@@ -1,102 +0,0 @@
1
- # CLAUDE.md - Node.js API
2
-
3
- This file provides guidance to Claude Code when working with Node.js API applications using TypeScript.
4
-
5
- ## Project Type
6
-
7
- This is a Node.js API application with TypeScript and Express.js support.
8
-
9
- ## Development Commands
10
-
11
- ### API Development
12
- - **`/route`** - Create API routes and endpoints
13
- - **`/middleware`** - Create and manage Express middleware
14
- - **`/api-endpoint`** - Generate complete API endpoints
15
- - **`/database`** - Set up database operations and models
16
-
17
- ### Testing and Quality
18
- - **`/test`** - Run tests and create test files
19
- - **`/lint`** - Run linting and fix code style issues
20
- - **`/typescript-migrate`** - Migrate JavaScript files to TypeScript
21
-
22
- ### Development Workflow
23
- - **`/npm-scripts`** - Run npm scripts and package management
24
- - **`/debug`** - Debug Node.js applications
25
- - **`/refactor`** - Refactor and optimize code
26
-
27
- ## Framework-Specific Guidelines
28
-
29
- ### Express.js Best Practices
30
- - Use middleware for cross-cutting concerns
31
- - Implement proper error handling
32
- - Follow RESTful API design principles
33
- - Use proper HTTP status codes
34
-
35
- ### Database Integration
36
- - Use TypeORM, Prisma, or Mongoose for database operations
37
- - Implement proper connection pooling
38
- - Use migrations for database schema changes
39
- - Follow repository pattern for data access
40
-
41
- ### Security Considerations
42
- - Implement authentication and authorization
43
- - Use HTTPS in production
44
- - Validate and sanitize input data
45
- - Implement rate limiting and CORS
46
-
47
- ### Error Handling
48
- - Use centralized error handling middleware
49
- - Implement proper logging
50
- - Return consistent error responses
51
- - Handle async errors properly
52
-
53
- ## TypeScript Configuration
54
-
55
- The project uses strict TypeScript configuration:
56
- - Strict type checking enabled
57
- - Proper interface definitions for requests/responses
58
- - Generic type support for database models
59
- - Integration with Express types
60
-
61
- ## API Design Patterns
62
-
63
- ### RESTful Routes
64
- ```
65
- GET /api/users - Get all users
66
- GET /api/users/:id - Get user by ID
67
- POST /api/users - Create new user
68
- PUT /api/users/:id - Update user
69
- DELETE /api/users/:id - Delete user
70
- ```
71
-
72
- ### Request/Response Structure
73
- - Use consistent JSON response format
74
- - Implement proper status codes
75
- - Include metadata in responses
76
- - Handle pagination properly
77
-
78
- ## Testing Strategy
79
-
80
- - Unit tests with Jest
81
- - Integration tests for API endpoints
82
- - Database testing with test databases
83
- - Load testing for performance validation
84
-
85
- ## File Naming Conventions
86
-
87
- - Routes: `routeName.routes.ts` (e.g., `user.routes.ts`)
88
- - Controllers: `ControllerName.controller.ts`
89
- - Models: `ModelName.model.ts`
90
- - Middleware: `middlewareName.middleware.ts`
91
- - Services: `ServiceName.service.ts`
92
- - Tests: `fileName.test.ts`
93
-
94
- ## Recommended Libraries
95
-
96
- - **Framework**: Express.js, Fastify, Koa.js
97
- - **Database**: Prisma, TypeORM, Mongoose
98
- - **Authentication**: Passport.js, JWT, Auth0
99
- - **Validation**: Joi, Yup, Zod
100
- - **Testing**: Jest, Supertest, Artillery
101
- - **Documentation**: Swagger/OpenAPI, Postman
102
- - **Monitoring**: Winston, Morgan, Prometheus
@@ -1,29 +0,0 @@
1
- # React Component Generator
2
-
3
- Create a React component named $ARGUMENTS following project conventions.
4
-
5
- ## Steps
6
-
7
- 1. **Analyze project structure**: Check existing components to understand file organization, naming conventions, and patterns
8
- 2. **Examine styling approach**: Identify CSS/SCSS modules, styled-components, Tailwind, or other styling methods used
9
- 3. **Review testing patterns**: Check existing test files to understand testing framework and conventions
10
- 4. **Create component structure**: Generate appropriate files (component, styles, tests, index)
11
- 5. **Implement component**: Write TypeScript/JavaScript with proper props interface and logic
12
- 6. **Add tests**: Write comprehensive tests following project patterns
13
- 7. **Verify integration**: Ensure component works with existing project setup
14
-
15
- ## Requirements
16
-
17
- - Follow existing project file structure and naming conventions
18
- - Use TypeScript if project uses it
19
- - Include proper accessibility attributes
20
- - Add responsive design considerations
21
- - Write tests that match project testing patterns
22
- - Include usage examples in component documentation
23
-
24
- ## Important Notes
25
-
26
- - ALWAYS examine existing components first to understand project patterns
27
- - Use the same styling approach as the rest of the project
28
- - Follow the project's TypeScript conventions for props and interfaces
29
- - Don't install new dependencies without asking first
@@ -1,44 +0,0 @@
1
- # React Hooks
2
-
3
- Create or optimize React hooks for $ARGUMENTS following project conventions.
4
-
5
- ## Task
6
-
7
- Analyze the request and create appropriate React hooks:
8
-
9
- 1. **Examine existing hooks**: Check project for existing custom hooks patterns and conventions
10
- 2. **Identify hook type**: Determine if creating new custom hook, optimizing existing hook, or implementing specific hook pattern
11
- 3. **Check TypeScript usage**: Verify if project uses TypeScript and follow typing conventions
12
- 4. **Implement hook**: Create hook with proper:
13
- - Naming convention (use prefix)
14
- - TypeScript types and interfaces
15
- - Proper dependency arrays
16
- - Error handling
17
- - Performance optimizations
18
- 5. **Add tests**: Create comprehensive unit tests using project's testing framework
19
- 6. **Add documentation**: Include JSDoc comments and usage examples
20
-
21
- ## Common Hook Patterns
22
-
23
- When creating hooks, consider these patterns based on the request:
24
- - **Data fetching**: API calls, loading states, error handling
25
- - **State management**: Local state, derived state, state persistence
26
- - **Side effects**: Event listeners, timers, subscriptions
27
- - **Context consumption**: Theme, auth, app state
28
- - **Form handling**: Input management, validation, submission
29
- - **Performance**: Memoization, debouncing, throttling
30
-
31
- ## Requirements
32
-
33
- - Follow existing project hook conventions
34
- - Use TypeScript if project uses it
35
- - Include proper cleanup in useEffect
36
- - Add error boundaries where appropriate
37
- - Write tests that cover all hook functionality
38
- - IMPORTANT: Always check existing hooks first to understand project patterns
39
-
40
- ## Notes
41
-
42
- - Ask for clarification if the hook requirements are ambiguous
43
- - Suggest optimizations for existing hooks if relevant
44
- - Consider accessibility implications for UI-related hooks
@@ -1,45 +0,0 @@
1
- # React State Management
2
-
3
- Implement state management solution for $ARGUMENTS following project conventions.
4
-
5
- ## Task
6
-
7
- Set up or optimize state management based on the requirements:
8
-
9
- 1. **Analyze current setup**: Check existing state management approach and project structure
10
- 2. **Determine solution**: Based on requirements, choose appropriate state management:
11
- - Context API for simple, localized state
12
- - Redux Toolkit for complex, global state
13
- - Zustand for lightweight global state
14
- - Custom hooks for component-level state
15
- 3. **Examine dependencies**: Check package.json for existing state management libraries
16
- 4. **Implement solution**: Create store, providers, and hooks with proper TypeScript types
17
- 5. **Set up middleware**: Add devtools, persistence, or other middleware as needed
18
- 6. **Create typed hooks**: Generate properly typed selectors and dispatch hooks
19
- 7. **Add tests**: Write unit tests for state logic and reducers
20
- 8. **Update providers**: Integrate with app's provider hierarchy
21
-
22
- ## Implementation Requirements
23
-
24
- - Follow project's TypeScript conventions
25
- - Use existing state management patterns if present
26
- - Create proper type definitions for state shape
27
- - Include error handling and loading states
28
- - Add proper debugging setup (devtools)
29
- - Consider performance optimizations (selectors, memoization)
30
-
31
- ## State Management Selection Guide
32
-
33
- Choose based on complexity:
34
- - **Simple state**: React hooks + Context API
35
- - **Medium complexity**: Zustand or custom hooks
36
- - **Complex state**: Redux Toolkit with RTK Query
37
- - **Form state**: React Hook Form or Formik
38
-
39
- ## Important Notes
40
-
41
- - ALWAYS check existing state management first
42
- - Don't install new dependencies without asking
43
- - Follow project's folder structure for state files
44
- - Consider server state vs client state separation
45
- - Add proper TypeScript types for all state interfaces
@@ -1,81 +0,0 @@
1
- # CLAUDE.md - React Application
2
-
3
- This file provides guidance to Claude Code when working with React applications using TypeScript.
4
-
5
- ## Project Type
6
-
7
- This is a React application with TypeScript support.
8
-
9
- ## Development Commands
10
-
11
- ### Component Development
12
- - **`/component`** - Create React components with TypeScript
13
- - **`/hooks`** - Create and manage React hooks
14
- - **`/state-management`** - Implement state management solutions
15
-
16
- ### Testing and Quality
17
- - **`/test`** - Run tests and create test files
18
- - **`/lint`** - Run linting and fix code style issues
19
- - **`/typescript-migrate`** - Migrate JavaScript files to TypeScript
20
-
21
- ### Development Workflow
22
- - **`/npm-scripts`** - Run npm scripts and package management
23
- - **`/debug`** - Debug React applications
24
- - **`/refactor`** - Refactor and optimize code
25
-
26
- ## Framework-Specific Guidelines
27
-
28
- ### React Best Practices
29
- - Use functional components with hooks
30
- - Implement proper TypeScript typing for props and state
31
- - Follow React performance optimization patterns
32
- - Use proper component composition patterns
33
-
34
- ### State Management
35
- - Use useState for local component state
36
- - Consider useContext for shared state
37
- - Implement Redux Toolkit for complex state management
38
- - Use Zustand for lightweight state management
39
-
40
- ### Component Architecture
41
- - Keep components small and focused
42
- - Use custom hooks for reusable logic
43
- - Implement proper prop drilling prevention
44
- - Follow component testing best practices
45
-
46
- ### Performance Optimization
47
- - Use React.memo for expensive components
48
- - Implement proper dependency arrays in useEffect
49
- - Use useMemo and useCallback judiciously
50
- - Optimize bundle size with code splitting
51
-
52
- ## TypeScript Configuration
53
-
54
- The project uses strict TypeScript configuration:
55
- - Strict type checking enabled
56
- - Proper interface definitions for props
57
- - Generic type support for reusable components
58
- - Integration with React's built-in types
59
-
60
- ## Testing Strategy
61
-
62
- - Unit tests with Jest and React Testing Library
63
- - Component testing with proper mocking
64
- - Integration tests for complex workflows
65
- - E2E tests for critical user journeys
66
-
67
- ## File Naming Conventions
68
-
69
- - Components: `PascalCase.tsx` (e.g., `UserCard.tsx`)
70
- - Hooks: `use` prefix in `camelCase` (e.g., `useApiData.ts`)
71
- - Types: `types.ts` or inline interfaces
72
- - Tests: `ComponentName.test.tsx`
73
-
74
- ## Recommended Libraries
75
-
76
- - **State Management**: Redux Toolkit, Zustand, Context API
77
- - **Styling**: Styled-components, Emotion, Tailwind CSS
78
- - **Forms**: React Hook Form, Formik
79
- - **Routing**: React Router v6
80
- - **HTTP Client**: Axios, SWR, React Query
81
- - **Testing**: Jest, React Testing Library, Cypress
@@ -1,46 +0,0 @@
1
- # Vue Components
2
-
3
- Create Vue Single File Components for $ARGUMENTS following project conventions.
4
-
5
- ## Task
6
-
7
- Create or optimize Vue components based on the requirements:
8
-
9
- 1. **Analyze project structure**: Check existing Vue components to understand patterns, conventions, and file organization
10
- 2. **Examine Vue setup**: Identify Vue version (2/3), TypeScript usage, and Composition/Options API preference
11
- 3. **Check styling approach**: Determine if using CSS modules, SCSS, styled-components, or other styling methods
12
- 4. **Review testing patterns**: Check existing component tests to understand testing framework and conventions
13
- 5. **Create component structure**: Generate SFC with template, script, and style sections
14
- 6. **Implement component**: Write TypeScript interfaces, props, emits, and component logic
15
- 7. **Add accessibility**: Include proper ARIA attributes and semantic HTML
16
- 8. **Create tests**: Write comprehensive component tests following project patterns
17
- 9. **Add documentation**: Include JSDoc comments and usage examples
18
-
19
- ## Component Requirements
20
-
21
- - Follow project's TypeScript conventions and interfaces
22
- - Use existing component patterns and naming conventions
23
- - Implement proper props validation and typing
24
- - Add appropriate event emissions with TypeScript signatures
25
- - Include scoped styles following project's styling approach
26
- - Add proper accessibility attributes (ARIA, semantic HTML)
27
- - Consider responsive design if applicable
28
-
29
- ## Vue Patterns to Consider
30
-
31
- Based on the component type:
32
- - **Composition API**: For Vue 3 projects with `<script setup>`
33
- - **Options API**: For Vue 2 or legacy Vue 3 projects
34
- - **Composables**: Extract reusable logic into composables
35
- - **Provide/Inject**: For deep component communication
36
- - **Slots**: For flexible component content
37
- - **Teleport**: For portal-like functionality (Vue 3)
38
-
39
- ## Important Notes
40
-
41
- - ALWAYS examine existing components first to understand project patterns
42
- - Use the same Vue API style (Composition vs Options) as the project
43
- - Follow project's folder structure for components
44
- - Don't install new dependencies without asking
45
- - Consider component performance (v-memo, computed properties)
46
- - Add proper TypeScript types for all props and emits
@@ -1,51 +0,0 @@
1
- # Vue Composables
2
-
3
- Create Vue composables for $ARGUMENTS following project conventions.
4
-
5
- ## Task
6
-
7
- Create or optimize Vue composables based on the requirements:
8
-
9
- 1. **Analyze existing composables**: Check project for existing composable patterns, naming conventions, and file organization
10
- 2. **Examine Vue setup**: Verify Vue 3 Composition API usage and TypeScript configuration
11
- 3. **Identify composable type**: Determine the composable category:
12
- - State management (reactive data, computed properties)
13
- - API/HTTP operations (data fetching, mutations)
14
- - DOM interactions (event listeners, element refs)
15
- - Utility functions (validation, formatting, storage)
16
- - Lifecycle management (cleanup, watchers)
17
- 4. **Check dependencies**: Review existing composables to avoid duplication
18
- 5. **Implement composable**: Create composable with proper TypeScript types and reactivity
19
- 6. **Add lifecycle management**: Include proper cleanup with onUnmounted when needed
20
- 7. **Create tests**: Write comprehensive unit tests for composable logic
21
- 8. **Add documentation**: Include JSDoc comments and usage examples
22
-
23
- ## Implementation Requirements
24
-
25
- - Follow project's TypeScript conventions and interfaces
26
- - Use appropriate Vue reactivity APIs (ref, reactive, computed, watch)
27
- - Include proper error handling and loading states
28
- - Add cleanup for side effects (event listeners, timers, subscriptions)
29
- - Make composables reusable and focused on single responsibility
30
- - Consider performance implications (shallow vs deep reactivity)
31
-
32
- ## Common Composable Patterns
33
-
34
- Based on the request:
35
- - **Data fetching**: API calls with loading/error states
36
- - **Form handling**: Input management, validation, submission
37
- - **State management**: Local state, persistence, computed values
38
- - **DOM utilities**: Element refs, event handling, intersection observer
39
- - **Storage**: localStorage, sessionStorage, IndexedDB
40
- - **Authentication**: User state, token management, permissions
41
- - **UI utilities**: Dark mode, responsive breakpoints, modals
42
-
43
- ## Important Notes
44
-
45
- - ALWAYS examine existing composables first to understand project patterns
46
- - Use proper Vue 3 Composition API patterns
47
- - Follow project's folder structure for composables (usually /composables)
48
- - Don't install new dependencies without asking
49
- - Consider composable composition (using other composables within composables)
50
- - Add proper TypeScript return types and generic constraints
51
- - Include proper reactivity patterns (avoid losing reactivity)
@@ -1,124 +0,0 @@
1
- # Django Model Generator
2
-
3
- Create Django models with proper structure and relationships.
4
-
5
- ## Purpose
6
-
7
- This command helps you quickly create Django models with fields, relationships, and best practices.
8
-
9
- ## Usage
10
-
11
- ```
12
- /django-model
13
- ```
14
-
15
- ## What this command does
16
-
17
- 1. **Creates model classes** with proper field definitions
18
- 2. **Adds relationships** (ForeignKey, ManyToMany, OneToOne)
19
- 3. **Includes meta options** and model methods
20
- 4. **Generates migrations** automatically
21
- 5. **Follows Django conventions** and best practices
22
-
23
- ## Example Output
24
-
25
- ```python
26
- # models.py
27
- from django.db import models
28
- from django.contrib.auth.models import User
29
-
30
- class Category(models.Model):
31
- name = models.CharField(max_length=100, unique=True)
32
- slug = models.SlugField(unique=True)
33
- description = models.TextField(blank=True)
34
- created_at = models.DateTimeField(auto_now_add=True)
35
- updated_at = models.DateTimeField(auto_now=True)
36
-
37
- class Meta:
38
- verbose_name_plural = "categories"
39
- ordering = ['name']
40
-
41
- def __str__(self):
42
- return self.name
43
-
44
- class Post(models.Model):
45
- STATUS_CHOICES = [
46
- ('draft', 'Draft'),
47
- ('published', 'Published'),
48
- ('archived', 'Archived'),
49
- ]
50
-
51
- title = models.CharField(max_length=200)
52
- slug = models.SlugField(unique=True)
53
- content = models.TextField()
54
- status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='draft')
55
- author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='posts')
56
- category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True, blank=True)
57
- tags = models.ManyToManyField('Tag', blank=True)
58
- created_at = models.DateTimeField(auto_now_add=True)
59
- updated_at = models.DateTimeField(auto_now=True)
60
-
61
- class Meta:
62
- ordering = ['-created_at']
63
- verbose_name = 'blog post'
64
- verbose_name_plural = 'blog posts'
65
-
66
- def __str__(self):
67
- return self.title
68
-
69
- def get_absolute_url(self):
70
- return reverse('post_detail', kwargs={'slug': self.slug})
71
-
72
- class Tag(models.Model):
73
- name = models.CharField(max_length=50, unique=True)
74
- slug = models.SlugField(unique=True)
75
-
76
- def __str__(self):
77
- return self.name
78
- ```
79
-
80
- ## Field Types Supported
81
-
82
- - **CharField** - Text fields with max length
83
- - **TextField** - Large text fields
84
- - **IntegerField** - Integer numbers
85
- - **FloatField** - Floating point numbers
86
- - **BooleanField** - True/False values
87
- - **DateField** - Date only
88
- - **DateTimeField** - Date and time
89
- - **EmailField** - Email addresses
90
- - **URLField** - URLs
91
- - **ImageField** - Image uploads
92
- - **FileField** - File uploads
93
- - **JSONField** - JSON data (PostgreSQL)
94
-
95
- ## Relationships
96
-
97
- - **ForeignKey** - One-to-many relationships
98
- - **ManyToManyField** - Many-to-many relationships
99
- - **OneToOneField** - One-to-one relationships
100
-
101
- ## Best Practices Included
102
-
103
- - Proper field choices and defaults
104
- - Appropriate related_name attributes
105
- - __str__ methods for admin interface
106
- - Meta class with ordering and verbose names
107
- - get_absolute_url methods where appropriate
108
- - Proper use of null and blank parameters
109
- - Field validation and constraints
110
-
111
- ## After Creating Models
112
-
113
- ```bash
114
- # Create and apply migrations
115
- python manage.py makemigrations
116
- python manage.py migrate
117
-
118
- # Register in admin (optional)
119
- # Add to admin.py:
120
- from django.contrib import admin
121
- from .models import Post, Category, Tag
122
-
123
- admin.site.register([Post, Category, Tag])
124
- ```