Software Developer

Category 1: Code Generation, Refactoring, & Modernization

 

1. SOLID Principle Refactoring: “Act as a senior software architect specializing in clean code. I have a monolithic function in [Language] that violates several SOLID principles. Here is the code: [Paste Code Snippet]. Refactor this code into smaller, single-responsibility functions and classes. Provide the refactored code and a detailed, principle-by-principle explanation (e.g., ‘Single Responsibility: Extracted X logic into its own class…’) of how the new structure improves maintainability and testability.”

 

2. Design Pattern Implementation: “Generate a practical implementation of the [Specify Design Pattern, e.g., Strategy, Observer, Factory] pattern in [Language]. The context is [Describe the problem, e.g., a notification system that needs to support email, SMS, and push notifications]. Provide the complete, commented code for all interfaces, concrete classes, and the client. Include a brief explanation of the pattern’s benefits in this specific scenario.”

 

3. Idiomatic Code Translation: “I need to translate a codebase from [Source Language, e.g., Python] to idiomatic [Target Language, e.g., Go]. Here is a key module: [Paste Code Snippet]. Rewrite this code, not just line-by-line, but by leveraging the unique strengths and conventions of [Target Language], such as [e.g., goroutines and channels for Go, ownership and borrowing for Rust]. Add comments to highlight the idiomatic changes you made.”

 

4. Legacy Code Modernization Plan: “Analyze this legacy [Language] code file: [Paste Code]. It lacks dependency management, uses outdated libraries, and has no tests. Act as a tech lead and create a step-by-step modernization plan. The plan should include: recommended new libraries, a strategy for introducing a testing framework (e.g., Jest, PyTest), a method for modularizing the code, and a plan for setting up a CI/CD pipeline to prevent future decay. Prioritize steps by impact and effort.”

 

5. Boilerplate Generation for New Service: “Generate the complete directory structure and boilerplate code for a new microservice in [Framework, e.g., Node.js with Express, Python with FastAPI]. The service should include: a RESTful API for a [Resource, e.g., 'products'] entity with full CRUD functionality, layered architecture (controller, service, repository layers), basic error handling middleware, environment variable configuration (.env), and a simple Dockerfile for containerization.”

 

Category 2: Debugging, Performance, & Security

 

6. Root Cause Analysis from Stack Trace: “I’m facing a cryptic error in my [Language/Framework] application. Here is the full stack trace: [Paste Full Stack Trace]. Based on this trace and the application context of [Briefly describe what the application does], perform a root cause analysis. Identify the most likely point of failure, explain the sequence of calls that led to it, and propose three potential solutions or debugging steps to confirm the hypothesis.”

 

7. Concurrency Issue Identification: “Analyze the following multi-threaded [Language] code for potential concurrency issues like race conditions, deadlocks, or starvation. Code: [Paste Code Snippet]. Explain where and why these issues might occur in a high-concurrency environment. Provide a corrected version of the code using appropriate synchronization primitives like mutexes, semaphores, or atomic operations, and justify your choice.”

 

8. Performance Bottleneck Analysis: “Act as a performance optimization expert. Here is a function from my [Language] application that is running too slow: [Paste Code]. Analyze it for performance bottlenecks, focusing on algorithmic complexity, memory allocation, I/O operations, and inefficient library usage. Provide an optimized version of the function and a quantitative explanation of the improvements, referencing Big O notation (e.g., ‘Reduced time complexity from O(n^2) to O(n log n) by…’).”

 

9. Security Vulnerability Audit (OWASP Top 10): “Conduct a security audit on this [Language] code snippet, which handles user input and database interaction: [Paste Code]. Check for common vulnerabilities from the OWASP Top 10, such as SQL Injection, Cross-Site Scripting (XSS), Insecure Deserialization, and Broken Access Control. For each vulnerability found, explain the risk and provide the patched, secure code.”

 

10. Memory Leak Detection Strategy: “I suspect a memory leak in my long-running [Language, e.g., Node.js, C++] application. The application’s purpose is [Describe purpose]. Based on the following code that handles object creation/destruction: [Paste Relevant Code], describe a detailed strategy to diagnose and confirm the leak. Suggest specific tools (e.g., Valgrind, heapdump) and techniques (e.g., heap profiling, garbage collection analysis) to pinpoint the source of the leak.”

 

Category 3: System Design & Architecture

 

11. Architectural Pattern Trade-off Analysis: “I need to design a system for [Specify problem, e.g., processing a large volume of user-uploaded images]. Compare and contrast two architectural patterns for this system: [Pattern 1, e.g., Monolithic] vs. [Pattern 2, e.g., Microservices]. Create a markdown table that evaluates them based on the following criteria: Scalability, Development Complexity, Deployment Overhead, Fault Isolation, Cost, and Data Consistency. Conclude with a recommendation for a startup with a small team.”

 

12. API Design (RESTful vs. GraphQL): “Design the API for a client-facing ‘User Profile’ service. The client needs to fetch a user’s profile, their recent posts, and their followers. Provide two complete API design specifications: one using REST and one using GraphQL. For REST, define the endpoints, methods, and sample JSON payloads. For GraphQL, define the schema (types, queries, mutations). Conclude with a summary of which approach is better and why, considering issues like over-fetching and front-end development velocity.”

 

