[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DW0P9AHE4ARE393P5S6RPE":3,"skill-same:01M6DW0P9AHE4ARE393P5S6RPE":60},{"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":33,"linkOnly":34,"markdownContent":35,"markdownBody":36,"frontMatter":37,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":6,"ownerHtmlUrl":43,"ownerBlogUrl":44,"ownerDescription":6,"updatedAt":45,"install":46,"resources":59},"01M6DW0P9AHE4ARE393P5S6RPE","prg-pattern",null,"ACTIVATE when implementing form handling, POST endpoints, or any controller that modifies data. ACTIVATE for 'form submission', 'POST redirect', 'PRG', 'duplicate submission'. Covers: POST success always redirects, POST error re-renders (no redirect), flash messages after redirect. DO NOT use for: FormType design (see symfony:symfony-form), API endpoints returning JSON.","FabienSalles\u002Fclaude-marketplace","FabienSalles","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F937901?v=4","01M6DVJBD31CJKRB382FQFZ5FH","Fabien Salles","01M6DVJBQNY8Q18KJD1ESAD6TX",9,"MIT","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsymfony\u002Fskills\u002Fprg-pattern\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32],"pattern","prg pattern","design","messages","data","controller","api","json","flash","use","endpoints","activate","do","duplicate","2026-11-10 10:12:30",false,"---\nname: prg-pattern\ndescription: \"ACTIVATE when implementing form handling, POST endpoints, or any controller that modifies data. ACTIVATE for 'form submission', 'POST redirect', 'PRG', 'duplicate submission'. Covers: POST success always redirects, POST error re-renders (no redirect), flash messages after redirect. DO NOT use for: FormType design (see symfony:symfony-form), API endpoints returning JSON.\"\n---\n\n# Post\u002FRedirect\u002FGet (PRG) Pattern\n\nPOST success -> redirect. POST error -> re-render with errors. This prevents duplicate submissions on page refresh.\n\n## The Solution\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                         PRG FLOW                            │\n├─────────────────────────────────────────────────────────────┤\n│                                                             │\n│   GET \u002Fform ──────────► Display Form                        │\n│        ▲                     │                              │\n│        │                     ▼                              │\n│        │              User fills & submits                  │\n│        │                     │                              │\n│        │                     ▼                              │\n│   ┌────┴────┐          POST \u002Fform                           │\n│   │ Refresh │                │                              │\n│   │  safe!  │                ▼                              │\n│   └────┬────┘     ┌──────────┴──────────┐                   │\n│        │          │                     │                   │\n│        │     Validation OK?        Validation KO            │\n│        │          │                     │                   │\n│        │          ▼                     ▼                   │\n│        │    302 REDIRECT          Re-render form            │\n│        │          │               with errors               │\n│        │          ▼                                         │\n│        └──── GET \u002Fsuccess                                   │\n│                                                             │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## Implementation Rules\n\n### 1. POST Success → Always Redirect\n\n```php\nif ($request->isMethod('POST')) {\n    $selection = $request->request->getString('choice');\n\n    if ($this->isValid($selection)) {\n        \u002F\u002F ✅ Success: REDIRECT (never return HTML)\n        return new RedirectResponse(\n            $this->urlGenerator->generate('next_step')\n        );\n    }\n\n    \u002F\u002F ❌ Error: Re-render form (no redirect)\n    return $this->render(..., hasError: true);\n}\n```\n\n### 2. POST Error → Re-render (No Redirect)\n\nWhen validation fails, **re-render the form** with error messages. This is NOT a violation of PRG because:\n- User needs to see their input + errors\n- Refreshing will re-submit, but that's intentional (user correcting data)\n- Redirecting would lose the submitted data\n\n### 3. Flash Messages for User Feedback\n\nWhen redirecting after success, use flash messages:\n\n```php\n\u002F\u002F In controller\n$this->session->getFlashBag()->add('success', 'Operation completed');\nreturn new RedirectResponse(...);\n\n\u002F\u002F In template\n{% for message in app.flashes('success') %}\n    \u003Cdiv class=\"alert alert-success\">{{ message }}\u003C\u002Fdiv>\n{% endfor %}\n```\n\n## Complete Example\n\n```php\n#[Route(path: '\u002Fform', name: 'my_form', methods: ['GET', 'POST'])]\npublic function __invoke(Request $request): Response\n{\n    if ($request->isMethod('POST')) {\n        $data = $request->request->all();\n\n        if (!$this->validate($data)) {\n            \u002F\u002F Error: re-render with data\n            return $this->render($data, hasError: true);\n        }\n\n        \u002F\u002F Success: process and redirect\n        $this->process($data);\n\n        return new RedirectResponse(\n            $this->urlGenerator->generate('success_page')\n        );\n    }\n\n    \u002F\u002F GET: display empty form\n    return $this->render();\n}\n```\n\n## Quick Reference\n\n| Scenario | Response | Why |\n|----------|----------|-----|\n| GET request | Render form | Display form |\n| POST + valid | **RedirectResponse** | PRG: prevent re-submit |\n| POST + invalid | Render with errors | Show validation errors |\n| POST + exception | Render with error | Show error message |\n\n## Anti-Patterns\n\n```php\n\u002F\u002F ❌ WRONG: Returning HTML after successful POST\nif ($valid) {\n    $this->save($data);\n    return new Response('Success!');  \u002F\u002F Refresh will re-submit!\n}\n\n\u002F\u002F ❌ WRONG: Redirecting on error (loses user input)\nif (!$valid) {\n    return new RedirectResponse('\u002Fform?error=1');\n}\n\n\u002F\u002F ✅ CORRECT\nif ($valid) {\n    $this->save($data);\n    return new RedirectResponse('\u002Fsuccess');\n}\n\nreturn $this->renderWithErrors($data);\n```\n","# Post\u002FRedirect\u002FGet (PRG) Pattern\n\nPOST success -> redirect. POST error -> re-render with errors. This prevents duplicate submissions on page refresh.\n\n## The Solution\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                         PRG FLOW                            │\n├─────────────────────────────────────────────────────────────┤\n│                                                             │\n│   GET \u002Fform ──────────► Display Form                        │\n│        ▲                     │                              │\n│        │                     ▼                              │\n│        │              User fills & submits                  │\n│        │                     │                              │\n│        │                     ▼                              │\n│   ┌────┴────┐          POST \u002Fform                           │\n│   │ Refresh │                │                              │\n│   │  safe!  │                ▼                              │\n│   └────┬────┘     ┌──────────┴──────────┐                   │\n│        │          │                     │                   │\n│        │     Validation OK?        Validation KO            │\n│        │          │                     │                   │\n│        │          ▼                     ▼                   │\n│        │    302 REDIRECT          Re-render form            │\n│        │          │               with errors               │\n│        │          ▼                                         │\n│        └──── GET \u002Fsuccess                                   │\n│                                                             │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## Implementation Rules\n\n### 1. POST Success → Always Redirect\n\n```php\nif ($request->isMethod('POST')) {\n    $selection = $request->request->getString('choice');\n\n    if ($this->isValid($selection)) {\n        \u002F\u002F ✅ Success: REDIRECT (never return HTML)\n        return new RedirectResponse(\n            $this->urlGenerator->generate('next_step')\n        );\n    }\n\n    \u002F\u002F ❌ Error: Re-render form (no redirect)\n    return $this->render(..., hasError: true);\n}\n```\n\n### 2. POST Error → Re-render (No Redirect)\n\nWhen validation fails, **re-render the form** with error messages. This is NOT a violation of PRG because:\n- User needs to see their input + errors\n- Refreshing will re-submit, but that's intentional (user correcting data)\n- Redirecting would lose the submitted data\n\n### 3. Flash Messages for User Feedback\n\nWhen redirecting after success, use flash messages:\n\n```php\n\u002F\u002F In controller\n$this->session->getFlashBag()->add('success', 'Operation completed');\nreturn new RedirectResponse(...);\n\n\u002F\u002F In template\n{% for message in app.flashes('success') %}\n    \u003Cdiv class=\"alert alert-success\">{{ message }}\u003C\u002Fdiv>\n{% endfor %}\n```\n\n## Complete Example\n\n```php\n#[Route(path: '\u002Fform', name: 'my_form', methods: ['GET', 'POST'])]\npublic function __invoke(Request $request): Response\n{\n    if ($request->isMethod('POST')) {\n        $data = $request->request->all();\n\n        if (!$this->validate($data)) {\n            \u002F\u002F Error: re-render with data\n            return $this->render($data, hasError: true);\n        }\n\n        \u002F\u002F Success: process and redirect\n        $this->process($data);\n\n        return new RedirectResponse(\n            $this->urlGenerator->generate('success_page')\n        );\n    }\n\n    \u002F\u002F GET: display empty form\n    return $this->render();\n}\n```\n\n## Quick Reference\n\n| Scenario | Response | Why |\n|----------|----------|-----|\n| GET request | Render form | Display form |\n| POST + valid | **RedirectResponse** | PRG: prevent re-submit |\n| POST + invalid | Render with errors | Show validation errors |\n| POST + exception | Render with error | Show error message |\n\n## Anti-Patterns\n\n```php\n\u002F\u002F ❌ WRONG: Returning HTML after successful POST\nif ($valid) {\n    $this->save($data);\n    return new Response('Success!');  \u002F\u002F Refresh will re-submit!\n}\n\n\u002F\u002F ❌ WRONG: Redirecting on error (loses user input)\nif (!$valid) {\n    return new RedirectResponse('\u002Fform?error=1');\n}\n\n\u002F\u002F ✅ CORRECT\nif ($valid) {\n    $this->save($data);\n    return new RedirectResponse('\u002Fsuccess');\n}\n\nreturn $this->renderWithErrors($data);\n```\n",{"name":5,"description":7},"main","479b264ec17cc5fafbf36287a1087472d3a386d3","plugins\u002Fsymfony\u002Fskills\u002Fprg-pattern",2,"https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace","https:\u002F\u002Fgithub.com\u002FFabienSalles","https:\u002F\u002Ffabiensalles.com","2026-10-13 04:33:22",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add FabienSalles\u002Fclaude-marketplace --skill prg-pattern",{"tool":52,"command":53},"bunx","bunx skills add FabienSalles\u002Fclaude-marketplace --skill prg-pattern",{"tool":55,"command":56},"pnpm","pnpm dlx skills add FabienSalles\u002Fclaude-marketplace --skill prg-pattern","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fsymfony\u002Fskills\u002Fprg-pattern\u002FSKILL.md",true,[],[61,85,101,122,144,160],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":33},"01M6DW2YS1MGF65JNS1QQ15QHS","vitest-test-conventions","ACTIVATE when writing Vitest tests, creating test files, using vi.fn()\u002Fvi.mock()\u002Fvi.spyOn(), or test factories. ACTIVATE for 'Vitest', 'it.each', 'NestJS testing module', 'supertest', 'vi.fn', 'vi.mock', 'spyOn'. Provides Vitest\u002FNestJS-specific testing patterns; cross-language testing principles (DAMP, AAA, spy over mock, what NOT to test) live in craft:testing-principles. DO NOT use for: node:test files (a file importing node:test) or a project whose tests run under node --test (see node-test:node-test-conventions), TDD workflow\u002Fiterations (see vitest:vitest-tdd-workflow), PHP\u002FPHPUnit tests (see phpunit:php-test-conventions).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvitest\u002Fskills\u002Fvitest-test-conventions\u002FSKILL.md",[],[68,69,70,71,72,73,74,75,76,77,28,78,79,30,31,80,81,82,83,84],"test","vitest","conventions","vitest test conventions","testing","writing","tdd","workflow","file","testing patterns","files","nestjs","project","tests","module","fn","testing principles",{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":33},"01M6DW2VFE6NPFCGQKQ68P1MVZ","vitest-tdd-workflow","ACTIVATE when building new features, endpoints, or user stories using TDD with Vitest in a TypeScript\u002FNestJS context. ACTIVATE for '\u002Ffeature-tdd-dev', 'TDD', 'red-green-refactor' in TS context. Provides Vitest\u002FNestJS-specific TDD examples and commands; cross-language TDD workflow (cross-layer iterations, RED-GREEN-REFACTOR, working app, bug-fix-first-test, mocks-hiding-bugs) lives in craft:tdd-workflow-principles. DO NOT use for: node:test files (a file importing node:test) or a project whose tests run under node --test (see node-test:node-test-conventions), test writing conventions (see vitest:vitest-test-conventions), PHP TDD (see phpunit:php-tdd-workflow).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvitest\u002Fskills\u002Fvitest-tdd-workflow\u002FSKILL.md",[],[74,75,92,69,93,73,94,76,95,96,28,97,78,30,31,98,80,81,99,100],"tdd workflow","vitest tdd workflow","dev","examples","fix","red-green-refactor","green","feature","app",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":33},"01M6DW2RGMQE10D8C5Z5MA2RMY","ts-refactoring","ACTIVATE when refactoring TypeScript code. ACTIVATE for 'refactor', 'extract', 'redesign', 'simplify', or 'clean up' in a TypeScript \u002F Node \u002F NestJS context. This skill provides TS-specific examples for the cross-language refactoring rules defined in craft:refactoring-principles. DO NOT use for: writing new features from scratch, general OOP patterns (see ts-oop).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-refactoring\u002FSKILL.md",[],[108,109,73,110,111,95,112,113,114,115,116,28,117,118,119,79,120,30,31,121],"refactoring","ts refactoring","typescript","code","refactor","simplify","Rules","node","redesign","up","general","clean","craft","patterns",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":33},"01M6DW2MHYXNBBVYEGB058Y48J","ts-ports-adapters","ACTIVATE when a TypeScript codebase with no dependency-injection container has to declare a port and wire its adapter — a repository, a clock, an id generator, an event dispatcher the domain depends on. ACTIVATE for 'port', 'adapter', 'SPI', 'dependency inversion' or 'composition root' in a codebase that wires its dependencies by hand. Covers: the port as a type of functions in the domain layer, the adapter as an object literal annotated with it, the handler that takes its dependencies first and its data second, the composition root in the infrastructure layer, and the in-memory stub that substitutes for the adapter in a unit test. DO NOT use for: NestJS, or any container-based DI with decorators and tokens (see nest-ddd-conventions), aggregate operations and smart constructors (see ddd-ts-fp), the Result type itself (see ts-functional).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-ports-adapters\u002FSKILL.md",[],[129,130,131,68,132,133,28,134,135,79,136,30,31,137,138,139,140,141,142,143],"ports","ts ports adapters","memory","ddd","Composition","container","functions","Literal","dependency-injection","domain","tokens","as","type","id","adapter",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":33},"01M6DW2GRXZFYT05HEDB26C9B8","ts-oop","ACTIVATE when designing TypeScript classes, and the value objects or collections modelled as classes, or when the user asks about object design, encapsulation, Tell Don't Ask, or Symbol.iterator. Provides TS-specific examples for the cross-language OOP rules defined in craft:oop-principles, plus TS-specific patterns (Symbol.iterator, branded types for primitive identifiers). DO NOT use for: a value object or an aggregate modelled as an immutable record rather than a class (see ddd-ts-fp), refactoring methodology (see ts-refactoring).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-oop\u002FSKILL.md",[],[151,152,21,110,132,95,153,154,108,114,155,28,156,120,30,31,157,158,159,140],"oop","ts oop","methodology","immutable","ask","refactoring methodology","objects","record","collections",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":33},"01M6DW2D26XG5MJMTP9MSE43S2","ts-layer-boundaries","ACTIVATE when wiring a Worker entry point, a Router, a controller, or a domain event consumer in a TypeScript CQRS codebase, or when deciding where a port belongs. ACTIVATE for 'composition root', 'layer boundary', 'ESLint zones', 'domain must not import infrastructure'. Covers: the *Worker.ts composition root, the curried consumer, Router wiring of command endpoints, the five-gesture controller, the domain-to-infrastructure import boundary enforced by ESLint, infrastructure-only ports, in-memory doubles for every port, the read-can-reach-write asymmetry, and read endpoints going through a domain handler. DO NOT use for: the port's own shape and adapter binding (see ts-ports-adapters), the Result type (see ts-functional), domain event structure (see ts-ddd-events).","https:\u002F\u002Fgithub.com\u002FFabienSalles\u002Fclaude-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Fts-layer-boundaries\u002FSKILL.md",[],[167,131,132,24,168,133,129,28,169,170,29,30,31,171,138,172,173,141,143,174],"ts layer boundaries","boundary","router","only","structure","cqrs","worker","import"]