Primer Design

Primer Design

by:

@OpenSourceBuffGuy

📚 Education & Research

Designs and audits PCR and RT-qPCR primers with Primer3, thermodynamic checks and off-target amplification screening, keeping sequence coordinates traceable.

Skill files15 files

assets/

references/

scripts/

SKILL.md279 lines
1
---
2
name: primer-design
3
description: Designs and audits PCR and RT-qPCR primers with Primer3, explicit thermodynamic conditions, reference-based off-target amplification searches, and traceable sequence coordinates. Use for designing primer pairs, checking existing primers, exon-junction or isoform-specific assays, variant masking, cloning tails, multiplex compatibility, and interpreting Primer-BLAST results. Includes bounded local in-silico PCR and BLAST screening; distinguishes computational candidates from experimentally validated assays.
4
license: MIT
5
compatibility: Requires Python 3.11+ and primer3-py 2.3.1 for design and thermodynamics. Local exhaustive screening uses the standard library; BLAST screening additionally needs blastn and makeblastdb on PATH. Network access is needed only for installation, reference retrieval, or external Primer-BLAST.
6
metadata:
7
version: "1.1"
8
skill-author: K-Dense Inc.
9
last-reviewed: "2026-10-01"
10
---
11
12
# Primer design and specificity
13
14
Produce candidate oligos in 5-prime-to-3-prime orientation, with the exact template,
15
chemistry, intended products, and search scope behind each conclusion. Calculate
16
sequence-dependent quantities with the supplied tools. A familiar gene name, good
17
Primer3 penalty, or a single BLAST alignment cannot establish primer specificity.
18
19
## Choose the workflow
20
21
| Request | Start here |
22
| --- | --- |
23
| New genomic PCR or RT-qPCR pair | Define the assay and reference; design; assess thermodynamics; screen products. |
24
| Check an existing pair | Prepare pair TSV; assess both full oligos and annealing cores; screen with explicit intended coordinates. |
25
| Exon junction, transcript isoform, allele discrimination | Read [design-workflows.md](references/design-workflows.md); supply sequence annotation before imposing constraints. |
26
| Cloning/adaptor-tailed primers | Design annealing cores, append declared 5-prime tails, reassess full oligos, reconstruct the final product. |
27
| Multiplex panel | Enable `--multiplex` in both thermodynamics and specificity tools to assess oligo interactions and cross-pair products. |
28
| Degenerate, bisulfite, probe, or modified-base assay | Use the specialized workflow in [design-workflows.md](references/design-workflows.md); the bundled ordinary-DNA model is insufficient. |
29
30
The local tooling supports paired primers with unambiguous ACGT cores. Advanced assay
31
types have substantive design and validation guidance, but are not silently reduced
32
to ordinary PCR. This skill designs assays; expression normalization, experimental
33
diagnostic validation, and guide-RNA design are separate tasks.
34
35
## Establish the assay contract
36
37
Obtain what changes the result; use explicit provisional assumptions for an exploratory
38
design, and identify them in the report:
39
40
- **Purpose and template:** genomic DNA, cDNA, plasmid, or another defined substrate;
41
target organism, accession **with version**, assembly/transcript release, strand,
42
desired isoforms, and product-size range. Name wanted and unwanted templates.
43
- **Sequence evidence:** local FASTA plus source/retrieval date and its SHA-256 hash.
44
A locus excerpt uses local coordinates; record its mapping to the full reference.
45
Include relevant paralogs, pseudogenes, alternate contigs, transcript isoforms,
46
vector backbone, and host sequence in the appropriate screen.
47
- **Reaction conditions:** polymerase/buffer, monovalent salt, total divalent salt,
48
total dNTP, and oligo concentrations. Primer3 uses mM for salts/dNTP and nM for DNA.
49
Record the initial reaction concentration separately from Primer3's effective
50
annealing-oligo concentration parameter. Engine defaults are assumptions.
51
- **Constraints:** target interval, allowed/excluded binding regions, junctions,
52
variant exclusions and their source, fixed primers, tails, or multiplex membership.
53
Do not guess exon boundaries or silently substitute another assembly.
54
- **Definition of an acceptable result:** relevant off-target references, amplicon
55
lengths, mismatch search limits, controls, and experimental validation appropriate
56
to the assay. There is no universal thermodynamic cutoff that validates all PCRs.
57
58
Use [input-contract.md](references/input-contract.md) for file schemas and coordinate
59
examples. Copy [assay-report-template.md](assets/assay-report-template.md) into the
60
analysis directory to collect evidence. Reference retrieval may be manual or through
61
an established sequence API; preserve accession/version and verify the returned
62
sequence. The supplied scripts use local files and do not submit sequences online.
63
64
## Install and verify
65
66
Set `SKILL_DIR` to this skill's actual installed directory. Work in a separate analysis
67
directory so environments, reference databases, and results do not enter the skill.
68
69
```bash
70
uv venv --python 3.13 .venv-primer
71
uv pip install --python .venv-primer/bin/python -r "$SKILL_DIR/assets/requirements.txt"
72
.venv-primer/bin/python "$SKILL_DIR/scripts/design_primers.py" --help
73
```
74
75
Use the environment's `Scripts/python.exe` on Windows. The design/thermodynamic
76
examples target primer3-py **2.3.1**, tested with Python **3.13**. For the optional
77
BLAST engine, install NCBI BLAST+ from its official distribution and check:
78
79
```bash
80
blastn -version
81
makeblastdb -version
82
```
83
84
Local integration checks also exercise BLAST+ 2.17.0; other releases require checking
85
their output and search behavior before claiming equivalent coverage.
86
87
Read [sources.md](references/sources.md) when updating dependencies or API assumptions.
88
The scripts record engine versions and effective settings in their JSON reports.
89
90
## 1. Design candidates
91
92
For an initial functional demonstration, use the bundled synthetic sequence. It is
93
nonbiological example input, not an experimentally validated assay:
94
95
```bash
96
.venv-primer/bin/python "$SKILL_DIR/scripts/design_primers.py" \
97
--template "$SKILL_DIR/assets/demo-template.fasta" \
98
--preset qpcr --config "$SKILL_DIR/assets/qpcr-config.json" \
99
--output design.json --pairs-out pairs.tsv --expected-out expected.tsv
100
```
101
102
For actual work, substitute the reviewed target FASTA and constraints. A multi-record
103
FASTA requires `--record` with its exact ID. The `pcr` preset requests 100–1000 bp;
104
`qpcr` requests 70–200 bp. Override these starting ranges in the configuration.
105
The example overrides its range to 90–180 bp and includes a specific target interval.
106
Multiple `SEQUENCE_TARGET` intervals are alternatives: Primer3 flanks at least one.
107
To require coverage of every interval, supply one enclosing target and verify the
108
returned product; separate assays require separate design runs.
109
110
The tool:
111
112
- Passes validated `sequence_args` and `global_args` to Primer3. Unsupported or
113
misspelled tags fail rather than silently changing the task.
114
- Converts ambiguous template positions to `N` and forbids ambiguous primer bases.
115
It does not interpret lowercase sequence as a repeat mask; use explicit exclusions.
116
- Optionally imports `--mask-bed` exclusions in **the supplied template's coordinates**.
117
Use BED intervals for variant/repeat masking only after validating the reference
118
mapping; it does not infer allele frequencies or convert arbitrary VCFs.
119
- Verifies returned forward and reverse sequences against the template and checks
120
product lengths. Primer3's right-primer position is converted into a half-open
121
binding interval; the reverse primer is already in ordering orientation.
122
- Optionally appends `--forward-tail` and `--reverse-tail` to cores. The design score
123
and core Tm do not include those tails; step 2 checks complete oligos.
124
125
Inspect `engine_explanations` when no candidates are found. Change a biologically
126
justified constraint and rerun; do not silently relax all constraints or return an
127
invented sequence. Preserve previous reports when comparing parameter choices.
128
129
`expected.tsv` describes intended products **on the design template**. If screening
130
another reference, map these coordinates to its exact record IDs and orientation.
131
A cDNA product cannot be relabeled as a genomic interval across introns.
132
133
## 2. Assess thermodynamics
134
135
Use the **same chemistry as the design**. The following explicit values match the
136
bundled design defaults; replace them together when the actual conditions differ:
137
138
```bash
139
.venv-primer/bin/python "$SKILL_DIR/scripts/check_thermodynamics.py" \
140
--pairs pairs.tsv --mv-conc 50 --dv-conc 1.5 --dntp-conc 0.6 \
141
--dna-conc 50 --temp-c 37 --output thermodynamics.json
142
```
143
144
The report contains core Tm, core and full-oligo hairpins/homodimers, full-oligo
145
heterodimers, self 3-prime end stability, and both directional inter-oligo 3-prime
146
end-stability calculations. Delta-G and
147
delta-H are reported in kcal/mol; delta-S in cal/(mol K). `--temp-c` controls the
148
temperature for delta-G, **not** a recommended PCR annealing temperature.
149
150
If design used different Tm/salt models, also set `--tm-method` and
151
`--salt-corrections-method` to match; see the mapping in the input contract.
152
153
For a panel, add `--multiplex` to examine all unordered oligo combinations, including
154
forward/forward and reverse/reverse between different pairs. Distinguish a panel to
155
be combined from alternative candidates that will be tested separately.
156
157
Read [thermodynamics.md](references/thermodynamics.md) before interpreting these
158
values. Full oligos longer than 60 bases are reported as unresolved; they are never
159
silently truncated. Modified bases and degenerate mixtures require a suitable model.
160
Thermodynamic predictions support ranking and experimental planning, not a blanket
161
claim of primer quality.
162
Nonfinite Tm or a Tm at/below absolute zero is rejected as a calculation/input
163
failure; such a result must not be ranked as an ordinary low-Tm primer.
164
165
## 3. Screen amplification products
166
167
Read [specificity.md](references/specificity.md) before making a specificity claim.
168
Search each primer on both strands and pair inward-facing binding sites. A binding
169
hit alone is not an amplicon; absence of a reported hit is not proof of absence.
170
171
### Exhaustive bounded local search
172
173
```bash
174
.venv-primer/bin/python "$SKILL_DIR/scripts/screen_specificity.py" \
175
--pairs pairs.tsv --reference "$SKILL_DIR/assets/demo-template.fasta" \
176
--expected expected.tsv --engine exhaustive \
177
--min-product 40 --max-product 1000 --max-mismatches 2 \
178
--three-prime-bases 5 --max-three-prime-mismatches 0 \
179
--output specificity.json
180
```
181
182
This enumerates full-length, ungapped binding sites in a **bounded local reference**
183
and checks F/R, R/F, F/F, and R/R products for each pair. Reference ambiguity is
184
treated conservatively as unresolved sequence; it cannot establish a clean result.
185
The mismatch limits are a search model, not a validated polymerase discrimination
186
rule. Tight 3-prime thresholds can exclude amplifiable mismatched sites; broaden
187
the search when evaluating that uncertainty.
188
189
Use `--circular RECORD_ID` for a circular molecule. Wrapped products use canonical
190
start coordinates and unwrapped ends greater than the reference length; only
191
products spanning at most one molecule are considered. Caps on comparisons, hits,
192
and products prevent unbounded work; hitting a cap makes the result incomplete.
193
194
### BLAST-assisted local search
195
196
```bash
197
.venv-primer/bin/python "$SKILL_DIR/scripts/screen_specificity.py" \
198
--pairs pairs.tsv --reference "$SKILL_DIR/assets/demo-template.fasta" \
199
--expected expected.tsv --engine blast \
200
--min-product 40 --max-product 1000 --max-mismatches 2 \
201
--three-prime-bases 5 --max-three-prime-mismatches 0 \
202
--output specificity-blast.json
203
```
204
205
The script builds a temporary local BLAST database, runs short-query alignment,
206
rechecks complete primer-length candidate sites, and records commands and versions.
207
It checks configured hit limits and tool failures. BLAST discovery is heuristic:
208
successful execution and unsaturated limits do not establish exhaustive coverage.
209
The reference is loaded in memory; plan memory and search bounds for large genomes.
210
The small example verifies execution, not human-genome sensitivity or scalability.
211
212
For broader public-reference screening, follow the official NCBI Primer-BLAST
213
workflow in [specificity.md](references/specificity.md), choosing the organism,
214
database, intended templates, maximum product length, and mismatch policy deliberately.
215
Submitting a sequence sends it to NCBI; keep local-only work local. Primer-BLAST
216
is not a documented REST API implemented by these scripts.
217
218
### Interpret the result
219
220
- `potential_off_target`: inspect every unexpected product, including its orientation,
221
length, mismatch positions, and reference identity; redesign or justify its relevance.
222
- `intended_target_not_found`: resolve mapping, reference, sequence, and search problems
223
before drawing specificity conclusions.
224
- `no_expected_target`: results are a product inventory, without a target-specific
225
conclusion. Supply all intended product intervals for the assay.
226
- `incomplete`: reference uncertainty, resource limits, or failed computation leaves
227
the conclusion unresolved. Inspect the reported reason and repeat appropriately.
228
- `no_off_target_found_within_search_scope`: state the exact reference and search
229
model. Check the report's exhaustive/heuristic flags; this is not empirical validation.
230
231
For a multiplex reaction, add `--multiplex` to the specificity command as well as
232
the thermodynamics command. The specificity tool then searches every cross-pair
233
oligo combination, retaining the original oligo identities and tails. It treats
234
cross-pair products as unintended; intentionally shared-primer designs require
235
explicit standalone combinations with reviewed expected products. The
236
`--max-panel-combinations` cap defaults to 10,000 and is checked before expansion.
237
Thermodynamic `--multiplex` checks structures; specificity `--multiplex` checks
238
reference products. Both are necessary for this panel assessment.
239
240
## 4. Validate the assay and deliver evidence
241
242
Select candidates using assay purpose, coverage, specificity evidence, and chemistry,
243
not just the lowest Primer3 penalty. Preserve multiple candidates when uncertainty
244
remains. Follow [design-workflows.md](references/design-workflows.md) for the relevant
245
experimental checks: expected product identity/size, negative and no-template controls,
246
genomic contamination controls for RT-qPCR, and efficiency/dynamic-range assessment
247
when quantification is intended. A single melt peak alone does not prove identity.
248
249
Deliver the completed [report template](assets/assay-report-template.md), pair TSV,
250
design/thermodynamic/specificity JSON, and source manifest. Include:
251
252
1. Exact ordering sequences, separated annealing cores and tails, primer lengths,
253
intended product coordinates/size, and any relevant transcript/junction mapping.
254
2. Chemistry and model settings; engine versions; reference accession/release, source,
255
retrieval date, and file hashes; explicit exclusions and rationale.
256
3. Intended and potential unintended products; uncertainty from unknown bases,
257
incomplete references, heuristic searches, caps, and unsupported assay chemistry.
258
4. Experimental evidence actually obtained, outstanding validation, and the reason
259
for each recommended candidate. Label untested candidates accurately.
260
261
## Validation and limits of this implementation
262
263
The repository suite at `tests/primer-design/` exercises actual Primer3 calculations,
264
orientation and coordinate reconstruction, masking, tails, concentration handling,
265
off-target product geometry, mismatch/ambiguity behavior, failure states, and local
266
BLAST integration when its executables are installed. Synthetic fixtures establish
267
software behavior; they do not validate a biological assay or prove genome-wide recall.
268
269
Tools return 0 when their computation completes, 1 for a completed design with no
270
candidates or incomplete long-oligo thermodynamics, and 2 for invalid input or tool
271
failure. Read the JSON scientific status even after exit 0: finding an off-target is
272
a successfully completed calculation. See the input contract for screen-specific exits.
273
274
## Citing Scientific Agent Skills
275
276
If used in published work, cite the upstream methods in [sources.md](references/sources.md)
277
and [Scientific Agent Skills](https://arxiv.org/abs/2609.00065). Report the software
278
versions and assay-specific settings required to reproduce the actual analysis.
279

© K-Dense Inc. · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…