Atproto AMA app

Development Process - Quick Reference#

The 5-Step Process (Always follow in order)#

1. ALLOY MODEL
   └─→ specs/alloy/*.als

2. DATABASE SCHEMA
   └─→ src/db/schema.ts
   └─→ pnpm db:generate && pnpm db:push

3. TYPES
   └─→ src/__tests__/utils/test-types.ts
   └─→ src/db/validation.ts

4. BEHAVIORAL TESTS (Loop until pass)
   └─→ src/__tests__/*.test.ts
   └─→ pnpm test:run ❌
   └─→ Implement logic
   └─→ pnpm test:run ✅

5. UI + TDD LOOP
   └─→ Write integration test
   └─→ pnpm test:run ❌
   └─→ Create UI component
   └─→ Implement feature
   └─→ pnpm test:run ✅

Quick Commands#

# 1. After updating Alloy model
pnpm db:generate
pnpm db:push

# 2. TDD Loop
pnpm test          # Watch mode

# 3. Verify everything
pnpm test:run      # All tests must pass ✅

# 4. Run dev server
pnpm dev

Checklist for New Feature#

[ ] 1. Update specs/alloy/*.als
[ ] 2. Update src/db/schema.ts
[ ] 3. Create types in test-types.ts
[ ] 4. Write behavioral tests
[ ] 5. Run tests (should fail ❌)
[ ] 6. Implement business logic
[ ] 7. Run tests (should pass ✅)
[ ] 8. Write integration test
[ ] 9. Run test (should fail ❌)
[ ] 10. Create UI component
[ ] 11. Implement feature
[ ] 12. Run test (should pass ✅)
[ ] 13. All tests passing? Ship it! 🚀

Key Rules#

  • DO: Write specs first
  • DO: Write tests before implementation
  • DO: Run tests after every change
  • DON'T: Skip any step
  • DON'T: Code without tests
  • DON'T: Merge without all tests passing

Test-Driven Development Loop#

1. Write test
2. Run test → ❌ RED
3. Write minimal code to pass
4. Run test → ✅ GREEN
5. Refactor
6. Run test → ✅ Still GREEN
7. Repeat

This Process Guarantees#

  • ✓ Correctness (proven by tests)
  • ✓ Maintainability (clear structure)
  • ✓ Confidence (can refactor safely)
  • ✓ Documentation (specs are always current)

Remember: Specification → Tests → Implementation

See DEVELOPMENT_PROCESS.md for full details.