ワンクリックで
implement-api-endpoint
Use when adding or modifying API endpoints in the Smartsheet Java SDK, before writing implementation code or tests
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when adding or modifying API endpoints in the Smartsheet Java SDK, before writing implementation code or tests
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when cutting a new release of the Smartsheet Java SDK — version bump, changelog, tag, and GitHub Release
Use when reviewing PRs that add or modify API endpoints in the Smartsheet Java SDK, before approving changes
| name | implement-api-endpoint |
| description | Use when adding or modifying API endpoints in the Smartsheet Java SDK, before writing implementation code or tests |
This skill ensures API endpoint implementations follow SDK architecture patterns, validate against OpenAPI specifications, and include complete test coverage per TESTING.md rules.
Core principle: Every endpoint must match the OpenAPI spec exactly and have all 6 mandatory test types.
Use when:
Do NOT use for:
You MUST have the OpenAPI specification before starting.
Two options:
If no spec is available, STOP. Do not implement without specification.
digraph implement_endpoint {
"Start" [shape=doublecircle];
"Have OpenAPI spec?" [shape=diamond];
"STOP - Request spec" [shape=box, style=filled, fillcolor=red];
"Fetch/read spec" [shape=box];
"Validate spec has endpoint" [shape=diamond];
"Create model classes" [shape=box];
"Validate ALL model fields match spec" [shape=box];
"Add interface method" [shape=box];
"Implement using AbstractResources" [shape=box];
"Create ALL 6 test types" [shape=box];
"Validate tests follow TESTING.md" [shape=box];
"Create WireMock mappings" [shape=box];
"Done" [shape=doublecircle];
"Start" -> "Have OpenAPI spec?";
"Have OpenAPI spec?" -> "STOP - Request spec" [label="no"];
"Have OpenAPI spec?" -> "Fetch/read spec" [label="yes"];
"Fetch/read spec" -> "Validate spec has endpoint";
"Validate spec has endpoint" -> "STOP - Request spec" [label="not found"];
"Validate spec has endpoint" -> "Create model classes" [label="found"];
"Create model classes" -> "Validate ALL model fields match spec";
"Validate ALL model fields match spec" -> "Add interface method";
"Add interface method" -> "Implement using AbstractResources";
"Implement using AbstractResources" -> "Create ALL 6 test types";
"Create ALL 6 test types" -> "Validate tests follow TESTING.md";
"Validate tests follow TESTING.md" -> "Create WireMock mappings";
"Create WireMock mappings" -> "Done";
}
MANDATORY: Verify spec before any code.
For public endpoints:
# Fetch the spec
curl -s https://developers.smartsheet.com/_spec/api/smartsheet/openapi.json > openapi.json
# Verify endpoint exists (example: GET /users/{userId}/plans)
jq '.paths."/users/{userId}/plans".get' openapi.json
For user-provided specs:
Checklist:
Reference: ADVANCED.md → Model Object Construction section
For EACH model in the response:
src/main/java/com/smartsheet/api/models/Example validation (UserPlan model):
OpenAPI spec shows:
UserPlan:
required: [planId, seatType]
properties:
planId:
type: integer
format: int64
seatType:
type: string
seatTypeLastChangedAt:
type: string
format: date-time
Java model MUST have:
private Long planId; // int64 → Long (required)
private SeatType seatType; // string enum → SeatType (required)
private ZonedDateTime seatTypeLastChangedAt; // date-time → ZonedDateTime (optional)
Reference: ADVANCED.md → Resource Module Organization section
*Resources interface (e.g., UserResources.java)SmartsheetException, InvalidRequestException, etc.list*(), get*(), create*(), update*(), delete*()Reference: ADVANCED.md → Request Lifecycle section
REQUIRED: Use AbstractResources template methods.
Common patterns:
getResource(path, ResponseClass.class)listResources(path, ResponseClass.class) or listResourcesWithWrapper()createResource(path, ResponseClass.class, requestObject)updateResource(path, ResponseClass.class, requestObject)deleteResource(path, ResponseClass.class)Example (GET with pagination):
public TokenPaginatedResult<UserPlan> listUserPlans(long userId, String lastKey, Long maxItems) {
String path = USERS + "/" + userId + "/plans";
Map<String, Object> parameters = new HashMap<>();
if (lastKey != null) {
parameters.put("lastKey", lastKey);
}
if (maxItems != null) {
parameters.put("maxItems", maxItems);
}
return listResourcesWithTokenPagination(path, UserPlan.class, parameters);
}
Do NOT:
Reference: TESTING.md → Mock API Test Patterns section
ABSOLUTE REQUIREMENT: Every endpoint MUST have all 6 tests.
Create test class in src/test/java/com/smartsheet/api/sdktest/{resource}/Test{Operation}.java
/errors/400-response mapping/errors/500-response mappingChecklist from TESTING.md:
Reference: TESTING.md → WireMock Mapping Creation section
Tests will fail without mappings.
Create mapping files in smartsheet-sdk-tests repository:
all-response-body-properties (includes all optional fields)required-response-body-properties (only required fields)/errors/400-response, /errors/500-response)Mapping x-test-name MUST match test code:
// Test code
Utils.createWiremockSmartsheetClient("/users/list-user-plans/all-response-body-properties", requestId);
// Mapping file: users-list-user-plans-all-properties.json
"x-test-name": {
"equalTo": "/users/list-user-plans/all-response-body-properties"
}
These thoughts mean you're cutting corners:
All of these mean: STOP. Follow the process completely.
| Excuse | Reality |
|---|---|
| "6 tests is too many" | Each test type catches different issues. All 6 are required. |
| "Required/all property tests are redundant" | Required tests validate minimal API contract. All tests catch field additions. Both needed. |
| "We'll add tests later" | Tests written after catch zero design issues. Later never comes. |
| "We have SOME coverage" | Partial coverage gives false confidence. Regressions slip through gaps. |
| "We've spent 3 hours already" | Sunk cost fallacy. Skipping tests costs more time debugging production issues. |
| "Spec is incomplete, I'll guess" | Wrong guesses break API contract. Get complete spec or STOP. |
| "Full field validation is tedious" | One missed field = production bug. Validate every field. |
| "HttpClient directly is simpler" | Bypasses retry, logging, error handling. Always use AbstractResources. |
Problem: Implementing based on assumptions or partial documentation.
Fix: Always fetch complete OpenAPI spec. Validate every field, type, and requirement before coding.
Problem: Creating 3 tests instead of 6 because "it's enough."
Fix: All 6 test types are mandatory. Each catches different categories of bugs. No exceptions.
Problem: Validating only id/name/permalink, skipping other fields.
Fix: Assert EVERY field from OpenAPI spec. Use complete object assertions, not sampling.
Problem: Calling HttpClient directly for "simple" requests.
Fix: Always use AbstractResources template methods. They provide retry logic, logging, error handling.
Without this process:
Following this process: