[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-98bf956a-cb84-4a4b-ada2-10488162c488":3,"$fsfIOt_KWtdSWj8XS5Uq07qM30CScfZ4DZSogoK1BJ8k":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"98bf956a-cb84-4a4b-ada2-10488162c488","tdd-workflows-tdd-green","实现使失败的测试在TDD绿色阶段通过的最小代码。","cat_coding_review","mod_coding","sickn33,coding","---\nname: tdd-workflows-tdd-green\ndescription: \"Implement the minimal code needed to make failing tests pass in the TDD green phase.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Green Phase: Simple function\ndef product_list(request):\n    products = Product.objects.all()\n    return JsonResponse({'products': list(products.values())})\n\n# Refactor: Class-based view\nclass ProductListView(View):\n    def get(self, request):\n        products = Product.objects.all()\n        return JsonResponse({'products': list(products.values())})\n\n# Refactor: Generic view\nclass ProductListView(ListView):\n    model = Product\n    context_object_name = 'products'\n```\n\n### Express Patterns\n\n**Inline → Middleware → Service Layer:**\n```javascript\n\u002F\u002F Green Phase: Inline logic\napp.post('\u002Fapi\u002Fusers', (req, res) => {\n  const user = { id: Date.now(), ...req.body };\n  users.push(user);\n  res.json(user);\n});\n\n\u002F\u002F Refactor: Extract middleware\napp.post('\u002Fapi\u002Fusers', validateUser, (req, res) => {\n  const user = userService.create(req.body);\n  res.json(user);\n});\n\n\u002F\u002F Refactor: Full layering\napp.post('\u002Fapi\u002Fusers',\n  validateUser,\n  asyncHandler(userController.create)\n);\n```\n\n## Use this skill when\n\n- Moving from red to green in a TDD cycle\n- Implementing minimal behavior to satisfy tests\n- You want to keep implementation intentionally simple\n\n## Do not use this skill when\n\n- You are refactoring for design or performance\n- Tests are already passing and you need new requirements\n- You need a full architectural redesign\n\n## Instructions\n\n1. Review failing tests and identify the smallest fix.\n2. Implement the minimal change to pass the next test.\n3. Run tests after each change to confirm progress.\n4. Record shortcuts or debt for the refactor phase.\n\n## Safety\n\n- Avoid bypassing tests to make them pass.\n- Keep changes scoped to the failing behavior only.\n\n## Resources\n\n- `resources\u002Fimplementation-playbook.md` for detailed patterns and examples.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,120,1089,"2026-05-16 13:43:17",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"代码审查","review","mdi-magnify-scan","代码质量分析、安全审查",4,145,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"3dfd38aa-11ef-4981-94d9-ff8bb5fbf443","1.0.0","tdd-workflows-tdd-green.zip",9356,"uploads\u002Fskills\u002F98bf956a-cb84-4a4b-ada2-10488162c488\u002Ftdd-workflows-tdd-green.zip","be39b506759e4f070c89b1af91bdf806fa8b966ac39cbfa2014a045bc10d1462","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":2274},{\"path\":\"resources\u002Fimplementation-playbook.md\",\"isDirectory\":false,\"size\":23930}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]