Best Practices

Build like a Xano expert. Master the iterative workflow that gets results.

The Golden Rule: Small Changes, Fast Feedback

The pattern that works:

  1. Make a small change
  2. cURL test it
  3. Verify it works
  4. Build on it

Why this matters:

  • Isolates issues early
  • Faster debugging
  • Better results
  • Less backtracking
  • Confidence at each step

The Iterative Approach

Example: Building Authentication

❌ Wrong approach (all at once):

You: "Create a complete authentication system with email/password, 
JWT tokens, email verification, password reset, 2FA, role-based 
permissions, and session management"

What happens:

  • AI generates complex system
  • Something breaks
  • Hard to debug what went wrong
  • Backtrack and start over

✅ Right approach (incremental):

Step 1:
You: "Create a users table with email and password fields"
AI: [Creates table]
✓ Verified in Xano

Step 2:
You: "Add a login endpoint that returns a JWT token"
AI: [Creates endpoint]
cURL test:
curl -X POST https://your-instance.xano.io/api:v1/login \
  -d '{"email":"test@example.com","password":"test123"}'
✓ Returns token

Step 3:
You: "Add bcrypt password hashing to the login"
AI: [Updates endpoint]
cURL test:
curl -X POST https://your-instance.xano.io/api:v1/login \
  -d '{"email":"test@example.com","password":"test123"}'
✓ Still works, now hashed

Step 4:
You: "Add email uniqueness validation"
AI: [Adds validation]
cURL test:
curl -X POST https://your-instance.xano.io/api:v1/register \
  -d '{"email":"test@example.com","password":"test123"}'
✓ Rejects duplicates

Step 5:
You: "Add a protected /me endpoint that requires auth"
AI: [Creates authenticated endpoint]
cURL test:
curl https://your-instance.xano.io/api:v1/me \
  -H "Authorization: Bearer YOUR_TOKEN"
✓ Returns user data

Result: Complete auth system, every step tested and working


Testing Best Practices

Test Every Change

After each AI response:

  1. Get the cURL command (AI provides it)
  2. Run it immediately (in terminal)
  3. Verify the response (check structure and data)
  4. Only then continue (don’t stack untested changes)

Example Testing Session

You: "Create a products list endpoint with pagination"

AI: Created GET /products/list
Test with:
curl "https://your-instance.xano.io/api:v1/products/list?page=1&per_page=10"

You: [Runs cURL]
Response: {
  "items": [],
  "pagination": {"page": 1, "total": 0}
}
✓ Structure looks good

You: "Add search by product name"

AI: Updated GET /products/list
Test with:
curl "https://your-instance.xano.io/api:v1/products/list?search=laptop&page=1"

You: [Runs cURL]
Response: {
  "items": [...],
  "pagination": {"page": 1, "total": 5}
}
✓ Search working

You: "Add filter by category"

AI: Updated GET /products/list
Test with:
curl "https://your-instance.xano.io/api:v1/products/list?category=electronics&page=1"

You: [Runs cURL]
Response: {
  "items": [...],
  "pagination": {"page": 1, "total": 12}
}
✓ Filtering working

Testing Edge Cases

Don’t just test happy paths:

Test boundary conditions:

# Empty search
curl "https://your-instance.xano.io/api:v1/products/list?search="
 
# Invalid page number
curl "https://your-instance.xano.io/api:v1/products/list?page=-1"
 
# Large per_page value
curl "https://your-instance.xano.io/api:v1/products/list?per_page=1000"
 
# Special characters in search
curl "https://your-instance.xano.io/api:v1/products/list?search=test%20%26%20stuff"

Ask AI to handle edge cases:

You: "The endpoint should limit per_page to maximum 100"
AI: [Updates validation]

You: "Return empty array if search has no results, not an error"
AI: [Updates response logic]

When Something Breaks

The Debug Pattern

1. Identify what changed You know the last thing you asked for - that’s likely the issue.

2. Ask for specific help

You: "That returned a 500 error. Can you check the logs?"
AI: [Reviews Xano logs, identifies issue]

You: "The pagination broke. Revert to the previous version"
AI: [Removes last change]

You: "Show me the XanoScript that was generated"
AI: [Displays XanoScript with issue highlighted]

3. Test the revert

curl "https://your-instance.xano.io/api:v1/products/list?page=1"
# Should work again

4. Fix and retry

You: "Let's try adding pagination differently. Use the default Xano pagination"
AI: [Implements different approach]
cURL test: ✓ Working

