Agent skill

Fortran

by Mindrally in Mindrally/skills

Best practices for modern Fortran (2003/2008+) scientific and numerical computing, covering modules, explicit interfaces, kind parameters, memory safety, and testing.

Apache-2.0Auto-check passedTesting & QA

Install Fortran

skills CLI
$ npx skills add Mindrally/skills --skill fortran -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Mindrally/skills fortran --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Mindrally/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/fortran .claude/skills/fortran && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fortran
GitHub stars
269
Token cost
~2.3k tokens
SKILL.md length
1,052 words
Files
1
Skills in repo
34
Repo updated
First seen
Licence
Apache-2.0

At a glance

Best practices for modern Fortran (2003/2008+) scientific and numerical computing, covering modules, explicit interfaces, kind parameters, memory safety, and testing.

  • Works in 7 steps: Define shared kinds first — Create a… → Design the module — Group related… → Write procedure interfaces — Give every… → …
  • Reviewing Fortran source (.f90/.f95/.f03/.f08)
  • SKILL.md covers Workflow for Writing a Modern…, Basic Principles, Kinds and Types and Naming and Style, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Fortran is an agent skill from Mindrally/skills. Best practices for modern Fortran (2003/2008+) scientific and numerical computing, covering modules, explicit interfaces, kind parameters, memory safety, and testing. Use when writing or reviewing Fortran source (.f90/.f95/.f03/.f08), defining modules and derived types, choosing numeric kind parameters, working with allocatable arrays, setting up a Fortran build with CMake or fpm, or writing unit tests for numerical code.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with C++. The repository describes itself as: 265+ Claude Code skills for every major framework and language. Install with: npx skills add Mindrally/skills. The licence is Apache-2.0.

When your agent uses it

  • Reviewing Fortran source (.f90/.f95/.f03/.f08)
  • Defining modules and derived types
  • Choosing numeric kind parameters
  • Working with allocatable arrays

Example prompts

  • “/fortran”

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Define shared kinds first — Create a kinds_mod (or similarly named) module with iso_fortran_env or selected_real_kind/selected_int_kind…
  2. Design the module — Group related derived types and procedures into one focused module per file; declare implicit none at the top.
  3. Write procedure interfaces — Give every dummy argument an explicit intent(in), intent(out), or intent(inout); use use, only: to import…
  4. Implement with early validation — Check preconditions (array bounds, allocation state, valid ranges) at the top of each procedure and…
  5. Manage arrays explicitly — Use allocatable arrays, check allocated() before use, and deallocate when the lifetime isn't naturally scoped.
  6. Build with warnings on — Compile with -Wall -Wextra -std=f2008 (gfortran) or the equivalent, and fail CI on new warnings.
  7. Test — Write unit tests for individual procedures and integration tests for full numerical workflows, checking tolerances rather than…

What it can do on your machine

Read from SKILL.md and the folder at commit 7682ca7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are fortran).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Fortran loads about 2.3k tokens when it runs. Until then it costs about 108 tokens; SKILL.md has 1,052 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~108
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Mindrally/skills at commit 7682ca7, republished under its Apache-2.0 licence (© Mindrally). 1,052 words, ~2,346 tokens.

