Feature Build Pipeline for Existing Codebases
Builds a feature in your codebase: traces a similar feature, plans, implements, runs real tests, and self-reviews the diff.
Before & after
Same prompt, same agent — the only difference is the skill.
I can help you build an OAuth 2.0 login flow for Next.js. That's definitely doable. You'd need to set up the OAuth provider configuration, handle the authorization code flow, and store the tokens securely. There are libraries like NextAuth that can help simplify this. To build this properly, I'd want to understand a few things first. Which OAuth provider are you using—Google, GitHub, another? What's your current authentication setup? Do you already have a database for storing user sessions? Once I understand your architecture better, I can map out the flow and start building.
FEATURE DELIVERY: OAuth 2.0 Login Flow
STEP 1: CODEBASE EXPLORATION (Complete)
Found: /lib/auth/ has session handler, /pages/api/auth has existing token refresh
Gap: No OAuth redirect handler; secrets config is missing
Stack confirmed: Next.js 14, uses database.Session table, Prisma ORM
Blocker: .env.local missing OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET
STEP 2: ARCHITECTURE DESIGN (Complete)
Flow: User clicks login → Google OAuth consent screen → Redirect callback → Exchange code for token → Upsert user in DB → Create session → Redirect to dashboard
Security: Store refresh_token in httpOnly cookie, access_token in memory only
Error handling: Graceful fallback if token exchange fails, retry logic for network issues
Components:
/pages/api/auth/login - Redirect to Google OAuth endpoint
/pages/api/auth/callback - Handle code exchange, create session
/pages/api/auth/logout - Clear session cookie
/lib/oauth-client.js - Encapsulate OAuth logic
STEP 3: CODE WRITTEN (Complete)
Implementation: 340 lines
- oauth-client.js (87 lines) - Handles token exchange, refresh logic
- login.js (52 lines) - Redirect handler
- callback.js (98 lines) - Code verification, session creation
- logout.js (36 lines) - Session cleanup
Used fetch API with proper error handling, avoided third-party auth library dependency
STEP 4: TESTS GENERATED & PASSING (8/8 passing)
Unit tests: oauth token exchange mocked, session validation
Integration test: Full login flow with test user
Edge cases: Invalid code, expired token refresh, network timeout
Coverage: 84% of auth paths
STEP 5: CODE REVIEW (Flagged 2 items)
Issue: logout endpoint doesn't revoke token at Google—users stay logged in on Google side
Recommendation: Add optional revoke param or separate revoke endpoint
Naming: Rename oauth-client.getTokens to oauth-client.exchangeCode for clarity
Sign-off: Ready for QA once revoke addedAbout this skill
Claude builds the feature, but it invents its own HTTP client, error format, and folder layout instead of using yours. It says "tests pass" when nothing was run, or when the tests mock the very thing they claim to test. This skill makes Claude work the way a senior engineer does in a codebase they did not write. It anchors every decision to an existing feature, verifies against a recorded baseline, and reports only what it actually observed.
What it does
- Finds the build, lint, and test commands and runs them first, so pre-existing failures are recorded instead of blamed on the new feature or hidden by it
- Traces the closest existing feature end to end (route, validation, auth, persistence, errors, tests) and copies its conventions exactly
- Writes a short change plan with contracts, failure modes, ASSUMPTION lines, and an out-of-scope list, and pauses only before migrations, breaking API changes, new dependencies, or auth and billing changes
- Writes tests that cover the wrong-tenant caller, dependency failure, boundary input, and duplicate submission, then confirms the key test fails without the change
- Self-reviews the full diff for debug leftovers, unsafe migrations, N+1 queries, scope creep, and backward compatibility
- Reports verified and not-verified results separately, with the exact commands that were run
What you get
You get a working, tested feature that matches your codebase's patterns. It comes with a compact report of findings, plan, files changed, and test commands with real results, plus remaining risks and at most 3 questions.
Best for
Developers using Claude Code on established repos, contractors new to a codebase, and teams tired of agent-written features that compile but quietly break conventions or tests.
SKILL.md preview
---
name: feature-build-pipeline
description: Builds a new feature inside an existing codebase. It traces the closest existing feature end to end, writes a short change plan, and implements in verifiable increments. It then writes tests that fail without the change, runs them against a recorded baseline, and self-reviews the full diff before reporting. Use when the user says "add X to the app", "build this feature end to end", "implement this ticket", "I'm new to this repo, add Y", "Claude keeps inventing its own patterns instead of using ours", "it said the tests pass but they don't", or "my new feature works but broke something else".
---
# Feature Build Pipeline for Existing Codebases
… (sign up to view the full skill)More development skills
View all Development skills →Performance Bottleneck Profiling: Node, Python, Go
Classifies a slowdown, gives exact profiler commands, reads the output, and proves the fix with same-conditions p95/p99 numbers.
Feature Scaffolding with Working Tests
Turn a short feature spec into code, runnable tests, and integration wiring that match your existing project.
Feature Flag Rollouts and Kill Switches
Design staged flag rollouts, verify rollback paths, and audit flag debt with explicit defaults, gates, and retirement plans.
Microcontroller Firmware and RTOS Engineering
Build and debug MCU firmware with bounded ISR/RTOS timing, safe DMA ownership, and measured power budgets.