Example: Debugging Session

You: "Add sorting by price"
AI: [Updates endpoint]

cURL test:
curl "https://your-instance.xano.io/api:v1/products/list?sort=price"
Response: 500 Internal Server Error
✗ Broken

You: "That broke. What's the error in Xano logs?"
AI: Error: Invalid sort field 'price'. Field name is 'product_price'

You: "Update the sort to use 'product_price'"
AI: [Fixes field name]

cURL test:
curl "https://your-instance.xano.io/api:v1/products/list?sort=product_price"
Response: { "items": [...] }
✓ Working

Prompt Patterns That Work

Be Specific About What You Want

❌ Too vague:

"Create a database"
"Make some APIs"
"Add authentication"

✅ Specific and clear:

"Create a users table with email (unique), name, and password (hashed) fields"
"Generate CRUD endpoints for products with search by name and filter by category"
"Add JWT authentication to the products endpoints with 24-hour token expiry"

Ask for One Thing at a Time

❌ Multiple requests:

"Create a products table, add CRUD endpoints, add authentication, 
integrate Stripe, and send email confirmations"

✅ One request:

"Create a products table with name, price, description, and stock fields"

Then after testing:

"Generate CRUD endpoints for the products table with pagination"

Then after testing:

"Add authentication to the create, update, and delete endpoints"

Request Testing Information

Include testing in your requests:

"Create a login endpoint and give me a cURL command to test it"

"Add pagination to products list. Show me examples with page=1 and page=2"

"Create a Stripe webhook endpoint. Provide a test payload I can use"

Workflow Patterns

Starting a New Project

1. Explore your workspace

You: "Show me my current tables and API groups"

2. Plan your data model

You: "Create a users table with..."
You: "Create a products table with..."
You: "Create an orders table with..."

3. Build basic endpoints

You: "Create simple CRUD for users"
You: "Create simple CRUD for products"

4. Add complexity gradually

You: "Add search to products list"
You: "Add filters by category and price range"
You: "Add authentication to protected endpoints"

Adding Features to Existing Project

1. Review what exists

You: "What endpoints exist in the products API group?"

2. Test current functionality

curl "https://your-instance.xano.io/api:v1/products/list"
# Understand current behavior

3. Describe the addition

You: "Add a 'featured' boolean field to products table"

4. Update endpoints

You: "Update the products list to allow filtering by featured=true"

5. Test the changes

curl "https://your-instance.xano.io/api:v1/products/list?featured=true"

Refactoring Existing Code

1. Ask AI to review

You: "Review the products list endpoint. What could be improved?"

2. Make targeted improvements

You: "Add better error handling for invalid page numbers"
You: "Optimize the database query to use indexes"

3. Test each improvement

# Test edge cases after each change
curl "https://your-instance.xano.io/api:v1/products/list?page=invalid"

Using Claude Code Effectively

Terminal access:

  • AI gives cURL command
  • You run it in same window
  • Immediate feedback loop
  • Natural conversation flow

Better workflow:

You: "Create products list endpoint"

AI: Created endpoint. Test with:
curl "https://your-instance.xano.io/api:v1/products/list?page=1"

[Claude Code can run this for you]

Response: { "items": [...] }

You: "Perfect. Now add search functionality"

Using the Terminal Effectively

Ask AI to generate commands:

You: "Create a test script that adds 5 sample products"
AI: [Generates bash script with multiple cURL commands]

Request different test formats:

You: "Show me how to test this endpoint with Postman"
You: "Give me a Python script to test all the endpoints"
You: "Create a JavaScript fetch example for my frontend"

Batch Testing

Create test suites:

You: "Create a bash script that tests all CRUD operations for products"

AI: [Generates comprehensive test script]

#!/bin/bash
# Test Create
curl -X POST https://your-instance.xano.io/api:v1/products \
  -d '{"name":"Test","price":10}'

# Test Read
curl "https://your-instance.xano.io/api:v1/products/1"

# Test Update  
curl -X PUT https://your-instance.xano.io/api:v1/products/1 \
  -d '{"price":15}'

# Test Delete
curl -X DELETE https://your-instance.xano.io/api:v1/products/1

Advanced Patterns

Building Complex Features Incrementally

Example: E-commerce checkout flow

Step 1: Basic cart
You: "Create a cart_items table with user_id, product_id, quantity"
✓ Test table creation

Step 2: Add to cart endpoint
You: "Create endpoint to add items to cart"
✓ Test adding items

