A complete feature built with Composer: a user authentication system with login/logout endpoints, a session model, and middleware — all generated across multiple files from a single description.
When to Use Composer vs Chat vs Cmd+K
Cursor has three AI interaction modes. Knowing which to use saves time and frustration.
Tab Completion
Use for: typing code (passive, always on)
Good at: completing patterns, next edit prediction
Cmd+K (Inline Edit)
Use for: modifying selected code
Good at: targeted transformations (add error handling,
refactor, add types, write tests for this function)
Chat (Cmd+L)
Use for: questions, understanding, debugging
Good at: explaining code, diagnosing bugs, getting advice
Composer (Cmd+Shift+I)
Use for: multi-file feature implementation
Good at: "build X feature," "add Y capability to the project"
Think of it as: you describe the feature, Composer writes
the code across all necessary filesEffective Composer Prompts
Composer works best when you give it: the goal, the relevant context, and the constraints. Vague prompts produce code you'll spend more time fixing than if you'd written it yourself.
# Weak — too vague
"Add authentication"
# Strong — specific constraints and context
"Add JWT-based authentication to this FastAPI app.
Create:
- POST /auth/login: accepts email + password, returns JWT token
- POST /auth/logout: invalidates the token
- GET /auth/me: returns current user info (requires valid token)
- A User model in database.py with: id, email, hashed_password
- A verify_token dependency for protected routes
Use python-jose for JWT, passlib for password hashing.
Token expiry: 24 hours.
Don't modify existing endpoints."The constraints ("don't modify existing endpoints") are as important as the requirements. Composer will try to help with everything it thinks is related — be explicit about boundaries.
Build a Feature with Composer
Open Composer with Cmd+Shift+I. Use this prompt on the FastAPI project from earlier in the course:
Add a user management system to this FastAPI app.
Create:
1. models.py: User model (id, email, hashed_password, created_at)
2. auth.py: password hashing with bcrypt, JWT token creation/verify
3. routes/users.py: POST /users (register), POST /auth/login,
GET /users/me (protected)
Requirements:
- Use existing database.py for SQLAlchemy session
- Use python-jose for JWT, passlib[bcrypt] for passwords
- Return 409 if email already exists
- Don't change main.py (just tell me what to add to it)
Existing files: @main.py @database.pyComposer will generate a diff showing every file it wants to create or modify. Review each change before accepting. If a file looks wrong, you can edit the prompt and regenerate just that file.
Review everything. Composer produces working code surprisingly often — but "working" means "runs without errors," not "does exactly what you meant." Read every file it generates. This takes 10 minutes and prevents 2 hours of debugging later.
What You Learned Today
- When to use each Cursor mode: Tab for typing, Cmd+K for modifying, Chat for questions, Composer for multi-file features
- How to write specific Composer prompts that include goals, constraints, and boundaries
- The Composer review workflow: diffs before applying, file-by-file acceptance
- Why reviewing Composer output always takes less time than debugging code you didn't review
Go Further on Your Own
- Use Composer to add comprehensive test coverage to a feature you've built: 'Add pytest tests for all endpoints in routes/users.py. Mock the database. Test success and error cases.'
- Give Composer a vague prompt deliberately and observe the output. Then rewrite the prompt with specific constraints and compare. How much does specificity matter?
- Build a feature entirely with Composer, then code-review the output as if a colleague wrote it. Write down: what's good, what you'd change, what's wrong. This trains you to use Composer effectively.
Nice work. Keep going.
Day 4 is ready when you are.
Continue to Day 4Want live instruction and hands-on projects? Join the AI bootcamp — 3 days, 5 cities.