Rafter secure design

From Raftersecurity/rafter-cli · View interactive version

Rafter secure design is an AI agent skill from the GitHub repository Raftersecurity/rafter-cli. REQUIRED before writing code for any feature touching auth, payments, credentials, tokens, sessions, file upload, user data, untrusted input, deserialization, network endpoints, or data deletion. Scope by that surface, not the task label — a research/experimental/local-only feature with none of it d

How to use this skill

Skill file

Rafter Secure Design — Designing It Right The First Time

A designer's skill, not a scanner. The goal is to catch the flaw in the whiteboard sketch, not three weeks later in a PR. Each sub-doc asks the questions a security engineer would ask at kickoff — "which primitive, which boundary, which default?"

Pair with rafter-code-review (structured review during PR) and the rafter skill (automated detection of what slipped through). This skill is the earliest stage — prevention before the code exists.

When this applies (and when it doesn't)

Engage this design walk when the feature you're about to build touches a real security surface: auth or access control, credentials / secrets / tokens / sessions, user or untrusted input, SQL or query construction, shell / exec, file paths or uploads, (de)serialization, crypto, network-facing endpoints or outbound fetchers, data deletion, or new dependencies.

If the thing you're designing has none of that — a research / experimental / local-only / throwaway piece such as a training script, analysis pipeline, plot, model-eval harness, notebook, or pure computation over trusted local data — a quick surface check is enough and you can proceed to implementation without the full walk. Judge by the surface, not by whether the work is called "research": a research feature that stores user data, handles a token, or opens a network endpoint is back on the engage list.

How to use this skill

  1. Identify what's being designed (below). If multiple apply, walk them in the order listed — threat-modeling last, as a capstone.
  2. Read only the matching sub-doc. Do not preload them all; pick-and-load keeps the conversation tight.
  3. Work through its questions against the proposed design. Capture the answer inline (architecture doc, design RFC, PR description). If you can't answer a question, that's a design gap — resolve it before writing code.
  4. When the design is stable, run the threat-modeling walk to stress-test it.
  5. Hand off to rafter-code-review during implementation.

Choose Your Adventure

(1) Authentication & Authorization

For: login, sessions, tokens, service-to-service identity, multi-tenant access, role-based permissions, anything that answers "who is this and what can they do?"

(2) Data storage — at rest, in transit, PII

For: database schema design, file storage, caches, logs, anything that decides where sensitive data lives and who holds the keys.

(3) API surface — REST / GraphQL / gRPC / webhooks

For: designing new endpoints, shaping request/response schemas, choosing between resource styles, rate limiting, versioning, exposing internal services.

(4) Ingestion — inputs, uploads, parsers, user content

For: anything that accepts user-controlled bytes: form posts, file uploads, webhook payloads, imports, content rendering, search indexing.

(5) Deployment — topology, network, secrets, runtime

For: infra plan, service boundaries, secret distribution, egress policy, CI/CD pipeline, build-time vs. run-time separation.

(6) Dependencies & supply chain

For: picking a library, adopting a framework, pulling a container base image, introducing a new SaaS, wiring a postinstall script.

(7) Threat model — STRIDE walk of the full design

For: the capstone pass after the above decisions are drafted. Also good for any greenfield service review.

(8) Which standards / frameworks should bound this?

For: scoping compliance, picking a baseline, answering "how much is enough?"


What this skill will NOT do


Fast path at feature kickoff

1. Sketch the design (one-pager, box-and-arrow).
2. Walk the sub-doc that matches the riskiest choice you're about to make.
3. Walk threat-modeling.md as a capstone.
4. Write the decisions into the design doc as "decided / rejected / why".
5. Start coding — and loop in `rafter-code-review` when the PR lands.

If you're revisiting an existing design (refactor, migration), same flow: treat the current shape as "proposed" and walk the relevant sub-docs as questions.


Tie-backs

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.