HK-hub/AgentSkills / ax-audit
ax-audit
VerifiedAudits agentic applications for architecture and trust: tool parity, tool granularity, context injection, completion signals, approval gates, confidence cues, escape hatches, intent handshakes, memory visibility, and adaptive canvases. Produces a ship-readiness verdict plus an AX Relationship Summary. Use when reviewing agentic feature PRs or asking "is this agent-native", "AX review", "critique this AI feature", "does this earn user trust", or "audit this for AX". For traditional frontend UX use ui-audit.
rules-arch/granularity-static-api-mapping.md
View on GitHub---
title: One tool per API endpoint instead of dynamic discovery
slug: granularity-static-api-mapping
category: granularity
defaultTier: backlog
surfaces: agent-tool-execution
agent-native-principle: Granularity
detection: observational
related: granularity-workflow-shaped-tool
---
## One tool per API endpoint instead of dynamic discovery
50 tools for 50 API endpoints. Adding an endpoint requires a code change and redeploy. The agent can only access what was anticipated at build time. For evolving APIs, a discover-and-access pattern keeps capabilities in sync automatically.
## What goes wrong
CMS has 30 content types, 90 tools total. An editor adds "Press Release" in the CMS admin. The agent can't access it: no `read_press_release` tool exists yet.
## Detection
**Surfaces:** agent-tool-execution
**Static signals:**
1. Count tool definitions. High counts (>20) with repetitive patterns suggest static mapping.
2. Check whether the data source supports dynamic type discovery.
**Concrete commands:**
```bash
rg 'name:\s*["\x27]' --type=ts src/tools/ -c | awk -F: '{sum+=$2} END {print "Total tools:", sum}'
rg 'name:\s*["\x27](read|get|list|create|update|delete)_' --type=ts -o --no-filename src/tools/ | awk -F'_' '{print $1}' | sort | uniq -c | sort -rn
```
**False-positive guards:**
- Skip small stable APIs (<10 types), tools with genuinely different params, and `// ax-audit-ignore:granularity-static-api-mapping`.
## Fix
Replace static tools with discover + access.
```ts
// before: read_blog_post, read_landing_page ... 30 identical tools
// after: two tools cover the entire surface
export const listContentTypes = tool({
name: "list_content_types",
execute: async () => api.get("/content/types"),
});
export const readContent = tool({
name: "read_content",
parameters: { type: { type: "string" }, id: { type: "string" } },
execute: async ({ type, id }) => api.get(`/content/${type}/${id}`),
});
```
## Default tier and overrides
**Defaults to:** `backlog`: scaling problem, not correctness. Works fine for small, stable APIs.
## Examples
**Anti-pattern (fails):**
```ts
export const readContact = tool({ name: "read_contact", execute: ({ id }) => api.get(`/crm/contact/${id}`) });
export const readDeal = tool({ name: "read_deal", execute: ({ id }) => api.get(`/crm/deal/${id}`) });
// ... 48 more: new custom "Partner" object added in CRM, agent can't access it
```
**Applied (passes):**
```ts
// Two tools: discover + access. New "Partner" type works immediately.
export const listObjectTypes = tool({ name: "list_crm_object_types", execute: () => api.get("/crm/objects") });
export const readObject = tool({ name: "read_crm_object", execute: ({ objectType, id }) => api.get(`/crm/${objectType}/${id}`) });
```
## Suppression
```ts
// ax-audit-ignore:granularity-static-api-mapping, stable API with <10 types
export const readUser = tool({ name: "read_user", /* ... */ });
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |