Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Retrieve protein and nucleotide sequences from NCBI databases using E-utilities. Supports direct accession lookup, CDS translation, gene+organism search, locus lookup, PubMed-linked sequences, patent protein extraction, and organism+length fallback search. Use when you need to fetch biological sequences by accession, gene name, locus tag, PubMed ID, or patent number.
.claude/skills/mkurman-ncbi-sequence-fetch/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-06 | ✗→✓ | ▲ Improved | 256% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 83% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 251% | 0% |
| case-13 | ✓→✓ | = Same ✓ | 144% | 0% |
| case-14 | ✓→✓ | = Same ✓ | 300% | 0% |
uv: Read the uv skill and follow its Setup instructions to ensureuv is installed and on PATH.
this skill directory then (1) prominently notify the user to check the terms at https://www.ncbi.nlm.nih.gov/ and https://www.ncbi.nlm.nih.gov/home/about/policies/, then (2) create the file recording the notification text and timestamp.
.env file: Make sure the .env file exists in your home directory.Create one if it does not exist.
NCBI_API_KEY (optional): Raises the NCBI rate limit from 3 to 10requests/second. The skill works without it, but a key is recommended if the user plans many queries or encounters a 429 error. The user can obtain one for free by registering at https://www.ncbi.nlm.nih.gov/account/settings/. If the variable is missing from .env, do NOT ask the user to paste it into the chat (this would leak the key into the agent's context). Instead, give the user this command — substituting ENV_FILE with the resolved literal path to the .env file:
bash printf "Enter NCBI API key (typing hidden): " && read -s key && echo && echo "NCBI_API_KEY=$key" >> "ENV_FILE" && echo "Saved."
The scripts load credentials automatically via dotenv. NEVER read, print, or inspect the .env file or its variables (e.g. no cat, grep, echo, printenv, or os.environ.get on keys). Credentials must stay out of the agent's context.
database rather than accessing the database directly. The scripts automatically enforce the required rate limit gracefully.
NCBI_API_KEY in theirenvironment, the query speed limits are automatically increased significantly.
output.
Wraps NCBI's Entrez E-utilities (efetch, esearch, elink, esummary) for retrieving protein and nucleotide sequences. Provides 10 subcommands covering the full range of sequence retrieval workflows:
fetch-protein — Direct protein accession lookup (GenPept, RefSeq)fetch-nucleotide — Direct nucleotide accession lookupcds-translate — Fetch CDS and translate to protein (3 methods)search — Free-text search of any NCBI databaseelink — Follow cross-database links (PubMed→Protein, etc.)gene-protein — Search protein by gene name + organismlocus-protein — Search protein by locus tag + organismpubmed-proteins — Find proteins linked to a PubMed articlepatent-search — Extract protein sequences from patentsorganism-length — Last-resort search by organism + exact AA lengthscripts/ncbi_fetch.py — Single script with subcommands.
All subcommands write structured JSON output. Use --output FILE to save to a file, or omit it to print to stdout. A human-readable summary is always printed to stdout.
Fetches protein FASTA from NCBI by accession (XP_, NP_, GenPept, etc.)
bashuv run scripts/ncbi_fetch.py fetch-protein XP_022033624 -o /tmp/result.json uv run scripts/ncbi_fetch.py fetch-protein NP_001234567 ABC12345.1
Fetches nucleotide FASTA from NCBI by accession.
bashuv run scripts/ncbi_fetch.py fetch-nucleotide MK034466 -o /tmp/result.json
Fetches a CDS/nucleotide accession and translates to protein sequence. Tries three approaches in order: 1. NCBI's pre-translated CDS protein (fasta_cds_aa)
finding
bashuv run scripts/ncbi_fetch.py cds-translate MK034466 -o /tmp/result.json uv run scripts/ncbi_fetch.py cds-translate HQ662330 --target-length 1043
If the accession is a genomic record (not mRNA/CDS), the tool will report is_genomic: true so you can fall back to a homology-based approach instead.
Free-text search using Entrez query syntax. Supports all NCBI databases.
bash# Search protein database uv run scripts/ncbi_fetch.py search "WRR4B[Gene Name] AND Arabidopsis[Organism]" \ --database protein --retmax 5 --fetch-sequences # Search nucleotide database uv run scripts/ncbi_fetch.py search "Rz2[Gene Name] AND Beta vulgaris[Organism]" \ --database nuccore --retmax 10 # Search with patent filter uv run scripts/ncbi_fetch.py search "disease resistance AND Solanum[Organism] AND patent[Properties]" \ --database protein --fetch-sequences # Search by sequence length uv run scripts/ncbi_fetch.py search '"Oryza sativa"[Organism] AND 1043[SLEN]' \ --database protein --fetch-sequences --retmax 50
Follow NCBI's cross-database links (e.g., PubMed article → linked proteins).
bashuv run scripts/ncbi_fetch.py elink 24896089 --dbfrom pubmed --db protein \ --fetch-sequences -o /tmp/linked.json
Searches for protein sequences by gene name and organism. Searches NCBI Protein with [Gene Name] and [Organism] qualifiers.
bashuv run scripts/ncbi_fetch.py gene-protein WRR4B --organism "Arabidopsis thaliana" uv run scripts/ncbi_fetch.py gene-protein Pikh-2 --organism "Oryza sativa" \ --target-length 1043 -o /tmp/result.json
Searches by locus tag in both NCBI Protein and Nuccore databases. Extracts CDS translations from GenBank XML when direct protein hits aren't available.
bashuv run scripts/ncbi_fetch.py locus-protein At1g56540 --organism "Arabidopsis thaliana" uv run scripts/ncbi_fetch.py locus-protein Niben101Scf02422g02015.1 \ --organism "Nicotiana benthamiana" -o /tmp/result.json
Finds protein sequences linked to a PubMed article. Searches NCBI Protein by PMID, follows elink PubMed→Protein, and extracts CDS translations from linked Nuccore records.
bashuv run scripts/ncbi_fetch.py pubmed-proteins 30692254 --identifier WRR4B uv run scripts/ncbi_fetch.py pubmed-proteins 24896089 --identifier "K2" \ -o /tmp/result.json
Two modes:
By patent number — fetches all protein sequences from a specific patent: bash uv run scripts/ncbi_fetch.py patent-search --patent-number US10123456 -o /tmp/patent.json
By keywords — searches NCBI Protein with patent[Properties] filter: bash uv run scripts/ncbi_fetch.py patent-search --keywords WRR4B Albugo --organism "Arabidopsis thaliana" -o /tmp/patent.json
> !IMPORTANT] Patent convention: In molecular biology patents, SEQ ID NO: 1 > is typically the DNA sequence and SEQ ID NO: 2 is the primary protein. Higher > SEQ ID NOs are variants or related sequences. Prefer Sequence 2 when selecting > the primary protein of interest.
Last-resort search when only organism and expected protein length are known. Uses NCBI's [SLEN] filter for exact length matching.
bashuv run scripts/ncbi_fetch.py organism-length \ --organism "Arabidopsis thaliana" --length 1048 --retmax 50 \ -o /tmp/result.json
> !NOTE] This often returns multiple candidates. Use the JSON output headers to > identify the correct protein.
When trying to find a protein sequence, follow this priority order:
fetch-protein with GenPept/RefSeq accessioncds-translate with nucleotide/CDS accessionpubmed-proteins with PMID + gene namelocus-protein with locus tag + organismgene-protein with gene name + organismpatent-search with patent number or keywordsorganism-length as last resortresults arraysequence (AA string), length, and header/metadatatarget_length)XP_ / NP_ — NCBI RefSeq proteinAAA to AZZ + digits — GenPept (translated GenBank)MK, MN, HQ, etc. + digits — GenBank nucleotideENSG, ENST, ENSP — Ensembl (use ensembl-database skill instead)Q, P, O + digits — UniProt (use uniprot-database skill instead)| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 13,892 | 6,992 | -50% | 1 | 1 | 0% | 1,806 | 2,894 | +60% | 0 | 0 | — |
case-19 | fail→fail | 12,475 | 7,577 | -39% | 1 | 1 | 0% | 2,132 | 3,026 | +42% | 0 | 0 | — |
case-02 | fail→fail | 20,233 | 6,757 | -67% | 1 | 1 | 0% | 2,504 | 2,860 | +14% | 0 | 0 | — |
case-03 | fail→fail | 5,745 | 6,835 | +19% | 1 | 1 | 0% | 224 | 2,865 | +1179% | 0 | 0 | — |
case-04 | fail→fail | 12,562 | 9,723 | -23% | 1 | 1 | 0% | 2,488 | 3,342 | +34% | 0 | 0 | — |
case-05 | fail→fail | 21,680 | 7,598 | -65% | 1 | 1 | 0% | 3,768 | 2,872 | -24% | 0 | 0 | — |
case-20 | fail→fail | 13,725 | 12,093 | -12% | 1 | 1 | 0% | 2,626 | 3,397 | +29% | 0 | 0 | — |
case-06 | fail→pass | 10,118 | 12,871 | +27% | 1 | 1 | 0% | 1,226 | 4,366 | +256% | 0 | 0 | — |
case-07 | fail→fail | 7,198 | 7,190 | -0% | 1 | 1 | 0% | 329 | 2,908 | +784% | 0 | 0 | — |
case-08 | fail→fail | 20,197 | 17,245 | -15% | 1 | 1 | 0% | 4,332 | 2,852 | -34% | 0 | 0 | — |
case-09 | fail→pass | 13,587 | 7,814 | -42% | 1 | 1 | 0% | 2,156 | 3,953 | +83% | 0 | 0 | — |
case-21 | fail→fail | 7,996 | 37,814 | +373% | 1 | 1 | 0% | 1,146 | 3,045 | +166% | 0 | 0 | — |
case-10 | fail→fail | 8,052 | 8,293 | +3% | 1 | 1 | 0% | 1,371 | 3,056 | +123% | 0 | 0 | — |
case-11 | fail→fail | 27,248 | 7,129 | -74% | 1 | 1 | 0% | 5,036 | 2,976 | -41% | 0 | 0 | — |
case-12 | fail→fail | 22,143 | 7,094 | -68% | 1 | 1 | 0% | 1,908 | 3,123 | +64% | 0 | 0 | — |
case-13 | pass→pass | 8,631 | 6,555 | -24% | 1 | 1 | 0% | 1,509 | 3,676 | +144% | 0 | 0 | — |
case-14 | pass→pass | 5,498 | 4,754 | -14% | 1 | 1 | 0% | 852 | 3,404 | +300% | 0 | 0 | — |
case-15 | fail→fail | 31,233 | 6,896 | -78% | 1 | 1 | 0% | 5,659 | 2,930 | -48% | 0 | 0 | — |
case-16 | fail→fail | 11,285 | 7,982 | -29% | 1 | 1 | 0% | 567 | 3,017 | +432% | 0 | 0 | — |
case-17 | fail→pass | 29,377 | 7,040 | -76% | 1 | 1 | 0% | 1,099 | 3,856 | +251% | 0 | 0 | — |
case-18 | fail→fail | 6,129 | 8,325 | +36% | 1 | 1 | 0% | 1,206 | 3,039 | +152% | 0 | 0 | — |
case-22 | pass→pass | 7,712 | 10,149 | +32% | 1 | 1 | 0% | 1,230 | 3,474 | +182% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 5 counted toward the lift figure. The other 17 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +14 percentage points is the difference between those two pass rates over the 5 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.