agentleFS
swaaap-nilswaaap-nil/system-design-skill/skills/system-design-interview/SKILL.md

system-design-interview

Skill2 starsChanged 4 months agoMITView on GitHub

Turns the current codebase into a Staff-level system design interview problem. Scans directory structure, routes, data models and infrastructure, then produces a grounded interview brief — The Question, Core Requirements, Below the Line, Non-Functional Requirements, High-Level Architecture (target vs as-built), Data Models, and two Deep Dive bottlenecks with fixes. Use when the user asks to generate a system design question or interview problem from their code, wants to practice system design on a real repo, asks "how would this scale", "what breaks first", "what are the bottlenecks here", or wants an architectural walkthrough of a project in interview format.

  • Reads credentials
  • Commits and pushes

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. booklib-ai/booklib★ 38same name
    2. iamurali/system-design-skill★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. About 0 are common, 14 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read $ARGUMENTS. If empty, use brief.

    line 20
  2. Distinctive:

    If no tier is given, run Phase 0 and ask.

    line 34
  3. Very specific:

    Cite or don't claim: Every statement about what the code does carries a path/to/file.ext:42 reference.

    line 42
  4. Distinctive:

    Name the crux: Every good interview problem has exactly one genuinely hard part.

    line 47
  5. Distinctive:

    Cut complexity ruthlessly: Do not add Kafka, Kubernetes, a service mesh or a CQRS layer unless a numbered requirement in section 4 forces …

    line 50
  6. Distinctive:

    No filler: If the repo has no async work, say so and move on.

    line 56
  7. Very specific:

    Never open a secret: Do not read .env, key files, state files or credential stores — the deny-list is in references/recon.md and it is not …

    line 58
  8. Distinctive:

    If you hit a cap before finishing recon, say so in the output — one line under section 1:

    line 100
  9. Distinctive:

    Never exceed a cap to improve the output.

    line 103
  10. Distinctive:

    Read the top-level tree and note the shape: monolith, monorepo, service, library, frontend-only.

    line 118
  11. Distinctive:

    If the repository is empty, is only configuration, or has no server-side component, say so plainly and offer to run against a different …

    line 146
  12. Distinctive:

    Before writing anything, decide four things.

    line 153
  13. Distinctive:

    The scale multiplier: Read the repo's actual scale evidence — page sizes, rate limits, table counts, timeouts, instance counts.

    line 170
  14. Distinctive:

    Follow with a one-line Grounded in: note giving the repo's stack and the file that anchors the framing.

    line 188
  15. Distinctive:

    Every requirement cites the code that proves it exists.

    line 196
  16. Very specific:

    Only runs in save and contribute mode.

    line 285
  17. Distinctive:

    If Node is unavailable, say so and skip.

    line 319
  18. Very specific:

    Write the brief exactly as produced to docs/system-design/<slug>.md, creating the directory if needed.

    line 323
  19. Very specific:

    When eligible, apply every redaction rule in references/publishing.md — anonymise the product, generalise identifiers, strip anything …

    line 345
  20. Very specific:

    Only runs in similar mode.

    line 370
  21. Distinctive:

    Check every line before emitting.

    line 393

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Codebase → Staff-Level System Design Interview

Convert the repository in the working directory into a system design interview problem that a Staff/L6 candidate would be given, then answer it at that bar. The output is grounded in code that actually exists — not a generic template with the repo's name pasted in.

Modes

Read $ARGUMENTS. If empty, use brief.

ArgumentBehaviour
(empty) / briefFull 7-section interview brief. The default.
quickSame 7 sections, one-third the length. Drop the as-built subsection and delta table from section 5, and the access-pattern table from section 6. Keep the target-design diagram — it is the highest-value element.
deep <topic>Skip to section 7. Produce three bottlenecks on <topic> instead of two, each with the full failure math.
interviewSocratic mode. Emit sections 1–4 only, then stop and ask the user to propose a high-level design. Critique their answer against references/rubric.md, then reveal sections 5–7. Do not reveal the answer early.
save [slug]Produce the brief, then write it to docs/system-design/<slug>.md in the repo. Full fidelity — real paths, real names. Stays local. See Phase 4.
contribute [slug]Produce a redacted brief safe to publish, write it to docs/system-design/<slug>.shared.md, then offer to open the PR with scripts/contribute.mjs. Follows references/publishing.md exactly. See Phase 4.
similarRecon only, then match this repo against the community library and report the closest problems. No brief. See Phase 5.
<path>Scope recon to that subdirectory. Useful in a monorepo.