13. Scalable Database Schema Design: “Design a normalized relational database schema (up to 3NF) for [System, e.g., a course enrollment platform]. The core entities are Students, Instructors, Courses, and Enrollments. Provide the schema as a series of CREATE TABLE SQL statements. Include primary keys, foreign keys with ON DELETE rules, appropriate data types, and indexes for common query patterns (e.g., finding all students in a course). Additionally, generate an Entity-Relationship Diagram (ERD) in Mermaid syntax.”

 

14. CI/CD Pipeline Strategy: “Design a complete CI/CD pipeline for a [Specify type of application, e.g., containerized web application] using [Specify tools, e.g., GitHub Actions]. Detail the stages of the pipeline: Trigger, Build, Test (unit, integration, E2E), Static Code Analysis, Deploy to Staging, Manual Approval, and Deploy to Production. Provide a YAML configuration file for the pipeline and explain the purpose of each key step.”

 

15. Technical Debt Repayment Roadmap: “Imagine you are the new tech lead for a project with significant technical debt. The main issues are: [List 2-3 key problems, e.g., a tightly coupled architecture, lack of tests, an outdated framework]. Create a strategic 3-month roadmap to address this debt without halting feature development. Structure the roadmap into monthly sprints, detailing the specific refactoring tasks, metrics for success (e.g., improve code coverage from 20% to 50%), and how you will balance this work with delivering new business value.”

 

Category 4: Testing & Quality Assurance

 

16. Comprehensive Unit Test Generation: “Act as a Test-Driven Development (TDD) expert. Given the following function in [Language]: [Paste Function]. Write a comprehensive suite of unit tests using the [Testing Framework, e.g., Jest, JUnit, PyTest] framework. Include tests for happy paths, edge cases (e.g., null inputs, empty arrays), and potential error conditions. Use mocks or stubs where necessary to isolate the function from external dependencies.”

 

17. Integration Test Scenarios: “I have two microservices: a ‘User Service’ (handles authentication) and an ‘Order Service’ (handles purchases). Describe a set of critical integration test scenarios to ensure they work correctly together. For each scenario, define the prerequisite state, the action (API call), and the expected outcome across both services. Example scenario: ‘A user attempts to create an order with an expired authentication token’.”

 

18. End-to-End (E2E) Test Scripting: “Write a high-level E2E test script for a user flow on a simple e-commerce website using a Gherkin syntax (Given/When/Then). The flow is: User searches for a product, adds it to the cart, proceeds to checkout, and completes the purchase. The script should be descriptive enough for a QA engineer to automate using a tool like Cypress or Playwright.”

 

Category 5: Career & Professional Development

 

19. Code Review Feedback Simulation: “I am a junior developer and I’ve just submitted this pull request: [Paste Code Snippet and a brief description of the change]. Act as a constructive, empathetic senior developer. Provide a detailed code review. Your feedback should not just point out errors but also explain the ‘why’ behind your suggestions, reference best practices, and ask clarifying questions to encourage my learning.”

 

20. Technical Explanation for a Non-Technical Audience: “I need to explain the concept of [Complex Technical Concept, e.g., 'database indexing', 'asynchronous programming', 'containerization with Docker'] to a project manager. Write a clear, concise explanation using an analogy. Avoid jargon and focus on the business benefit (e.g., ‘how it makes the application faster’ or ‘how it lets us deliver features more reliably’).”

 

21. Personalized Learning Roadmap: “I am a [Your Current Role, e.g., Mid-level Frontend Developer] proficient in [Your Current Skills, e.g., React, TypeScript]. I want to become a [Your Goal Role, e.g., Full-Stack Developer with expertise in serverless computing]. Create a detailed 3-month learning roadmap. Break it down week-by-week, suggesting specific topics, technologies (e.g., AWS Lambda, API Gateway), small projects to build, and resources (blogs, courses, books) to consult.”

 

22. Feature Scoping and Estimation: “Act as a senior engineer in a sprint planning meeting. The product manager has proposed the following feature: [Describe a new feature, e.g., 'Add a social login option using Google and Facebook']. Your task is to break this feature down into granular technical tasks (e.g., ‘Set up OAuth 2.0 client IDs’, ‘Create new API endpoint’, ‘Update user database schema’, ‘Build frontend UI components’). Provide a rough time estimate for each task in story points (using Fibonacci sequence: 1, 2, 3, 5, 8) and identify potential risks or dependencies.”

 

23. Incident Post-Mortem Analysis: “An incident occurred: [Describe the incident, e.g., 'The checkout API was down for 30 minutes due to a database connection pool exhaustion']. Act as the lead engineer writing a blameless post-mortem. Create a report with the following sections: Summary, Timeline of Events, Root Cause Analysis (using the ‘5 Whys’ technique), Impact, and a list of Action Items (short-term and long-term) to prevent recurrence.”

 

24. Algorithm Selection & Justification: “For a [Describe feature, e.g., 'type-ahead search suggestion feature'], I need to choose an appropriate data structure and algorithm. Analyze the trade-offs between using a [Option 1, e.g., Trie] versus a [Option 2, e.g., simple array filter with startsWith]. Evaluate them on performance (search time complexity), memory usage, and implementation complexity. Conclude with a clear recommendation and justification for this specific use case.”

 

25. Refactoring vs. Rewriting Decision Framework: “My team is debating whether to refactor a critical but problematic legacy module ([Describe module, e.g., 'the old billing engine']) or rewrite it from scratch. Act as an architect and provide a decision-making framework. Create a list of questions we should answer to make an informed choice. The questions should cover business risk, team expertise, development time, feature velocity, and the module’s strategic importance.”