Agent skill

Coot Refinement

by pemsley in pemsley/coot

Best practices for protein structure refinement and validation in Coot.

GPL-3.0Auto-check passedResearch & Science

Install Coot Refinement

skills CLI
$ npx skills add pemsley/coot --skill coot-refinement -a claude-code

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

GitHub CLI
$ gh skill install pemsley/coot coot-refinement --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/pemsley/coot.git skills-src && mkdir -p .claude/skills && cp -r skills-src/mcp/docs/skills/refinement .claude/skills/coot-refinement && 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
coot-refinement
GitHub stars
168
Token cost
~2k tokens
SKILL.md length
568 words
Files
1
Skills in repo
11
Repo updated
First seen
Licence
GPL-3.0

At a glance

Best practices for protein structure refinement and validation in Coot.

  • Works in 4 steps: Enable immediate replacement → Set the refinement map → Refine residues (preferred method) → …
  • Residue refinement operations
  • SKILL.md covers Critical Configuration, Safe Refinement Workflow, Validation and Correlation and Common Crash Scenarios to Avoid, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Coot Refinement is an agent skill from pemsley/coot. Best practices for protein structure refinement and validation in Coot. Use when performing (1) Residue refinement operations, (2) Model building and fitting, (3) Rotamer fixing, (4) Scripted/automated refinement workflows, (5) Validation and correlation checking.

Its SKILL.md is about 2k 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 Research & Science, covering Protein structure and design. The repository describes itself as: Software for macromolecular model-building. The licence is GPL-3.0.

When your agent uses it

  • Residue refinement operations
  • Model building and fitting
  • Scripted/automated refinement workflows
  • Validation and correlation checking

Example prompts

  • “/coot-refinement”

Requirements

  • Python 3

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Enable immediate replacement
  2. Set the refinement map
  3. Refine residues (preferred method)
  4. so-called "sphere refine" is often useful because it allows movement/improvement

What it can do on your machine

Read from SKILL.md and the folder at commit 6e3c026. 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 python).

    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

Coot Refinement loads about 2k tokens when it runs. Until then it costs about 70 tokens; SKILL.md has 568 words of instructions outside code blocks.

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

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 pemsley/coot at commit 6e3c026, republished under its GPL-3.0 licence (© pemsley). 568 words, ~1,984 tokens.

