From ai-plugins
Execute a three-phase Plan -> Code -> Review workflow with iterative implementation until the review passes. Enforces production-readiness with extensive logging, comprehensive testing (unit + E2E), multi-agent code review, and build validation. Metrics and tracing are added when the project already has that infrastructure. Use when the user asks to build a feature, fix a bug, or make a structured change and wants planning, production-grade coding, and review in one workflow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ai-plugins:develop-featureThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A three-phase development workflow: **Plan → Code → Review** with automated iteration until the review passes.
A three-phase development workflow: Plan → Code → Review with automated iteration until the review passes.
Every feature produced by this workflow MUST be production-ready: structured logging, comprehensive unit and E2E tests, and a clean build. Metrics and distributed tracing should be added when the project already has that infrastructure in place. No shortcuts.
/develop-feature <describe the feature, bug fix, or change you want>
$ARGUMENTS - The feature request, bug description, or change specification.Execute these three phases in order. If the review phase requests changes, loop back to the coding phase with the review feedback, then re-review. Repeat until the review passes.
+----------+ +----------+ +----------+
| PLAN | --> | CODE | --> | REVIEW |
+----------+ +----------+ +----------+
^ |
| changes |
| requested |
+----------------+
Role: You are a planning agent. You have READ-ONLY access. You do not modify any code in this phase.
Goal: Produce a detailed, actionable implementation plan that is self-contained and precise enough for the coding phase to execute without re-analyzing the codebase.
Before any analysis, read the project's best-practices and contribution guidelines:
AGENTS.md — This is the primary source of project conventions, architecture rules, and agent-specific instructions. If this file exists, its rules override any defaults in this skill.CONTRIBUTING.md — Contribution workflow, PR format, commit conventions.CLAUDE.md or equivalent — Additional AI-agent instructions the project maintainers have set.Makefile / build scripts — Understand the build, test, and lint commands available..golangci.yml, .eslintrc, pyproject.toml, rustfmt.toml, etc.Rule: If any of these files exist and contain instructions, you MUST follow them. Project-specific conventions always take precedence over the generic guidelines in this skill.
Read the request thoroughly.
Identify scope.
Clarify ambiguities.
Explore the project structure.
Find project conventions.
Locate relevant existing code.
Map dependencies and call chains.
Based on the languages detected, perform the appropriate deep analysis.
mockgen, mockery, testify/mock). Note which interfaces need new mocks.testify, stdlib, gomega).slog, zap, logrus, klog), metrics library (prometheus, otel), and tracing setup (opentelemetry, jaeger). Note existing patterns for structured fields, metric names, and span naming.mypy or pyright is configured.asyncio, FastAPI, aiohttp. Note sync vs. async conventions.conftest.py files, pytest fixtures, parametrize decorators.pyproject.toml, requirements.txt. Note the dependency management tool.logging, structlog, loguru), metrics (prometheus_client, opentelemetry), and tracing setup.tsconfig.json for strict mode settings. Check for path aliases.Cargo.toml for workspace configuration, feature flags.thiserror, anyhow, custom error enums.#[cfg(test)] modules, integration tests in tests/.unsafe blocks and their safety invariants.tracing crate, metrics crate, structured logging setup.Produce a structured plan with the following sections.
One paragraph describing what will be implemented and why.
If the task requires design choices, list each decision with:
For each file, specify:
Order files by dependency.
Numbered, concrete steps. Each step should:
Logging is MANDATORY for every feature. Metrics and tracing are only required if the project already has metrics/tracing infrastructure. If the project does not use metrics or tracing, skip those sub-sections.
For each new code path, specify:
resource_name, operation, duration_ms, error)Skip this section if the project has no existing metrics infrastructure. Check for prometheus, otel-metrics, or similar in the codebase first.
For each new operation or resource, specify:
myservice_operation_total, myservice_operation_duration_seconds)status, method, resource_type)Skip this section if the project has no existing tracing infrastructure. Check for Jaeger, OpenTelemetry, or similar in the codebase first.
For each significant operation, specify:
ServiceName.OperationName)resource.id, operation.type)For each new or modified function, list specific test cases:
Include edge cases: nil/empty inputs, zero values, boundary conditions, error paths, concurrent access.
Coverage rule: Every new public function MUST have at least one test. Every error path MUST be tested. Aim for meaningful coverage of all new code paths.
For cross-component or user-facing changes:
Rule: If the feature touches 2+ layers (handler → service → repository), an E2E or integration test is MANDATORY, not optional.
Checkable criteria derived from the request:
Write the complete plan to:
docs/plans/{feature-name}-plan.md
Output: Present the plan to the user before proceeding to the coding phase.
Role: You are a staff-level coding agent. You write production-grade code, not prototypes.
Goal: Implement the plan from Phase 1 (or address review feedback if iterating). Every line of code you write must be ready for production: observable, tested, and clean.
Before writing any code, re-read the project's best-practices files:
AGENTS.md — Follow all project-specific rules and conventions.CONTRIBUTING.md and any other project guidelines.Makefile — Know the exact build, test, and lint commands.Rule: Project-specific conventions from these files ALWAYS override the generic guidelines below. If
AGENTS.mdsays "useklog", you useklogeven if the guidelines below suggestslog.
Read the planning output from Phase 1.
If iterating, read the review feedback from the previous cycle.
CHANGES_REQUESTED item. Do not skip any.Before writing code:
AGENTS.md, CLAUDE.md, CONTRIBUTING.md, Makefile).For each logical change:
RED — Write a failing test that describes the expected behavior.
GREEN — Write the minimum code to make the test pass. Do not optimize yet.
REFACTOR — Clean up while keeping tests green:
When TDD is impractical (wiring code, configuration, UI layout), write the code first but add tests immediately after.
Error Handling
fmt.Errorf("service_name: operation: %w", err)errors.Is() and errors.As() — never compare error strings.Interfaces
Concurrency
errgroup for concurrent operations that return errors.context.Context for cancellation and timeouts.sync.Mutex or sync.RWMutex.Testing
t.Run() for subtests.t.Helper() in test helper functions.Performance
strings.Builder for string concatenation in loops.Type Hints
Any unless truly necessary.TypedDict for dictionary shapes, Protocol for structural typing.Error Handling
except:.Testing
pytest with fixtures. @pytest.mark.parametrize for data-driven tests.pytest-asyncio.Frameworks
Depends() for DI.Strict Typing
any. Use unknown and narrow instead.React Hooks
useEffect.useCallback and useMemo only when there's a measured performance benefit.Component Design
Accessibility
Ownership and Borrowing
&T) over cloning.Cow<'_, str> when a function may or may not need to allocate.Error Handling
thiserror for library errors. anyhow for application errors.? operator for ergonomic error propagation.Logging is MANDATORY for every feature. Metrics and tracing should only be added if the project already has existing metrics/tracing infrastructure. If the project does not use metrics or tracing, skip sections 2.5.2 and 2.5.3 and focus on logging only.
Add log lines at appropriate levels throughout your new code. Follow the project's existing logging library and patterns.
Log Level Guidelines:
| Level | When to Use | Examples |
|---|---|---|
| DEBUG | Detailed internal flow for troubleshooting. High-volume, disabled in production by default. | Variable values, internal state transitions, detailed request/response payloads |
| INFO | Significant business events and operational milestones. Always enabled. | Service started, request handled, resource created/updated/deleted, configuration loaded |
| WARN | Recoverable issues that deserve attention. May indicate a degraded state. | Retry attempt, deprecated API used, fallback triggered, approaching resource limit |
| ERROR | Unrecoverable failures that require investigation. Must not be noisy. | Operation failed after retries, external dependency unreachable, data corruption detected |
Structured Logging Best Practices:
Use structured key-value pairs, not string concatenation or fmt.Sprintf for log fields:
// ✅ GOOD — structured fields
logger.Info("resource created", "name", resource.Name, "namespace", resource.Namespace, "duration_ms", elapsed.Milliseconds())
// ❌ BAD — string concatenation
logger.Info(fmt.Sprintf("resource %s/%s created in %dms", resource.Namespace, resource.Name, elapsed.Milliseconds()))
Include contextual fields that make debugging easier:
NEVER log sensitive data:
Log at entry and exit points of significant operations:
func (s *Service) ReconcileResource(ctx context.Context, name string) error {
logger := s.logger.With("resource", name, "operation", "reconcile")
logger.Debug("starting reconciliation")
// ... operation ...
if err != nil {
logger.Error("reconciliation failed", "error", err, "duration_ms", elapsed.Milliseconds())
return fmt.Errorf("reconcile %s: %w", name, err)
}
logger.Info("reconciliation completed", "duration_ms", elapsed.Milliseconds(), "changes_applied", changeCount)
return nil
}
Skip this section if the project has no existing metrics infrastructure. Check the codebase first for prometheus, otel-metrics, or similar libraries. If none exist, do not add metrics.
Add metrics to track the health and performance of your new code. Follow the project's existing metrics library and naming conventions.
Metric Types and When to Use Them:
| Type | When to Use | Naming Convention | Example |
|---|---|---|---|
| Counter | Monotonically increasing count of events | <service>_<operation>_total | myservice_requests_total{method="GET", status="200"} |
| Gauge | Current value that can go up or down | <service>_<resource>_current | myservice_active_connections_current |
| Histogram | Distribution of values (latencies, sizes) | <service>_<operation>_duration_seconds | myservice_request_duration_seconds{method="GET"} |
Follow the RED Method for service-level metrics:
Metrics Best Practices:
status or result label to distinguish success/failure_total suffix for counters, _seconds for duration histogramsSkip this section if the project has no existing tracing infrastructure. Check the codebase first for Jaeger, OpenTelemetry, or similar. If none exist, do not add tracing.
Add trace spans to your new code so operations can be followed across service boundaries. Follow the project's existing tracing setup (e.g., Jaeger, OpenTelemetry).
Tracing Best Practices:
Create spans for significant operations — not every function, but every meaningful unit of work:
func (s *Service) ProcessItem(ctx context.Context, itemID string) error {
ctx, span := s.tracer.Start(ctx, "Service.ProcessItem",
trace.WithAttributes(
attribute.String("item.id", itemID),
),
)
defer span.End()
// ... operation ...
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())
return err
}
span.SetAttributes(attribute.Int("items.processed", count))
return nil
}
Propagate context — Always pass ctx through the call chain. Never create a new background context mid-operation.
Name spans clearly — Use ServiceName.OperationName format (e.g., ResourceController.Reconcile, DBClient.Query).
Record errors on spans — Use span.RecordError(err) and span.SetStatus(codes.Error, ...) for failures.
Add relevant attributes — Resource identifiers, operation type, batch size, but NOT sensitive data.
Link child spans — When an operation triggers sub-operations, they should be child spans of the parent.
Apply to ALL code regardless of language.
Untested code is incomplete code. You MUST write both unit tests and E2E/integration tests for every new feature.
Every new or modified function MUST have unit tests. Follow these requirements:
Test Structure:
t.Run("returns error when input is nil", ...))t.Helper() in Go test helpers, @pytest.fixture in PythonWhat to Test:
Mocking:
mockgen, mockery, testify/mockpytest-mock, unittest.mockjest.mock, vitest, sinonmockallTest Quality Rules:
time.Sleep in tests — use synchronization primitives or polling with timeoutt.Cleanup() / t.TempDir() in Go, tmp_path fixture in PythonWhen the feature touches multiple components or layers, E2E tests are MANDATORY.
When E2E Tests are Required:
E2E Test Structure:
Mocking Strategy for E2E Tests:
httptest.NewServer (Go), responses / aioresponses (Python), msw (TypeScript)t.TempDir() (Go), tmp_path (Python)What to Assert in E2E Tests:
After writing tests:
You MUST validate that the code compiles, passes lint, and passes tests before finishing.
Run the project's build validation commands. You MUST discover the correct commands by reading AGENTS.md, Makefile, package.json, or Cargo.toml — do NOT assume any default commands. Look up the exact make targets for linting, testing, and building in the project's own documentation.
Rules for Build Validation:
Before finishing, perform a final verification:
Read back every file you modified. Check for:
fmt.Println, console.log, print())Observability checklist:
Test coverage checklist:
time.Sleep, no order-dependence)Check cross-file consistency. If you added a field to a struct, did you update all serialization? If you added an API endpoint, is it documented?
Run build validation — see Step 2.8 and Step 2.10.
This is the FINAL step before review. You MUST run mock generators, linters, and tests before declaring your coding work complete. Use ONLY
makecommands — do not run tools manually.
Procedure:
Read AGENTS.md (or equivalent project guidelines) to find the exact make targets for:
Run the commands in order: Execute the make targets discovered from AGENTS.md / Makefile in this order: mock generation → linting → tests → build. Do NOT guess or assume target names — use exactly what the project specifies.
Fix any failures in your code ONLY:
Re-run until clean. Iterate the cycle until all commands pass without errors on YOUR code.
CRITICAL RULES:
- ONLY use
makecommands. Do not rungo test ./...,golangci-lint run,pytest, or any tool directly. TheMakefileis the single source of truth for how to run these tools.- Check
AGENTS.mdfirst for the correct make targets. Different projects use different target names.- Fix ONLY your own code. Other coding agents may be working in parallel. Do not modify files outside your feature scope.
Role: You are a code review agent. You have READ-ONLY perspective — you identify issues but do not fix them yourself.
Goal: Thoroughly review the code changes from Phase 2 and either approve them or request specific changes.
Before reviewing, read AGENTS.md and other project convention files to ensure you review against the project's actual standards, not just generic best practices.
You MUST spawn multiple specialized code review sub-agents to review the changes in parallel. Do not perform all reviews in a single pass — parallel sub-agent review provides broader coverage and catches more issues.
Use the reusable review workflow in ../review-engine/SKILL.md and the perspective criteria in ../review-engine/review-perspectives.md.
When running the review as part of develop-feature, pass the following context into the review:
docs/plans/{feature-name}-plan.mdThe review MUST verify ALL of the following:
time.Sleep, shared state, ordering)If the review verdict is CHANGES_REQUESTED:
APPROVED.Maximum iterations: 3. If still not approved after 3 iterations, present all remaining findings to the user and ask for guidance.
Rule: Do NOT approve with known issues. If reviewers found real problems, fix them. The iteration loop exists for a reason.
AGENTS.md and project conventions — they override everything in this skill.Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub schseba/ai-plugins --plugin ai-plugins