05-web-development

Coding rules for web applications built with Vite, React, and TypeScript. They specify component structure, Tailwind styling, accessibility, testing, imports, and code-block formatting.

In plain words
What is it for?
Use them when writing React components, styling with Tailwind, adding Vitest tests, or presenting web application code.
Why use it?
They keep generated web code consistent with the project’s expected tools and make examples complete and easier to use.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/dafthunk-com/dafthunk/05-web-development
Clone the repo
git clone --depth 1 https://github.com/dafthunk-com/dafthunk

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,322 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01322
Opus 5 $0.00000 $0.00661
Sonnet 5 $0.00000 $0.00264
Haiku 4.5 $0.00000 $0.00132

Measured 2d ago against content hash debf57b6f5b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

05-web-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/05-web-development.mdc · 175 lines

How it starts

The opening of the file, as written. The whole thing — 175 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Web application

Guidelines

  1. Always write complete, functional components using tsx with a named export function Component.
  2. Use Tailwind CSS classes for styling and accessibility best practices.
  3. Prefer shadcn/ui and lucide-react if appropriate.
  4. All code should work in a Vite + React + TypeScript setup.
  5. Include only one file per code block. Avoid multi-file outputs.
  6. Use Vitest for testing; include test blocks where relevant.
  7. Use import type when importing types from libraries.
  8. Avoid dynamic imports, external APIs, or CDN usage unless requested.
  9. Escaped JSX characters like <, >, {, and } must be in string literals.

Code block structure

Use the following format for code blocks:

export function Component() {
  // your component here
}

Examples

Good Example: React component using Tailwind and shadcn/ui

import { Button } from "@/components/ui/button"

export function Component() {
  return <Button className="text-primary">Click me</Button>
}

Bad Example: Missing export, bad styling, incorrect file structure

function Button() {
  return <button style={{ color: 'blue' }}>Click</button>
}
// Missing `export default`
// Uses inline styles instead of Tailwind
// No project/file/type metadata

Good Example: Test file using Vitest

import { describe, it, expect } from "vitest"
import { add } from "./add"

describe("add", () => {
  it("adds two numbers", () => {
    expect(add(2, 3)).toBe(5)
  })
})

Bad Example: Jest used instead of Vitest

import { test, expect } from "@jest/globals"

test("adds numbers", () => {
  expect(add(2, 3)).toBe(5)
})
// This is incorrect because the project uses Vitest, not Jest

React Loading State Best Practices with SWR

When fetching data in React components, use the library SWR (stale-while-revalidate) for its benefits in caching, revalidation, and focus tracking. The primary approach should be to consolidate related data fetching for a view into a single useSWR call.

Read the full file on GitHub · 175 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 175 lines · 0 tokens per session scan A debf57b6f5b9

Subscribe to this mod's changes

05-web-development is a cursor rule published in the GitHub repository dafthunk-com/dafthunk (119 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,322 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.