docs/skills/api-design/SKILL.md
REST API design conventions, error response format, Swagger/OpenAPI configuration, and endpoint documentation standards for the AI Donor Matcher backend. Use when designing new endpoints, setting up Swagger UI with the project theme, or standardizing API responses.
npx skillsauth add rizwan2004cs/ai-donor-matcher-backend api-designInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
/api/{resource} → collection
/api/{resource}/{id} → single item
/api/{resource}/{id}/verb → action on item
| Pattern | Example | Usage |
|---------|---------|-------|
| Plural nouns | /api/ngos, /api/pledges | Collection endpoints |
| kebab-case | /api/auth/resend-verification | Multi-word paths |
| Actions as sub-paths | /api/needs/{id}/fulfill | State transitions |
| My-resource prefix | /api/ngo/my/profile | Authenticated user's own data |
| Method | Usage | Response Code | |--------|-------|---------------| | GET | Read data | 200 | | POST | Create resource | 201 | | PUT | Full update | 200 | | PATCH | Partial update / state change | 200 | | DELETE | Remove | 204 (no body) |
{
"id": 1,
"name": "Hope Foundation",
"status": "APPROVED"
}
{
"message": "Registration successful. Check your email."
}
{
"error": "Email already registered."
}
{
"error": "Validation failed.",
"fieldErrors": {
"email": "must not be blank",
"fullName": "must not be blank"
}
}
| # | Method | Endpoint | Feature |
|---|--------|----------|---------|
| 1 | POST | /api/auth/register | 1.1 |
| 2 | GET | /api/auth/verify?token= | 1.2 |
| 3 | POST | /api/auth/login | 1.3 |
| 4 | POST | /api/auth/resend-verification | 1.4 |
| 5 | GET | /api/ngos?lat=&lng=&radius=&category=&search= | 2.1 |
| 6 | GET | /api/ngos/{id} | 2.2 |
| # | Method | Endpoint | Feature |
|---|--------|----------|---------|
| 8 | GET | /api/ngo/my/profile | 3.1 |
| 9 | PUT | /api/ngo/my/profile | 3.2 |
| 10 | POST | /api/ngo/my/photo | 3.3 |
| 11 | GET | /api/ngo/my/needs | 4.1 |
| 12 | POST | /api/needs | 4.2 |
| 13 | PUT | /api/needs/{id} | 4.3 |
| 14 | DELETE | /api/needs/{id} | 4.4 |
| 15 | PATCH | /api/needs/{id}/fulfill | 4.5 |
| # | Method | Endpoint | Feature |
|---|--------|----------|---------|
| 16 | POST | /api/pledges | 5.1 |
| 17 | DELETE | /api/pledges/{id} | 5.2 |
| 18 | GET | /api/pledges/active | 5.3 |
| 19 | GET | /api/pledges/history | 5.4 |
| # | Method | Endpoint | Feature |
|---|--------|----------|---------|
| 20 | GET | /api/admin/ngos/pending | 6.1 |
| 21 | POST | /api/admin/ngos/{id}/approve | 6.2 |
| 22 | POST | /api/admin/ngos/{id}/reject | 6.3 |
| 23 | POST | /api/admin/ngos/{id}/suspend | 6.4 |
| 24 | GET | /api/admin/reports | 7.1 |
| 25 | PUT | /api/admin/needs/{id} | 7.2 |
| 26 | DELETE | /api/admin/needs/{id} | 7.3 |
| 27 | GET | /api/admin/stats | 7.4 |
| # | Method | Endpoint | Feature |
|---|--------|----------|---------|
| 7 | POST | /api/ngos/{id}/report | 2.3 |
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.3.0</version>
</dependency>
# Swagger / OpenAPI
springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.path=/swagger-ui.html
springdoc.swagger-ui.tags-sorter=alpha
springdoc.swagger-ui.operations-sorter=method
.requestMatchers("/swagger-ui/**", "/api-docs/**", "/swagger-ui.html").permitAll()
@Configuration
public class OpenApiConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.info(new Info()
.title("AI Donor Matcher API")
.description("REST API for connecting donors with verified NGOs")
.version("1.0.0")
.contact(new Contact().name("AI Donor Matcher").email("[email protected]")))
.addSecurityItem(new SecurityRequirement().addList("Bearer Auth"))
.components(new Components()
.addSecuritySchemes("Bearer Auth",
new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("bearer")
.bearerFormat("JWT")));
}
}
Add a custom CSS file at src/main/resources/static/swagger-custom.css and configure:
springdoc.swagger-ui.css-url=/swagger-custom.css
The theme CSS should use the brand palette:
#C1694F for primary actions and topbar#3B6B4B for success indicators#FAF7F2 background#2C2C2C text
See the swagger-theme skill or src/main/resources/static/swagger-custom.css for full styles.development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.