Download SKILL.mdSave it as .claude/skills/coot-refinement/SKILL.md (or your agent's skills folder).
name
coot-refinement
description
Best practices for protein structure refinement and validation in Coot. Use when performing (1) Residue refinement operations, (2) Model building and fitting, (3) Rotamer fixing, (4) Scripted/automated refinement workflows, (5) Validation and correlation checking.

Coot Refinement Best Practices

This skill provides guidance for effective and safe structure refinement in Coot, based on lessons learned from crashes and workflow optimization.

Critical Configuration

Set Immediate Replacement Mode for Scripting

ALWAYS call these two before any refinement operations in scripts:

python
coot.set_refinement_immediate_replacement(1)
# Makes refinement synchronous — results are committed immediately.

coot.set_imol_refinement_map(imol_map)
# Tells Coot which map to refine against.
# CRITICAL: without this, refine_residues_py() silently fails (returns -2 with no atoms moved).
# Call once per session, or whenever the active map changes.

Why: Enables synchronous operation where refinement directly updates coordinates. Without this:

  • Refinement happens asynchronously in background threads
  • Need to call coot.set_refinement_immediate_replacement() before using refinement functions (just once is enough) which should remove the risk of threading conflicts and crashes, race conditions between refinement and rendering.

When to use: Any time you're scripting refinement operations (refine_residues_py, refine_zone, etc.)

Safe Refinement Workflow

1. Enable immediate replacement

coot.set_refinement_immediate_replacement(1)

2. Set the refinement map

coot.set_imol_refinement_map(imol_map)

3. Refine residues (preferred method)

Pass a list of residue specs: [["A", 42, ""], ["A", 43, ""], ...]

residue_specs = [["A", resno, ""] for resno in range(start_resno, end_resno + 1)] result = coot.refine_residues_py(imol, residue_specs)

4. so-called "sphere refine" is often useful because it allows movement/improvement

of residues that are close in space but distant in sequence.

central_residue_spec = ['A', 12, ''] neigbs = coot.residues_near_residue_py(imol, central_residue_spec) residue_spec = neigbs residue_specs.append(central_residue_spec) result = coot.refine_residues_py(imol, residue_specs)

Hard-Mode-Soft-Mode-Hard-Mode

Some problems are of the kind where the geometry restraints "get in the way" of the atoms moving to the correct minimum. In such cases, you can try letting the refinement "go soft" - ie.

o Mediocre Refinement o increase the map weight (weight_matrix) by a factor of 10 or so. o Refine the same residues again o Restore the previous map weight o Refine the same residues again

This can sometimes be helpful to remove bad geometry or bad fit - atom clashes in particular.

Additionally, or perhaps at the same time, you can try to reduce LJ epsilon using coot.set_refinement_lennard_jones_epsilon() by a factor of 100 or so. And then restore it and re-refine the same residues.

Zone Refinement
python
# Enable immediate replacement
coot.set_refinement_immediate_replacement(1)

# Refine zone
coot.refine_zone(
    imol,
    chain_id,
    start_resno,
    end_resno,
    ""  # alt conf
)

Validation and Correlation

Check Residue Quality
python
# Get density correlation for specific residue
correlation = coot.density_correlation_analysis_scm(imol, chain_id, resno, ins_code)
# Returns dict with 'all-atom' and 'side-chain' correlations

# Get worst residues
worst = coot.get_n_residues_with_worst_density_fit(imol, n_residues)
# Returns list of [chain_id, resno, inscode, correlation]
Correlation Targets

Good fit:

  • All-atom correlation: > 0.8
  • Side-chain correlation: > 0.8

Poor fit (needs attention):

  • All-atom correlation: < 0.5
  • Side-chain correlation: < 0.5

Common Crash Scenarios to Avoid

Threading/Rendering Conflicts

Problem: Rapid-fire refinement operations while graphics are rendering can cause memory corruption in GTK rendering pipeline.

Symptoms:

nanov2_guard_corruption_detected
gdk_gl_texture_new_from_builder
gtk_gl_area_snapshot

Solution: Use set_refinement_immediate_replacement(1) for synchronous operation

Show full SKILL.md (218 more words)Show less
Asynchronous Refinement Without Accept

Handling refine_residues_py() Return Values

refine_residues_py() returns ['', status, lights] where status is a GSL minimiser code:

  • 0 (GSL_SUCCESS): converged — done.
  • -2 (GSL_CONTINUE): not yet converged — call refine_residues_py() again (once or twice more as needed).
  • 27 (GSL_ENOPROG): no progress — stop, refinement is stuck.
python
# Correct pattern for robust refinement:
for _ in range(3):
    result = coot.refine_residues_py(imol, residue_specs)
    if result and result[1] != -2:
        break
lights = result[2] if result else []

Multi-Line Code Limitation

Coot only returns values if code is a single line:

Doesn't work:

python
x = 5
y = 10
x + y  # Won't return value

Workaround:

python
# Call 1: Define function
def calculate():
    x = 5
    y = 10
    return x + y

# Call 2: Execute function
calculate()  # Returns 15

Systematic Residue Fixing Workflow

python
# 1. Enable immediate replacement
coot.set_refinement_immediate_replacement(1)

# 2. Find worst residues
worst = coot.get_n_residues_with_worst_density_fit(0, 10)

# 3. For each poor residue:
for residue in worst:
    chain_id, resno, inscode, corr = residue

    # Build CID
    cid = f"//{chain_id}/{resno}"

    # Try rotamer fix
    coot.auto_fit_best_rotamer(cid, "", 0, 1, 1, 0.1)

    # Refine in context
    coot.refine_residues_using_atom_cid(0, cid, "SPHERE", 4000)

    # Check improvement
    new_corr = coot.density_correlation_analysis_scm(0, chain_id, resno, inscode)
    print(f"{cid}: {corr:.3f} → {new_corr['all-atom']:.3f}")

Refining with Secondary Structure Restraints

When adding residues in a known secondary structure conformation (e.g. a helix or strand), use set_secondary_structure_restraints_type() to maintain that geometry during real-space refinement. Without this, refine_residues_py() treats residues independently and the conformation can distort away from the intended geometry if the density doesn't strongly support it.

Secondary structure restraint types
  • 0 — no restraints (default)
  • 1 — alpha helix (restrains i→i+4 hydrogen bond geometry)
  • 2 — beta strand
Pattern: always bracket the refinement call
python
# Set BEFORE refinement
coot.set_secondary_structure_restraints_type(1)  # 1 = alpha helix

coot.refine_residues_py(imol, residue_specs)

# Reset AFTER refinement - critical, or all subsequent refinements
# will use helix restraints unintentionally
coot.set_secondary_structure_restraints_type(0)
Example: add and refine a 6-residue helix
python
coot.set_refinement_immediate_replacement(1)
coot.set_secondary_structure_restraints_type(1)

residue_specs = [["A", resno + i, ""] for i in range(6)]
coot.refine_residues_py(imol, residue_specs)

coot.set_secondary_structure_restraints_type(0)
Common mistake

Calling refine_residues_py() directly after building helical residues without setting the restraint type — the helix geometry will not be maintained during refinement.

Common Functions

Refinement
  • auto_fit_best_rotamer(cid, alt_conf, imol, imol_map, use_rama, rama_weight) - Fix rotamer
  • refine_residues_using_atom_cid(imol, cid, mode, radius) - Sphere/zone refinement
  • refine_zone(imol, chain, start, end, alt_conf) - Refine residue range
  • set_refinement_immediate_replacement(istate) - Enable synchronous refinement
Validation
  • density_correlation_analysis_scm(imol, chain, resno, inscode) - Get correlation
  • get_n_residues_with_worst_density_fit(imol, n) - Find problem residues
Other
  • pepflip(imol, atom_cid, alt_conf) - Flip peptide

© pemsley, GPL-3.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 mcp/docs/skills/refinement of pemsley/coot.

Open the folder on GitHubat commit 6e3c026

Compare with similar skills

Coot Refinement 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.

Coot Refinement compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Coot Refinement this skillpemsley/coot168—~2kAutomated safety check: PassGPL-3.0
Alphafold Database Fetch And Analyzegoogle-deepmind/science-skills3.2k2 repos~1.2kAutomated safety check: PassApache-2.0
Alphafoldadaptyvbio/protein-design-skills1634 repos~1.2kAutomated safety check: PassMIT
Bindcraftadaptyvbio/protein-design-skills1634 repos~1.3kAutomated safety check: PassMIT
Pymol VisualizationChatMol/ChatMol372—~1.2kAutomated safety check: PassMIT
Complexa Binder DesignNVIDIA-BioNeMo/bionemo-agent-toolkit478—~3.1kAutomated safety check: NotesApache-2.0

Similar skills

  • Alphafold Database Fetch And Analyze

    google-deepmind/science-skills

    Retrieve and analyze AlphaFold predicted structures for a protein.

    3.2k GitHub starsUsed in 2 repos~1.2k tokens
    Research & ScienceAuto-check passed
  • Alphafold

    adaptyvbio/protein-design-skills

    Validate protein designs using AlphaFold2 structure prediction.

    163 GitHub starsUsed in 4 repos~1.2k tokens
    Research & ScienceAuto-check passed
  • Bindcraft

    adaptyvbio/protein-design-skills

    End-to-end binder design using BindCraft hallucination. An agent skill from adaptyvbio/protein-design-skills.

    163 GitHub starsUsed in 4 repos~1.3k tokens
    Research & ScienceAuto-check passed
  • Pymol Visualization

    ChatMol/ChatMol

    Generate publication-quality molecular visualization images using PyMOL.

    372 GitHub stars~1.2k tokensUpdated 6 mo ago
    Research & ScienceAuto-check passed
  • Complexa Binder Design

    NVIDIA-BioNeMo/bionemo-agent-toolkit

    Run a complete protein binder design campaign with NVIDIA Proteina-Complexa: resolve a target structure and hotspots from a name/sequence/PDB, co-design binder sequence+structure with reward-guided…

    478 GitHub stars~3.1k tokensUpdated today
    Research & ScienceAuto-check: notes
  • Boltzgen

    adaptyvbio/protein-design-skills

    All-atom protein design using BoltzGen diffusion model. An agent skill from adaptyvbio/protein-design-skills.

    163 GitHub starsUsed in 4 repos~2k tokens
    Research & ScienceAuto-check passed

More from pemsley/coot

All 11 skills in this repo
  • Coot Inline Graphs

    pemsley/coot

    Create interactive inline Chart.js graphs directly in the chat from live Coot data.

    168 GitHub stars~2.8k tokensUpdated today
    Auto-check passed
  • Coot Rdkit

    pemsley/coot

    RDKit molecular manipulation and visualization within Coot's Python environment.

    168 GitHub stars~981 tokensUpdated today
    Auto-check passed
  • Coot Essential API

    pemsley/coot

    API documentation to be loaded at startup - when starting a Coot session, immediately call getfunctiondescriptions() with the functions listed in this skill.

    168 GitHub stars~4.5k tokensUpdated today
    Auto-check passed
  • Coot Figure Making

    pemsley/coot

    Best practices for creating publication-quality molecular graphics figures in Coot using user-defined colors, ribbons, and molecular representations

    168 GitHub stars~7.3k tokensUpdated today
    Auto-check passed
  • Best Practices for Model-Building Tools and Refinement. An agent skill from pemsley/coot.

    168 GitHub stars~13k tokensUpdated today
    Auto-check passed
  • Coot Validation

    pemsley/coot

    Comprehensive structure validation combining model-to-map analysis and unmodeled density detection

    168 GitHub stars~6.2k tokensUpdated today
    Auto-check passed

Questions about Coot Refinement

What does Coot Refinement do?

Best practices for protein structure refinement and validation in Coot. Coot Refinement is an agent skill from pemsley/coot. Best practices for protein structure refinement and validation in Coot.

When should I use Coot Refinement?

Coot Refinement fits situations like: residue refinement operations; model building and fitting; scripted/automated refinement workflows; validation and correlation checking.

How do I install Coot Refinement in Claude Code?

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

How do I install Coot Refinement in Codex?

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

Can I use Coot Refinement 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 pemsley/coot --skill coot-refinement -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/coot-refinement, .gemini/skills/coot-refinement, .github/skills/coot-refinement and .opencode/skills/coot-refinement in your project.

What does Coot Refinement need to run?

SKILL.md names no scripts, command-line tools or credentials: Coot Refinement is instructions for the agent only. Our summary lists: Python 3.

Does Coot Refinement 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 Coot Refinement 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 Coot Refinement use?

Coot Refinement is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Coot Refinement use?

About 2k tokens (SKILL.md is roughly 7.9k 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 Coot Refinement?

Skills that share tags, products or a category with Coot Refinement: Alphafold Database Fetch And Analyze (google-deepmind/science-skills, 3.2k stars), Alphafold (adaptyvbio/protein-design-skills, 163 stars), Bindcraft (adaptyvbio/protein-design-skills, 163 stars) and Pymol Visualization (ChatMol/ChatMol, 372 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Coot Refinement?

pemsley (a GitHub user) maintains it in pemsley/coot, which has 168 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on October 7, 2026.

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