Any mode can be combined with an effort tier — quick scan, thorough, interview standard. If no tier is given, run Phase 0 and ask.


Rules of engagement

These are not style preferences. Violating any of them makes the output worthless.

  1. Cite or don't claim. Every statement about what the code does carries a path/to/file.ext:42 reference. If you cannot cite it, you may not assert it.
  2. Tag every assumption. Scale, traffic, team size, SLAs and business context are not in the repo. Write them as [Assumed] with a one-clause justification. Never present an assumption as an observation.
  3. Name the crux. Every good interview problem has exactly one genuinely hard part. Find it and organise the whole brief around it. A brief where every section is equally weighted is a failed brief.
  4. Cut complexity ruthlessly. Do not add Kafka, Kubernetes, a service mesh or a CQRS layer unless a numbered requirement in section 4 forces it. Every box in the architecture diagram must trace to a requirement ID. Unjustified components are the most common failure of this skill.
  5. Take positions. "We could use Postgres or DynamoDB" is a junior answer. "Postgres, because the booking flow needs a multi-row transaction; revisit at 50k writes/sec" is the bar. See references/rubric.md.
  6. No filler. If the repo has no async work, say so and move on. Do not invent a queue to have something to talk about.
  7. Never open a secret. Do not read .env, key files, state files or credential stores — the deny-list is in references/recon.md and it is not negotiable. save writes full-fidelity output into the user's repository, so anything you read can end up committed. If you encounter a credential incidentally, record that it exists — "credentials hardcoded at config/settings.py:12" is legitimate findings material — and never reproduce the value.

Phase 0 — Effort budget

Skip only if the user already named a tier in $ARGUMENTS.

Size the repository first — one call, before anything else:

git ls-files 2>/dev/null | wc -l

Then present the tiers with a recommendation, and wait for an answer:

TierFiles readTool callsRough costWhat you get
scan≤ 8≤ 12~15–25k tokensSections 1–4 solid, 5–7 shallower. Framing over depth.
standard≤ 20≤ 25~40–70k tokensThe full brief. The default.
thorough≤ 45≤ 60~100–150k tokensFull brief, plus every dependency of the hot path read end to end.
Repository sizeRecommend
Under 150 filesscan — there isn't enough surface to justify more
150–1,500 filesstandard
Over 1,500 filesstandard, and suggest scoping to a subdirectory with <path>
Over 5,000 filesstandard only with a path scope; unscoped thorough will hit the cap before reaching the hot path

The token figures are estimates, not measurements. You cannot observe your own token usage. Say so if the user asks for a precise number. The file and tool-call caps are what you actually enforce, because you can count those.

Enforcing the budget

The caps are hard. Track files read and tool calls as you go.

  • At 80% of the cap, stop exploring and start writing with what you have.
  • If you hit a cap before finishing recon, say so in the output — one line under section 1: Recon stopped at the <tier> cap (N files). Sections 6–7 are thinner than they'd be at <next tier>. Never silently produce a shallow brief and present it as a complete one.
  • Never exceed a cap to improve the output. The user chose the budget; spending past it is not yours to decide.

Record the tier and the actual counts — Phase 4 writes them into saved files.

Phase 1 — Recon

Budget: the tool-call cap from Phase 0 (~25 at standard). Stop as soon as you can name the stack, three entrypoints, three persisted entities, and the datastores. Depth beyond that is wasted; you are building an interview problem, not an audit.

