# Approval

> Approval workflow skill. View pending approval tasks and approve or reject service requests.

- Skill: `cloudchef/approval` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add cloudchef/approval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cloudchef/approval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: CloudChef (https://skillmd.com/u/cloudchef)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cloudchef/approval

---


# approval

Approval workflow management skill.

## Purpose

Manage approval workflows for service catalog requests:
- Query pending approval items with priority analysis
- Approve one or more requests with optional reason
- Reject one or more requests with reason

## Trigger Conditions

Use this skill when user intent is any of:
- View pending approvals / list approvals / check what needs approval
- Analyze one pending approval in read-only mode
- Approve a request / approve all / batch approve
- Reject a request / deny request / batch reject

| Intent | Keywords |
|--------|----------|
| View pending | "show pending approvals", "list approvals", "what needs approval" |
| Analyze | "analyze approval request", "review approval", "只读分析审批请求", "审批分析" |
| Approve | "approve request", "agree request", "pass request", "approve #1", "agree 1", "同意 1", "批准 1", "通过 1", "approve all", "batch approve" |
| Reject | "reject request", "deny request", "refuse request", "reject #1", "deny 1", "拒绝 1", "驳回 1", "batch reject" |

## Intent Priority

Action commands always win over detail lookup.

| User intent | Required tool |
|-------------|---------------|
| approve/agree/pass + Request ID or row number | `smartcmp_approve` |
| 批准/同意/通过/审批通过 + Request ID or row number | `smartcmp_approve` |
| reject/deny/refuse + Request ID or row number | `smartcmp_reject` |
| 拒绝/驳回 + Request ID or row number | `smartcmp_reject` |
| analyze/evaluate/review + Request ID | `smartcmp_analyze_approval_request` |
| 分析/评估/审查/只读分析 + Request ID | `smartcmp_analyze_approval_request` |
| view/show/inspect/check detail + Request ID | `smartcmp_get_request_detail` |
| 查看/看下/详情 + Request ID | `smartcmp_get_request_detail` |

Examples:
- `approve CHG20260413000011` MUST call `smartcmp_approve`.
- `agree RES20260505000010` MUST call `smartcmp_approve`.
- `pass TIC20260502000003` MUST call `smartcmp_approve`.
- `批准 CHG20260413000011` MUST call `smartcmp_approve`.
- `reject CHG20260413000011` MUST call `smartcmp_reject` without a reason so the Provider returns a trace-bound input request without executing a rejection.
- `deny RES20260505000010 because it exceeds quota` MUST call `smartcmp_reject`.
- `analyze approval request RES20260505000010` MUST call `smartcmp_analyze_approval_request`.
- `只读分析审批请求 RES20260505000010` MUST call `smartcmp_analyze_approval_request`.
- `查看 CHG20260413000011 的详情` MUST call `smartcmp_get_request_detail`.
- `show detail of CHG20260413000011` MUST call `smartcmp_get_request_detail`.

## Handlers and helpers

All five Tool commands are co-located in `scripts/adapter.py`:

| Handler | Description |
|--------|-------------|
| `list_pending` | List pending approval items with priority |
| `get_request_detail` | Read one approval request |
| `analyze_request` | Analyze one pending approval without executing a decision |
| `approve` | Approve one or more requests |
| `reject` | Reject one or more requests |

`scripts/_approval_object_actions.py` remains separate because the embedded
assistant Context resolver also calls it to build page actions. It is not a
one-command forwarding script.

The Adapter receives the selected instance and Cookie/user/robot credential
from AtlasClaw Context. SmartCMP Provider owns authentication resolution and
all SmartCMP API calls.

## Workflow

### Step 1: List Pending Approvals

Call `smartcmp_list_pending` with optional `days`.

**Output Format:**
- Human-readable: Markdown table sorted by latest SmartCMP update first
- Public structured rows: request ID, name, catalog, applicant, approval step,
  current approver, and other compact approval evidence used to render the table
- Machine-readable: `_internal.items` in the Tool result, retained by AtlasClaw workflow context

The hidden continuation metadata is intentionally smaller than each public row;
it retains only the fields listed below.

**`_internal.items` fields:**
| Field | Description |
|-------|-------------|
| `index` | Display index (1, 2, 3...) — for user selection only |
| `request_id` | **Exact SmartCMP user-facing Request ID / request number** — use this opaque value for approve/reject tool input |
| `name` | Request name |
| `applicant` | Requester name |

---

## CRITICAL: Request ID Field Selection

> **MUST USE `request_id` field for `smartcmp_approve` and `smartcmp_reject`**
>
> The list result exposes one ID field to the agent: the user-facing `_internal.items[].request_id`.
> SmartCMP Provider resolves `request_id` to the internal approval action identifier before calling the CMP approval API.

| Field | Format Example | Can Use as approve/reject tool input? |
|-------|----------------|----------------------------|
| `request_id` | Exact value from `_internal.items[].request_id`, such as `SR-2026/000019` | **YES — USE THIS** |
| display index | `1`, `2`, `3` | **NO — resolve row index to `request_id` first** |
| invented value | placeholder or guessed ID | **NO — re-list and use the returned `request_id`** |

**Mapping user selection to correct ID:**
```
User explicitly says "row 1", "approve the first row", or "同意第 1 行"
  |
  v
Find the selected item in the latest `smartcmp_list_pending` `_internal.items`
  |
  v
Extract the `request_id` field
  |
  v
Pass to `smartcmp_approve` or `smartcmp_reject`
```

Treat `request_id` as opaque: do not require a prefix, character set, or fixed length pattern. Never invent a value. If the latest list metadata is unavailable, list pending approvals again before calling approve/reject.

### Step 2: Approve Requests

Call `smartcmp_approve` with one or more `request_ids` and an optional
`reason`.

### Step 3: Reject Requests

Call `smartcmp_reject` with one or more `request_ids`. A non-empty rejection
`reason` is required before SmartCMP is changed. If the user has not supplied
one, omit `reason`; the tool returns a trace-bound input request and performs no
rejection. Call the tool again with the reason after the user provides it.

## Output Parsing

### Approval `_internal.items` entry

```json
{
  "index": 1,
  "request_id": "RES20260505000010",
  "name": "Test Request",
  "applicant": "TestUser"
}
```

### Quick Reference: Which ID to Use

```
[OK]    smartcmp_approve(request_id) <- exact value returned by the pending list
[OK]    smartcmp_reject(request_id, reason) <- exact value returned by the pending list

[OK]    smartcmp_approve("1")   <- valid when "1" is the exact returned request_id
[FAIL]  smartcmp_approve(row_index) <- resolve an explicitly selected row first
[FAIL]  smartcmp_approve(guessed-value) <- invented value, re-list pending approvals
```

## Critical Rules

> **ONLY use `request_id` field for approve/reject tool input**. SmartCMP Agent
> SmartCMP Provider converts it to the approval action ID internally.

> **A rejection reason is required before execution**. When it is missing, call
> `smartcmp_reject` without `reason`; treat its `required_input` response as a
> clarification, not a failure. No SmartCMP write occurs on that call.

> **NEVER create temp files** — no `.py`, `.txt`, `.json`. Your context IS your memory.

> **Always show pending list first** before approve/reject operations.

> **Confirm with user** before batch operations affecting multiple items.

## Error Handling

| Error | Cause | Resolution |
|-------|-------|------------|
| `400` + `activity is null` | Used an internal or stale identifier after Request ID resolution | Re-list pending approvals, verify the item is still pending, and retry with `request_id` |
| `Invalid SmartCMP Request ID(s)` | Request ID is blank or exceeds the supported size limit | Re-list pending approvals and use the exact `request_id` field |
| `401` / Token expired | Selected SmartCMP session expired | Refresh the selected SmartCMP session or credential |
| `404` / Not found | Invalid or stale Request ID | Verify ID from the latest `smartcmp_list_pending` result |
| `[ERROR]` output | Various | Report to user immediately; do NOT self-debug |

## References

- [WORKFLOW.md](references/WORKFLOW.md) — Detailed approval workflow documentation

