tdd-workflows-tdd-green
Tests & QualitéImplement the minimal code needed to make failing tests pass in the TDD green phase.
Documentation
Green Phase: Simple function
def product_list(request):
products = Product.objects.all()
return JsonResponse({'products': list(products.values())})
Refactor: Class-based view
class ProductListView(View):
def get(self, request):
products = Product.objects.all()
return JsonResponse({'products': list(products.values())})
Refactor: Generic view
class ProductListView(ListView):
model = Product
context_object_name = 'products'
### Express Patterns
**Inline → Middleware → Service Layer:**// Green Phase: Inline logic
app.post('/api/users', (req, res) => {
const user = { id: Date.now(), ...req.body };
users.push(user);
res.json(user);
});
// Refactor: Extract middleware
app.post('/api/users', validateUser, (req, res) => {
const user = userService.create(req.body);
res.json(user);
});
// Refactor: Full layering
app.post('/api/users',
validateUser,
asyncHandler(userController.create)
);
Compétences similaires
Explorez d'autres agents de la catégorie Tests & Qualité
browser-automation
"Browser automation powers web testing, scraping, and AI agent interactions. The difference between a flaky script and a reliable system comes down to understanding selectors, waiting strategies, and anti-detection patterns. This skill covers Playwright (recommended) and Puppeteer, with patterns for testing, scraping, and agentic browser control. Key insight: Playwright won the framework war. Unless you need Puppeteer's stealth ecosystem or are Chrome-only, Playwright is the better choice in 202"
seo-content-auditor
Analyzes provided content for quality, E-E-A-T signals, and SEO
error-debugging-multi-agent-review
"Use when working with error debugging multi agent review"