37 AI Prompts for Functions & Logic

The best Functions & Logic prompts in the Coding library. Tested on ChatGPT, Claude, Gemini and every major model.

Browse the prompts

## Role
You are an ML pipeline architect specializing in production-grade scikit-learn preprocessing. Your expertise is in building modular, leak-free data transformations that prevent train-test contamination and survive production deployment.

## Task
Guide the user through building a custom preprocessing pipeline using scikit-learn's transformer API. Analyze their data landscape, then architect a modular pipeline with the optimal number of phases (typically 3โ€“15) determined by data complexity, transformation needs, and production constraints.

## Context
The user needs a preprocessing solution tailored to:

{{data-and-problem-description}}

**Expected details:** data types present (numerical, categorical, text, datetime, etc.); target variable and ML task (regression, classification, clustering, etc.); known data quality issues (missing values, outliers, class imbalance, etc.); any pr

Build Preprocessing Pipelines for Machine Learning

Generates production-grade scikit-learn preprocessing pipelines that prevent train-test leakage and handle diverse data types. Runs on ChatGPT, Claude, and code-focused LLMs.

35
## Role

You are an expert ML Systems Architect specializing in production machine learning deployment. Your focus is building robust prediction functions that handle edge cases, maintain training-inference consistency, and fail gracefully under production conditions.

## Task

Guide the user through building a production-grade ML prediction function. For each phase, analyze what could break, what monitoring is needed, and what edge cases may emerge in production.

Adapt your approach based on the user's infrastructure maturity, model complexity, production environment constraints, and monitoring needs.

## Process

Work through phases dynamically (typically 5-12 phases depending on complexity):

**Phase 1: Model Architecture Discovery**  
Gather requirements:
- Model type (neural network, tree-based, linear, etc.)
- Expected input format (data types, shapes, features)
- Production envir

Build ML Prediction Function

Guides you through building a production-grade machine learning prediction function with input validation, error handling, monitoring, and edge case management. Runs on ChatGPT, Claude, and Cursor to generate Python code.

34

Create Function Templates With Single Responsibility

Generates clean, single-purpose function templates in any language that enforce the Single Responsibility Principle through structured documentation, intent-revealing naming, and guard clauses. Outputs production-ready code for ChatGPT, Claude, or Cursor.

27

C++ Algorithm Solution Expert

Generate a C++ code solution for algorithmic problems, meeting time complexity constraints and written in IOI/ACM style with detailed comments.

7

Nuclei Security Template Rule Writer

Generate a production-ready YAML Nuclei template for identifying specific security vulnerabilities. This prompt is for cybersecurity professionals using Nuclei.

6
# Animated Rรฉsumรฉ Showcase โ€“ Self-Rendering Motion Graphic

Generate a complete, self-contained HTML file that renders a 15-second motion graphic at 1920ร—1080, 60 fps. The animation must be driven by a single `seek(t)` function where `t` ranges from 0 to 15 seconds, enabling frame-perfect playback via Playwright screenshot loops and ffmpeg encoding.

## Technical Requirements

- **Duration:** 15 seconds exactly
- **Resolution:** 1920ร—1080 pixels
- **Frame rate:** 60 fps
- **Audio:** Original synthesized soundtrack at 128 BPM (8 beats per 15 seconds; one beat every 1.875 seconds)
- **Structure:** Single HTML file with `<canvas>` element; all rendering logic in a `seek(t)` function that draws the frame for time `t`
- **Easing:** Use spring physics (damped oscillation) for all motionโ€”no linear interpolation
- **Beat sync:** Every major state transition and visual emphasis must land exactly 

Fifteen-Second Seek-Function Motion Video

Generate a complete self-contained HTML file rendering a precise 15-second motion graphic animation.

5
You are an elite software engineer specializing in secure, maintainable code architecture. You receive a project snapshot as JSON and produce precise file modifications using a structured API.

# INPUT FORMAT

You will receive a JSON array containing:

1. **Project structure** (`"type": "directory"`) - the current codebase hierarchy with file contents
2. **Summary report** (`"type": "report"`) - counts of directories and files
3. **Change instructions** (`"type": "instructions"`, `"name": "code_change_instructions"`) - the `"details"` field contains what needs to be changed

# YOUR TASK

Analyze the project structure and implement the requested changes following these principles:

**Security & Quality Standards:**
- Treat all external input as untrusted; validate and sanitize rigorously
- Follow language-specific security best practices (SQL injection prevention, XSS protection, etc.)
- 

Secure Coding Feature Generator

Generate secure and composable code features using structured JSON input for project modifications.

5

Programmatic Vertical Music Video Pipeline

Generate a production-ready codebase for transforming a song into a vertical music video using automated scene generation with Three.js.

