You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the user's prompt starts with "EP:", then the user wants to enhance the prompt. Read the PROMPT_ENHANCER.md file and follow the guidelines to enhance the user's prompt. Show the user the enhancement and get their permission to run it before taking action on the enhanced prompt.
The enhanced prompts will follow the language of the original prompt (e.g., Korean prompt input will output Korean prompt enhancements, English prompt input will output English prompt enhancements, etc
This guide provides strategies for analyzing user prompts and enhancing them by incorporating project context, current progress, and potential requirements to create more effective development instructions.
Enhancement Process
Step 1: Original Prompt Analysis
- Intent Recognition: What does the user really want?
- Clarity Level: What parts are ambiguous?
- Scope Definition: How much work needs to be done?
- Missing Context: What information is lacking?
Fix this Code
- Unclear which file
- Ambiguous what to fix
- No defined goals
Optimize performance for `src/components/UserList.tsx`
- Current issue: 3-second delay when rendering 1000 items
- Target: Reduce render time to under 1 second
- Methods: Apply React.memo, virtualization or pagination
- Preserve existing styling and API interface
Simple -> Detailed Plan
Add search feature
- Unclear where to add
- Ambiguous search targets and methods
- Missing UI/UX considerations
Implement real-time search for ProductList component
1. UI Implementation
- Create new `SearchBar.tsx` component
- Follow `UserList.tsx` styling for consistency
2. Search Logic
- Filter by name, category and tags
- Apply 300ms debouncing
- Highlight search results
3. State Management
- Use useState for search terms and results
- Optimize API calls with useEffect
4. Testing
- Unit tests for search component
- Performance testing with 1000 items
Feature Request -> Complete Workflow
Create login functionality
- Authentication method unclear
- Security considerations missing
- Integration with existing system needed
Build comprehensive user authentication system
Phase 1 - Backend Authentication:
- `models/User.js`: bcrypt password hashing
- `middleware/auth.js`: JWT token validation
- `routes/auth.js`: login/signup endpoints
- Follow existing API router patterns
Phase 2 - Frontend Implementation:
- components/LoginForm.tsx: form validation and error handling
- hooks/userauth.js: authentication state management
- utils/authService.js: API call logic
- Reference existing UserProfile.tsx styling
Phase 4 - Testing:
- Unit tests: per component
- Integration tests: complete auth flow
- Security tests: vulnerability verification
Project Context Utilization Strategies
Existing Pattern Analysis
- Import ordering and grouping rules
- Function naming conventions
- Error handling patterns
- State management approaches
- Testing style guidelines
Following existing `UserService.js` patterns
- Apply same error handling approach
- Use identical logging structure
- Maintain similar test coverage
Dependency Considerations
- Libraries currently in use
- Version compatibility
- Dev/production dependency separation
Leverage existing project libraries
- Use existing fetch wrapper instead of axios
- Actively utilize lodash methods
- Minimize additional dependency introduction
Architecture Consistency
- Folder structure and naming conventions
- Component hierarchy
- Data flow patterns
Align with `src/features/` structure
- Create `feature/auth/` directory
- Maintain `components/`, `hooks/`, `services/`, sub-structure
- Unify export through `index.js`
Special Situation Enhancements
Legacy Code Improvement
Update this old code
- Existing code vintage and patterns
- Gap with current project standards
- Compatibility maintenance needs
Migrate `legacy/userManager.js` to modern JavaScript
1. Syntax Updates
- Convert `var` -> `const`/`let`
- Transform functions -> arrow function (where appropriate)
- Apply `Promise` -> `async`/`await` conversion
2. Feature Improvements
- Enhance error handling (add try-catch)
- Improve type safety (JSDoc or TS)
- Utilize current project utilities
3. Compatibility Assurance
- Maintain existing API interfaces
- Minimize impact on dependent modules
- Design for gradual migration
Emergency Bug Fixes
Fix this error urgently
- Urgency recognition
- Safety consideration
Emergency bug fix (safe hotfix approach)
- Immediate Fix
- Problem file: {analyzed filename}
- Resolve error with minimal change
- Preserve existing logic as much as possible
- Temporary Measures
- Add fallback handling for error cases
- Enhance logging for monitoring
- Provide clear error messages to users
- Follow-up Task (separate PR)
- Root cause analysis
- Add test cases
- Review architecture improvements
Automatic Quality Standards Addition
Performance Standards
Auto-added for all feature development
Performance targets
- Initial render: under 200ms
- User interactions: under 100ms
- Memory usage: max 20% increase from baseline
- Bundle size: under 10KB addition
Accessibility Standards
Auto-added for UI component work
Accessibility requirements
- Proper ARIA label configuration
- Keyboard navigation support
- Maintain 4.5:1 color contrast ratio
- Screen reader compatibility testing
Testing Standards
Auto-added for code writing
Testing requirements
- Unit tests: 100% coverage for core logic
- Integration tests: major user flows
- Edge cases: error scenario handling
- Consistency with existing test suite
1. Current working directory files
2. Package spec documents and configuration files
3. Recent git commit messages
4. Similar existing implementations
5. Project documentation and README
3. Standardized Output Structure
1. Clear objective statement
2. Specific work scope
3. Step-by-step execution plan
4. Quality criteria and constraints
5. Validation and testing methods
6. Related files and reference code
Advanced Enhancement Techniques
Implicit Requirement Discovery
When user says "Create a button"
Develop button component (complete UI system):
Base button component
- Support variants (primary, secondary, danger)
- Size options (small, medium, large)
- Handle disable and loading states
Styling
- Utilize existing design system color palette
- Style for hover, focus, active states
- Dark mode support (if applicable)
For API endpoint requests
Implement User API endpoints
- Core tasks
- `GET /api/users` (list + pagination)
- `POST /api/users` (user creation)
- `PUT /api/users/:id` (info update)
- `DELETE /api/users/:id` (deletion)
- Related task suggestions:
- Auto-generate swagger documentation
- Write API test suite
- Update frontend service layer
- Integrate permission check middleware
- Add logging and monitoring
Practical Enhancement Examples
Example 1: Vague debugging request
Why doesn't this work?
1. Check recently modified files
2. Estimate console errors or warnings
3. Analyze related code patterns
Debug `src/components/ProductList.tsx` rendering issue
- Problem situation
- Expected: product list should display
- Actual: Blank screen or error occurrence
- Debugging steps
1. Check and analyze console error messages
2. Verify API response data structure
3. Review state management logic (`useState/useEffect`)
4. Examine conditional rendering logic
- Resolution priority
1. Immediate fix: critical errors
2. Short-term improvement: enhance error handling
3. Long-term optimization: overall structure review
Example 2: Simple Feature Request
Add dark mode
Implement enterprise-wide dark mode system
- Phase 1. Infrastructure Setup
- Design CSS variable-based color system
- Implement theme switching context
- Save settings to localStorage
- Phase 2. Component Application
- Add dark mode styles to all existing components
- Priority: Header, Sidebar, main pages
- Maintain consistent color hierarchy
- Phase 3. User Experience
- Theme toggle button (with animation)
- Auto-detect system preferences
- Smooth transition effects
- Phase 4. Quality Assurance
- Test dark mode on all pages
- Verify accessibility contrast
- Minimize performance impact
Security Considerations
Security Guidelines
- Avoid exposing sensitive information in enhanced prompts
- Validate file paths before accessing
- Sanitize user inputs in generated code
- Include security reviews for authentication-related code
- Implement proper error handling without information leakage
Error Handling Guidelines
- Always include try-catch blocks for critical operations
- Provide meaningful error messages
- Include rollback mechanisms for destructive operations
- Log errors appropriately without exposing sensitive data
- Implement graceful degradation strategies