Work these in order. references/recon.md has the per-stack grep patterns — load it once at the start of this phase and follow its tables.

  1. Inventory. git ls-files (fall back to find . -type f -not -path '*/node_modules/*'). Read the top-level tree and note the shape: monolith, monorepo, service, library, frontend-only.
  2. Stack. Find the manifest — package.json, pyproject.toml, requirements.txt, go.mod, pom.xml, build.gradle, Gemfile, composer.json, Cargo.toml, *.csproj. Read its dependency list. The dependencies tell you more about the architecture than the source does.
  3. Entrypoints. Locate route definitions, handlers, RPC services, GraphQL resolvers, CLI commands, or event consumers. Count them. Identify the 3–5 that carry the product's value.
  4. Data models. ORM model classes, migrations, schema.sql, schema.prisma, mongoose schemas, protobuf, or struct tags. Capture field names and types for the core entities — you need these verbatim for section 6.
  5. Infrastructure. docker-compose.yml, Dockerfile, k8s/, *.tf, serverless.yml, .env.example, Procfile, CI workflows. This is where you learn there's a Redis, an S3 bucket, a Kafka topic, or that everything runs in one process.
  6. Async and scheduled work. Celery, Sidekiq, BullMQ, cron, Temporal, Lambda triggers, @scheduled, background threads. Note whether the hot path does work synchronously that should be deferred.
  7. External dependencies. Third-party SDK imports and outbound HTTP calls: payments, email, SMS, LLM APIs, object storage, geocoding. Each is a latency source and a failure mode.
  8. Archaeology. Two git log calls — file churn, and commits mentioning fix/perf/timeout/ revert. The code tells you what the system is; the history tells you where it hurts. A file with high churn and repeated fixes is a section-7 bottleneck with evidence attached. Worth doing even at scan.
  9. The hot path. Pick the single endpoint or job that would be called most often in production and read it end to end — the churn ranking from step 8 usually names it. This one function is where both of your section-7 bottlenecks will almost certainly live.

Recon output (internal, do not print): stack, deployment shape, N entrypoints, core entities, datastores, async story, external calls, hot path, and one sentence on the crux.

If the repository is empty, is only configuration, or has no server-side component, say so plainly and offer to run against a different directory. Do not fabricate a system.


Phase 2 — Framing

Before writing anything, decide four things.

The shape. Load references/shapes.md and identify what kind of repository this is. The default seven-section brief assumes a request-serving backend; a data pipeline, an IaC repo, a mobile client or a library needs a different frame, and a docs repo needs an honest refusal. Forcing the default onto the wrong shape produces a brief that reads plausibly and describes nothing real. Do this first — it changes everything below.

The product category. Map the repo to a recognisable class of system — a booking system, a feed, a job queue, a marketplace, a CRM, a metrics pipeline, a chat app, an ad server. Interviewers ask "Design Ticketmaster", not "Design svc-inventory-v2". Name the closest real-world analogue.

The crux. The one constraint that makes the problem non-trivial. It is usually one of: concurrent contention on a scarce resource, read amplification on a fan-out, write throughput on a hot key, strong consistency under partition, ordering guarantees, long-running stateful work, or latency on a cross-service path. Everything else in the brief is scaffolding around this.

The scale multiplier. Read the repo's actual scale evidence — page sizes, rate limits, table counts, timeouts, instance counts. Then state explicitly what scale the interview assumes and why: "The repo is built for one tenant; the interview assumes 10M DAU, a 1000× jump. That jump is what makes section 7 interesting." Never silently swap in FAANG numbers.


Phase 3 — Output

Emit exactly these seven sections, in this order, with these headings. No preamble, no closing summary. references/example-output.md is a complete worked example — match its shape and density.

1. The Question

Two to four sentences, phrased the way an interviewer would say it out loud. Open with "Design a…". Name the real-world analogue in parentheses. End with the constraint that contains the crux, because that is what the candidate must notice in the first five minutes.

Follow with a one-line Grounded in: note giving the repo's stack and the file that anchors the framing.

2. Core Requirements

Exactly 3–4 functional requirements. Format each as Users should be able to …, ordered by centrality to the product — the first one is the thing the system exists to do.

Every requirement cites the code that proves it exists. No CRUD filler, no "users should be able to log in" unless auth is the product.

3. Below the Line

Four to six items that are explicitly out of scope, each with a half-line reason. Draw them from two places: things the repo genuinely does that don't drive the architecture (admin panels, email templates, settings pages), and things an interviewer would deliberately wave off (auth, billing, GDPR, i18n, analytics). Naming these is a seniority signal — it shows you scoped before you built.

4. Non-Functional Requirements

Three to five, each in the form System should [property] — [number] — [why that number]. Cover at minimum: the consistency/availability choice (pick a side, per subsystem, and justify it), a latency budget on the hot path, peak throughput, and durability or retention.

State the assumed scale first, with the evidence trail from Phase 2. Then a compact back-of-envelope block — only for the numbers that change a design decision. Skip the traditional storage-math ritual if nothing depends on it. references/numbers.md has the latency and throughput constants; use them rather than guessing.

