From automation
Complete guide to building a contract upload page (signature process start). The page lets users upload contract documents, view scan/preparation status, delete documents, edit signature fields, and proceed to signature assignment. Use when building, modifying, or debugging any contract upload page, signaturprozess page, or contract file upload feature in the finstreet context.
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin finstreet-fe-claude-pluginsThis skill uses the workspace's default tool permissions.
A contract upload page is the first step of the signature process. Users upload contract PDFs, the system scans them and detects signature fields, and users can edit those fields before proceeding to signature assignment. The page displays contract groups with their documents, a file upload area per group, and action buttons at the bottom.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
A contract upload page is the first step of the signature process. Users upload contract PDFs, the system scans them and detects signature fields, and users can edit those fields before proceeding to signature assignment. The page displays contract groups with their documents, a file upload area per group, and action buttons at the bottom.
Page (server) → SubPageHeader + PageContent wrapper
↓
ContractsPageContent (client)
↓
Contract Group × N
├── Group title + description
├── ContractDocument × N per group (from @finstreet/ui)
├── ContractFileUpload (file input per group)
└── ContractActionButtons (at bottom, once)
Page (server)
├── fetches contracts via getContracts(product)
├── fetches signingHeader via getSigningHeader(product)
└── fetches editorStatus via getEditorStatus(product)
↓
ContractsPageContent (client)
├── useContracts hook (polls for scan updates every 5s)
├── renders ContractDocument per document
├── renders ContractFileUpload per contract group
└── renders ContractActionButtons (uses useEditorStatus hook)
The feature components live under src/features/contracts/. The backend layer (schema, server/client fetch functions) is assumed to already exist or be created with the secure-fetch skill — this skill only covers the server actions, the polling hook, and the UI components.
src/features/contracts/
└── components/
├── ContractsPageContent.tsx ← main content component
├── ContractFileUpload.tsx ← file upload per contract group
├── ContractActionButtons.tsx ← back/continue buttons + warning banner
└── ContractsLoading.tsx ← skeleton loading state
src/shared/backend/models/contracts/
├── uploadContractAction.ts ← server action: checksum → direct upload → Google Cloud
├── deleteContractAction.ts ← server action: delete contract
└── hooks/
└── useContracts.ts ← React Query hook with auto-polling
Assumed to already exist (created via secure-fetch skill or manually):
schema.ts — Zod schemas and typesserver.ts — server-side fetch functions (product-parameterized)client.ts — client-side fetch function for pollinguploadContractAction.ts, deleteContractAction.tsuseContracts.tsContractsLoading.tsxpage.tsx + loading.tsxAll backend functions take a product: Product parameter. The product determines the API path segment via productPath[product]. The page components themselves are product-agnostic — they get product from the useProduct() context hook.
The continue button behavior in ContractActionButtons may vary by product. Some products may start signing directly (bypassing signature assignment), while others navigate to a signature assignment page. Adapt the handleClick logic to the product's requirements.
ContractsPageContent is "use client" — it uses hooks (useContracts, useProduct, useQueryClient, useTranslations, useRouter)ContractFileUpload does NOT have "use client" directive — it's already rendered inside a client component boundaryContractActionButtons is "use client" — it's imported by ContractsPageContent which is also client, but has its own directiveContractsPageContent inside <PageContent> from @finstreet/ui["contracts", financingCaseId] and ["editorStatus", financingCaseId] query keysdocumentExchangeRefetchAction(financingCaseId) to sync document exchangesignatureProcess.startSignatureProcess for all componentsuseTranslations from next-intl (not useExtracted)export const) for componentsuseContracts hook auto-polls every 5 seconds while any document is still scanning or signature fields aren't editable — stops when all documents are cleanloading.tsx