patterns — Claude Code rule: what it does, how to install
patterns sets standard TypeScript interfaces for APIs and repositories, provides a useDebounce hook, and defines a workflow for evaluating skeleton repos.
MIT ★ 6,739 updated 2026-01-23
/plugin marketplace add WorldFlowAI/everything-claude-code
/plugin install everything-claude-code@everything-claude-codeWhat patterns does
The rule introduces shared TypeScript structures to keep code style predictable. It specifies an ApiResponse<T> contract with success indicators, error strings, payload slots, and pagination meta fields. For data access, it defines a generic Repository<T> interface containing standard query and mutation signatures. A React useDebounce hook implementation handles deferred updates.
When new functionality is requested, the rule instructs Claude Code to search for vetted skeleton projects instead of building from scratch. It directs parallel agents to inspect candidates across security, extensibility, relevance, and implementation planning before cloning the chosen base.
Because the examples depend on TypeScript interfaces and React state primitives, the rule offers little value in non-TypeScript or non-React codebases.
What it helps with
- standardize API payloads and pagination metadata envelopes
- apply a common Repository interface across persistence layers
- add debounced value handling with a standard React hook
- evaluate third-party skeleton repos before starting feature builds
Example prompts for the agent
- Write an API route that formats the result using our ApiResponse structure
- Generate an entity persistence layer conforming to the Repository pattern
- Search for skeleton repos for our new module and evaluate them for security and extensibility
How to install patterns
1Plugin marketplace
/plugin marketplace add WorldFlowAI/everything-claude-code/plugin install everything-claude-code@everything-claude-code2Manually: put the files in place
.claude/rules/patterns.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/patterns.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/patterns.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/patterns.mdManually: put the files in place
.clinerules/patterns.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about patterns
How to install patterns in Claude Code?
Run /plugin marketplace add WorldFlowAI/everything-claude-code followed by /plugin install everything-claude-code@everything-claude-code. Alternatively, place the content directly into .claude/rules/patterns.md.
What does patterns do?
It guides the agent with shared TypeScript response formats, CRUD repository signatures, a debounce hook snippet, and an evaluation rubric for skeleton repos.
What dependencies does this rule require?
The provided patterns rely directly on TypeScript and React hooks (useState and useEffect), making them suited for that specific stack.
Source text
patterns.md · MIT
# Common Patterns
## API Response Format
```typescript
interface ApiResponse<T> {
success: boolean
data?: T
error?: string
meta?: {
total: number
page: number
limit: number
}
}
```
## Custom Hooks Pattern
```typescript
export function useDebounce<T>(value: T, delay: number): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value)
useEffect(() => {
const handler = setTimeout(() => setDebouncedValue(value), delay)
return () => clearTimeout(handler)
}, [value, delay])
return debouncedValue
}
```
## Repository Pattern
```typescript
interface Repository<T> {
findAll(filters?: Filters): Promise<T[]>
findById(id: string): Promise<T | null>
create(data: CreateDto): Promise<T>
update(id: string, data: UpdateDto): Promise<T>
delete(id: string): Promise<void>
}
```
## Skeleton Projects
When implementing new functionality:
1. Search for battle-tested skeleton projects
2. Use parallel agents to evaluate options:
- Security assessment
- Extensibility analysis
- Relevance scoring
- Implementation planning
3. Clone best match as foundation
4. Iterate within proven structure
© Affaan Mustafa · MIT · WorldFlowAI/everything-claude-code