# Feature Implementation with Tests

## Purpose
Generate a complete feature implementation including the main code and comprehensive tests.

## Prompt Template

```
I need to implement a {feature_description} in {language/framework}.

Context:
- Project structure: {describe project structure}
- Dependencies: {list relevant dependencies}
- Existing patterns: {describe coding patterns or conventions}

Requirements:
1. {requirement_1}
2. {requirement_2}
3. {requirement_3}

Please provide:
1. The main implementation code
2. Unit tests covering happy path and edge cases
3. Integration tests if applicable
4. Any necessary documentation or comments

Code should follow {coding_standard} and include proper error handling.
```

## Variables
- `{feature_description}`: Clear description of what you're building
- `{language/framework}`: E.g., "Python with FastAPI" or "React with TypeScript"
- `{describe project structure}`: Brief overview of how code is organized
- `{list relevant dependencies}`: Libraries or modules being used
- `{describe coding patterns}`: Any conventions to follow
- `{requirement_N}`: Specific functional requirements
- `{coding_standard}`: E.g., "PEP 8", "Airbnb style guide"

## Example Usage

**Input**:
```
I need to implement a password reset feature in Python with FastAPI.

Context:
- Project structure: Following Clean Architecture with separate layers for routes, services, and repositories
- Dependencies: FastAPI 0.104, SQLAlchemy 2.0, Pydantic V2, Redis for token storage
- Existing patterns: We use dependency injection for services, async/await for all endpoints

Requirements:
1. User requests password reset with email
2. System generates secure token, stores in Redis with 1-hour expiration
3. System sends email with reset link
4. User submits new password with token
5. System validates token and updates password

Please provide:
1. The main implementation code (routes, service, repository)
2. Unit tests covering happy path and edge cases
3. Integration tests if applicable
4. Any necessary documentation or comments

Code should follow PEP 8 and include proper error handling.
```

**Output**:
[AI would provide complete implementation with tests]

## Tips
- Be specific about error handling requirements
- Mention security considerations if relevant
- Specify test framework preferences
- Include performance requirements if applicable
- Request documentation style you prefer

## Variations

### Variation 1: With Specific Test Framework
Add: "Use {test_framework} for testing" (e.g., "Use pytest with fixtures")

### Variation 2: With Security Focus
Add: "Pay special attention to security: {security_requirements}"

### Variation 3: With Performance Requirements
Add: "Optimize for: {performance_criteria}" (e.g., "sub-100ms response time")

## Tags
#code-generation #testing #tdd #feature-implementation
