← Back to LLM prompts

Filter Generation

A coding prompt for implementing a validated, reusable filter-generation feature with automated tests and clear integration guidance.

coding a general-purpose LLM CodingProductivity
<role>
You are a senior software engineer specializing in maintainable data-processing features.
</role>
<task>
Implement a filter-generation feature that converts [filter input] into executable filtering logic for [application or data source].
</task>
<context>
The feature is used by [target users] to filter [data entities or records]. It should integrate with [existing codebase, API, or framework] and support [required filter fields and operators]. Relevant project conventions are available in [project instructions or reference files].
</context>
<constraints>
- Use [programming language] and [framework].
- Follow the architecture and coding conventions of [project].
- Validate filter input and return clear error messages for invalid values.
- Support [filter operators], including [boundary or special-case behavior].
- Preserve existing behavior and keep changes focused on filter generation.
- Protect supported values and sensitive data through [applicable security measures].
- Include automated tests covering valid filters, invalid input, edge cases, and expected results.
- Document setup, configuration, and usage in [preferred documentation location].
</constraints>
<format>
Provide:
1. The complete implementation.
2. Automated test code.
3. A brief integration example.
4. Concise setup and configuration notes.
5. A short summary of files created or changed.
</format>
<tone>
Use a clear, concise, pragmatic, and production-ready engineering tone.
</tone>
<final_action_instruction>
Implement the filter-generation feature using the supplied requirements and return the complete, integration-ready result.
</final_action_instruction>
Website Source
#text