- Get link
- X
- Other Apps
🧠Master Class: Steering Your AI Coding Assistant
Steering is about guiding the AI step-by-step, especially within your IDE where it can see your existing code. By providing the logic "skeleton" via comments, you turn the AI into a powerful pair programmer that handles syntax while you handle architecture.
1. Inline Steering with Comments
This is the most powerful technique for real-time coding assistance. You write the "What" in comments, and the AI fills in the "How."
A. Step-by-Step Logic Guidance
def process_orders(orders):
# First, filter out cancelled orders (status = 'cancelled')
active_orders = [order for order in orders if order['status'] != 'cancelled']
# Then, calculate total for each order (price * quantity)
for order in active_orders:
order['total'] = order['price'] * order['quantity']
# Now, group orders by customer_id and sum their totals
customer_totals = {}
for order in active_orders:
customer_id = order['customer_id']
# If customer doesn't exist, initialize to 0
if customer_id not in customer_totals:
customer_totals[customer_id] = 0
customer_totals[customer_id] += order['total']
return customer_totals
B. Data Transformation Pipeline
def clean_dataset(raw_data):
# Step 1: Remove rows with any null values
cleaned = [row for row in raw_data if all(val is not None for val in row.values())]
# Step 2: Convert "$XX.XX" strings to float
for row in cleaned:
if isinstance(row['price'], str) and row['price'].startswith('$'):
row['price'] = float(row['price'].replace('$', ''))
# Step 3: Normalize email addresses to lowercase
for row in cleaned:
if 'email' in row:
row['email'] = row['email'].lower().strip()
return cleaned
2. File-Level Steering with Context
Use docstrings and TODOs to define the "soul" of a new file before logic is written.
Creating New Utility Files (auth_utils.py)
"""
Authentication utilities for the Flask application.
Uses JWT tokens and bcrypt for password hashing.
"""
# TODO: Import necessary libraries (jwt, bcrypt, datetime)
def hash_password(password: str) -> str:
"""Hash a password using bcrypt with salt"""
pass
def verify_jwt_token(token: str, secret: str) -> dict:
"""Verify and decode JWT token"""
pass
3. API & Database Development Steering
Steer toward validation and security requirements within specific routes.
Express.js Route with Validation:
// POST /api/users - Create a new user
router.post('/users', async (req, res) => {
// 1. Validate request body (name, email, password)
// 2. Validate email format using regex
// 3. Check if user already exists in DB
// 4. Hash the password using bcrypt (10 rounds)
// 5. Generate JWT token and return 201 response
});
💡 Pro Steering Techniques
- The "Fill-in-the-Blanks" Pattern: Initialize a class and use
# TODOorpassto invite the AI to implement specific methods based on your configuration. - The "Fix This Code" Pattern: Paste buggy code and add a
// BUG:comment. The AI will prioritize fixing that specific issue over a generic rewrite.
Happy Prompting! — STEERING AI Coding Assistant
Comments