5. High-Level Architecture

Three parts:

Core entities and API. The 3–6 nouns the system manages, then the 3–5 endpoints that matter, derived from real routes. One line each, request → response shape. Do not enumerate every endpoint in the repo.

Target design. A diagram (ASCII box-and-arrow, or Mermaid if the client renders it) plus a numbered walkthrough of the hot path. Annotate every component with the requirement ID that forces it — [NFR-2], [FR-1]. A component with no annotation must be deleted.

As-built. What the repository actually does today, in 3–6 lines, cited. Then a delta table:

| Concern | As-built | Target | Why it matters |

Be fair to the code. Most repos are correctly simple for their current scale — say that when it's true. "Single Postgres, and that's the right call until ~10k writes/sec" is a stronger observation than a list of everything that isn't distributed.

6. Data Models

The core entities as they exist, with real field names and types, cited. Use compact DDL or a schema block — not prose.

For each entity, mark: the access pattern it is optimised for, the shard key candidate if it would ever need partitioning, and the field that becomes hot at scale.

Then an access-pattern table for the hot path:

| Query | Current index | Verdict at target scale |

Close with what's missing that the target design needs — a new index, a denormalised counter, an outbox table, a materialised view. Two or three items, not a wishlist.

7. Deep Dive / Bottlenecks

Exactly two bottlenecks (three in deep mode) — the two with the highest product of blast radius and likelihood. Select them using the detection table in references/bottlenecks.md; do not freestyle this.

Each bottleneck uses this structure:

Bottleneck N — <short name>

Where. path/to/file.ext:120-140 — one sentence on what the code does.

Why it breaks. The failure math. At 5k RPS this endpoint issues 5k × 40 = 200k queries/sec against a Postgres primary that tops out near 15k. A bottleneck without a number is an opinion.

Blast radius. What else goes down when it does, and how it is first observed in production.

Fix. A specific, named change. Not "add caching" — "materialise the counter in Redis with a write-through on the mutation path, INCR/DECR under the item key, reconciled hourly from the source of truth."

Trade-off accepted. What you give up. There is always something: staleness bound, extra operational surface, dual-write risk, cost.

How you'd verify. The metric or load test that proves the fix worked.

Close with two or three follow-up questions an interviewer would ask next, as a short list. These are the questions the candidate should be ready for, not answers.


Phase 4 — Saving and sharing

Only runs in save and contribute mode. Load references/publishing.md before either.

Before writing any file

Scan the draft you are about to write. If it contains any of the following, remove them and say what you removed — do not write the file first and fix it after, because the write is what makes it committable:

  • AKIA, ASIA, AIza, ghp_, gho_, github_pat_, sk-, sk_live_, sk_test_, xoxb-, xoxp-, SG., -----BEGIN (any key block)
  • A connection string carrying a password: postgres://user:<password>@…, mongodb+srv://…, redis://:<password>@…, amqp://…
  • Any run of 32+ characters of base64 or hex that isn't a hash you can account for
  • Internal hostnames, private IPs, bucket names, account IDs

This runs for save as well as contribute. save skips redaction — it keeps real paths and names on purpose — but it never skips this scan. Redaction is about identity; this is about credentials, and they are not the same rule.

After writing

This skill bundles two checkers in its own scripts/ directory. Run both against what you just wrote, from the skill's directory, and report the results:

node scripts/verify-brief.mjs <written-file> --repo <project-root>
node scripts/scan-secrets.mjs <written-file>

verify-brief.mjs resolves every citation you produced against the real files and checks the structural contract. If it reports a broken citation, fix the citation — do not delete it. A citation that does not resolve means you asserted something you did not read, which is the failure this whole skill is built to avoid. Re-read the file, correct the line number, and run it again.

If Node is unavailable, say so and skip; do not claim the checks passed.

save

Write the brief exactly as produced to docs/system-design/<slug>.md, creating the directory if needed. Derive <slug> from the product category when the user didn't supply one — class-booking-platform, not the repo name. Prepend the frontmatter block from references/publishing.md, including the production metadata: fill effort, files_read and tool_calls from what you actually did, and leave tokens, duration_min, agent and model blank for the user — you cannot measure those. Confirm the path and stop.

This copy keeps real file paths, real table names and real product identity. It is a working document for the user's own repository. Do not redact it — redacting the local copy destroys the citations that make it verifiable.

