{"id":29919,"date":"2024-10-01T09:30:00","date_gmt":"2024-10-01T07:30:00","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=29919"},"modified":"2024-10-01T19:05:14","modified_gmt":"2024-10-01T17:05:14","slug":"generative-ai-prompt-patterns-for-software-engineering","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/","title":{"rendered":"Generative AI Prompt Patterns for Software Engineering"},"content":{"rendered":"\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-c7c63e85      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tTable Of Contents\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#introduction\" class=\"uagb-toc-link__trigger\">Introduction<\/a><li class=\"uagb-toc__list\"><a href=\"#integrating-generative-ai-into-development-workflows\" class=\"uagb-toc-link__trigger\">Integrating Generative AI into Development Workflows<\/a><li class=\"uagb-toc__list\"><a href=\"#1-full-context-code-analysis-pattern\" class=\"uagb-toc-link__trigger\">1. Full-Context Code Analysis Pattern<\/a><li class=\"uagb-toc__list\"><a href=\"#2-llm-method-replacement-pattern\" class=\"uagb-toc-link__trigger\">2. LLM Method Replacement Pattern<\/a><li class=\"uagb-toc__list\"><a href=\"#3-context-reducer-pattern\" class=\"uagb-toc-link__trigger\">3. Context Reducer Pattern<\/a><li class=\"uagb-toc__list\"><a href=\"#4-comments-replacement-pattern\" class=\"uagb-toc-link__trigger\">4. Comments Replacement Pattern<\/a><li class=\"uagb-toc__list\"><a href=\"#conclusion\" class=\"uagb-toc-link__trigger\">Conclusion<\/a><li class=\"uagb-toc__list\"><a href=\"#davide-consonni\" class=\"uagb-toc-link__trigger\">Davide Consonni<\/a><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<h2 class=\"wp-block-heading\" id=\"h-introduction\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>The role of developers is changing rapidly. <strong>Those who aren\u2019t ready for this AI-powered future risk becoming extinct, like the Dodo \ud83e\udda4.<\/strong> As Large Language Models (LLMs) improve in their ability to write code, with lower costs and larger context windows, we\u2019re nearing a shift towards Generative AI-driven programming. In this new approach, developers may move away from directly writing code and focus more on being Prompt Engineers and Code Reviewers.<\/p>\n\n\n\n<p>In this article, we\u2019ll explore some key <strong>Generative AI Prompt Patterns<\/strong> that are shaping the future of software engineering. These patterns represent innovative techniques designed to optimize the interaction between developers and LLMs, streamlining the development process and enhancing code quality.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-integrating-generative-ai-into-development-workflows\"><strong>Integrating Generative AI into Development Workflows<\/strong><\/h2>\n\n\n\n<p>Before diving into specific Generative AI patterns, it\u2019s crucial to understand how to integrate these powerful tools into your development process effectively. While not all patterns require extended context windows, some advanced techniques significantly benefit from this capability. Moreover, for AI to be truly effective in coding tasks, the chosen models must excel at code generation and understanding.<\/p>\n\n\n\n<p>For robust and scalable AI integration, I strongly recommend using a native, managed cloud service like <strong>AWS Bedrock<\/strong>. Such services offer superior reliability, built-in scalability, and simplified management, allowing developers to focus on leveraging AI capabilities rather than maintaining infrastructure. Here\u2019s an example of how to integrate a high-performing LLM, <strong>such as <a href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/claude-tech-interview\/\" target=\"_blank\" rel=\"noreferrer noopener\">Claude 3.5 Sonnet<\/a><\/strong> via AWS Bedrock, into your workflow:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">import boto3\nimport json\nfrom tenacity import retry, stop_after_attempt, wait_exponential\n\n@retry(stop=stop_after_attempt(<span class=\"hljs-number\">5<\/span>), wait=wait_exponential(multiplier=<span class=\"hljs-number\">1<\/span>, min=<span class=\"hljs-number\">4<\/span>, max=<span class=\"hljs-number\">10<\/span>))\ndef call_claude(prompt, max_tokens=<span class=\"hljs-number\">1000<\/span>):\n    bedrock = boto3.client(<span class=\"hljs-string\">'bedrock-runtime'<\/span>)\n    body = json.dumps({\n        <span class=\"hljs-string\">\"prompt\"<\/span>: prompt,\n        <span class=\"hljs-string\">\"max_tokens_to_sample\"<\/span>: max_tokens,\n        <span class=\"hljs-string\">\"temperature\"<\/span>: <span class=\"hljs-number\">0.0<\/span>\n    })\n    response = bedrock.invoke_model(\n        body=body,\n        modelId=<span class=\"hljs-string\">\"anthropic.claude-3-5-sonnet-20240620-v1:0\"<\/span>,\n        contentType=<span class=\"hljs-string\">\"application\/json\"<\/span>\n    )\n    <span class=\"hljs-keyword\">return<\/span> json.loads(response&#91;<span class=\"hljs-string\">'body'<\/span>].read())&#91;<span class=\"hljs-string\">'completion'<\/span>]\n\n<span class=\"hljs-comment\"># Usage example for code generation<\/span>\ncode_generation_prompt = <span class=\"hljs-string\">\"\"<\/span><span class=\"hljs-string\">\"\n...\n\"<\/span><span class=\"hljs-string\">\"\"<\/span>\ngenerated_code = call_claude(code_generation_prompt)\n<span class=\"hljs-keyword\">print<\/span>(generated_code)\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>This implementation showcases best practices for integrating AI into your development workflow. The @retry decorator implements exponential backoff, enhancing resilience against transient errors. This approach is crucial when working with external AI services, ensuring robust performance even in the face of temporary network issues or service interruptions.<\/p>\n\n\n\n<p>By leveraging AWS Bedrock, you benefit from a managed service that handles the complexities of scaling, security, and maintenance. This allows you to focus on implementing and refining your AI-driven development patterns without worrying about the underlying infrastructure.<\/p>\n\n\n\n<p>As you develop, it\u2019s vital to understand the strengths of the LLM you\u2019re working with and how they align with your project\u2019s needs. The combination of cutting-edge AI models and the reliability of cloud services like Bedrock gives you the perfect foundation for building advanced AI-driven solutions into your software, without the typical hassle.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. Full-Context Code Analysis Pattern<\/strong><\/h2>\n\n\n\n<p><em>Leveraging comprehensive codebase understanding for precise AI assistance<\/em><\/p>\n\n\n\n<p>This pattern involves inserting the entire codebase or a complete microservice into the prompt, providing the LLM with a comprehensive view of the application. This approach enables more accurate and context-aware responses.<\/p>\n\n\n\n<p>One particularly powerful use of this pattern is for <strong>microservices <\/strong>under 1,000 lines of code. By inserting the entire codebase or a complete microservice into the prompt, you provide the LLM with a full view of the application, leading to more accurate, context-aware responses. This is a game-changer for small, self-contained services where a holistic understanding is essential for generating precise and useful output.<\/p>\n\n\n\n<p><strong>Input:<\/strong><\/p>\n\n\n\n<p><strong># [Entire microservice code is pasted here]<br><\/strong><br>Please implement a new GET API endpoint in this microservice with the following requirements:<br>1. The endpoint should return a list of book objects. Each book object should contain:<br>&nbsp; &#8211; id (UUID)<br>&nbsp; &#8211; title (string)<br>&nbsp; &#8211; author (string)<br>&nbsp; &#8211; publication_year (integer)<br>&nbsp; &#8211; genre (string)<br>2. Implement pagination for this endpoint:<br>&nbsp; &#8211; Accept &#8216;page&#8217; and &#8216;size&#8217; query parameters<br>&nbsp; &#8211; Return appropriate metadata (total items, total pages, current page)<br>3. Apply security measures similar to existing methods in the microservice<br>4. Implement execution time measurement for this method and log it<\/p>\n\n\n\n<p><strong>Output:<\/strong> The LLM provides a complete implementation of the new endpoint, fully integrated with the existing codebase, including pagination, security measures, and execution time logging.<strong>Note:<\/strong> This pattern is often used in conjunction with the Context Reset Pattern, which involves pasting the entire current source code into the LLM chat and asking for confirmation before proceeding with specific queries. This ensures the LLM always has the most up-to-date version of the code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2. LLM Method Replacement Pattern<\/strong><\/h2>\n\n\n\n<p><em>Simplifying complex code with AI-generated solutions<\/em><\/p>\n\n\n\n<p>This pattern involves replacing complex methods in software applications with LLM-driven solutions. It\u2019s particularly valuable for tasks that benefit from natural language processing capabilities and adaptability to changing requirements.<\/p>\n\n\n\n<p>By leveraging LLMs, you can drastically simplify the readability and maintainability of the methods, making the codebase easier to understand and modify. To ensure reliability, it\u2019s recommended to validate both inputs and outputs, guaranteeing that the LLM\u2019s generated solutions meet the expected standards and integrate seamlessly into your application.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">Input:\ndef extract_financial_data(text):\n    prompt = f<span class=\"hljs-string\">\"\"<\/span><span class=\"hljs-string\">\"\n    Extract the following financial data from the given text:\n    - Revenue\n    - Net Income\n    - Earnings Per Share (EPS)\n    - Debt-to-Equity Ratio\n\n    Text: {text}\n\n    Return the results as a JSON object with the extracted values.\n    If a value is not found, use null.\n    \"<\/span><span class=\"hljs-string\">\"\"<\/span>\n\n    <span class=\"hljs-keyword\">try<\/span>:\n        response = call_llm(prompt)\n        financial_data = json.loads(response)\n        \n        <span class=\"hljs-comment\"># Validate and process the extracted data<\/span>\n        <span class=\"hljs-keyword\">for<\/span> key in &#91;<span class=\"hljs-string\">'Revenue'<\/span>, <span class=\"hljs-string\">'Net Income'<\/span>, <span class=\"hljs-string\">'EPS'<\/span>, <span class=\"hljs-string\">'Debt-to-Equity Ratio'<\/span>]:\n            <span class=\"hljs-keyword\">if<\/span> key not in financial_data:\n                financial_data&#91;key] = None\n        \n        <span class=\"hljs-keyword\">return<\/span> financial_data\n    except <span class=\"hljs-keyword\">Exception<\/span> <span class=\"hljs-keyword\">as<\/span> e:\n        <span class=\"hljs-keyword\">print<\/span>(f<span class=\"hljs-string\">\"Error in LLM processing: {e}\"<\/span>)\n        <span class=\"hljs-keyword\">return<\/span> None\n\n<span class=\"hljs-comment\"># Usage<\/span>\ntext = <span class=\"hljs-string\">\"\"<\/span><span class=\"hljs-string\">\"\nIn the fiscal year 2023, XYZ Corp reported strong financial performance. \nThe company's revenue reached $10.5 billion, up 15% year-over-year. \nNet income increased to $2.1 billion, resulting in an earnings per share \n(EPS) of $4.20. The company maintained a healthy balance sheet with \na debt-to-equity ratio of 0.8.\n\"<\/span><span class=\"hljs-string\">\"\"<\/span>\n\nresult = extract_financial_data(text)\n<span class=\"hljs-keyword\">print<\/span>(json.dumps(result, indent=<span class=\"hljs-number\">2<\/span>))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Output:<\/strong><br><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json\">{\n  <span class=\"hljs-attr\">\"Revenue\"<\/span>: <span class=\"hljs-string\">\"$10.5 billion\"<\/span>,\n  <span class=\"hljs-attr\">\"Net Income\"<\/span>: <span class=\"hljs-string\">\"$2.1 billion\"<\/span>,\n  <span class=\"hljs-attr\">\"EPS\"<\/span>: <span class=\"hljs-string\">\"$4.20\"<\/span>,\n  <span class=\"hljs-attr\">\"Debt-to-Equity Ratio\"<\/span>: <span class=\"hljs-string\">\"0.8\"<\/span>\n}\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\"><strong>3. Context Reducer Pattern<\/strong><\/h2>\n\n\n\n<p><em>Optimizing structured data generation for efficiency and cost-effectiveness<\/em><\/p>\n\n\n\n<p>This pattern addresses the challenges of generating structured data with Generative AI, particularly when dealing with context limitations and output costs. It involves creating a condensed version of the data structure and expanding it in post-processing.<\/p>\n\n\n\n<p><strong>Input:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">unstructured_data = <span class=\"hljs-string\">\"\"<\/span><span class=\"hljs-string\">\"\nJohn Doe, johndoe@email.com, 30 years old, residing in Germany, contact: \n+49 123 456789\nJane Smith, janesmith@email.com, 28 years old, residing in France, contact: \n+33 987 654321\nMike Johnson, mikej@email.com, 35 years old, residing in Spain, contact: \n+34 567 890123\n\"<\/span><span class=\"hljs-string\">\"\"<\/span>\n\nprompt = f<span class=\"hljs-string\">\"\"<\/span><span class=\"hljs-string\">\"\nConvert the following unstructured user data into a reduced JSON structure \nusing these abbreviations:\nn: name\ne: email\na: age\nc: country\np: phone\n\nUnstructured data:\n{unstructured_data}\n\nGenerate the reduced JSON output for all users.\n\"<\/span><span class=\"hljs-string\">\"\"<\/span>\n\n<span class=\"hljs-comment\"># Generate the reduced JSON structure<\/span>\nresponse = call_llm(prompt)\n\ndef expand_keys(data):\n    key_mapping = {<span class=\"hljs-string\">\"n\"<\/span>: <span class=\"hljs-string\">\"name\"<\/span>, <span class=\"hljs-string\">\"e\"<\/span>: <span class=\"hljs-string\">\"email\"<\/span>, <span class=\"hljs-string\">\"a\"<\/span>: <span class=\"hljs-string\">\"age\"<\/span>, <span class=\"hljs-string\">\"c\"<\/span>: <span class=\"hljs-string\">\"country\"<\/span>, \n                   <span class=\"hljs-string\">\"p\"<\/span>: <span class=\"hljs-string\">\"phone\"<\/span>}\n    <span class=\"hljs-keyword\">return<\/span> &#91;{key_mapping.get(k, k): v <span class=\"hljs-keyword\">for<\/span> k, v in item.items()} \n            <span class=\"hljs-keyword\">for<\/span> item in data]\n\nreduced_data = json.loads(response)\nexpanded_data = expand_keys(reduced_data)\n\n<span class=\"hljs-keyword\">print<\/span>(<span class=\"hljs-string\">\"\\nExpanded data:\"<\/span>)\n<span class=\"hljs-keyword\">print<\/span>(json.dumps(expanded_data, indent=<span class=\"hljs-number\">2<\/span>))<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Output:<\/strong><br><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JSON \/ JSON with Comments\" data-shcb-language-slug=\"json\"><span><code class=\"hljs language-json\">&#91;\n  {\n    <span class=\"hljs-attr\">\"name\"<\/span>: <span class=\"hljs-string\">\"John Doe\"<\/span>,\n    <span class=\"hljs-attr\">\"email\"<\/span>: <span class=\"hljs-string\">\"johndoe@email.com\"<\/span>,\n    <span class=\"hljs-attr\">\"age\"<\/span>: <span class=\"hljs-number\">30<\/span>,\n    <span class=\"hljs-attr\">\"country\"<\/span>: <span class=\"hljs-string\">\"Germany\"<\/span>,\n    <span class=\"hljs-attr\">\"phone\"<\/span>: <span class=\"hljs-string\">\"+49 123 456789\"<\/span>\n  },\n  {\n    <span class=\"hljs-attr\">\"name\"<\/span>: <span class=\"hljs-string\">\"Jane Smith\"<\/span>,\n    <span class=\"hljs-attr\">\"email\"<\/span>: <span class=\"hljs-string\">\"janesmith@email.com\"<\/span>,\n    <span class=\"hljs-attr\">\"age\"<\/span>: <span class=\"hljs-number\">28<\/span>,\n    <span class=\"hljs-attr\">\"country\"<\/span>: <span class=\"hljs-string\">\"France\"<\/span>,\n    <span class=\"hljs-attr\">\"phone\"<\/span>: <span class=\"hljs-string\">\"+33 987 654321\"<\/span>\n  },\n  {\n    <span class=\"hljs-attr\">\"name\"<\/span>: <span class=\"hljs-string\">\"Mike Johnson\"<\/span>,\n    <span class=\"hljs-attr\">\"email\"<\/span>: <span class=\"hljs-string\">\"mikej@email.com\"<\/span>,\n    <span class=\"hljs-attr\">\"age\"<\/span>: <span class=\"hljs-number\">35<\/span>,\n    <span class=\"hljs-attr\">\"country\"<\/span>: <span class=\"hljs-string\">\"Spain\"<\/span>, \n    <span class=\"hljs-attr\">\"phone\"<\/span>: <span class=\"hljs-string\">\"+34 567 890123\"<\/span>\n  }\n]\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JSON \/ JSON with Comments<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">json<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\"><strong>4. Comments Replacement Pattern<\/strong><\/h2>\n\n\n\n<p><em>Enhancing code readability in multilingual development environments<\/em><\/p>\n\n\n\n<p>This pattern addresses the challenge of working with codebases containing comments in various languages. It leverages LLMs to translate and adapt comments to a desired language, improving code readability and maintainability.<\/p>\n\n\n\n<p>When using LLMs for this task, generating a patch rather than directly rewriting the entire codebase helps minimize unnecessary changes. This reduces the output to only what\u2019s needed, keeping the process efficient. It\u2019s recommended to thoroughly review the patch to ensure that no unintended code modifications are made in the process.<\/p>\n\n\n\n<p><strong>Input:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">You are an expert polyglot programmer.\nYour task is to translate all comments in the following Python code\nfrom Japanese to English.\nMaintain the original comment structure <span class=\"hljs-keyword\">and<\/span> enhance clarity where possible.\nGenerate a Git patch format output <span class=\"hljs-keyword\">for<\/span> the changes.\n\ndef calculate_total(items):\n    <span class=\"hljs-comment\"># \u30a2\u30a4\u30c6\u30e0\u306e\u5408\u8a08\u91d1\u984d\u3092\u8a08\u7b97\u3059\u308b<\/span>\n    total = <span class=\"hljs-number\">0<\/span>\n    <span class=\"hljs-keyword\">for<\/span> item in items:\n        <span class=\"hljs-comment\"># \u7a0e\u8fbc\u307f\u4fa1\u683c\u3092\u8a08\u7b97<\/span>\n        price_with_tax = item.price * <span class=\"hljs-number\">1.1<\/span>\n        total += price_with_tax\n    <span class=\"hljs-comment\"># \u5408\u8a08\u3092\u8fd4\u3059<\/span>\n    <span class=\"hljs-keyword\">return<\/span> total\n<span class=\"hljs-comment\"># \u30e1\u30a4\u30f3\u51e6\u7406<\/span>\n<span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">\"__main__\"<\/span>:\n    <span class=\"hljs-comment\"># \u30c6\u30b9\u30c8\u30c7\u30fc\u30bf<\/span>\n    test_items = &#91;Item(<span class=\"hljs-number\">100<\/span>), Item(<span class=\"hljs-number\">200<\/span>), Item(<span class=\"hljs-number\">300<\/span>)]\n    result = calculate_total(test_items)\n    <span class=\"hljs-keyword\">print<\/span>(f<span class=\"hljs-string\">\"\u5408\u8a08\u91d1\u984d: {result}\u5186\"<\/span>)\n\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">diff --git a\/sample.py b\/sample.py\nindex abcdef1..ghijklm <span class=\"hljs-number\">100644<\/span>\n--- a\/sample.py\n+++ b\/sample.py\n@@ <span class=\"hljs-number\">-1<\/span>,<span class=\"hljs-number\">13<\/span> +<span class=\"hljs-number\">1<\/span>,<span class=\"hljs-number\">13<\/span> @@\n def calculate_total(items):\n-    <span class=\"hljs-comment\"># \u30a2\u30a4\u30c6\u30e0\u306e\u5408\u8a08\u91d1\u984d\u3092\u8a08\u7b97\u3059\u308b<\/span>\n+    <span class=\"hljs-comment\"># Calculate the total amount for all items<\/span>\n     total = <span class=\"hljs-number\">0<\/span>\n     <span class=\"hljs-keyword\">for<\/span> item in items:\n-        <span class=\"hljs-comment\"># \u7a0e\u8fbc\u307f\u4fa1\u683c\u3092\u8a08\u7b97<\/span>\n+        <span class=\"hljs-comment\"># Calculate price including tax<\/span>\n         price_with_tax = item.price * <span class=\"hljs-number\">1.1<\/span>\n         total += price_with_tax\n-    <span class=\"hljs-comment\"># \u5408\u8a08\u3092\u8fd4\u3059<\/span>\n+    <span class=\"hljs-comment\"># Return the total<\/span>\n     <span class=\"hljs-keyword\">return<\/span> total\n \n-<span class=\"hljs-comment\"># \u30e1\u30a4\u30f3\u51e6\u7406<\/span>\n+<span class=\"hljs-comment\"># Main process<\/span>\n <span class=\"hljs-keyword\">if<\/span> __name__ == <span class=\"hljs-string\">\"__main__\"<\/span>:\n-    <span class=\"hljs-comment\"># \u30c6\u30b9\u30c8\u30c7\u30fc\u30bf<\/span>\n+    <span class=\"hljs-comment\"># Test data<\/span>\n     test_items = &#91;Item(<span class=\"hljs-number\">100<\/span>), Item(<span class=\"hljs-number\">200<\/span>), Item(<span class=\"hljs-number\">300<\/span>)]\n     result = calculate_total(test_items)\n-    <span class=\"hljs-keyword\">print<\/span>(f<span class=\"hljs-string\">\"\u5408\u8a08\u91d1\u984d: {result}\u5186\"<\/span>)\n+    <span class=\"hljs-keyword\">print<\/span>(f<span class=\"hljs-string\">\"Total amount: {result} ye\u00f9n\"<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>The patterns we\u2019ve explored represent just the tip of the iceberg in the rapidly evolving field of AI-assisted software development. As we continue to refine these techniques and develop new ones, we\u2019re witnessing a fundamental shift in how software is created and maintained.<\/p>\n\n\n\n<p>At <a href=\"https:\/\/www.capgemini.com\/\">Capgemini<\/a>, we\u2019re committed to staying at the forefront of this AI revolution in software engineering. We believe that by embracing these patterns and continually innovating, we can create more efficient, robust, and adaptable software solutions for our clients.<\/p>\n\n\n\n<p>As we move forward, it\u2019s crucial to remember that while AI is a powerful tool, it doesn\u2019t replace human creativity and judgment. The most effective approach is a synergy between human expertise and AI capabilities. By mastering these prompt patterns and remaining open to emerging techniques, developers can position themselves at the cutting edge of this exciting new frontier in technology.<\/p>\n\n\n\n<p>The future of software engineering is one of human-AI collaboration, where our creativity and expertise are amplified by the capabilities of artificial intelligence. Are you ready to be part of this revolution?<\/p>\n\n\n\n<div style=\"background-color:#f2f2f2;color:#32373c\" class=\"wp-block-genesis-blocks-gb-profile-box square gb-has-avatar gb-font-size-18 gb-block-profile gb-profile-columns\"><div class=\"gb-profile-column gb-profile-avatar-wrap\"><div class=\"gb-profile-image-wrap\"><figure class=\"gb-profile-image-square\"><img loading=\"lazy\" decoding=\"async\" width=\"1940\" height=\"1940\" class=\"gb-profile-avatar wp-image-29922\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG.jpg\" alt=\"Davide Consonni Capgemini\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG.jpg 1940w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-300x300.jpg 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-1024x1024.jpg 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-150x150.jpg 150w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-768x768.jpg 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-1536x1536.jpg 1536w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-100x100.jpg 100w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-600x600.jpg 600w\" sizes=\"auto, (max-width: 1940px) 100vw, 1940px\" \/><\/figure><\/div><\/div><div class=\"gb-profile-column gb-profile-content-wrap\"><h2 class=\"gb-profile-name\" style=\"color:#32373c\"><a href=\"https:\/\/www.linkedin.com\/in\/davideconsonni\/\" target=\"_blank\" rel=\"noreferrer noopener\">Davide Consonni<\/a><\/h2><p class=\"gb-profile-title\" style=\"color:#32373c\">Head of Cloud Native @<a href=\"https:\/\/www.capgemini.com\/\">Capgemini<\/a><\/p><div class=\"gb-profile-text\"><em>Davide is the Head of Cloud Native at Capgemini, where he leads innovative cloud solutions and strategies. With extensive experience as a People Manager, Engagement Manager, and Cloud Architect, he specializes in optimizing business operations through cutting-edge technology.<\/em><br><br><em>Renowned for his expertise in cloud computing and project management, Davide is dedicated to helping organizations leverage cloud-native architectures. His insights will reshape your understanding of digital transformation and enhance your approach to cloud adoption.<\/em><\/div><ul class=\"gb-social-links\"><\/ul><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction The role of developers is changing rapidly. Those who aren\u2019t ready for this AI-powered future risk becoming extinct, like the Dodo \ud83e\udda4. As Large Language Models (LLMs) improve in their ability to write code, with lower costs and larger context windows, we\u2019re nearing a shift towards Generative AI-driven programming. In this new approach, developers&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/\">Read more<\/a><\/p>\n","protected":false},"author":296,"featured_media":29928,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[46],"tags":[],"collections":[],"class_list":{"0":"post-29919","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ai-ml","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Generative AI Prompt Patterns for Software Engineering - Codemotion Magazine<\/title>\n<meta name=\"description\" content=\"Don&#039;t miss this extensive guide on AI prompt patterns with insights from Davide Consonni, Head of Cloud Native at Capgemini\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Generative AI Prompt Patterns for Software Engineering\" \/>\n<meta property=\"og:description\" content=\"Don&#039;t miss this extensive guide on AI prompt patterns with insights from Davide Consonni, Head of Cloud Native at Capgemini\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-01T07:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-01T17:05:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1792\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Davide Consonni\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Davide Consonni\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/\"},\"author\":{\"name\":\"Davide Consonni\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/0f92e9ce8f638ee2c5c6e43c415158cf\"},\"headline\":\"Generative AI Prompt Patterns for Software Engineering\",\"datePublished\":\"2024-10-01T07:30:00+00:00\",\"dateModified\":\"2024-10-01T17:05:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/\"},\"wordCount\":1167,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp\",\"articleSection\":[\"AI\\\/ML\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/\",\"name\":\"Generative AI Prompt Patterns for Software Engineering - Codemotion Magazine\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp\",\"datePublished\":\"2024-10-01T07:30:00+00:00\",\"dateModified\":\"2024-10-01T17:05:14+00:00\",\"description\":\"Don't miss this extensive guide on AI prompt patterns with insights from Davide Consonni, Head of Cloud Native at Capgemini\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp\",\"width\":1792,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/generative-ai-prompt-patterns-for-software-engineering\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI\\\/ML\",\"item\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/ai-ml\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Generative AI Prompt Patterns for Software Engineering\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#website\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Codemotion.Italy\\\/\",\"https:\\\/\\\/x.com\\\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/#\\\/schema\\\/person\\\/0f92e9ce8f638ee2c5c6e43c415158cf\",\"name\":\"Davide Consonni\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Davide-Consonni-JPG-100x100.jpg\",\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Davide-Consonni-JPG-100x100.jpg\",\"contentUrl\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/Davide-Consonni-JPG-100x100.jpg\",\"caption\":\"Davide Consonni\"},\"description\":\"Davide is the Head of Cloud Native at Capgemini, where he leads innovative cloud solutions and strategies. With extensive experience as a People Manager, Engagement Manager, and Cloud Architect, he specializes in optimizing business operations through cutting-edge technology. Renowned for his expertise in cloud computing and project management, Davide is dedicated to helping organizations leverage cloud-native architectures. His insights will reshape your understanding of digital transformation and enhance your approach to cloud adoption.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/davideconsonni\\\/\"],\"url\":\"https:\\\/\\\/www.codemotion.com\\\/magazine\\\/author\\\/davide-consonni\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Generative AI Prompt Patterns for Software Engineering - Codemotion Magazine","description":"Don't miss this extensive guide on AI prompt patterns with insights from Davide Consonni, Head of Cloud Native at Capgemini","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/","og_locale":"en_US","og_type":"article","og_title":"Generative AI Prompt Patterns for Software Engineering","og_description":"Don't miss this extensive guide on AI prompt patterns with insights from Davide Consonni, Head of Cloud Native at Capgemini","og_url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2024-10-01T07:30:00+00:00","article_modified_time":"2024-10-01T17:05:14+00:00","og_image":[{"width":1792,"height":1024,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp","type":"image\/webp"}],"author":"Davide Consonni","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Davide Consonni","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/"},"author":{"name":"Davide Consonni","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/0f92e9ce8f638ee2c5c6e43c415158cf"},"headline":"Generative AI Prompt Patterns for Software Engineering","datePublished":"2024-10-01T07:30:00+00:00","dateModified":"2024-10-01T17:05:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/"},"wordCount":1167,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp","articleSection":["AI\/ML"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/","url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/","name":"Generative AI Prompt Patterns for Software Engineering - Codemotion Magazine","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp","datePublished":"2024-10-01T07:30:00+00:00","dateModified":"2024-10-01T17:05:14+00:00","description":"Don't miss this extensive guide on AI prompt patterns with insights from Davide Consonni, Head of Cloud Native at Capgemini","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp","width":1792,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/generative-ai-prompt-patterns-for-software-engineering\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"AI\/ML","item":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/"},{"@type":"ListItem","position":3,"name":"Generative AI Prompt Patterns for Software Engineering"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/0f92e9ce8f638ee2c5c6e43c415158cf","name":"Davide Consonni","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-100x100.jpg","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-100x100.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/Davide-Consonni-JPG-100x100.jpg","caption":"Davide Consonni"},"description":"Davide is the Head of Cloud Native at Capgemini, where he leads innovative cloud solutions and strategies. With extensive experience as a People Manager, Engagement Manager, and Cloud Architect, he specializes in optimizing business operations through cutting-edge technology. Renowned for his expertise in cloud computing and project management, Davide is dedicated to helping organizations leverage cloud-native architectures. His insights will reshape your understanding of digital transformation and enhance your approach to cloud adoption.","sameAs":["https:\/\/www.linkedin.com\/in\/davideconsonni\/"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/davide-consonni\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--600x400.webp","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--600x600.webp","author_info":{"display_name":"Davide Consonni","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/davide-consonni\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp",1792,1024,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--150x150.webp",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--300x171.webp",300,171,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--768x439.webp",768,439,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--1024x585.webp",1024,585,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--1536x878.webp",1536,878,true],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines-.webp",1792,1024,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--100x100.webp",100,100,true],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--180x128.webp",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--896x504.webp",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--400x225.webp",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--600x400.webp",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2024\/09\/DALL\u00b7E-2024-09-30-17.05.08-A-simplified-conceptual-widescreen-design-representing-AI-generative-patterns.-The-image-focuses-on-minimalistic-abstract-shapes-and-flowing-lines--600x600.webp",600,600,true]},"uagb_author_info":{"display_name":"Davide Consonni","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/davide-consonni\/"},"uagb_comment_info":0,"uagb_excerpt":"Introduction The role of developers is changing rapidly. Those who aren\u2019t ready for this AI-powered future risk becoming extinct, like the Dodo \ud83e\udda4. As Large Language Models (LLMs) improve in their ability to write code, with lower costs and larger context windows, we\u2019re nearing a shift towards Generative AI-driven programming. In this new approach, developers&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/29919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/296"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=29919"}],"version-history":[{"count":3,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/29919\/revisions"}],"predecessor-version":[{"id":29951,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/29919\/revisions\/29951"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/29928"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=29919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=29919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=29919"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=29919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}