Creating a reusable test-writing command
Reviewing auth.ts revealed that the session functions aren't tested yet—likely your next task. Since you'll be writing similar Vitest tests across the codebase, automate the workflow with a custom slash command. Save the common instructions in .claude/commands/write_tests.md using a $ARGUMENTS placeholder, then run /write_tests path/to/file.ts whenever you need tests for a file.
Note: Newer Claude Code versions pick up new commands automatically without a restart. The version used in this exercise environment still requires the /exit and restart shown here.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Claude Code in Action
अभ्यास निर्देश
- Start Claude Code with
claude. - Ask Claude to create a custom command at
.claude/commands/write_tests.mdthat uses$ARGUMENTSto write Vitest tests for the file the learner names. - Type
/exitto exit Claude Code.
इंटरैक्टिव व्यावहारिक अभ्यास
हमारे इंटरैक्टिव अभ्यासों में से किसी एक के साथ सिद्धांत को व्यवहार में बदलें
अभ्यास शुरू करें