Step 3: View cart
You: "Create endpoint to get user's cart with product details"
✓ Test cart retrieval

Step 4: Calculate totals
You: "Add total price calculation to cart endpoint"
✓ Test price calculations

Step 5: Checkout
You: "Create checkout endpoint that creates order from cart"
✓ Test order creation

Step 6: Payment
You: "Integrate Stripe payment to checkout"
✓ Test with Stripe test cards

Step 7: Webhooks
You: "Add webhook to handle payment confirmations"
✓ Test with Stripe webhook tester

Each step builds on tested, working code.

Handling External Integrations

Pattern: Test external APIs separately first

Step 1: Test API access
You: "Create a test endpoint that calls the Stripe API"
cURL test: ✓ Can reach Stripe

Step 2: Parse response
You: "Update to parse and return the customer data"
cURL test: ✓ Data structure correct

Step 3: Integrate with your data
You: "Store the Stripe customer ID in users table"
cURL test: ✓ Data persisting

Step 4: Add error handling
You: "Handle Stripe API errors gracefully"
cURL test: ✓ Errors handled

Database Design Iteration

Don’t finalize schema too early:

You: "Create a basic products table"
[Build some features]

You: "Add a 'category' field to products"
[Test with categories]

You: "Actually, let's make categories a separate table with relationships"
AI: [Refactors to use foreign keys]
[Test with relational queries]

You: "Add a many-to-many relationship for product tags"
[Build and test tagging system]

It’s okay to evolve your schema as you learn what you need.


Common Pitfalls to Avoid

Don’t Stack Untested Changes

❌ Bad:

You: "Create users table"
You: "Add products table"
You: "Create orders table"  
You: "Generate all CRUD endpoints"
You: "Add authentication everywhere"
[Now test]
[Something doesn't work - which part?]

✅ Good:

You: "Create users table"
[Test: ✓]

You: "Add products table"
[Test: ✓]

You: "Create orders table"
[Test: ✓]

You: "Generate CRUD for products"
[Test: ✓]

Don’t Ignore Errors

When you see an error:

  1. Don’t push forward with more changes
  2. Do stop and debug immediately
  3. Do ask AI to explain the error
  4. Do test the fix before continuing

Example:

cURL response: 500 error
You: ❌ "Okay, now also add search functionality"  
     [Compounding the problem]

You: ✓ "That returned 500. Check the Xano logs"
     [Fixing before continuing]

Don’t Assume AI Remembers Everything

AI can forget context. Remind it:

You: "We created a users table earlier with email and password fields. 
      Now add a 'name' field to that table."

Be explicit about which resources:

You: "Update the /products/list endpoint (not the /products/:id endpoint) 
      to include pagination"

Don’t Skip the Review Step

Before deploying complex changes:

You: "Show me the SDK code for this endpoint before deploying"
AI: [Shows code]

You: "Change the validation to require minimum 8 characters"
AI: [Updates code]

You: "Looks good. Deploy it"
AI: [Deploys]

Productivity Tips

Use AI to Generate Bulk Test Data

You: "Create a script that adds 50 sample products with realistic data"
AI: [Generates seeding script]
[Run script]
[Now you have data to test pagination, search, etc.]

Ask for Documentation

You: "Document all the products endpoints with example requests and responses"
AI: [Generates API documentation]

Request Refactoring Suggestions

You: "Review the products endpoints and suggest performance improvements"
AI: [Analyzes and suggests optimizations]

Generate Frontend Integration Code

You: "Create a TypeScript service class for calling the products API from Next.js"
AI: [Generates type-safe service layer]

Measuring Success

You’re doing it right when:

  • ✓ Every change is tested before the next
  • ✓ You can explain what each endpoint does
  • ✓ Debugging takes minutes, not hours
  • ✓ You’re building confidence with each step
  • ✓ The Xano GUI shows clean, reviewable logic

You need to adjust when:

  • ✗ Multiple untested changes stacked up
  • ✗ Not sure which change caused an error
  • ✗ Spending more time debugging than building
  • ✗ Can’t explain what the code does
  • ✗ Xano GUI shows messy, hard-to-follow logic

Next Steps

Continue Learning

Start Building

You now know:

  • ✓ The iterative workflow pattern
  • ✓ How to test each change
  • ✓ When something breaks, how to debug
  • ✓ Prompt patterns that work
  • ✓ Common pitfalls to avoid

The best way to master this: Build something real.

Start small, test everything, build incrementally. You’ve got this.