kmaruthi2002/universal-llm-skills/backend-development
Claude Code and agent skill by kmaruthi2002/universal-llm-skills
- community
Checking that the SKILL.md file is still in the repository.
Build and change server-side services in any language or framework: the request lifecycle, input validation, where business logic belongs, transactions and data access, background jobs, configuration and secrets, statelessness, timeouts and resource limits, logging, and testing. Use when implementing an endpoint, handler, worker, or service; adding a feature to a server codebase; wiring up a database or queue; moving work to the background; or making a backend production-ready. For API contract design use api-design; for schema design use database-design; for structure across modules use software-architecture.
Install
npx vskill@latest install kmaruthi2002/universal-llm-skills/backend-developmentSKILL.md
The same SKILL.md was published earlier as kmaruthi2002/universal-llm-skills/backend-development.
Backend Development
Backend code runs unattended, under concurrent load, against data that matters, while talking to dependencies that fail. Most backend bugs are not in the clever parts; they are at the edges — unvalidated input, missing timeouts, half-committed transactions, retries that duplicate work, configuration that differs between environments. This skill is about getting those edges right in whatever stack the project uses.
Scope
Covers implementing server-side behaviour: HTTP/RPC handlers, workers and consumers, scheduled tasks, data access, integration with caches, queues, and external services, and the operational concerns that make a service production-ready.
Neighbouring skills:
- Contract design (URLs, payloads, errors, versioning) —
api-design. - Schemas, keys, and indexes —
database-design; query writing —sql-and-queries. - Module boundaries and layering across the codebase —
software-architecture. - Error strategy in depth —
error-handling; concurrency primitives —concurrency-and-async. - Identity and permissions —
authentication-and-authorization; vulnerabilities —secure-coding. - Metrics, logs, tracing —
observability. Cron-style jobs —scheduled-jobs.
Core principles
1. Trust nothing that crosses the boundary
Every input from outside the process — request bodies, headers, query strings, uploaded files, messages from queues, responses from other services, even rows written by other systems — may be malformed, oversized, or malicious. Validate at the boundary, convert to well-typed internal values once, and let the inside of the system work with values that are known to be valid. The "why": validation scattered throughout the code is always incomplete; validation at one choke point can be complete.
2. Keep handlers thin; put rules where they can be tested
A handler's job is to translate: parse and validate the request, call the operation that does the work, translate the result or error into a response. Business rules belong in code that does not know about HTTP, queues, or the framework, so they can be tested directly and reused from a handler, a worker, a CLI, or a test. Fat handlers duplicate rules across entry points and can only be tested through the transport.
3. Every external call can be slow, fail, or succeed without you knowing
Databases, caches, other services, and third-party APIs will time out, return errors, and occasionally complete work after you have given up waiting. Put a timeout on every call, decide what failure means for your operation, and make retried work safe (idempotency). A missing timeout is how one slow dependency exhausts every thread or connection in a service.
4. Statelessness is what makes scaling and recovery easy
A service instance that keeps no essential state in memory or on local disk can be restarted, replaced, or multiplied freely. Keep session data, uploads, job state, and caches that must be shared in external stores. In-process caches are fine as optimisations if every instance can rebuild them and staleness across instances is acceptable.
5. Data integrity outranks convenience
Use the database's guarantees — transactions, constraints, unique indexes, foreign keys — rather than application code that checks and then writes. "Check, then act" in application code races under concurrency; a unique constraint does not. Code can have bugs; constraints catch them.
6. Make it observable from the first commit
You will debug this code in production, from logs and metrics, without a debugger. Structured logs with request/correlation IDs, metrics on rate, errors, and latency for each endpoint and dependency, and traces across services are much cheaper to add while writing the code than during an incident.
Discovering the project's conventions
Before writing backend code in an existing project, find out, and then follow:
- Framework and layering: how is a request routed? Where do handlers, services/use cases, repositories/data access live? Trace one existing endpoint end to end and copy its shape.
- Validation approach: schema library, framework validators, hand-written checks, generated types from an API spec.
- Error handling: custom error types, how they map to responses, the error envelope.
- Data access: ORM, query builder, raw SQL, stored procedures; transaction helpers; how migrations are written.
- Dependency injection or wiring: how services get their database handles, clients, and config.
- Configuration: environment variables, config files, a secrets manager; how environments differ.
- Background work: which job or queue system, how jobs are defined, retried, and monitored.
- Logging and metrics: logger, log format, what fields are always included, metric naming.
- Testing: unit vs. integration split, fixtures and factories, how the test database is set up, whether tests hit real dependencies or fakes.
- Code style and lint rules, and any checked-in scripts for running, testing, and formatting.
When conventions conflict with this skill, follow the project in the code you write and raise the concern separately, unless the convention creates a security or data-integrity bug — then raise it before proceeding.
The request lifecycle
Walk through every stage for each new endpoint or handler:
- Transport and middleware: TLS termination, request ID assignment or propagation, request size limits, timeouts, CORS (for browsers), compression. Usually configured once; verify the new route is covered.
- Authentication: identify the caller. Reject early if required and missing.
- Parsing and validation: parse the body and parameters into typed values; reject with field-level errors. Check types, required fields, ranges, lengths, formats, enum membership, and overall size. Strip or reject unknown fields according to the project's convention.
- Authorization: can this caller perform this action on this specific object? Object-level checks require loading the object (or querying with the owner as a filter) — do not skip them because the route is "only used by our UI".
- Business operation: the domain logic, usually inside a transaction if it writes.
- Side effects: events, emails, calls to other services — ideally after commit, via an outbox or job, so they do not happen for rolled-back work (see below).
- Response mapping: map the result to the response shape explicitly (do not serialise internal objects directly), set status codes and caching headers.
- Error mapping: map known domain errors to appropriate responses; let unknown errors become a generic 500 with a correlation ID while the details go to logs.
- Telemetry: log the outcome with request ID, user/tenant ID (if appropriate), duration, and status; record metrics.
Where business logic goes
| Logic | Place it | |
|---|---|---|
| Shape/format checks on input ("is a valid email", "1–100 items") | Boundary validation | |
| Rules about the domain ("an order can't be cancelled after shipping") | Domain/service layer, independent of transport | |
| Invariants that must hold under concurrency ("email unique", "stock ≥ 0") | Database constraints and domain code (domain code gives good errors, constraint guarantees correctness) | |
| Orchestration ("reserve stock, charge card, create shipment") | Application/use-case layer, which owns the transaction boundary | |
| Access rules ("only the owner or an admin") | An authorization layer or policy functions called from the use case, not scattered if checks | |
| Presentation ("format price for display") | Response mapping or the client, not the domain |
Avoid two extremes: everything in handlers (untestable, duplicated), and an elaborate many-layer structure for simple CRUD (indirection without benefit). Match the depth to the complexity of the rules and to the project's existing structure.
Data access and transactions
- Transaction boundaries belong to the use case, not to individual repository calls. One business operation that must be all-or-nothing runs in one transaction.
- Keep transactions short. Never make network calls to external services, send emails, or wait for user input inside a database transaction; it holds locks and connections while waiting on something slow and unreliable.
- Know your isolation level. Many databases default to read committed, which permits lost updates and write skew in read-modify-write sequences. Use atomic updates (
UPDATE ... SET balance = balance - ? WHERE balance >= ?), row locks (SELECT ... FOR UPDATE), optimistic version checks, or a stricter isolation level with retry on serialisation failure. - Let constraints do their job, and translate constraint violations (e.g. unique violation) into domain errors (409 "email already registered") rather than 500s.
- Avoid N+1 queries: loading a list then querying per item. Use joins, batch loading (
WHERE id IN (...)), or the ORM's eager loading. Seesql-and-queries. - Bound every query: paginate lists, limit result sizes, and never load an unbounded table into memory.
- Use parameterised queries always. String-built SQL is an injection vulnerability, regardless of how trusted the input seems.
- Connection pools are finite. Size pools against the database's connection limit divided by the number of instances; a fleet of autoscaled instances each with a large pool can exhaust the database.
- Schema changes go through migrations, written to be safe under live traffic (see
database-migrations).
Side effects and the dual-write problem
A common bug: the code commits a database transaction and then publishes a message (or sends an email, or calls another service). If the process crashes between the two, one happens without the other. If it publishes first and the transaction rolls back, consumers act on something that never happened.
Options, from most to least robust:
- Transactional outbox: write the message to an outbox table in the same transaction; a separate relay publishes and marks it sent. Consumers must be idempotent because the relay may publish twice.
- Change data capture from the database log, feeding a stream.
- Enqueue a job after commit using a job system that stores jobs in the same database (so enqueueing is part of the transaction).
- Publish after commit with retries and reconciliation — acceptable for low-stakes side effects (analytics), not for money or inventory.
Background work
Move work out of the request path when it is slow (more than roughly a second or two), can fail transiently and should be retried, depends on unreliable third parties, or is triggered in bulk.
Design every job to be:
- Idempotent: running it twice has the same effect as once. Jobs will run more than once (retries after timeouts, redelivery after worker crashes). Use natural idempotency (upserts, "set status to X" rather than "toggle"), dedupe keys, or a processed-IDs table.
- Small and resumable: a job that processes a million rows should be split into batches or checkpoint progress, so a crash does not restart from zero and a deploy does not kill hours of work.
- Bounded in retries: exponential backoff with jitter, a maximum attempt count, then a dead-letter destination that someone monitors. Distinguish permanent failures (bad input — do not retry) from transient ones.
- Time-limited: a maximum runtime, after which it is killed and retried or failed.
- Observable: log start, finish, failure, and duration with the job ID; alert on queue age and failure rate.
- Safe to deploy during: workers should finish or release the current job on shutdown signals (graceful shutdown) rather than dying mid-write.
Pass job arguments by ID and re-load current state in the job, rather than serialising whole objects into the job payload — the object may have changed by the time the job runs.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/backend-development/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kmaruthi2002/universal-llm-skills/backend-development)