contribute

Produce a version safe to publish in a public repository, then write it to docs/system-design/<slug>.shared.md.

Before writing anything, run the eligibility check in references/publishing.md and report the result to the user. If the code is an employer's, if the repository is private, or if you cannot tell, say so plainly and ask before continuing. Do not proceed on an assumption. A generated brief is an architecture document with a list of exploitable weaknesses attached; publishing one from a codebase the user doesn't own is a real problem, not a formality.

When eligible, apply every redaction rule in references/publishing.md — anonymise the product, generalise identifiers, strip anything operational — then re-read the result and answer one question in the output: could a reader identify the original system or organisation? If yes, the redaction is incomplete; fix it before writing the file.

Then offer to open the PR:

node scripts/contribute.mjs docs/system-design/<slug>.shared.md

That script forks, copies, regenerates the index, runs the check suite, commits, pushes, and opens the PR form in the user's browser with the full diff visible. It does not submit. Tell the user plainly that reading that diff is the point — automated redaction is not trustworthy on its own, and a published brief cannot be un-published.

It refuses outright on a failed credential scan or a failed structural check, so do not attempt to work around either; fix the brief instead. If gh is missing or unauthenticated the script says so — relay that rather than falling back to manual git commands.

Never run git push or gh pr create yourself. The script exists so that the review gate sits where GitHub enforces it. Reconstructing the steps by hand removes the gate.

Phase 5 — Similar problems

Only runs in similar mode. Run Phases 0–2, skip Phase 3 entirely, then read references/library-index.md.

Match on the crux, not the domain. Two systems in unrelated industries with the same contention problem are the useful match; two booking systems with different cruxes are not. A repo whose problem is single-key write contention should surface the ticketing entry even though one sells concert seats and the other schedules MRI scanners.

Report at most three, closest first:

<title> — <one line on why it matches this repo, naming the shared crux> Differs in: <the one dimension where their situation is not yours> <url>

Then one line on what to read them for. If nothing genuinely matches, say so — the library is small and a forced match is worse than none. Suggest contribute in that case: an unmatched crux is exactly what the library is missing.

The entries are not bundled with this skill, only linked. Do not summarise one you have not fetched, and do not invent its contents from the crux line.

Quality gate

Check every line before emitting. If a check fails, fix it — do not caveat it.

  • Every claim about the codebase carries a path:line citation.
  • Every non-code claim is tagged [Assumed] with a justification.
  • Section 1 names a real-world analogue and contains the crux.
  • Section 4 states the scale multiplier and its evidence trail.
  • Every component in the section 5 diagram is annotated with a requirement ID.
  • Both bottlenecks in section 7 contain an actual number and a named fix.
  • The specificity test: would this brief read differently for a different repo in the same language? If it would not, the recon was too shallow — go back to Phase 1 and read the hot path properly.
  • Nothing was invented to fill a section. Empty is better than fabricated.

References

Load these on demand, not upfront.

  • references/recon.md — per-stack file and grep patterns for finding routes, models, infra and queues. Load at the start of Phase 1.
  • references/bottlenecks.md — 14 detectable scaling anti-patterns with their break points, fixes and trade-offs. Load before writing section 7.
  • references/numbers.md — latency, throughput and capacity constants for back-of-envelope work. Load before writing section 4.
  • references/rubric.md — the Staff-level bar, common failure modes, and the scoring used in interview mode. Load in interview mode, or when the user asks how their own design would be graded.
  • references/shapes.md — how to recognise a repository that isn't a request backend, and what to do instead. Load in Phase 2, always.
  • references/publishing.md — frontmatter format, the eligibility check, and the redaction rules. Load in save and contribute mode.
  • references/library-index.md — the community library, one row per problem. Load in similar mode.
  • references/example-output.md — a complete worked brief. Load once if you are unsure about format or density.

Bundled scripts, run rather than read:

  • scripts/verify-brief.mjs — resolves every citation in a written brief against the real files and checks the structural contract. Run after save or contribute.
  • scripts/scan-secrets.mjs — scans written markdown for credentials. Run after save or contribute, and suggest the user run it over docs/system-design/ before committing.
  • scripts/contribute.mjs — forks, copies, indexes, checks, pushes, and opens the library PR form in the browser without submitting. Offer it after contribute; never hand-roll the git steps.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.