/jaan-to:backend-service-implementfrom jaan-to
Generates full backend service implementations with business logic from TODO stubs, OpenAPI specs, data models, and task breakdowns. Use when implementing backend services.
Ships in jaan-to. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Bridge spec to code — generate full service implementations with business logic from TODO stubs and upstream specs.
$JAAN_CONTEXT_DIR/tech.md - Tech stack context (CRITICAL — determines framework, ORM, patterns)
#current-stack, #frameworks, #constraints, #patterns$JAAN_CONTEXT_DIR/config.md - Project configuration$JAAN_TEMPLATES_DIR/jaan-to-backend-service-implement.template.md - Output template$JAAN_LEARN_DIR/jaan-to-backend-service-implement.learn.md - Past lessons (loaded in Pre-Execution)${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md - Language resolution protocol${CLAUDE_PLUGIN_ROOT}/docs/research/70-dev-backend-service-implementation-generation.md - Research: service layer architecture, ORM queries, RFC 9457 errors, pagination, transactions, idempotency, JWT lifecycleUpstream Artifacts: $ARGUMENTS
Accepts 1-4 file paths or directory references:
MANDATORY — Read and execute ALL steps in: ${CLAUDE_PLUGIN_ROOT}/docs/extending/pre-execution-protocol.md
Skill name: backend-service-implement
Execute: Step 0 (Init Guard) → A (Load Lessons) → B (Resolve Template) → C (Offer Template Seeding)
Also read context files if available:
$JAAN_CONTEXT_DIR/tech.md — Know the tech stack for framework-specific service generation$JAAN_CONTEXT_DIR/config.md — Project configurationRead and apply language protocol: ${CLAUDE_PLUGIN_ROOT}/docs/extending/language-protocol.md
Override field for this skill: language_backend-service-implement
Language exception: Generated code output (variable names, code blocks, schemas, SQL, API specs) is NOT affected by this setting and remains in the project's programming language.
ultrathink
Use extended reasoning for:
For each provided path:
// TODO comments and map to endpoint operationsReport which inputs found vs missing; suggest fallback for missing:
Present input summary:
INPUT SUMMARY
─────────────
Sources Found: {list}
Sources Missing: {list with fallback suggestions}
Entities: {extracted entity/resource names}
TODO Stubs: {count from scaffold}
Endpoints: {count from API contract}
Tables: {count from data model}
Task Slices: {count from task breakdown}
Business Rules: {count of derived rules}
Read $JAAN_CONTEXT_DIR/tech.md:
#current-stack (default: Fastify v5+)#current-stack (default: Prisma)#current-stack (default: PostgreSQL)#patterns (auth, error handling, logging)Multi-Stack Detection:
| tech.md value | Framework | ORM/DB | Service Pattern | Output |
|---|---|---|---|---|
| Node.js / TypeScript | Fastify v5+ | Prisma | Plain exported functions + Prisma singleton | .ts files |
| PHP | Laravel 12 / Symfony 7 | Eloquent / Doctrine | Service classes + Repository pattern | .php files |
| Go | Chi / stdlib (Go 1.22+) | sqlc / GORM | Feature-based internal packages | .go files |
Parse all // TODO: implement stubs from scaffold. For each:
Derive implementation patterns from API spec semantics:
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Business Logic Derivation Patterns" for HTTP status code patterns, schema difference analysis, endpoint relationship patterns, and task breakdown derivation rules.
When API specs include status fields with constrained transitions:
Use AskUserQuestion:
Scope question:
Auth question (if auth endpoints detected):
Pagination question (if list endpoints detected):
Transaction depth (if multi-step operations detected):
Idempotency question (if POST/PUT endpoints exist):
IMPLEMENTATION PLAN
═══════════════════
STACK: {framework} + {orm} + {database}
TODO COVERAGE
─────────────
Total TODOs: {count}
Implementing: {count} ({scope choice})
Skipping: {count} (if partial scope)
SERVICES ({count})
──────────────────
{For each service:}
{resource}.service.ts
- {method}: {description} ({status codes})
...
SHARED HELPERS
──────────────
- error-factory.ts (RFC 9457 problem details, error type registry)
- pagination.ts ({strategy} pagination helper)
{- cursor.ts (cursor encode/decode) — if cursor pagination}
{- auth.service.ts (JWT lifecycle with jose) — if auth}
{- idempotency.ts (Idempotency-Key middleware) — if enabled}
STATE MACHINES ({count if any})
───────────────────────────────
{resource}: {state1} → {state2} → ...
DEPENDENCY ORDER
────────────────
1. Shared helpers
2. {ordered service list}
Use AskUserQuestion:
Do NOT proceed to Phase 2 without explicit approval.
All files in $JAAN_OUTPUTS_DIR/backend/service-implement/{id}-{slug}/:
{id}-{slug}/
├── {id}-{slug}.md # Implementation guide + decisions log
├── {id}-{slug}-services/ # Service files by domain
│ ├── {resource}.service.ts # Per-resource service implementation
│ ├── auth.service.ts # Auth/JWT service (if applicable)
│ └── ...
├── {id}-{slug}-helpers/ # Shared helper files
│ ├── error-factory.ts # RFC 9457 error creation
│ ├── pagination.ts # Pagination utility
│ ├── cursor.ts # Cursor encode/decode (if cursor pagination)
│ └── idempotency.ts # Idempotency middleware (if enabled)
└── {id}-{slug}-readme.md # Integration instructions
File extensions adapt to detected stack (.ts for Node.js, .php for PHP, .go for Go).
Generate helpers in dependency order (these are used by services):
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Helper Generation Patterns" for Error Factory (RFC 9457), Pagination Helper, Auth Service, and Idempotency Middleware generation templates.
Node.js/TypeScript (Fastify + Prisma):
// Plain exported functions importing Prisma singleton
// Module caching acts as built-in singleton (no DI container needed)
// Testable via vi.mock()
import { prisma } from '../lib/prisma.js';
import { createProblemDetail, BusinessError } from '../helpers/error-factory.js';
import { paginateWithCursor } from '../helpers/pagination.js';
import type { RequestContext } from '../types.js';
PHP (Laravel + Eloquent):
// Service class with constructor injection
// Repository pattern optional (Eloquent IS the repository)
// API Resources for response transformation
Go (Chi/stdlib + sqlc):
// Feature-based internal package
// Constructor injection with small interfaces (1-3 methods)
// Accept interfaces, return structs
For each TODO stub, generate the full implementation:
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Per-Method Implementation Patterns" for CREATE, READ, LIST, UPDATE, DELETE, and ACTION operation implementation steps.
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "State Machine Generation" for transition map template and validation function code.
For operations spanning multiple services:
$transaction with explicit isolation leveltx (transaction client) to all participating service methodsmaxWait: 5000 and timeout: 100001-2 sentences: resource count, stack, key patterns implemented (pagination, auth, idempotency).
For each decision made during generation:
| Decision | Choice | Rationale |
|---|---|---|
| Pagination | Cursor-based | Stable under concurrent writes, O(1) seek |
| Auth | jose JWT | Web Crypto API, edge-compatible |
| Transactions | Interactive | Multi-step inventory reservation |
| ... | ... | ... |
| Service | TODOs Found | TODOs Implemented | Coverage |
|---|---|---|---|
| user.service.ts | 5 | 5 | 100% |
| order.service.ts | 8 | 8 | 100% |
| ... | ... | ... | ... |
| Total | {n} | {n} | 100% |
Mermaid diagram showing service dependencies and shared helpers.
vi.mock() pattern)/jaan-to:qa-test-generate — Generate tests for these implementations/jaan-to:sec-audit-remediate — Security audit the implementationsBefore preview, verify every item in the checklist (coverage, error handling, patterns, security, code quality).
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Quality Check Checklist" for the full verification checklist.
If any check fails, fix before preview.
Present generated output summary:
Use AskUserQuestion:
source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/id-generator.sh"
SUBDOMAIN_DIR="$JAAN_OUTPUTS_DIR/backend/service-implement"
mkdir -p "$SUBDOMAIN_DIR"
NEXT_ID=$(generate_next_id "$SUBDOMAIN_DIR")
slug="{project-name-slug}"
OUTPUT_FOLDER="${SUBDOMAIN_DIR}/${NEXT_ID}-${slug}"
Preview output configuration:
Output Configuration
- ID: {NEXT_ID}
- Folder:
$JAAN_OUTPUTS_DIR/backend/service-implement/{NEXT_ID}-{slug}/- Main file:
{NEXT_ID}-{slug}.md
mkdir -p "$OUTPUT_FOLDER"mkdir -p "$OUTPUT_FOLDER/${NEXT_ID}-${slug}-services"mkdir -p "$OUTPUT_FOLDER/${NEXT_ID}-${slug}-helpers"$OUTPUT_FOLDER/${NEXT_ID}-${slug}.md$OUTPUT_FOLDER/${NEXT_ID}-${slug}-services/{resource}.service.ts$OUTPUT_FOLDER/${NEXT_ID}-${slug}-helpers/{helper}.ts$OUTPUT_FOLDER/${NEXT_ID}-${slug}-readme.mdsource "${CLAUDE_PLUGIN_ROOT}/scripts/lib/index-updater.sh"
add_to_index \
"$SUBDOMAIN_DIR/README.md" \
"$NEXT_ID" \
"${NEXT_ID}-${slug}" \
"{Project Title} Service Implementations" \
"{Executive summary — 1-2 sentences}"
Service implementations written to:
$JAAN_OUTPUTS_DIR/backend/service-implement/{NEXT_ID}-{slug}/Index updated:$JAAN_OUTPUTS_DIR/backend/service-implement/README.md
Service implementations generated successfully!
TODO Coverage: {n}/{n} (100%)
Next Steps:
- Copy service files to your project (see integration readme for placement)
- Run
/jaan-to:qa-test-generateto generate tests for these implementations- Run
/jaan-to:sec-audit-remediateto audit the implementations for security issues- Run your existing test suite to verify integration
Use AskUserQuestion:
If "Learn from this": Run /jaan-to:learn-add backend-service-implement "{feedback}"
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Key Generation Rules — Node.js/TypeScript (Research-Informed)" for the full rules list covering Service Layer, Prisma Queries, Error Handler, RFC 9457, JWT, Cursor Pagination, Idempotency, Transactions, Import Extensions, and DTO Mapping.
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Multi-Stack Service Patterns" for PHP (Laravel + Symfony) and Go stack-specific service patterns.
Reference: See
${CLAUDE_PLUGIN_ROOT}/docs/extending/backend-service-implement-reference.mdsection "Anti-Patterns" for per-stack anti-pattern lists (All Stacks, Node.js, PHP, Go).
tech.md detection$JAAN_OUTPUTS_DIR pathWhat SKILL.md sets; muted values are Claude Code's defaults
59 skills in this plugin
/backend-api-contractGenerate OpenAPI 3.1 contracts with schemas, RFC 9457 errors, versioning, and examples. Use when defining API contracts from entities./backend-data-modelGenerate data model docs with tables, constraints, indexes, retention, and migration notes. Use when designing database schemas from entities./backend-pr-reviewReview backend PRs for security, performance, code quality, and testing gaps across any stack. Use when reviewing backend pull requests./backend-scaffoldGenerate production-ready backend code with routes, data models, service layers, and validation. Use when scaffolding backend from specs./backend-task-breakdownConvert a PRD into structured backend development tasks with reliability patterns. Use when planning backend work from requirements./data-gtm-datalayerGenerate production-ready GTM tracking code with dataLayer pushes and HTML attributes. Use when adding analytics tracking.npx claudepluginhub parhumm/jaan-to --plugin jaan-toOther plugins' skills for the same job