Skip to content

Latest commit

 

History

History
200 lines (155 loc) · 7.61 KB

DEFAULT_TASK_WORKFLOW.md

File metadata and controls

200 lines (155 loc) · 7.61 KB

Development Workflow

This document outlines the development workflow for this project when working with Claude Code.

Before Starting Each Task

CRITICAL: Git branch management

  1. Check for uncommitted changes:

    git status
  2. If there are uncommitted changes:

    • Review all changes with the user
    • Ask whether to commit them or discard them
    • WAIT for user decision before proceeding
    • If committing: use conventional commit messages
    • If discarding: use git restore <file> or git clean -fd for untracked files
  3. Create a new branch for the task:

    git checkout -b task/<task-number>-<brief-description>
    • Example: git checkout -b task/1-create-swiftdata-models
    • Example: git checkout -b task/4-build-week-header-view

During Task Execution

  1. Use TodoWrite tool to track task progress
  2. Make small, focused commits as you complete logical units of work:
    • Prefer multiple small commits over one large commit
    • Each commit should represent a single, coherent change
    • Stack commits to build up functionality incrementally
    • Examples:
      • ✅ Commit 1: "refactor: simplify Task initializer"
      • ✅ Commit 2: "fix: force Monday as first weekday"
      • ❌ Avoid: One commit with "refactor Task + fix calendar + update docs"
  3. Build frequently to catch compilation errors early

After Completing Each Task

IMPORTANT: Always perform these steps after each task completion:

  1. Build the project to verify compilation:

    cd BulletJournalTodos
    # Default to iPhone 17 (iOS 26) for testing
    xcodebuild -scheme BulletJournalTodos -sdk iphonesimulator \
      -destination 'platform=iOS Simulator,name=iPhone 17' build
  2. Run unit tests to verify correctness:

    # From project root (bullet-journal-todos-swiftui/)
    xcodebuild test -scheme BulletJournalTodos \
      -project BulletJournalTodos/BulletJournalTodos.xcodeproj \
      -destination 'platform=iOS Simulator,name=iPhone 17'
    • All tests must pass before proceeding
    • If tests fail, fix the issues and re-run
    • Test output will show which specific tests failed and why
  3. Run the app in iOS Simulator for user review:

    # Boot an iOS 17+ simulator if needed
    open -a Simulator
    
    # Find the built app (adjust path based on your build)
    APP_PATH="./build/Build/Products/Debug-iphonesimulator/BulletJournalTodos.app"
    
    # Install and launch app
    xcrun simctl install booted "$APP_PATH"
    xcrun simctl launch booted com.vivqu.BulletJournalTodos
  4. Take a screenshot (optional, for documentation):

    xcrun simctl io booted screenshot screenshot-task-<N>.png
    • IMPORTANT: Screenshots are for testing documentation only
    • Never commit screenshots to git
    • Before merging into main, delete all screenshot files:
      git rm screenshot-*.png
      # Or if not yet committed:
      rm screenshot-*.png
  5. Wait for user approval before proceeding to the next task

    • User will review the running app in simulator
    • User may request changes or approve to continue
  6. Review code for style and language compliance:

    • Review all modified Swift files against the style guide in docs/swift.md
    • Fix any violations (e.g., force unwrapping, naming conventions, etc.)
    • Ensure code follows Swift best practices and project conventions
    • Re-run tests after style fixes to verify correctness
  7. After user approval, update plan.md:

    • Mark the completed task with [x] in plan.md
    • Example: Change - [ ] 1. Create SwiftData models to - [x] 1. Create SwiftData models
    • This keeps the plan in sync with actual progress
  8. Clean up temporary documentation files:

    • Review all files created during the task
    • Delete task-specific temporary files (e.g., TASK_23_SUMMARY.md, TESTING_LIMITATIONS.md)
    • Ask the user: "Should I synthesize the content from [temporary file names] into a reusable docs/ page (or add to an existing one)?"
    • If yes, create/update the appropriate docs/ file with permanent, reusable content
    • If no, simply delete the temporary files
    • Examples of permanent documentation:
      • Testing guides: docs/ipad.md, docs/testing.md
      • Architecture notes: Add to CLAUDE.md or create docs/architecture.md
      • Implementation patterns: Add to relevant docs/ file
    • Commit the cleanup separately from feature work

Committing Changes

When creating commits, follow these guidelines:

  1. Use conventional commit format:

    • feat: add SwiftData models for Task, Week, and FocusArea
    • fix: correct relationship between Task and Week models
    • refactor: extract view components into separate files
    • docs: update CLAUDE.md with architecture notes
    • test: add unit tests for Week model
  2. Include co-author attribution:

    git commit -m "feat: <description>
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>"

Error Handling

Avoid fatalError() for user-facing errors - only use it for unrecoverable system failures or developer mistakes. Use assertionFailure() for data integrity warnings that allow the app to continue functioning gracefully.

Available Simulators

The project requires iOS 17.0 or later (SwiftData minimum requirement).

Default simulator for testing: iPhone 17 or latest iOS 26+ device

  • Always use the latest iOS version (iOS 26+) for primary testing
  • This ensures we're testing with the latest APIs and behaviors
  • Only test on older iOS versions (iOS 17-25) when specifically requested for compatibility verification

Recommended iOS 26+ simulators:

  • iPhone 17, iPhone 17 Pro, iPhone 17 Pro Max
  • iPhone Air, iPhone 16e

To list available simulators:

xcrun simctl list devices available | grep "iPhone"

Troubleshooting

App won't install on simulator

  • Verify simulator is running iOS 17.0 or later
  • Check minimum deployment target in project settings
  • Try: xcrun simctl erase all (WARNING: deletes all simulator data)

Build fails with "Item.self not found"

  • The old Item.swift template file may need to be removed from the project
  • Verify new models are properly imported in BulletJournalTodosApp.swift

Simulator shows old version of app

  • Uninstall app from simulator first: xcrun simctl uninstall booted com.vivqu.BulletJournalTodos
  • Clean build folder: cd BulletJournalTodos && xcodebuild clean

End of Task - Branch Merging

IMPORTANT: Before starting a new task, check if the current branch should be merged into main.

After completing a task and receiving user approval:

  1. Delete all testing screenshots before merging:

    # Remove any screenshot files created during testing
    git rm screenshot-*.png 2>/dev/null || rm screenshot-*.png 2>/dev/null
    git commit -m "chore: remove testing screenshots" 2>/dev/null || true

    Screenshots are for manual verification only and should never be committed to main.

  2. Ask the user: "Should I merge the current branch (<branch-name>) into main?"

  3. If yes, merge and clean up the branch:

    git checkout main
    git merge <branch-name> --no-ff -m "Merge <task-description>"
    git branch -d <branch-name>

    The -d flag safely deletes the branch after it's been merged.

  4. If no, continue on the same branch for the next task. This allows related work to stay together before merging into main.

This ensures completed work is integrated into main at appropriate checkpoints while giving you control over when merges happen.