Flash Attention

Use when the user asks about FlashAttention, flash_attn, SDPA, scaled_dot_product_attention backends, online softmax, FA2/FA3/FA4 or attention OOM at long context. Produces the right exact-attention path, config and a check that the flash kernel really runs. Not for KV-cache paging in serving (use paged-attention) or custom kernels (use triton-kernels).

45 stars 6 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add j4flmao/agent-skills --skill flash-attention
Manual install
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/agent-skills/skills/hardware-acceleration/flash-attention ~/.claude/skills/flash-attention

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# FlashAttention

## Purpose
Compute exact softmax attention without materializing the N x N score matrix in GPU HBM. FlashAttention is IO-aware: it tiles Q, K, V into on-chip SRAM, fuses matmul + softmax + matmul into one kernel, and recomputes scores in the backward pass. FLOPs are unchanged (still O(N²·d)); memory for attention drops from O(N²) to O(N), and wall-clock time drops because HBM traffic drops.

## Agent Protocol

### Trigger
"flashattention", "flash attention", "flash_attn", "sdpa", "scaled_dot_product_attention", "online softmax", "attention OOM", "long context training memory".

### Input Context
- GPU (Ampere/Ada/Hopper/Blackwell), dtype, head dimension, sequence lengths, masking (causal, padding, sliding window).
- Framework (PyTorch, HF transformers, JAX) and whether training or inference.

### Output Artifact
Configuration/code to enable the fastest exact attention path + verification steps. No file unless requested.

### Response Format
```
Path: {SDPA flash backend|flash-attn FA2|FA3|FA4|cuDNN|memory-efficient}
Requirements met: dtype={fp16/bf16} head_dim={d} mask={...}
Change: {code/config}
Verify: {profiler kernel name / benchmark}
```

### Completion Criteria
- [ ] Confirmed the flash kernel actually runs (profiler trace or forced backend), not a silent fallback.
- [ ] Numerical parity checked against a reference attention on small inputs.
- [ ] Padding handled with varlen/packed sequences rather than dense masks where possible.
Read the full skill on GitHub

Details

Skill name
flash-attention
Path
skills/hardware-acceleration/flash-attention/SKILL.md
License
MIT
Repo updated
17 November 2026

FAQ

What does the Flash Attention skill do?

Use when the user asks about FlashAttention, flash_attn, SDPA, scaled_dot_product_attention backends, online softmax, FA2/FA3/FA4 or attention OOM at long context. Produces the right exact-attention path, config and a check that the flash kernel really runs. Not for KV-cache paging in serving (use paged-attention) or custom kernels (use triton-kernels).

How do I install the Flash Attention skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add j4flmao/agent-skills --skill flash-attention. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Flash Attention popular?

It lives in j4flmao/agent-skills, which has 45 GitHub stars and 6 forks.

Related skills

Agent Observability

45

j4flmao/agent-skills

Use when the user asks about agent observability, tracing agent reasoning, debugging an agent loop, OpenTelemetry GenAI spans for LLM calls, LLM cost tracking per agent, agent audit logs or hallucination/eval monitoring in production. Produces instrumentation config, trace schema, dashboards, alerts and cost attribution. Not for generic service tracing without LLMs (use devops-opentelemetry).

DevOps & Cloud

AI Agent Architectures

45

j4flmao/agent-skills

Use when the user asks to build an AI agent, design an agent that calls tools and keeps memory, write an agent system prompt or pick an agent framework (Claude Agent SDK, OpenAI Agents SDK, LangGraph). Produces an architecture brief covering loop, tools, memory, guardrails and evals, routing depth to child skills. Not for workflow patterns (use ai-agentic-workflows).

AI, LLMs & Agents

AI Agent Core Loop

45

j4flmao/agent-skills

Use when the user asks about the agent loop, ReAct vs plan-and-solve, re-planning, Reflexion, an agent stuck in a loop, max iterations or termination conditions. Produces a loop spec or patch with state, success predicate, caps and no-progress detection. Not for overall agent design (use ai-agent-architectures) or tool schemas (use tool-calling-principles).

AI, LLMs & Agents

Flask Backend

45

j4flmao/agent-skills

Use when the user asks about Flask, Flask application factory, blueprints, Flask extensions (init_app), Flask-SQLAlchemy, Alembic migrations or Flask testing. Produces modular Flask apps. Not for FastAPI (use python-fastapi-architecture) or Django (use python-django-architecture).

Software Development

Enterprise Togaf Zachman

45

j4flmao/agent-skills

Use when the user asks about TOGAF, the ADM phases, Zachman Framework, enterprise architecture frameworks, architecture building blocks or stakeholder viewpoints. Produces ADM phase plans, Zachman cell mapping and EA deliverables. Not for review boards and decision rights (use enterprise-architecture-governance) or solution design (use create-tech-spec).

Software Development

Frontend Astro Architecture

45

j4flmao/agent-skills

Use when the user asks about Astro, building a content site with Astro islands, .astro files, content collections, file-based routing, static vs server output or Astro adapters. Produces a zero-JS-by-default Astro project structure with typed content and deployment config. Not for client:* tuning, view transitions or integrations (use frontend-astro-patterns).

Software Development

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.