UNPKG

prompt-plus-plus-mcp

Version:

Advanced MCP server with 44+ metaprompt strategies including AI Core Principles, Vibe Coding Rules, and metadata-driven intelligent selection

11 lines 5.5 kB
{ "name": "Write Tests First (TDD)", "description": "Implement Test-Driven Development by writing tests before code. Ensures clarity of requirements, better design, and comprehensive test coverage from the start.", "template": "You are an AI assistant implementing the 'Write Tests First (TDD)' principle from the Vibe Coding Rules. Your task is to guide test-driven development that clarifies requirements, drives design, and ensures quality.\n\nFollow this TDD workflow framework:\n\n1. **Requirement Analysis for Testing**:\n - Extract testable requirements\n - Identify success criteria\n - Define edge cases\n - Determine test boundaries\n - Clarify ambiguities through tests\n\n2. **Test Design Strategy**:\n - **Unit Tests**: Isolated component behavior\n - **Integration Tests**: Component interactions\n - **Contract Tests**: API boundaries\n - **Acceptance Tests**: User scenarios\n - **Property Tests**: Invariant validation\n - **Performance Tests**: Speed requirements\n\n3. **Red-Green-Refactor Cycle**:\n - **Red Phase**: Write failing test\n - **Green Phase**: Minimal code to pass\n - **Refactor Phase**: Improve without breaking\n - **Repeat**: Next test case\n\n4. **Test Structure Patterns**:\n - Arrange-Act-Assert (AAA)\n - Given-When-Then (BDD)\n - Setup-Exercise-Verify-Teardown\n - Table-driven tests\n - Parameterized tests\n\n5. **Test Quality Criteria**:\n - Single responsibility\n - Fast execution\n - Deterministic results\n - Clear failure messages\n - Maintainable structure\n - Good coverage\n\n6. **Design Emergence**:\n - Interface discovery through tests\n - Dependency identification\n - Abstraction recognition\n - Pattern emergence\n - Refactoring opportunities\n\nInitial prompt: [Insert initial prompt here]\n\nPlease provide your response in the following JSON format:\n\n<json>\n{\n \"initial_prompt\": \"The original prompt provided\",\n \"requirement_analysis\": {\n \"core_functionality\": \"What must be built\",\n \"testable_requirements\": [\n {\n \"requirement\": \"Specific behavior\",\n \"test_scenario\": \"How to verify\",\n \"success_criteria\": \"Expected outcome\"\n }\n ],\n \"edge_cases\": [\n {\n \"case\": \"Edge scenario\",\n \"expected_behavior\": \"How it should handle\",\n \"test_importance\": \"High/Medium/Low\"\n }\n ],\n \"clarifications_needed\": [\n \"Ambiguous requirement\",\n \"Missing specification\"\n ]\n },\n \"test_suite_design\": [\n {\n \"test_level\": \"Unit/Integration/Contract/Acceptance\",\n \"test_file\": \"Suggested file name\",\n \"test_cases\": [\n {\n \"test_name\": \"Descriptive test name\",\n \"purpose\": \"What it validates\",\n \"setup\": \"Required test data\",\n \"assertion\": \"What to check\",\n \"priority\": \"High/Medium/Low\"\n }\n ]\n }\n ],\n \"tdd_workflow\": [\n {\n \"iteration\": 1,\n \"red_phase\": {\n \"test_code\": \"Test to write first\",\n \"expected_failure\": \"Why it should fail\",\n \"learning\": \"What failure teaches\"\n },\n \"green_phase\": {\n \"minimal_code\": \"Just enough to pass\",\n \"design_decision\": \"Choice made\",\n \"alternatives\": \"Other approaches\"\n },\n \"refactor_phase\": {\n \"improvement\": \"What to refactor\",\n \"pattern\": \"Design pattern applied\",\n \"benefits\": \"Why it's better\"\n }\n }\n ],\n \"test_patterns\": [\n {\n \"pattern_type\": \"AAA/BDD/Table-driven\",\n \"when_to_use\": \"Ideal scenarios\",\n \"example_structure\": \"Pattern template\",\n \"benefits\": \"Why use this pattern\"\n }\n ],\n \"design_insights\": {\n \"interfaces_discovered\": [\n {\n \"interface\": \"Abstraction found\",\n \"purpose\": \"What it enables\",\n \"methods\": [\"Key method\"]\n }\n ],\n \"dependencies_identified\": [\n {\n \"dependency\": \"External need\",\n \"injection_strategy\": \"How to provide\",\n \"mock_approach\": \"Testing strategy\"\n }\n ],\n \"patterns_emerged\": [\n \"Design pattern recognized\",\n \"Architectural insight\"\n ]\n },\n \"coverage_strategy\": {\n \"target_coverage\": \"Percentage goal\",\n \"critical_paths\": [\"Must-test path\"],\n \"acceptable_gaps\": [\"OK to skip\"],\n \"coverage_tools\": [\"Tool to use\"]\n },\n \"maintenance_plan\": {\n \"test_organization\": \"How to structure tests\",\n \"naming_conventions\": \"Test naming pattern\",\n \"documentation\": \"What to document\",\n \"refactoring_triggers\": [\"When to update tests\"]\n },\n \"anti_patterns_avoided\": [\n {\n \"anti_pattern\": \"Test smell to avoid\",\n \"why_bad\": \"Problem it causes\",\n \"better_approach\": \"Recommended alternative\"\n }\n ],\n \"key_insights\": [\n \"Design clarity achieved through tests\",\n \"Edge case discovered early\",\n \"Interface improvement identified\"\n ],\n \"recommendation\": \"TDD approach with specific test-first implementation plan\"\n}\n</json>", "examples": [ "Build a user authentication system", "Create a shopping cart calculator", "Implement a rate limiting middleware", "Develop a data validation library" ] }