Software design document template
A design doc explains how you plan to build something before you build it, so reviewers can catch problems while they are still cheap to fix. Copy the example below into docs/design, keep the section headings, and replace the scheduled exports feature with your own.
Updated
Files
# Design: Scheduled exports
- Author: Platform team
- Reviewers: Backend, Security
- Status: In review
- Last updated: 2026-11-30
## Summary
Workspace owners can schedule a CSV export of their reports to run daily or weekly and arrive by
email or in an S3 bucket they own. This document proposes a scheduler table, a worker job and a
delivery step, and estimates three weeks for one engineer.
## Background
Customers export reports by hand from the Reports page today. Twelve of our 40 largest accounts
asked for automatic exports last quarter, and four wrote scripts against our API to do it, which
causes most of our API rate-limit errors.
## Goals
- An owner can create, pause and delete a schedule for any saved report.
- Exports arrive within 15 minutes of the scheduled time.
- A failed delivery is retried and the owner is told when it gives up.
## Non-goals
- Formats other than CSV. XLSX can follow once this ships.
- Schedules more frequent than daily.
- Delivery to destinations other than email and S3.
## Proposed design
### Data model
A new `export_schedules` table stores the report, the cadence (`daily` or `weekly` with a weekday),
the time and time zone, the destination and `next_run_at`. Destinations store an S3 bucket and
role ARN, never access keys.
### Scheduling
A worker runs every minute, claims schedules with `next_run_at <= now()` using `FOR UPDATE SKIP
LOCKED`, enqueues one export job per schedule and advances `next_run_at`. Computing the next run in
the schedule's time zone keeps exports at the same local time across daylight saving changes.
### Export and delivery
The export job reuses the existing CSV generator. Files under 10 MB are attached to the email.
Larger files are uploaded to our storage and emailed as a link that expires after 7 days. S3
delivery assumes the customer's role with an external ID and uploads with `PutObject`.
### Failure handling
Delivery retries three times with exponential backoff. After the last failure the schedule is
paused and the owner gets an email and an in-app notification that says what failed.
## Alternatives considered
- **A cron service per schedule** (such as EventBridge Scheduler). Precise timing, but adds a
cloud dependency that self-hosted customers don't have.
- **Let customers keep scripting the API.** No work for us, but rate-limit errors keep growing.
## Security and privacy
Exports contain customer financial data. Email links are signed and single-workspace. S3 delivery
uses role assumption with an external ID, so we hold no customer credentials. Every run is written
to the audit log.
## Rollout
1. Ship behind a feature flag to five accounts that asked for it.
2. Watch delivery success rate and export duration for two weeks.
3. Enable for all paid plans and announce in the changelog.
## Open questions
- Do we count scheduled exports against the API rate limit?
- Should owners be able to send to more than one destination per schedule?Save with your agent
Run this command to add Sniptide to Claude Code in the current project. Open /mcp in Claude Code and sign in to Sniptide. Once the server shows as connected, use the prompt below to save a private copy in your library.
claude mcp add --scope local --transport http sniptide https://app.sniptide.com/api/mcpRead https://sniptide.com/templates/design-doc-template.json and use create_snippet to save its files as a private Sniptide snippet titled "Software design document template". Keep the file names and contents from the JSON.When to write one
Write a design doc when the work takes more than a week, touches several systems, changes data that is hard to migrate, or has more than one reasonable approach. Skip it for work where the first idea is obviously right. The doc's job is to get disagreement out early: a reviewer's comment costs minutes now and weeks after launch.
What each section does
Section | What it settles | How to write it |
|---|---|---|
Summary | What you propose and what it costs. | Three sentences a busy reviewer can stop after. Include the estimate. |
Background | Why now. | The problem with evidence, such as support tickets, numbers and incidents. |
Goals and non-goals | What success means and what is deliberately left out. | Goals are checkable. Non-goals are the features people will assume come along. |
Proposed design | How it works. | Data model first, then the flow. Name tables, jobs and endpoints. Add a diagram when there are more than three moving parts. |
Alternatives considered | Why not the other approaches. | One short paragraph each, with the deciding reason. |
Security and privacy | What data moves and who can reach it. | Name the data, the credentials and the audit trail. |
Rollout | How it reaches users safely. | Flags, the first users and the metrics you watch. |
Open questions | What you still need decided. | Each question with the person who can answer it. Empty this section before you start building. |
Keep the doc to what a reviewer needs to agree or disagree. Implementation details that won't change the decision belong in the pull requests.
Run the review
Share the doc with the reviewers named at the top and give them a deadline, such as three working days. Resolve each comment in the doc. Once the open questions are empty, set the status to Approved and start building. Record the decisions that will outlive the feature, such as the scheduler approach, as architecture decision records.
Variant: a one-page design
For a smaller change, keep four sections:
# Design: Rate-limit headers
## Problem
API clients can't tell how close they are to the limit until they get a 429.
## Proposal
Return `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset` on every API response,
computed from the existing limiter.
## Alternatives
A `/rate-limit` endpoint. Rejected: it costs a request to check.
## Rollout
Ship to all clients at once. The headers are additive, so no client breaks.