Plan, implement, test, and document a new feature end-to-end. Follows the full agentic workflow — clarifying questions, implementation, tests, validation, and CLAUDE.md updates.
You are implementing a new feature for desgrava.ar, a tax deduction automation platform for Argentine taxpayers.
$ARGUMENTS
CLAUDE.md to understand current architecture, patterns, and conventions.specs/ matching this feature, read it for acceptance criteria.Once the plan is approved:
If database changes are needed:
prisma/schema.prismanpx prisma migrate dev --name <descriptive-name>npx prisma generateIf the feature involves ARCA/SiRADIG automation (src/lib/automation/), use /implement-loop to iterate: test against live SiRADIG, observe failures with agent-browser, fix, and re-test until the automation succeeds. Then continue to Phase 3.
Implement the feature following these conventions:
src/lib/ (organized by domain)src/app/api/ (mirror domain structure, validate session?.user?.id)src/components/ (split by feature domain)Decimal.js for all monetary calculationsborder-gray-200, bg-gray-50, generous whitespacesm:, md:, lg: breakpoints.w-full sm:w-[280px], not w-[280px]).w-full sm:max-w-md).overflow-x-auto) on mobile.min-h-[44px] min-w-[44px] on interactive elements).flex-col sm:flex-row for layouts that stack vertically on mobile.overflow-x-hidden to page containers to prevent horizontal scroll bleed.next-themes with Tailwind's dark: variant (@custom-variant dark (&:is(.dark *))). Rules:
bg-gray-50, , without a counterpart. Prefer semantic tokens (, , , ) which auto-adapt.Write unit tests for all new business logic in src/lib/:
__tests__/ directory alongside the moduledescribe/it blocks@/ path aliases for importsWrite tests for new validators (Zod schemas).
If the feature includes new API routes, consider integration test patterns.
Run the full test suite: npm run test
Run the full CI check locally:
npm run lint && npm run format:check && npm run build && npm run test
All four commands must pass. If any fail, fix and re-run.
Update CLAUDE.md if the feature introduces:
src/lib/ or src/components/Create or update a spec in specs/ if acceptance criteria were defined.
Mark the spec as implemented with a status: implemented field.
Present a summary:
bg-whitetext-gray-600dark:bg-mutedtext-muted-foregroundbg-cardborder-borderbg-green-50 dark:bg-green-950/30 border-green-200 dark:border-green-900 text-green-700 dark:text-green-400.hover:bg-accent dark:hover:bg-accent/50.dark:bg-input/30, dark:border-input.Run npm run lint and npm run format:check after implementation. Fix any issues.