Asoba Zorora Documentation

Code Development Use Case

Use Zorora’s /develop workflow for multi-step code development.

Scenario

You have a Flask application and want to add user authentication with JWT tokens, password hashing, and protected routes. You need to:

Code Development Example Screenshot
(Placeholder - Add screenshot showing /develop workflow for code development)

Step-by-Step Guide

Step 1: Start Development Workflow

Terminal:

zorora
[1] ⚙ > /develop Add user authentication to my Flask app with JWT tokens and password hashing

Step 2: Pre-flight Checks

What happens:

Output:

[Phase 0/5] Pre-flight checks...
✓ Git repository found
⚠ Uncommitted changes detected
Proceed? (yes/no)

Step 3: Codebase Exploration

What happens:

Output:

[Phase 1/5] Exploring codebase...
✓ Detected Flask project
✓ Found app.py, requirements.txt
✓ Identified existing routes: /, /api/data
✓ Dependencies: Flask, requests

Step 4: Planning

What happens:

Output:

[Phase 2/5] Creating development plan...

Plan:
1. Create models/user.py (User model with password hashing)
2. Create routes/auth.py (authentication routes: login, register, logout)
3. Create utils/jwt.py (JWT token generation and validation)
4. Modify app.py (add auth blueprint, protect routes)
5. Update requirements.txt (add flask-jwt-extended, bcrypt)
6. Create tests/test_auth.py (unit tests for authentication)

Dependencies to add:
- flask-jwt-extended
- bcrypt
- python-dotenv (for JWT secret)

Step 5: User Approval

What happens:

Output:

[Phase 3/5] Approval required

Files to create:
- models/user.py
- routes/auth.py
- utils/jwt.py
- tests/test_auth.py

Files to modify:
- app.py
- requirements.txt

Dependencies to add:
- flask-jwt-extended
- bcrypt
- python-dotenv

Approve? (yes/no/modify)

User Response:

yes

Step 6: Execution

What happens:

Output:

[Phase 4/5] Executing plan...
✓ Created models/user.py
✓ Created routes/auth.py
✓ Created utils/jwt.py
✓ Modified app.py
✓ Updated requirements.txt
✓ Created tests/test_auth.py

Step 7: Lint & Validate

What happens:

Output:

[Phase 5/5] Linting and validation...
✓ Ruff: No issues
✓ Syntax: Valid
✓ Imports: Resolved

Example Generated Code

models/user.py

from werkzeug.security import generate_password_hash, check_password_hash
from datetime import datetime

class User:
    def __init__(self, username, email, password):
        self.username = username
        self.email = email
        self.password_hash = generate_password_hash(password)
        self.created_at = datetime.now()
    
    def check_password(self, password):
        return check_password_hash(self.password_hash, password)

routes/auth.py

from flask import Blueprint, request, jsonify
from models.user import User
from utils.jwt import generate_token, verify_token

auth_bp = Blueprint('auth', __name__)

@auth_bp.route('/register', methods=['POST'])
def register():
    data = request.get_json()
    user = User(data['username'], data['email'], data['password'])
    # Save user to database
    token = generate_token(user.username)
    return jsonify({'token': token}), 201

@auth_bp.route('/login', methods=['POST'])
def login():
    data = request.get_json()
    user = User.find_by_username(data['username'])
    if user and user.check_password(data['password']):
        token = generate_token(user.username)
        return jsonify({'token': token}), 200
    return jsonify({'error': 'Invalid credentials'}), 401

Best Practices

Writing Development Requests

Be Specific:

Include Requirements:

Specify Framework:

Reviewing Plans

Check File Changes:

Review Dependencies:

Approve Carefully:

After Execution

Review Generated Code:

Run Tests:

Commit Changes:

git add .
git commit -m "Add user authentication"

Advanced Usage

Complex Features

Multi-File Changes:

/develop Refactor the API to use async/await and add comprehensive error handling

With Testing:

/develop Add user authentication with unit tests achieving 80% coverage

Iterative Development

Step 1: Initial Implementation

/develop Add basic user authentication

Step 2: Enhancements

/develop Add password reset functionality to existing auth system

Step 3: Testing

/develop Add integration tests for authentication endpoints

Troubleshooting

Plan Not Accurate

Problem: Generated plan doesn’t match request

Solution:

Execution Fails

Problem: Code execution fails

Solution:

Lint Errors

Problem: Linter reports errors

Solution:

See Also