[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75GFDN90VVECRGFEGKBNKM5":3,"skill-same:01M75GFDN90VVECRGFEGKBNKM5":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":6,"ownerHtmlUrl":36,"ownerBlogUrl":37,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M75GFDN90VVECRGFEGKBNKM5","fosmvvm-serverrequest-test-generator",null,"Generate ServerRequest tests using VaporTesting. Covers typed request\u002Fresponse validation for Show, Create, Update, and Delete operations.","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Ffoscomputerservices\u002Ffosmvvm-serverrequest-test-generator\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: fosmvvm-serverrequest-test-generator\ndescription: Generate ServerRequest tests using VaporTesting. Covers typed request\u002Fresponse validation for Show, Create, Update, and Delete operations.\nhomepage: https:\u002F\u002Fgithub.com\u002Ffoscomputerservices\u002FFOSUtilities\nmetadata: {\"clawdbot\": {\"emoji\": \"🧪\", \"os\": [\"darwin\", \"linux\"]}}\n---\n\n# FOSMVVM ServerRequest Test Generator\n\nGenerate test files for ServerRequest types using VaporTesting infrastructure.\n\n## Conceptual Foundation\n\n> For full architecture context, see [FOSMVVMArchitecture.md](..\u002F..\u002Fdocs\u002FFOSMVVMArchitecture.md) | [OpenClaw reference]({baseDir}\u002Freferences\u002FFOSMVVMArchitecture.md)\n\nServerRequest testing uses **VaporTesting** infrastructure to send typed requests through the full server stack:\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                    ServerRequest Test Flow                           │\n├─────────────────────────────────────────────────────────────────────┤\n│                                                                      │\n│  Test Code:                                                          │\n│    let request = MyRequest(query: .init(...))                        │\n│    app.testing().test(request, locale: en) { response in }           │\n│                                                                      │\n│  Infrastructure handles:                                             │\n│    • Path derivation from type name (MyRequest → \u002Fmy)                │\n│    • HTTP method from action (ShowRequest → GET)                     │\n│    • Query\u002Fbody encoding                                             │\n│    • Header injection (locale, version)                              │\n│    • Response decoding to ResponseBody type                          │\n│                                                                      │\n│  You verify:                                                         │\n│    • response.status (HTTPStatus)                                    │\n│    • response.body (R.ResponseBody? - typed!)                        │\n│    • response.error (R.ResponseError? - typed!)                      │\n│                                                                      │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\n---\n\n## STOP AND READ THIS\n\n**Testing ServerRequests uses VaporTesting infrastructure. No manual URL construction. Ever.**\n\n```\n┌──────────────────────────────────────────────────────────────────────┐\n│          SERVERREQUEST TESTING USES TestingApplicationTester          │\n├──────────────────────────────────────────────────────────────────────┤\n│                                                                       │\n│  1. Configure Vapor Application with routes                           │\n│  2. Use app.testing().test(request, locale:) { response in }          │\n│  3. Verify response.status, response.body, response.error             │\n│                                                                       │\n│  TestingServerRequestResponse\u003CR> provides TYPED access to:            │\n│    • status: HTTPStatus                                               │\n│    • headers: HTTPHeaders                                             │\n│    • body: R.ResponseBody?     ← Auto-decoded!                        │\n│    • error: R.ResponseError?   ← Auto-decoded!                        │\n│                                                                       │\n└──────────────────────────────────────────────────────────────────────┘\n```\n\n### What You Must NEVER Do\n\n```swift\n\u002F\u002F ❌ WRONG - manual URL construction\nlet url = URL(string: \"http:\u002F\u002Flocalhost:8080\u002Fmy_request?query=value\")!\nlet response = try await URLSession.shared.data(from: url)\n\n\u002F\u002F ❌ WRONG - string path with method\ntry await app.test(.GET, \"\u002Fmy_request\") { response in }\n\n\u002F\u002F ❌ WRONG - manual JSON encoding\u002Fdecoding\nlet json = try JSONEncoder().encode(requestBody)\nlet decoded = try JSONDecoder().decode(ResponseBody.self, from: data)\n\n\u002F\u002F ❌ WRONG - constructing TestingHTTPRequest manually\nlet httpRequest = TestingHTTPRequest(method: .GET, url: \"\u002Fpath\", headers: headers)\ntry await app.testing().performTest(request: httpRequest)\n```\n\n### What You Must ALWAYS Do\n\n```swift\n\u002F\u002F ✅ RIGHT - Use TestingApplicationTester.test() with ServerRequest\nlet request = MyShowRequest(query: .init(userId: userId))\ntry await app.testing().test(request, locale: en) { response in\n    #expect(response.status == .ok)\n    #expect(response.body?.viewModel.name == \"Expected Name\")\n}\n\n\u002F\u002F ✅ RIGHT - Test multiple locales\nfor locale in [en, es] {\n    try await app.testing().test(request, locale: locale) { response in\n        #expect(response.status == .ok)\n        \u002F\u002F Localized values are automatically handled\n    }\n}\n\n\u002F\u002F ✅ RIGHT - Test error responses\nlet badRequest = MyShowRequest(query: .init(userId: invalidId))\ntry await app.testing().test(badRequest, locale: en) { response in\n    #expect(response.status == .notFound)\n    #expect(response.error != nil)\n}\n```\n\n**The path is derived from the ServerRequest type. HTTP method comes from the action. Headers are automatic. You NEVER write URL strings or decode JSON manually.**\n\n---\n\n## When to Use This Skill\n\n- Testing any ServerRequest implementation\n- Verifying server responses for CRUD operations\n- Testing error handling and edge cases\n- Multi-locale response verification\n- Integration testing between client request types and server controllers\n\n**If you're about to write `URLSession`, `app.test(.GET, \"\u002Fpath\")`, or manual JSON decoding, STOP and use this skill instead.**\n\n## What This Skill Generates\n\n| File | Location | Purpose |\n|------|----------|---------|\n| `{Feature}RequestTests.swift` | `Tests\u002F{Target}Tests\u002FRequests\u002F` | Test suite for ServerRequest |\n| Test YAML (if needed) | `Tests\u002F{Target}Tests\u002FTestYAML\u002F` | Localization for test ViewModels |\n\n## Project Structure Configuration\n\n| Placeholder | Description | Example |\n|-------------|-------------|---------|\n| `{Feature}` | Feature or entity name (PascalCase) | `Idea`, `User`, `Dashboard` |\n| `{Target}` | Server test target | `WebServerTests`, `AppTests` |\n| `{ViewModelsTarget}` | Shared ViewModels SPM target | `ViewModels` |\n| `{WebServerTarget}` | Server-side target | `WebServer`, `AppServer` |\n| `{ResourceDir}` | YAML resource directory | `TestYAML`, `Resources` |\n\n---\n\n## Key Types\n\n### TestingServerRequestResponse\u003CR>\n\nWraps HTTP response with typed access:\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `status` | `HTTPStatus` | HTTP status code (.ok, .notFound, etc.) |\n| `headers` | `HTTPHeaders` | Response headers |\n| `body` | `R.ResponseBody?` | **Typed** response body (auto-decoded) |\n| `error` | `R.ResponseError?` | **Typed** error (auto-decoded) |\n\n### TestingApplicationTester Extension\n\n```swift\nfunc test\u003CR: ServerRequest>(\n    _ request: R,\n    locale: Locale = en,\n    headers: HTTPHeaders = [:],\n    afterResponse: (TestingServerRequestResponse\u003CR>) async throws -> Void\n) async throws -> any TestingApplicationTester\n```\n\n### Convenience Locales\n\nAvailable on `TestingApplicationTester`:\n- `en` - English\n- `enUS` - English (US)\n- `enGB` - English (UK)\n- `es` - Spanish\n\n---\n\n## Test Structure\n\n### Basic Test Suite\n\n```swift\nimport FOSFoundation\n@testable import FOSMVVM\nimport FOSTesting\nimport FOSTestingVapor\nimport Foundation\nimport Testing\nimport Vapor\nimport VaporTesting\n\n@Suite(\"MyFeature Request Tests\")\nstruct MyFeatureRequestTests {\n    @Test func showRequest_success() async throws {\n        try await withTestApp { app in\n            let request = MyShowRequest(query: .init(id: validId))\n\n            try await app.testing().test(request, locale: en) { response in\n                #expect(response.status == .ok)\n                #expect(response.body?.viewModel != nil)\n            }\n        }\n    }\n\n    @Test func showRequest_notFound() async throws {\n        try await withTestApp { app in\n            let request = MyShowRequest(query: .init(id: invalidId))\n\n            try await app.testing().test(request, locale: en) { response in\n                #expect(response.status == .notFound)\n            }\n        }\n    }\n}\n\nprivate func withTestApp(_ test: (Application) async throws -> Void) async throws {\n    try await withApp { app in\n        \u002F\u002F Configure routes\n        try app.routes.register(collection: MyController())\n        try await test(app)\n    }\n}\n```\n\n### Testing Different Request Types\n\n| Request Type | HTTP Method | What to Test |\n|--------------|-------------|--------------|\n| `ShowRequest` | GET | Query params, response body, localization |\n| `ViewModelRequest` | GET | ViewModel population, all localized fields |\n| `CreateRequest` | POST | RequestBody validation, created entity, ID response |\n| `UpdateRequest` | PATCH | RequestBody validation, updated entity, response |\n| `DeleteRequest` | DELETE | Entity removal, status code |\n\n---\n\n## How to Use This Skill\n\n**Invocation:**\n\u002Ffosmvvm-serverrequest-test-generator\n\n**Prerequisites:**\n- ServerRequest type understood from conversation context\n- Test scenarios identified (success paths, error paths, validation)\n- Controller implementation exists or is being created\n- VaporTesting infrastructure understood\n\n**Workflow integration:**\nThis skill is used when testing ServerRequest implementations. The skill references conversation context automatically—no file paths or Q&A needed. Typically follows fosmvvm-serverrequest-generator.\n\n## Pattern Implementation\n\nThis skill references conversation context to determine test structure:\n\n### Request Analysis\n\nFrom conversation context, the skill identifies:\n- **ServerRequest type** (from prior discussion or server implementation)\n- **Request protocol** (ShowRequest, CreateRequest, UpdateRequest, etc.)\n- **ResponseBody type** (ViewModel or simple structure)\n- **ResponseError type** (custom errors or EmptyError)\n\n### Test Scenario Planning\n\nBased on operation semantics:\n- **Success paths** (valid input, expected output)\n- **Error paths** (not found, validation failure, business logic errors)\n- **Localization** (if ResponseBody has localized fields)\n- **Multi-locale** (testing across supported locales)\n\n### Infrastructure Detection\n\nFrom project state:\n- **Existing test patterns** (similar test files in codebase)\n- **Localization setup** (YAML fixtures needed)\n- **Database requirements** (seed data for tests)\n\n### Test File Generation\n\n1. Test suite conforming to VaporTesting patterns\n2. One @Test function per scenario\n3. withTestApp helper for application setup\n4. Route registration\n5. Request invocations using app.testing().test()\n\n### Context Sources\n\nSkill references information from:\n- **Prior conversation**: Test requirements, scenarios discussed\n- **ServerRequest**: If Claude has read ServerRequest code into context\n- **Controller**: From server implementation\n- **Existing tests**: From codebase analysis of similar test files\n\n---\n\n## Common Scenarios\n\n### Testing ViewModelRequest with Localization\n\n```swift\n@Test func viewModelRequest_multiLocale() async throws {\n    try await withTestApp { app in\n        let request = DashboardViewModelRequest()\n\n        \u002F\u002F Test English\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .ok)\n            let vm = try #require(response.body)\n            #expect(try vm.pageTitle.localizedString == \"Dashboard\")\n        }\n\n        \u002F\u002F Test Spanish\n        try await app.testing().test(request, locale: es) { response in\n            #expect(response.status == .ok)\n            let vm = try #require(response.body)\n            #expect(try vm.pageTitle.localizedString == \"Tablero\")\n        }\n    }\n}\n```\n\n### Testing CreateRequest with Validation\n\n```swift\n@Test func createRequest_validInput() async throws {\n    try await withTestApp { app in\n        let request = CreateIdeaRequest(requestBody: .init(\n            content: \"Valid idea content\"\n        ))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .ok)\n            #expect(response.body?.id != nil)\n        }\n    }\n}\n\n@Test func createRequest_invalidInput() async throws {\n    try await withTestApp { app in\n        let request = CreateIdeaRequest(requestBody: .init(\n            content: \"\"  \u002F\u002F Empty content should fail validation\n        ))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .badRequest)\n            #expect(response.error != nil)\n        }\n    }\n}\n```\n\n### Testing UpdateRequest\n\n```swift\n@Test func updateRequest_success() async throws {\n    try await withTestApp { app in\n        \u002F\u002F First create an entity\n        let createRequest = CreateIdeaRequest(requestBody: .init(content: \"Original\"))\n        var createdId: ModelIdType?\n        try await app.testing().test(createRequest, locale: en) { response in\n            createdId = response.body?.id\n        }\n\n        \u002F\u002F Then update it\n        let updateRequest = UpdateIdeaRequest(requestBody: .init(\n            ideaId: try #require(createdId),\n            content: \"Updated content\"\n        ))\n\n        try await app.testing().test(updateRequest, locale: en) { response in\n            #expect(response.status == .ok)\n            #expect(response.body?.viewModel.content == \"Updated content\")\n        }\n    }\n}\n```\n\n### Testing DeleteRequest\n\n```swift\n@Test func deleteRequest_success() async throws {\n    try await withTestApp { app in\n        \u002F\u002F Create, then delete\n        let deleteRequest = DeleteIdeaRequest(requestBody: .init(ideaId: existingId))\n\n        try await app.testing().test(deleteRequest, locale: en) { response in\n            #expect(response.status == .ok)\n        }\n\n        \u002F\u002F Verify deleted (should return not found)\n        let showRequest = ShowIdeaRequest(query: .init(ideaId: existingId))\n        try await app.testing().test(showRequest, locale: en) { response in\n            #expect(response.status == .notFound)\n        }\n    }\n}\n```\n\n### Testing ShowRequest with Query Parameters\n\n```swift\n@Test func showRequest_withQuery() async throws {\n    try await withTestApp { app in\n        let request = UserShowRequest(query: .init(\n            userId: userId,\n            includeDetails: true\n        ))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .ok)\n            #expect(response.body?.user.details != nil)\n        }\n    }\n}\n```\n\n---\n\n## Testing ServerRequestError Localizations\n\n### Why Error Localization Testing is Different\n\nUnlike ViewModels, `ServerRequestError` types:\n- Are often **enums**, not structs\n- Do **not** conform to `Stubbable` or `RetrievablePropertyNames`\n- Cannot use `expectTranslations(ErrorType.self)` like ViewModels\n\nThis means you must **manually test each error case** individually.\n\n### The Pattern\n\nUse `LocalizableTestCase.expectTranslations(_ localizable:)` on each error's `Localizable` property:\n\n```swift\n@Suite(\"MyError Localization Tests\")\nstruct MyErrorLocalizationTests: LocalizableTestCase {\n    let locStore: LocalizationStore\n\n    init() throws {\n        self.locStore = try Self.loadLocalizationStore(\n            bundle: Bundle.module,\n            resourceDirectoryName: \"TestYAML\"\n        )\n    }\n\n    @Test func errorMessages_simpleErrors() throws {\n        \u002F\u002F Test each error case individually\n        let serverFailed = MyError(code: .serverFailed)\n        try expectTranslations(serverFailed.message)\n\n        let appFailed = MyError(code: .applicationFailed)\n        try expectTranslations(appFailed.message)\n    }\n\n    @Test func errorMessages_withSubstitutions() throws {\n        \u002F\u002F For errors with associated values, test with representative values\n        let quotaError = QuotaError(code: .quotaExceeded(requested: 100, maximum: 50))\n        try expectTranslations(quotaError.message)\n    }\n}\n```\n\n### Testing Error Messages in Integration Tests\n\nWhen testing the full request\u002Fresponse cycle, verify error messages resolve:\n\n```swift\n@Test func createRequest_validationError_hasLocalizedMessage() async throws {\n    try await withTestApp { app in\n        let request = CreateIdeaRequest(requestBody: .init(content: \"\"))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .badRequest)\n            let error = try #require(response.error)\n\n            \u002F\u002F Verify the message resolved (not empty or pending)\n            #expect(!error.message.isEmpty)\n\n            \u002F\u002F Optionally verify specific text for English locale\n            #expect(try error.message.localizedString.contains(\"required\"))\n        }\n    }\n}\n```\n\n### Why Not Stubbable?\n\n`Stubbable` works well for ViewModels because:\n- ViewModels are structs with many properties\n- A single `stub()` provides a complete test instance\n\n`ServerRequestError` types are often enums where:\n- Each case may have different associated values\n- Each case may have a different localized message\n- A single `stub()` can't cover all cases\n\n**You must enumerate and test each error case explicitly.**\n\n### Checklist for Error Localization Tests\n\n- [ ] Test each enum case for simple errors\n- [ ] Test representative associated values for parameterized errors\n- [ ] Verify messages resolve (not empty) for all configured locales\n- [ ] Verify substitution placeholders are replaced in `LocalizableSubstitutions`\n\n---\n\n## Troubleshooting\n\n### \"Route not found\" Error\n\n**Cause:** Controller not registered in test app.\n\n**Fix:** Register the controller before testing:\n```swift\ntry app.routes.register(collection: MyController())\n```\n\n### Response body is nil but status is .ok\n\n**Cause:** JSON decoding failed silently.\n\n**Fix:** Check that `ResponseBody` type matches server response exactly. Use `response.headers` to verify Content-Type.\n\n### Localization not applied\n\n**Cause:** Locale not passed to encoder.\n\n**Fix:** The `test(_:locale:)` method handles this automatically. Ensure you're passing the locale parameter.\n\n### \"Missing Translation\" in Response\n\n**Cause:** YAML localization not loaded.\n\n**Fix:** Initialize localization store in test app setup:\n```swift\ntry app.initYamlLocalization(\n    bundle: Bundle.module,\n    resourceDirectoryName: \"TestYAML\"\n)\n```\n\n---\n\n## Naming Conventions\n\n| Concept | Convention | Example |\n|---------|------------|---------|\n| Test suite | `{Feature}RequestTests` | `IdeaRequestTests` |\n| Test file | `{Feature}RequestTests.swift` | `IdeaRequestTests.swift` |\n| Test method (success) | `{action}Request_success` | `showRequest_success` |\n| Test method (error) | `{action}Request_{errorCase}` | `showRequest_notFound` |\n| Test method (validation) | `{action}Request_{validationCase}` | `createRequest_emptyContent` |\n| Test helper | `withTestApp` | `withTestApp { app in }` |\n| Locale constant | `en`, `es`, `enUS`, `enGB` | `locale: en` |\n\n---\n\n---\n\n## File Templates\n\nSee [reference.md](reference.md) for complete file templates.\n\n---\n\n## See Also\n\n- [FOSMVVMArchitecture.md](..\u002F..\u002Fdocs\u002FFOSMVVMArchitecture.md) - Full architecture\n- [fosmvvm-serverrequest-generator](..\u002Ffosmvvm-serverrequest-generator\u002FSKILL.md) - Creating ServerRequest types\n- [fosmvvm-viewmodel-test-generator](..\u002Ffosmvvm-viewmodel-test-generator\u002FSKILL.md) - Testing ViewModels (localization only)\n- [reference.md](reference.md) - Complete file templates\n\n---\n\n## Version History\n\n| Version | Date | Changes |\n|---------|------|---------|\n| 1.1 | 2025-01-20 | Add ServerRequestError localization testing guidance |\n| 1.2 | 2026-01-24 | Update to context-aware approach (remove file-parsing\u002FQ&A). Skill references conversation context instead of asking questions or accepting file paths. |\n| 1.0 | 2025-01-05 | Initial skill |\n","# FOSMVVM ServerRequest Test Generator\n\nGenerate test files for ServerRequest types using VaporTesting infrastructure.\n\n## Conceptual Foundation\n\n> For full architecture context, see [FOSMVVMArchitecture.md](..\u002F..\u002Fdocs\u002FFOSMVVMArchitecture.md) | [OpenClaw reference]({baseDir}\u002Freferences\u002FFOSMVVMArchitecture.md)\n\nServerRequest testing uses **VaporTesting** infrastructure to send typed requests through the full server stack:\n\n```\n┌─────────────────────────────────────────────────────────────────────┐\n│                    ServerRequest Test Flow                           │\n├─────────────────────────────────────────────────────────────────────┤\n│                                                                      │\n│  Test Code:                                                          │\n│    let request = MyRequest(query: .init(...))                        │\n│    app.testing().test(request, locale: en) { response in }           │\n│                                                                      │\n│  Infrastructure handles:                                             │\n│    • Path derivation from type name (MyRequest → \u002Fmy)                │\n│    • HTTP method from action (ShowRequest → GET)                     │\n│    • Query\u002Fbody encoding                                             │\n│    • Header injection (locale, version)                              │\n│    • Response decoding to ResponseBody type                          │\n│                                                                      │\n│  You verify:                                                         │\n│    • response.status (HTTPStatus)                                    │\n│    • response.body (R.ResponseBody? - typed!)                        │\n│    • response.error (R.ResponseError? - typed!)                      │\n│                                                                      │\n└─────────────────────────────────────────────────────────────────────┘\n```\n\n---\n\n## STOP AND READ THIS\n\n**Testing ServerRequests uses VaporTesting infrastructure. No manual URL construction. Ever.**\n\n```\n┌──────────────────────────────────────────────────────────────────────┐\n│          SERVERREQUEST TESTING USES TestingApplicationTester          │\n├──────────────────────────────────────────────────────────────────────┤\n│                                                                       │\n│  1. Configure Vapor Application with routes                           │\n│  2. Use app.testing().test(request, locale:) { response in }          │\n│  3. Verify response.status, response.body, response.error             │\n│                                                                       │\n│  TestingServerRequestResponse\u003CR> provides TYPED access to:            │\n│    • status: HTTPStatus                                               │\n│    • headers: HTTPHeaders                                             │\n│    • body: R.ResponseBody?     ← Auto-decoded!                        │\n│    • error: R.ResponseError?   ← Auto-decoded!                        │\n│                                                                       │\n└──────────────────────────────────────────────────────────────────────┘\n```\n\n### What You Must NEVER Do\n\n```swift\n\u002F\u002F ❌ WRONG - manual URL construction\nlet url = URL(string: \"http:\u002F\u002Flocalhost:8080\u002Fmy_request?query=value\")!\nlet response = try await URLSession.shared.data(from: url)\n\n\u002F\u002F ❌ WRONG - string path with method\ntry await app.test(.GET, \"\u002Fmy_request\") { response in }\n\n\u002F\u002F ❌ WRONG - manual JSON encoding\u002Fdecoding\nlet json = try JSONEncoder().encode(requestBody)\nlet decoded = try JSONDecoder().decode(ResponseBody.self, from: data)\n\n\u002F\u002F ❌ WRONG - constructing TestingHTTPRequest manually\nlet httpRequest = TestingHTTPRequest(method: .GET, url: \"\u002Fpath\", headers: headers)\ntry await app.testing().performTest(request: httpRequest)\n```\n\n### What You Must ALWAYS Do\n\n```swift\n\u002F\u002F ✅ RIGHT - Use TestingApplicationTester.test() with ServerRequest\nlet request = MyShowRequest(query: .init(userId: userId))\ntry await app.testing().test(request, locale: en) { response in\n    #expect(response.status == .ok)\n    #expect(response.body?.viewModel.name == \"Expected Name\")\n}\n\n\u002F\u002F ✅ RIGHT - Test multiple locales\nfor locale in [en, es] {\n    try await app.testing().test(request, locale: locale) { response in\n        #expect(response.status == .ok)\n        \u002F\u002F Localized values are automatically handled\n    }\n}\n\n\u002F\u002F ✅ RIGHT - Test error responses\nlet badRequest = MyShowRequest(query: .init(userId: invalidId))\ntry await app.testing().test(badRequest, locale: en) { response in\n    #expect(response.status == .notFound)\n    #expect(response.error != nil)\n}\n```\n\n**The path is derived from the ServerRequest type. HTTP method comes from the action. Headers are automatic. You NEVER write URL strings or decode JSON manually.**\n\n---\n\n## When to Use This Skill\n\n- Testing any ServerRequest implementation\n- Verifying server responses for CRUD operations\n- Testing error handling and edge cases\n- Multi-locale response verification\n- Integration testing between client request types and server controllers\n\n**If you're about to write `URLSession`, `app.test(.GET, \"\u002Fpath\")`, or manual JSON decoding, STOP and use this skill instead.**\n\n## What This Skill Generates\n\n| File | Location | Purpose |\n|------|----------|---------|\n| `{Feature}RequestTests.swift` | `Tests\u002F{Target}Tests\u002FRequests\u002F` | Test suite for ServerRequest |\n| Test YAML (if needed) | `Tests\u002F{Target}Tests\u002FTestYAML\u002F` | Localization for test ViewModels |\n\n## Project Structure Configuration\n\n| Placeholder | Description | Example |\n|-------------|-------------|---------|\n| `{Feature}` | Feature or entity name (PascalCase) | `Idea`, `User`, `Dashboard` |\n| `{Target}` | Server test target | `WebServerTests`, `AppTests` |\n| `{ViewModelsTarget}` | Shared ViewModels SPM target | `ViewModels` |\n| `{WebServerTarget}` | Server-side target | `WebServer`, `AppServer` |\n| `{ResourceDir}` | YAML resource directory | `TestYAML`, `Resources` |\n\n---\n\n## Key Types\n\n### TestingServerRequestResponse\u003CR>\n\nWraps HTTP response with typed access:\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `status` | `HTTPStatus` | HTTP status code (.ok, .notFound, etc.) |\n| `headers` | `HTTPHeaders` | Response headers |\n| `body` | `R.ResponseBody?` | **Typed** response body (auto-decoded) |\n| `error` | `R.ResponseError?` | **Typed** error (auto-decoded) |\n\n### TestingApplicationTester Extension\n\n```swift\nfunc test\u003CR: ServerRequest>(\n    _ request: R,\n    locale: Locale = en,\n    headers: HTTPHeaders = [:],\n    afterResponse: (TestingServerRequestResponse\u003CR>) async throws -> Void\n) async throws -> any TestingApplicationTester\n```\n\n### Convenience Locales\n\nAvailable on `TestingApplicationTester`:\n- `en` - English\n- `enUS` - English (US)\n- `enGB` - English (UK)\n- `es` - Spanish\n\n---\n\n## Test Structure\n\n### Basic Test Suite\n\n```swift\nimport FOSFoundation\n@testable import FOSMVVM\nimport FOSTesting\nimport FOSTestingVapor\nimport Foundation\nimport Testing\nimport Vapor\nimport VaporTesting\n\n@Suite(\"MyFeature Request Tests\")\nstruct MyFeatureRequestTests {\n    @Test func showRequest_success() async throws {\n        try await withTestApp { app in\n            let request = MyShowRequest(query: .init(id: validId))\n\n            try await app.testing().test(request, locale: en) { response in\n                #expect(response.status == .ok)\n                #expect(response.body?.viewModel != nil)\n            }\n        }\n    }\n\n    @Test func showRequest_notFound() async throws {\n        try await withTestApp { app in\n            let request = MyShowRequest(query: .init(id: invalidId))\n\n            try await app.testing().test(request, locale: en) { response in\n                #expect(response.status == .notFound)\n            }\n        }\n    }\n}\n\nprivate func withTestApp(_ test: (Application) async throws -> Void) async throws {\n    try await withApp { app in\n        \u002F\u002F Configure routes\n        try app.routes.register(collection: MyController())\n        try await test(app)\n    }\n}\n```\n\n### Testing Different Request Types\n\n| Request Type | HTTP Method | What to Test |\n|--------------|-------------|--------------|\n| `ShowRequest` | GET | Query params, response body, localization |\n| `ViewModelRequest` | GET | ViewModel population, all localized fields |\n| `CreateRequest` | POST | RequestBody validation, created entity, ID response |\n| `UpdateRequest` | PATCH | RequestBody validation, updated entity, response |\n| `DeleteRequest` | DELETE | Entity removal, status code |\n\n---\n\n## How to Use This Skill\n\n**Invocation:**\n\u002Ffosmvvm-serverrequest-test-generator\n\n**Prerequisites:**\n- ServerRequest type understood from conversation context\n- Test scenarios identified (success paths, error paths, validation)\n- Controller implementation exists or is being created\n- VaporTesting infrastructure understood\n\n**Workflow integration:**\nThis skill is used when testing ServerRequest implementations. The skill references conversation context automatically—no file paths or Q&A needed. Typically follows fosmvvm-serverrequest-generator.\n\n## Pattern Implementation\n\nThis skill references conversation context to determine test structure:\n\n### Request Analysis\n\nFrom conversation context, the skill identifies:\n- **ServerRequest type** (from prior discussion or server implementation)\n- **Request protocol** (ShowRequest, CreateRequest, UpdateRequest, etc.)\n- **ResponseBody type** (ViewModel or simple structure)\n- **ResponseError type** (custom errors or EmptyError)\n\n### Test Scenario Planning\n\nBased on operation semantics:\n- **Success paths** (valid input, expected output)\n- **Error paths** (not found, validation failure, business logic errors)\n- **Localization** (if ResponseBody has localized fields)\n- **Multi-locale** (testing across supported locales)\n\n### Infrastructure Detection\n\nFrom project state:\n- **Existing test patterns** (similar test files in codebase)\n- **Localization setup** (YAML fixtures needed)\n- **Database requirements** (seed data for tests)\n\n### Test File Generation\n\n1. Test suite conforming to VaporTesting patterns\n2. One @Test function per scenario\n3. withTestApp helper for application setup\n4. Route registration\n5. Request invocations using app.testing().test()\n\n### Context Sources\n\nSkill references information from:\n- **Prior conversation**: Test requirements, scenarios discussed\n- **ServerRequest**: If Claude has read ServerRequest code into context\n- **Controller**: From server implementation\n- **Existing tests**: From codebase analysis of similar test files\n\n---\n\n## Common Scenarios\n\n### Testing ViewModelRequest with Localization\n\n```swift\n@Test func viewModelRequest_multiLocale() async throws {\n    try await withTestApp { app in\n        let request = DashboardViewModelRequest()\n\n        \u002F\u002F Test English\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .ok)\n            let vm = try #require(response.body)\n            #expect(try vm.pageTitle.localizedString == \"Dashboard\")\n        }\n\n        \u002F\u002F Test Spanish\n        try await app.testing().test(request, locale: es) { response in\n            #expect(response.status == .ok)\n            let vm = try #require(response.body)\n            #expect(try vm.pageTitle.localizedString == \"Tablero\")\n        }\n    }\n}\n```\n\n### Testing CreateRequest with Validation\n\n```swift\n@Test func createRequest_validInput() async throws {\n    try await withTestApp { app in\n        let request = CreateIdeaRequest(requestBody: .init(\n            content: \"Valid idea content\"\n        ))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .ok)\n            #expect(response.body?.id != nil)\n        }\n    }\n}\n\n@Test func createRequest_invalidInput() async throws {\n    try await withTestApp { app in\n        let request = CreateIdeaRequest(requestBody: .init(\n            content: \"\"  \u002F\u002F Empty content should fail validation\n        ))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .badRequest)\n            #expect(response.error != nil)\n        }\n    }\n}\n```\n\n### Testing UpdateRequest\n\n```swift\n@Test func updateRequest_success() async throws {\n    try await withTestApp { app in\n        \u002F\u002F First create an entity\n        let createRequest = CreateIdeaRequest(requestBody: .init(content: \"Original\"))\n        var createdId: ModelIdType?\n        try await app.testing().test(createRequest, locale: en) { response in\n            createdId = response.body?.id\n        }\n\n        \u002F\u002F Then update it\n        let updateRequest = UpdateIdeaRequest(requestBody: .init(\n            ideaId: try #require(createdId),\n            content: \"Updated content\"\n        ))\n\n        try await app.testing().test(updateRequest, locale: en) { response in\n            #expect(response.status == .ok)\n            #expect(response.body?.viewModel.content == \"Updated content\")\n        }\n    }\n}\n```\n\n### Testing DeleteRequest\n\n```swift\n@Test func deleteRequest_success() async throws {\n    try await withTestApp { app in\n        \u002F\u002F Create, then delete\n        let deleteRequest = DeleteIdeaRequest(requestBody: .init(ideaId: existingId))\n\n        try await app.testing().test(deleteRequest, locale: en) { response in\n            #expect(response.status == .ok)\n        }\n\n        \u002F\u002F Verify deleted (should return not found)\n        let showRequest = ShowIdeaRequest(query: .init(ideaId: existingId))\n        try await app.testing().test(showRequest, locale: en) { response in\n            #expect(response.status == .notFound)\n        }\n    }\n}\n```\n\n### Testing ShowRequest with Query Parameters\n\n```swift\n@Test func showRequest_withQuery() async throws {\n    try await withTestApp { app in\n        let request = UserShowRequest(query: .init(\n            userId: userId,\n            includeDetails: true\n        ))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .ok)\n            #expect(response.body?.user.details != nil)\n        }\n    }\n}\n```\n\n---\n\n## Testing ServerRequestError Localizations\n\n### Why Error Localization Testing is Different\n\nUnlike ViewModels, `ServerRequestError` types:\n- Are often **enums**, not structs\n- Do **not** conform to `Stubbable` or `RetrievablePropertyNames`\n- Cannot use `expectTranslations(ErrorType.self)` like ViewModels\n\nThis means you must **manually test each error case** individually.\n\n### The Pattern\n\nUse `LocalizableTestCase.expectTranslations(_ localizable:)` on each error's `Localizable` property:\n\n```swift\n@Suite(\"MyError Localization Tests\")\nstruct MyErrorLocalizationTests: LocalizableTestCase {\n    let locStore: LocalizationStore\n\n    init() throws {\n        self.locStore = try Self.loadLocalizationStore(\n            bundle: Bundle.module,\n            resourceDirectoryName: \"TestYAML\"\n        )\n    }\n\n    @Test func errorMessages_simpleErrors() throws {\n        \u002F\u002F Test each error case individually\n        let serverFailed = MyError(code: .serverFailed)\n        try expectTranslations(serverFailed.message)\n\n        let appFailed = MyError(code: .applicationFailed)\n        try expectTranslations(appFailed.message)\n    }\n\n    @Test func errorMessages_withSubstitutions() throws {\n        \u002F\u002F For errors with associated values, test with representative values\n        let quotaError = QuotaError(code: .quotaExceeded(requested: 100, maximum: 50))\n        try expectTranslations(quotaError.message)\n    }\n}\n```\n\n### Testing Error Messages in Integration Tests\n\nWhen testing the full request\u002Fresponse cycle, verify error messages resolve:\n\n```swift\n@Test func createRequest_validationError_hasLocalizedMessage() async throws {\n    try await withTestApp { app in\n        let request = CreateIdeaRequest(requestBody: .init(content: \"\"))\n\n        try await app.testing().test(request, locale: en) { response in\n            #expect(response.status == .badRequest)\n            let error = try #require(response.error)\n\n            \u002F\u002F Verify the message resolved (not empty or pending)\n            #expect(!error.message.isEmpty)\n\n            \u002F\u002F Optionally verify specific text for English locale\n            #expect(try error.message.localizedString.contains(\"required\"))\n        }\n    }\n}\n```\n\n### Why Not Stubbable?\n\n`Stubbable` works well for ViewModels because:\n- ViewModels are structs with many properties\n- A single `stub()` provides a complete test instance\n\n`ServerRequestError` types are often enums where:\n- Each case may have different associated values\n- Each case may have a different localized message\n- A single `stub()` can't cover all cases\n\n**You must enumerate and test each error case explicitly.**\n\n### Checklist for Error Localization Tests\n\n- [ ] Test each enum case for simple errors\n- [ ] Test representative associated values for parameterized errors\n- [ ] Verify messages resolve (not empty) for all configured locales\n- [ ] Verify substitution placeholders are replaced in `LocalizableSubstitutions`\n\n---\n\n## Troubleshooting\n\n### \"Route not found\" Error\n\n**Cause:** Controller not registered in test app.\n\n**Fix:** Register the controller before testing:\n```swift\ntry app.routes.register(collection: MyController())\n```\n\n### Response body is nil but status is .ok\n\n**Cause:** JSON decoding failed silently.\n\n**Fix:** Check that `ResponseBody` type matches server response exactly. Use `response.headers` to verify Content-Type.\n\n### Localization not applied\n\n**Cause:** Locale not passed to encoder.\n\n**Fix:** The `test(_:locale:)` method handles this automatically. Ensure you're passing the locale parameter.\n\n### \"Missing Translation\" in Response\n\n**Cause:** YAML localization not loaded.\n\n**Fix:** Initialize localization store in test app setup:\n```swift\ntry app.initYamlLocalization(\n    bundle: Bundle.module,\n    resourceDirectoryName: \"TestYAML\"\n)\n```\n\n---\n\n## Naming Conventions\n\n| Concept | Convention | Example |\n|---------|------------|---------|\n| Test suite | `{Feature}RequestTests` | `IdeaRequestTests` |\n| Test file | `{Feature}RequestTests.swift` | `IdeaRequestTests.swift` |\n| Test method (success) | `{action}Request_success` | `showRequest_success` |\n| Test method (error) | `{action}Request_{errorCase}` | `showRequest_notFound` |\n| Test method (validation) | `{action}Request_{validationCase}` | `createRequest_emptyContent` |\n| Test helper | `withTestApp` | `withTestApp { app in }` |\n| Locale constant | `en`, `es`, `enUS`, `enGB` | `locale: en` |\n\n---\n\n---\n\n## File Templates\n\nSee [reference.md](reference.md) for complete file templates.\n\n---\n\n## See Also\n\n- [FOSMVVMArchitecture.md](..\u002F..\u002Fdocs\u002FFOSMVVMArchitecture.md) - Full architecture\n- [fosmvvm-serverrequest-generator](..\u002Ffosmvvm-serverrequest-generator\u002FSKILL.md) - Creating ServerRequest types\n- [fosmvvm-viewmodel-test-generator](..\u002Ffosmvvm-viewmodel-test-generator\u002FSKILL.md) - Testing ViewModels (localization only)\n- [reference.md](reference.md) - Complete file templates\n\n---\n\n## Version History\n\n| Version | Date | Changes |\n|---------|------|---------|\n| 1.1 | 2025-01-20 | Add ServerRequestError localization testing guidance |\n| 1.2 | 2026-01-24 | Update to context-aware approach (remove file-parsing\u002FQ&A). Skill references conversation context instead of asking questions or accepting file paths. |\n| 1.0 | 2025-01-05 | Initial skill |\n",{"name":5,"homepage":24,"metadata":25,"description":7},"https:\u002F\u002Fgithub.com\u002Ffoscomputerservices\u002FFOSUtilities",{"clawdbot":26},{"os":27,"emoji":30},[28,29],"darwin","linux","🧪","main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Ffoscomputerservices\u002Ffosmvvm-serverrequest-test-generator",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill fosmvvm-serverrequest-test-generator",{"tool":46,"command":47},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill fosmvvm-serverrequest-test-generator",{"tool":49,"command":50},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill fosmvvm-serverrequest-test-generator","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Ffoscomputerservices\u002Ffosmvvm-serverrequest-test-generator\u002FSKILL.md",true,[],[55,63,70,77,84,91],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":62},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":62},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":62},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":62},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":62},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":62},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]