Download SKILL.mdSave it as .claude/skills/fortran/SKILL.md (or your agent's skills folder).
name
fortran
description
Best practices for modern Fortran (2003/2008+) scientific and numerical computing, covering modules, explicit interfaces, kind parameters, memory safety, and testing. Use when writing or reviewing Fortran source (.f90/.f95/.f03/.f08), defining modules and derived types, choosing numeric kind parameters, working with allocatable arrays, setting up a Fortran build with CMake or fpm, or writing unit tests for numerical code.
metadata.maintainer
Mindrally
metadata.source
https://github.com/Mindrally/skills

Modern Fortran Development

This skill covers writing modern, maintainable Fortran (2003/2008 and later) for scientific and numerical computing, including module organization, kind parameters, procedure design, memory safety, and testing.

Workflow for Writing a Modern Fortran Module

  1. Define shared kinds first — Create a kinds_mod (or similarly named) module with iso_fortran_env or selected_real_kind/selected_int_kind parameters used across the whole project.
  2. Design the module — Group related derived types and procedures into one focused module per file; declare implicit none at the top.
  3. Write procedure interfaces — Give every dummy argument an explicit intent(in), intent(out), or intent(inout); use use, only: to import exactly what's needed.
  4. Implement with early validation — Check preconditions (array bounds, allocation state, valid ranges) at the top of each procedure and return/stop early rather than nesting deeply.
  5. Manage arrays explicitly — Use allocatable arrays, check allocated() before use, and deallocate when the lifetime isn't naturally scoped.
  6. Build with warnings on — Compile with -Wall -Wextra -std=f2008 (gfortran) or the equivalent, and fail CI on new warnings.
  7. Test — Write unit tests for individual procedures and integration tests for full numerical workflows, checking tolerances rather than exact floating-point equality.

Basic Principles

  • Target modern Fortran standards — Fortran 2003, 2008, or newer — and avoid writing in a legacy FORTRAN 77 style just because the compiler still accepts it.
  • Put implicit none in every program unit (module, program, and — via inheritance from a module or explicit statement — every procedure) so undeclared-variable typos are caught at compile time instead of producing silent wrong answers.
  • Put procedures in modules rather than external subprograms; module procedures get automatically-generated explicit interfaces, which lets the compiler catch argument mismatches that external procedures cannot.
  • Keep modules focused on one concern and place each major module in its own file, named to match the module (e.g., module linear_solver in linear_solver.f90).
  • Prefer clear, structured code over clever language tricks — Fortran numerical code is read far more often than it's written, usually by someone other than the original author.
  • Avoid obsolete features: COMMON blocks (replace with modules), GOTO-heavy control flow (replace with structured if/do/select case, plus block where useful), and numeric statement labels used as jump targets.

Kinds and Types

  • Define numeric kind parameters in one shared module (e.g., kind_mod or precision_mod) so the whole codebase can change precision in one place.
  • Use real(kind=dp) (or the project's approved real kind) for floating-point values — never bare real or double precision, whose actual precision is compiler- and flag-dependent.
  • Use integer(kind=i4) (or the project's approved integer kind) for integers where the width matters, especially in interfaces to C or binary I/O.
  • Define constants such as pi explicitly and precisely (e.g., real(dp), parameter :: pi = 4.0_dp * atan(1.0_dp)) rather than truncated literals.
  • Include the physical units in a comment for any variable representing a physical quantity (real(dp) :: velocity ! m/s).
  • Use derived types to group related data (e.g., a particle_t type with position, velocity, and mass fields) instead of passing many loose primitive arguments through procedure calls.
Example: Kinds Module and a Numerical Procedure
fortran
module kinds_mod
  use iso_fortran_env, only: real64, int32
  implicit none
  private
  public :: dp, i4

  integer, parameter :: dp = real64
  integer, parameter :: i4 = int32
end module kinds_mod
fortran
module stats_mod
  use kinds_mod, only: dp
  implicit none
  private
  public :: mean, standard_deviation

contains

  pure function mean(x) result(m)
    real(dp), intent(in) :: x(:)
    real(dp) :: m

    m = sum(x) / real(size(x), dp)
  end function mean

  pure function standard_deviation(x) result(s)
    real(dp), intent(in) :: x(:)
    real(dp) :: s
    real(dp) :: m
    integer :: n

    n = size(x)
    if (n < 2) then
      s = 0.0_dp
      return
    end if

    m = mean(x)
    s = sqrt(sum((x - m)**2) / real(n - 1, dp))
  end function standard_deviation

end module stats_mod
fortran
program demo
  use kinds_mod, only: dp
  use stats_mod, only: mean, standard_deviation
  implicit none

  real(dp) :: samples(5)
  samples = [1.0_dp, 2.0_dp, 3.0_dp, 4.0_dp, 5.0_dp]

  print '(A, F0.4)', 'mean = ', mean(samples)
  print '(A, F0.4)', 'stddev = ', standard_deviation(samples)
end program demo

Naming and Style

  • Use lowercase for language keywords and most identifiers; Fortran is case-insensitive, so consistent lowercase avoids visual noise from mixed-case keywords.
  • Use underscores for multi-word names (particle_velocity, not particleVelocity or ParticleVelocity).
  • Avoid names that differ only by case (Count vs count) since Fortran treats them as identical, inviting confusion.
  • Use descriptive names for procedures and state (compute_residual, not cr or calc2).
  • Repeat the procedure or module name after end statements (end module kinds_mod, end subroutine compute_residual) so long units are easy to verify by eye.
  • Keep indentation consistent (2 or 4 spaces, matching the project) inside do, if, select case, and module blocks.
Show full SKILL.md (452 more words)Show less

Procedures

  • Keep subroutines and functions short and single-purpose — a procedure that computes a residual should not also write output files.
  • Use intent(in), intent(out), or intent(inout) for every dummy argument; an argument with no intent is a red flag that the interface hasn't been thought through.
  • Keep functions free of side effects whenever possible (mark them pure or elemental when they qualify) and reserve subroutines for procedures that mutate state or perform I/O.
  • Prefer early validation and clear returns (if (n <= 0) then; ...; return; end if) over deeply nested if blocks.
  • Use use, only: name1, name2 when importing from a module instead of a bare use module_name, so it's clear at the call site exactly what's being pulled in and name collisions are avoided.

Memory and Arrays

  • Prefer allocatable arrays over pointers unless pointer semantics (aliasing, linked structures) are specifically required — allocatables are automatically deallocated and safer by default.
  • Check allocated() state and array sizes (size(), lbound(), ubound()) before using an array that might not have been allocated yet.
  • Deallocate allocatable arrays explicitly when their lifetime isn't naturally scoped (e.g., held in a derived type that outlives a single procedure call); arrays local to a procedure are deallocated automatically on exit.
  • Specify array bounds clearly when they matter, especially non-default lower bounds (real(dp) :: a(0:n)).
  • Avoid unnecessary dynamic allocation inside hot loops — allocate once outside the loop and reuse the buffer, or use automatic/stack arrays for small, fixed-size temporaries.

Testing and Build

  • Use CMake, fpm (the Fortran Package Manager), Make, or whatever build system the project has standardized on — consistently, not a mix.
  • Compile with warnings enabled (gfortran -Wall -Wextra -std=f2008 -fcheck=all for development builds) and treat important warnings as CI failures.
  • Add unit tests for public procedures (a pure function like standard_deviation should have a small, fast test with known input/output) and integration tests for full numerical workflows.
  • Test boundary conditions (empty arrays, single-element arrays, zero/negative inputs), invalid inputs, and representative scientific cases drawn from the actual problem domain.
  • Verify numerical results against a tolerance (e.g., abs(actual - expected) < 1.0e-10_dp) rather than relying on exact floating-point equality, which is almost never guaranteed across compilers or optimization levels.

Common Mistakes

  • Declaring variables after executable statements without wrapping them in a block construct — Fortran requires all declarations before executable code in a given scoping unit.
  • Assuming random_number is a function; it is a subroutine (call random_number(x), not x = random_number()).
  • Writing to stdout (print, write(*,*)) from a procedure declared pure — this is not allowed and will fail to compile.
  • Declaring the same variable twice in the same scope, which is easy to miss when a module has grown large.
  • Assuming pi, dp, or other project-standard kind/constant names already exist without importing or defining them explicitly via use.

© Mindrally, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in fortran of Mindrally/skills.

Open the folder on GitHubat commit 7682ca7

Compare with similar skills

Fortran next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Fortran compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fortran this skillMindrally/skills269—~2.3kAutomated safety check: PassApache-2.0
OpenROAD Module Test AdderThe-OpenROAD-Project/OpenROAD3.2k—~1.8kAutomated safety check: PassBSD-3-Clause
Build GplatesGPlates/GPlates154—~750Automated safety check: PassCustom licence
Cpp TestGPlates/GPlates154—~696Automated safety check: PassCustom licence
Code Testing Extensionsmicrosoft/testfx1k2 repos~930Automated safety check: PassMIT
Test Smell Detectionmicrosoft/testfx1k—~5.3kAutomated safety check: PassMIT

Similar skills

  • OpenROAD Module Test Adder

    The-OpenROAD-Project/OpenROAD

    Adds integration or unit tests to an OpenROAD module: writes the Tcl test, generates golden files and registers it in both CMake and Bazel.

    3.2k GitHub stars~1.8k tokensUpdated today
    Testing & QAAuto-check passed
  • Build Gplates

    GPlates/GPlates

    Configure, build and test the GPlates desktop application. An agent skill from GPlates/GPlates.

    154 GitHub stars~750 tokensUpdated today
    Testing & QAAuto-check passed
  • Cpp Test

    GPlates/GPlates

    Conventions for adding or modifying C++ unit tests in GPlates (GoogleTest, src/unit-test/).

    154 GitHub stars~696 tokensUpdated today
    Testing & QAAuto-check passed
  • Code Testing Extensions

    microsoft/testfx

    Official

    Provides file paths to language-specific extension files for the code-testing pipeline.

    1k GitHub starsUsed in 2 repos~930 tokens
    Testing & QAAuto-check passed
  • Test Smell Detection

    microsoft/testfx

    Official

    Deep-dive audit using the full testsmells.org 19-smell academic catalog for tests in any language.

    1k GitHub stars~5.3k tokensUpdated today
    Testing & QAAuto-check passed
  • Test Case Reducer

    ArabelaTso/Skills-4-SE

    Automatically reduces bug-triggering test cases to minimal form while preserving the failure.

    253 GitHub stars~2.5k tokensUpdated 1 mo ago
    Testing & QAAuto-check passed

More from Mindrally/skills

All 34 skills in this repo
  • Analytics Data Analysis

    Mindrally/skills

    Best practices for analytics, data analysis, and visualization using Python, pandas, matplotlib, seaborn, and Jupyter notebooks.

    269 GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Best practices for AutoML and hyperparameter search with Optuna, Ray Tune, and PyCaret, covering search-space design, validation splits, and leakage prevention.

    269 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Blender Python Addon

    Mindrally/skills

    Best practices for writing Blender Python add-ons using the bpy API, covering operators, panels, properties, registration, and API-safe scripting.

    269 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • Expert guidelines for Chrome extension development with Manifest V3, covering security, performance, and best practices.

    269 GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Clean Code

    Mindrally/skills

    Clean, maintainable, human-readable code principles combined with anti-over-engineering discipline: naming, single responsibility, DRY, and scoping changes to exactly what was requested.

    269 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • Design Systems

    Mindrally/skills

    Comprehensive design system guidelines for building consistent, accessible, and scalable component libraries.

    269 GitHub stars~1.8k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Fortran

What does Fortran do?

Best practices for modern Fortran (2003/2008+) scientific and numerical computing, covering modules, explicit interfaces, kind parameters, memory safety, and testing. Fortran is an agent skill from Mindrally/skills. Best practices for modern Fortran (2003/2008+) scientific and numerical computing, covering modules, explicit interfaces, kind parameters, memory safety, and testing.

When should I use Fortran?

Fortran fits situations like: reviewing Fortran source (.f90/.f95/.f03/.f08); defining modules and derived types; choosing numeric kind parameters; working with allocatable arrays.

How do I install Fortran in Claude Code?

Run `npx skills add Mindrally/skills --skill fortran -a claude-code`. Or copy the skill folder (fortran in Mindrally/skills) into .claude/skills/fortran in your project. Claude Code loads it when a task matches its description.

How do I install Fortran in Codex?

Run `npx skills add Mindrally/skills --skill fortran -a codex`. Or copy the skill folder (fortran in Mindrally/skills) into .agents/skills/fortran in your project. Codex loads it when a task matches its description.

Can I use Fortran in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Mindrally/skills --skill fortran -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fortran, .gemini/skills/fortran, .github/skills/fortran and .opencode/skills/fortran in your project.

What does Fortran need to run?

SKILL.md names no scripts, command-line tools or credentials: Fortran is instructions for the agent only.

Does Fortran access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Fortran safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Fortran use?

Fortran is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fortran use?

About 2.3k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Fortran?

Skills that share tags, products or a category with Fortran: OpenROAD Module Test Adder (The-OpenROAD-Project/OpenROAD, 3.2k stars), Build Gplates (GPlates/GPlates, 154 stars), Cpp Test (GPlates/GPlates, 154 stars) and Code Testing Extensions (microsoft/testfx, 1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fortran?

Mindrally (a GitHub organization) maintains it in Mindrally/skills, which has 269 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on October 8, 2026.

Source: Mindrally/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.