c_agri_trade/process/Skills_GUIDE.md

270 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Skills Usage Guide — Invoking UP-AI v1.5 (Universal Generic Edition)
**Purpose:** The 19 skills under `.agents/skills/` (version-controlled in `process/.agents/skills/`) are the canonical executable forms of `process/AI_Native_Unified_Process_v1.md`. This guide shows, stage by stage, which skill to invoke and how across both **Greenfield (0-to-1)** and **Brownfield (Modernization)** projects. Hardened under UP-AI v1.4 (`PCR-005`) with deterministic semantic density validation (≥20 test cases in QA workbooks), mandatory Bruno API collections, and decoupled git-subtree architecture (`PCR-006`).
## How to Invoke a Skill
1. **Explicit, slash-style** — name the skill directly: `/up-use-case-author UC-001 user-identity-and-role-governance`.
2. **Sub-Agent / Role-based** — invoke with specialized persona prefix:
- `@requirements-analyst /up-requirements-elicit`
- `@requirements-analyst /up-brd-extract`
- `@spike-architect /up-arch-risk-spike`
- `@ui-designer-dev /up-wireframe-spec`
- `@backend-dev /up-code-generate`
- `@adversarial-tester /up-test-model-generate`
- `@gatekeeper /up-traceability-gate 14.1`
3. **Natural language** — describe the task; AI agents match it to the skill by its `description` frontmatter.
---
## Technology Stack Presets & Framework Guides (`tech-profile.yaml`)
UP-AI is stack-agnostic and drives code generation through [`tech-profile.yaml`](../tech-profile.yaml). For ready-to-copy configurations for major stacks, consult [`templates/tech-profile-presets.md`](templates/tech-profile-presets.md):
- **Preset A: Frappe Framework** (Python, MariaDB, DocTypes, `bench migrate`, site-based multi-tenancy) — *See [Frappe App-Centric Development Guide](framework_guides/frappe_app_centric_development_guide.md) for DevContainers, Antigravity integration, and `git subtree push`.*
- **Preset B: Django / DRF** (Python, PostgreSQL, Django ORM, `django_migrations`, Tailwind)
- **Preset C: Java / Spring Boot** (Java 17/21, PostgreSQL, Hibernate, Flyway, JUnit 5)
- **Preset D: FastAPI Modular Monolith** (Python, PostgreSQL RLS, SQLAlchemy, Alembic, React)
- **Preset E: Node.js / NestJS** (TypeScript, PostgreSQL, Prisma, Vitest, Next.js)
---
## 1. Inception (Stages 0–4) — Dual-Track Execution
### Greenfield Track (0-to-1 Development)
| Stage | Skill | Action |
|---|---|---|
| 0 | `up-project-bootstrap` | Initialize workspace with `tech-profile.yaml` configured from presets |
| 0B | `up-requirements-elicit` | *If BRD unsupplied:* Conduct Socratic interview and synthesize `01_BRD/PRD_Specification.md` |
| 1 | `up-brd-extract` | Extract business features and requirements from PRD/BRD, mint `BRD-FR-xxx` IDs |
| 1B / 6 | `up-arch-risk-spike` | Score domain risks, build thin walking skeleton before use-case authoring |
**Greenfield Invocations:**
```bash
# Stage 0: Bootstrap greenfield workspace with declarative profile
/up-project-bootstrap --archetype greenfield
# Stage 0B: Elicit requirements when no BRD exists (interactive Socratic interview)
/up-requirements-elicit --interactive
# Stage 1: Extract PRD features once PRD_Specification.md is baselined
/up-brd-extract 01_BRD/PRD_Specification.md
```
### Brownfield Track (Legacy Modernization / Migration)
| Stage | Skill | Action |
|---|---|---|
| 0 | `up-project-bootstrap` | Initialize workspace with `tech-profile.yaml` configured as `archetype: brownfield` |
| 1 | `up-brd-extract` | Extract target business requirements from BRD |
| 2–4 | `up-legacy-gap-analysis` | Mine legacy AST source code, DB schema, and UI screenshots into `02_legacy_analysis/` |
**Brownfield Invocations:**
```bash
# Stage 0: Bootstrap brownfield workspace
/up-project-bootstrap --archetype brownfield
# Stage 2-4: Run legacy gap analysis on a target module
/up-legacy-gap-analysis LegacyApp user-management
```
---
## 2. Elaboration (Stages 5–9) — Architecture & Requirements Spine
Invocation sequence: **Author (UC+FR) → Gate 5.1 → Risk Spike (Walking Skeleton) → SRS Derivation → HLD/LLD Fan-out → Gate 9.1**
| Stage | Skill | Gate after? |
|---|---|---|
| 5 | `up-use-case-author` | → Gate 5.1 (`up-traceability-gate`) |
| 6–7 | `up-arch-risk-spike` | — |
| 8 | `up-srs-derive` | — |
| 9 | `up-hld-lld-generate` | → Gate 9.1 (`up-traceability-gate`) |
**Stage 5 — Author a Use Case (repeat per use case in scope):**
```bash
/up-use-case-author UC-001 user-identity-and-role-governance
```
> "@requirements-analyst Author UC-001, User Identity and Role Governance. Embed the functional requirements (FR-AUTH-001 through FR-AUTH-003) directly under the use case."
**Immediately run Gate 5.1 — do not skip even if the use case looks complete:**
```bash
# Deterministic CLI check:
python3 scripts/verify_traceability_gates.py --gate 5.1
# Or via agent skill:
/up-traceability-gate 5.1
```
> "@gatekeeper Run the Gate 5.1 traceability check across everything authored under project_sdlc/03_requirements/use_cases/."
*If Critical findings exist (e.g., orphan FR or UC with 0 FRs), resolve before proceeding.*
**Stage 6–7 — Rank Architectural Risk and Build Walking Skeleton Spike:**
```bash
/up-arch-risk-spike
```
> "@spike-architect Score every authored use case for architectural risk (data isolation, third-party auth/payment gateways, high concurrency, financial sensitivity). Validate the top 15-20% significant shortlist with a thin walking skeleton HLD/LLD."
**Stage 8 — Derive System Requirements (SRS / NFRs):**
```bash
/up-srs-derive UC-001
```
> "Derive SRS and NFR requirements for all FRs under UC-001. Every SRS/NFR item must declare its parent_fr."
**Stage 9 — Fan out HLD/LLD Design using the Validated Spike Template:**
```bash
/up-hld-lld-generate
```
> "Design HLD and LLD in 04_architecture_design/ for the remaining use cases using the validated service template from architecture_spike_report.md."
**Gate 9.1 — Pre-Construction Architecture Gate:**
```bash
# Deterministic CLI check:
python3 scripts/verify_traceability_gates.py --gate 9.1
# Or via agent skill:
/up-traceability-gate 9.1
```
> "Run the Gate 9.1 check — confirm every FR resolves to an SRS requirement, an HLD component, and an LLD artifact before starting Construction."
---
## 3. Construction (Stages 10–14) — The Iteration Delivery Loop
Each iteration delivers a vertical slice of 3–8 related use cases to working software.
**Stage 10 — Iteration Planning & Surface Matrix:**
```bash
/up-iteration-plan
```
> "Plan iteration-01 in 05_iteration_planning/iterations/iteration-01/. Generate iteration_backlog.md and iteration_surface_matrix.md covering API, Frontend, Database, Integration, and QA surfaces."
**Stages 11 & 12 — Screen Specs & Multi-Path Test Model (Run in Parallel):**
```bash
/up-wireframe-spec
/up-test-model-generate
```
> "@ui-designer-dev Produce wireframes and field specs under 06_wireframes/ for iteration-01's screens, applying DESIGN.md tokens."
> "@adversarial-tester Generate multi-path test cases in 07_test_design/ (Happy, Alternate/Boundary, Negative, FSM Invariants), update Bruno API collections, and compile the 21-sheet Manual QA Excel Workbook (.xlsx)."
**Stage 13 — Wave-Based Code Generation ($\ge 95\%$ Coverage):**
```bash
/up-code-generate STORY-AUTH-001
```
> "@backend-dev @ui-designer-dev Implement STORY-AUTH-001 (User Registration & OIDC Login) against LLD-001 and screen specs. Generate backend routes, DB migrations, frontend views, and unit/integration/E2E tests achieving ≥95.0% coverage."
**Stage 14 — Code Review, Defect Triage & Gate 14.1:**
```bash
/up-defect-fix DEF-001
```
> "Review DEF-001. If it is a code defect, fix and add a regression test. If it reveals an uncaptured requirement or FSM transition, escalate to /up-change-request-impact."
**Branch Integration (when parallel lanes are used):**
```bash
/up-parallel-work-integrate lane/auth-service lane/user-profile-ui
```
**Gate 14.1 — Iteration Definition of Done (Hardened per UP-AI v1.4):**
```bash
# Deterministic CLI check with density inspection:
python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01
# Or with automated test execution hook:
python3 scripts/verify_traceability_gates.py --gate 14.1 --iteration iteration-01 --run-tests
# Or via agent skill:
/up-traceability-gate 14.1
```
> "@gatekeeper Run Gate 14.1 for iteration-01 — confirm all stories pass tests, automated coverage meets configured tiered thresholds (≥95% domain, ≥90% adapter, ≥80% frontend), regression tests pass, Bruno API collections are present for declared endpoints, and Excel QA workbooks are densely populated (≥20 test cases) before marking FRs Delivered (E2E Verified)."
---
## 4. Transition (Stages 15–18)
```bash
/up-uat-handover
```
> "All release scope shows Delivered in the traceability graph — prepare CI/CD deployment pipelines, UAT acceptance package, and review-ready baseline in 08_review_ready_baselines/."
---
## 5. Cross-Cutting: Change Request (CR) Lifecycle
Triggered from any stage whenever requirements, scope, or NFRs change post-baseline:
**A. Defect reveals a requirements gap:**
```bash
/up-change-request-impact
```
> "Raise CR-001: UC-001 is missing an account-lockout policy after 5 failed attempts. Run Impact Analysis against the traceability graph before modifying any document."
**B. New PRD/BRD requirement arrives mid-program:**
```bash
/up-change-request-impact
```
> "Raise CR-002: Client requested OAuth2 Social Login. Compute full blast radius across FRs, HLD, LLD, Wireframes, Stories, and Test Models."
---
## 6. Cross-Cutting: Meta-Governance (Process Evolution)
If the process itself needs adjustment (new gate, modified threshold, new tool):
```bash
/up-process-change
```
> "Propose Process-Adjustment CR: Update minimum test coverage threshold or add a new deployment validation gate."
---
## 7. Cross-Cutting: Session Checkpoints
Save and resume state across developer/agent sessions:
```bash
/up-context-checkpoint save
```
> "Save session checkpoint in 00_process_control/checkpoints/ before handoff, recording active stage, completed tasks, and next action."
---
## 8. Dual Worked End-to-End Scenarios
### Scenario A: Greenfield Track (0-to-1 User Management)
```bash
1. /up-project-bootstrap --archetype greenfield
1B. /up-requirements-elicit --interactive # Optional: if PRD not already supplied
2. /up-brd-extract 01_BRD/PRD_Specification.md
3. /up-use-case-author UC-001 user-authentication-rbac
4. /up-traceability-gate 5.1
5. /up-arch-risk-spike
6. /up-srs-derive UC-001
7. /up-hld-lld-generate
8. /up-traceability-gate 9.1
9. /up-iteration-plan
10. /up-wireframe-spec && /up-test-model-generate
11. /up-code-generate STORY-AUTH-001
12. /up-traceability-gate 14.1
13. /up-uat-handover
```
### Scenario B: Brownfield Track (Legacy Billing Modernization)
```bash
1. /up-project-bootstrap --archetype brownfield
2. /up-brd-extract 01_BRD/Modernization_Scope.md
3. /up-legacy-gap-analysis LegacyBillingModule
4. /up-use-case-author UC-010 invoice-and-payment-processing
5. /up-traceability-gate 5.1
6. /up-arch-risk-spike
7. /up-srs-derive UC-010
8. /up-hld-lld-generate
9. /up-traceability-gate 9.1
10. /up-iteration-plan
11. /up-wireframe-spec && /up-test-model-generate
12. /up-code-generate STORY-BILL-001
13. /up-traceability-gate 14.1
14. /up-uat-handover
```