5

Beat-Synced Procedural Video Renderer

Generate a Rust program to render SVG videos synchronizing animations to a 128 BPM beat grid.

4
# ROLE

You are an expert SIEM detection engineer specializing in translating threat intelligence into actionable detection rules. You analyze security publications and extract observable Tactics, Techniques, and Procedures (TTPs), then encode them as precise, host-based Sigma detection rules.

# TASK

Analyze the provided security publication and extract all identifiable TTPs suitable for host-based detection. For each TTP, produce a complete Sigma rule in YAML format that targets telemetry from Sysmon, PowerShell logging, or Windows event logs (Security, System, Application).

# INPUT

{{security-publication}}

# ANALYSIS REQUIREMENTS

- **Extract TTPs**: Identify specific adversary techniques mentioned or impliedโ€”process executions, command patterns, registry modifications, network connections, file operations, service manipulations, scheduled tasks, etc.
- **Prioritize observability*

SIEM Detection Rules From News

Generate Sigma detection rules from security news publications, extracting Tactics, Techniques, and Procedures (TTPs) and focusing on host-based detections such as Sysmon and PowerShell logging.

4
You are an expert creative coder specializing in procedural animation and command-line video production pipelines.

# Task
Generate a complete, production-ready code package for rendering a procedural animation to MP4 video with synchronized generative audio. The output must include:

1. **HTML/JavaScript animation engine** โ€“ A single-file webpage that renders pure code-driven animation where every frame is deterministically calculated from a time parameter (no CSS animations, no requestAnimationFrame drift)
2. **Playwright capture script** โ€“ Headless Chrome automation that steps through frames, captures screenshots at precise intervals, and exports a numbered image sequence
3. **ffmpeg assembly command** โ€“ Shell command that stitches frames into MP4 with motion blur, correct frame rate, and muxes the generated audio track
4. **Audio generation** โ€“ Code (Web Audio API or separate script)

Frame-Perfect Code Animation To MP4 Pipeline

Generate a complete code package for rendering procedural animations to MP4 video, including sound, using HTML, JavaScript, Playwright, and ffmpeg.

4

Beat-Analyzed Square Motion Design

Generate Python code for a 30-second motion design video that syncs with music, featuring complex animation and visual effects.

3

Pure Function Frame Pipeline For Music Video

Generate a pure function frame video that synchronizes UI animations to a musical beat grid using a single HTML file.

1

What are AI prompts for Functions & Logic?

AI prompts for Functions & Logic are engineered instructions that already work. These are not one-line questions. Each one fixes the role, the context, the task and the output format before you type a word, so you get a usable result on the first run instead of the fourth.

They cover the work Functions & Logic actually get asked for: research and briefs, copy and content, analysis and reporting, planning, outreach and the admin that eats the day. Open a card to see the full prompt and the output it returns.

Popular on this page right now: "Build Preprocessing Pipelines for Machine Learning", "Build ML Prediction Function", "Create Function Templates With Single Responsibility".

37 on this page, every one scoped to Functions & Logic. Free to read, free to copy.

Why these prompts work for Functions & Logic

A weak prompt costs you the hour you were trying to save: you rewrite it three times, get something generic, then finish the job by hand. An engineered prompt front-loads that thinking once.

In Functions & Logic that means first drafts you can send, analysis you can act on, and the repetitive work handed off, so the time goes into judgement instead of typing.

Every prompt here was written for a real job and tested against the models people actually use. Nothing scraped from a thread.

How to use these prompts

Open a prompt, copy it, and replace the [bracketed] variables with your own product, audience or topic. The structure around them stays as is. That structure is the part doing the work.

Paste it into ChatGPT, Claude, Gemini, Grok or the model you already use. If the output drifts, tighten the context line instead of rewriting the whole prompt.

No account needed to copy one. No setup, no extension, nothing to install.

Which AI tool works best for Functions & Logic prompts?

Text prompts here run well in ChatGPT, Claude, Gemini and Grok; image prompts target Midjourney and Nano Banana. Each card lists the models it was tested with.

Are these AI prompts free to use?

A big part of the library is free: open a prompt, copy it, use it. Premium packs and the Complete AI Bundle unlock the full collection with lifetime updates.

How do I adapt these prompts to my use case?

Start with the [variables]: niche, audience, constraints. If the result still misses, add one example of the output you want. A single good example beats three extra instructions.

For a prompt built from scratch, the Start Now card above opens the custom prompt generator.

Related resources

Get smarter on AI every week

One email a week with the best new prompts, tools, and model updates. Unsubscribe anytime.

Join 100,000+ subscribers. One email a week, real prompts, tools, and model updates. Unsubscribe anytime.