c_agri_trade/.agents/skills/up-code-generate/SKILL.md

5.3 KiB

name description
up-code-generate Generate production-grade backend services, frontend views/screens, database migrations, API contracts, and integration adapters for the stories in the current iteration's backlog, with explicit delivery-surface coverage across portal/frontend, API, data, integration, infrastructure, and QA. Use this after up-wireframe-spec and up-test-model-generate have produced the iteration's screens, surface matrix, and test cases. Covers Stage 13 (Construction) of the UP-AI v1.0 Process (00_prompts/AI_Native_Unified_Process_v1.md).

up-code-generate — Stage 13 (Construction, per iteration)

Objective

Implement the current iteration's stories as production-grade code — backend services, frontend screens/views, database migrations, API contracts, and integration adapters — adhering to the technology stack configured in tech-profile.yaml and requirement-driven development principles.

When to invoke

  • After up-wireframe-spec and up-test-model-generate have produced this iteration's screens and test cases.
  • Repeatedly within an iteration, once per story or logical group of related stories.

Read first

  • tech-profile.yaml (specifies backend language, framework, ORM, migrations, frontend framework, auth provider, and sandboxes)
  • Current iteration's 04_generated_documentation/05_iteration_planning/iterations/iteration-NN/iteration_backlog.md (STORY-xxx list)
  • Current iteration's iteration_surface_matrix.md (required delivery surfaces and owners)
  • Current iteration's parallel_work_plan.md (if parallel lanes are active)
  • Owning 04_generated_documentation/04_architecture_design/lld/LLD-0xx_*.md (API/table/event contracts)
  • Owning use case's functional-reqs.md (acceptance criteria, validation, audit requirements)
  • This iteration's wireframes (04_generated_documentation/06_wireframes/) and test cases (04_generated_documentation/07_test_design/)
  • 04_generated_documentation/06_wireframes/DESIGN.md or active design system tokens
  • architecture_spike_report.md (service template conventions)

Procedure

Pick the next STORY-xxx with status "Ready" from the iteration backlog. Implement only that story (or related group) per invocation:

Confirm every applicable surface in iteration_surface_matrix.md has an owner and repository path. If the story requires a frontend screen, frontend code is mandatory unless an approved CR-xxx/DEC-xxx explicitly defers it.

Backend service generation: Implement against the LLD API contract exactly — request/response shapes, status codes, error format, RBAC checks, tenant-context propagation, validation, and audit logging. Use the backend language/framework specified in tech-profile.yaml. Write unit and integration tests covering the story's acceptance criteria. Add or update API collections (Bruno .bru or OpenAPI spec) for added/changed endpoints.

Frontend screen generation: Implement against the iteration's wireframe/field-level spec — fields, validation, navigation, error states. Reuse DESIGN.md component library and tokens. Write corresponding component and browser-E2E tests (e.g. Playwright) tagged with UC-xxx/FR-xxx/STORY-xxx.

Database implementation: Generate migrations matching the LLD table definitions via the migration tool in tech-profile.yaml (e.g. Alembic, Prisma, Flyway); do not hand-edit schema outside migrations.

Integration adapters: Implement external API triggers, requests, and failure handling against the contracts in tech-profile.yaml. Consume and verify against the Wave 0 Sandbox/Mock adapters so test suites run 100% deterministically and offline without external API dependencies.

Rules (apply to every story):

  1. Do not introduce unrelated changes or refactor unrelated files.
  2. Write unit/integration/contract/smoke/browser-E2E tests assigned to this story by up-test-model-generate.
  3. Implement validation, error handling, structured logging, and audit trails where the FR requires it.
  4. Enforce tenant isolation and authorization per the architecture spike's validated pattern.
  5. Update iteration_surface_matrix.md with implementation status and verification evidence.
  6. Do not place secrets, live tokens, or production credentials in code, fixtures, logs, or commits.
  7. Automated Test Coverage Budgets: Ensure code meets the thresholds configured in tech-profile.yaml:
    • Backend Domain & FSMs: ≥95.0% statement and branch coverage.
    • Integration Adapters: ≥90.0% against Wave 0 sandboxes.
    • Frontend UI Components: ≥80.0% component branch coverage + mandatory Playwright browser-E2E tests for primary user journeys. Exercise Happy Path, Alternate/Boundary, Failure, and FSM Invariant scenarios.

Output expected

Source code changes; updated OpenAPI / Bruno specs; DB migrations; frontend portal artifacts; updated iteration_surface_matrix.md; execution log.

Exit criteria

Story implemented per LLD contract and screen spec across every applicable surface; API, data, integration, and frontend artifacts are synchronized; tests achieve configured coverage thresholds; ready for up-defect-fix and Gate 14.1.

Previous: up-wireframe-spec, up-test-model-generate. Next: up-defect-fix (code review, defect handling), then up-traceability-gate (Gate 14.1).