Switch dashboard auth to NextAuth and ask for tests

A developer used Cursor to move a dashboard off custom auth, while a background agent built tests in a separate branch.

Done with Cursor· Intermediate

What they did
They told Cursor’s Agent chat to replace the existing sign-in system with NextAuth.js. The agent touched 14 files across routing, middleware, session logic, page wrappers, and environment settings. Separately, a background agent worked on another branch, added test coverage for a Python data pipeline, and opened a pull request while the dashboard migration was still underway.
How it went
The auth change was completed in about 90 minutes, compared with a 4-hour estimate, but three manual corrections were still needed: a missing environment variable, a callback URL mismatch, and a session type problem. The testing branch produced 34 tests, with 28 passing at first and 6 needing fixture updates.
Tips
For this kind of migration, make the agent show its plan before it edits anything, then review auth and environment changes yourself. If you lean on agents often, watch your credit balance; this author used up Pro credits around day 22 and paid for extra credits twice.

Try it yourself with Cursor

I’m working on [project name]. Replace [current auth approach] with [target library] throughout the parts that depend on it: routes, middleware, session code, page wrappers, and environment config. Also, on a separate branch, have a background agent create and run tests for [related component or pipeline]. Before changing files, show me the plan and wait for approval. Afterward, report what was modified, which tests passed or failed, and anything I should check by hand before I merge, deploy, submit, send, or delete anything.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

Read the original on dev.to ↗

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.