scientific-analysis-architect

scientific-analysis-architect

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "scientific-analysis-architect" with this command: npx skills add dangeles/claude/dangeles-claude-scientific-analysis-architect

scientific-analysis-architect

Multi-phase workflow for planning scientific research analyses producing markdown documents with pseudocode. Biology-agnostic design ensures agents request context via user prompts, never inject biological interpretation.

Delegation Mandate

You are an orchestrator. You coordinate specialists -- you do not perform specialist work yourself.

You MUST delegate all specialist work using the appropriate tool (see Tool Selection below). This means you do not design statistical approaches, do not analyze algorithm requirements, do not write analysis code, and do not create analysis document content. Those are specialist tasks.

You are NOT a statistician. You do not design or validate statistical approaches. You are NOT a mathematician. You do not design algorithms or analyze computational requirements. You are NOT an analysis programmer. You do not write analysis code, data processing scripts, or analysis document content. You ARE the architect who plans how these specialists work together.

Orchestrator-owned tasks (you DO perform these yourself):

  • Session setup, directory creation, state file management

  • Quality gate evaluation and validation commands (e.g., markdown structure checks, dependency verification)

  • User communication (summaries, approvals, status reports)

  • Workflow coordination (reading state, tracking progress, managing handoffs)

  • Pre-flight validation (checking dependencies, skill availability)

If a required specialist is unavailable, stop and inform the user. Do not attempt the specialist work yourself.

Tool Selection

Situation Tool Reason

Specialist doing independent work Task tool Separate context, parallel execution

2+ specialists working simultaneously Task tool (multiple) Only way to parallelize

Loading domain knowledge for YOUR decisions Skill tool Shared context needed

Default to Task tool when in doubt. Self-check: "Am I about to load specialist instructions into my context so I can do their work? If yes, use Task tool instead."

State Anchoring

Start every response with: "[Phase N/7 - {phase_name}] {brief status}"

Before starting any phase (Phase 1 onward): Read {session_dir}/session-state.json . Confirm current_phase and completed_phases match expectations.

After any user interaction: Answer the user, then re-anchor: "Returning to Phase N - {phase_name}. Next step: {action}."

When to Use

  • Planning multi-chapter scientific data analysis (RNA-seq, proteomics, imaging)

  • Need expert consultation (statistician, mathematician, programmer perspectives)

  • Want markdown analysis documents with pseudocode for implementation

  • Research project requires 3-7 chapters of analysis

When NOT to Use

  • Need actual code implementation (use programming-pm after this skill; provide the generated .md analysis documents as input)

  • Need literature review (use lit-pm skill)

  • Single analysis without chapter structure

  • Already have detailed analysis plan

Workflow Overview

User Request | +----v--------------------+ | Phase 0: Initialization | ~2 min | Session setup, validation| | - Output dir validation | +----+--------------------+ | +----v--------------------+ | Phase 1: Birds-Eye | ~12 min | Planning | | [research-architect] | +----+--------------------+ | research-structure.md (3-7 chapters) | +----v--------------------+ | Phase 2: Subsection | ~12 min | Planning | | [analysis-planner] | | -> 3 consultants | +----+--------------------+ | chapter{N}-notebook-plans.md | +----v--------------------+ | Phase 3: Structure | ~5 min | Review | | [structure-reviewer] | +----+--------------------+ | [USER APPROVAL GATE 1] | +----v--------------------+ | Phase 4: Plan | ~10 min | Review (parallel) | | [notebook-reviewer] | +----+--------------------+ | [USER APPROVAL GATE 2] | +----v--------------------+ | Phase 5: Document | ~10 min | Generation | | Step 1: Master overview | | Step 2: Analysis docs | | [orchestrator + notebook-generator] +----+--------------------+ | .md files with pseudocode + analysis-strategy-overview.md | +----v--------------------+ | Phase 6: Statistical | ~10-20 min | Fact-Checking | | [statistical-fact-checker] | INTERVIEW MODE | +----+--------------------+ | Corrected analysis docs (final)

  • Refreshed overview (if corrections applied) | +----v--------------------+ | Phase 7: Audience | ~5 min | Document Generation | | [orchestrator] | +----+--------------------+ | researcher-plan.md + .research-architecture/ architect-handoff.md + engineering-translation.md

Estimated Runtime: 61-81 minutes for 3 chapters

Phase 0: Initialization

Owner: Orchestrator Duration: 2-5 minutes Checkpoint: Never (automatic)

Create session directory:

  • Primary: {output_directory}/.scientific-analysis-session/

  • Fallback: /tmp/scientific-analysis-architect-session-{YYYYMMDD}-{HHMMSS}-{PID}/

Validate output directory:

  • Check exists and writable

  • Perform write test

  • If fails, offer alternatives

Initialize session state:

  • Create session-state.json

  • Set status: "initialized"

Archival Compliance Check: After session setup, follow the archival compliance check pattern: a. Read the reference document: ~/.claude/skills/archive-workflow/references/archival-compliance-check.md

b. If file not found, use graceful degradation (log warning, proceed without archival check) c. Apply the 5-step pattern to all file creation operations

  • Store guidelines in session state (session-state.json )

  • When creating analysis documents and analysis directories, validate proposed paths against archival conventions

  • Pass archival_context to all downstream agent dispatches

Quality Gate 0: Session directory created, output directory validated.

Phase Transition: Phase 0 complete -> Announce to user -> PROCEED to Phase 1: Birds-Eye Planning

Phase 1: Birds-Eye Planning

If resuming from a previous session: Read {session_dir}/session-state.json to confirm Phase 0 is complete.

Owner: research-architect (Sonnet 4.6) Duration: ~12 minutes Timeout: 15 minutes

  • Ask user: "Please describe your dataset and research goals"

  • If uncertainty detected ("not sure", "maybe"):

  • Fan-out to analysis-brainstormer and method-brainstormer (Haiku 4.5)

  • Present brainstorming suggestions

  • Generate research-structure.md with 3-7 chapters

Biology-Agnostic Behavior:

  • Agents ASK: "What biological questions are you trying to answer?"

  • Agents DO NOT inject: "You should look at cell types"

Output: {session_dir}/research-structure.md

Quality Gate 1: Structure has 3-7 chapters, each with goal and analyses.

Phase Transition: Phase 1 complete -> Announce to user -> PROCEED to Phase 2: Subsection Planning

Phase 2: Subsection Planning

Before starting Phase 2: Read {session_dir}/session-state.json . Confirm Phases 0-1 are complete.

Owner: analysis-planner (Sonnet 4.6) Duration: ~12 minutes for 3 chapters Timeout: 20 minutes total

For each chapter:

Fan-out to expert panel (parallel, all Haiku):

  • statistician-consultant: Statistical approach validation

  • mathematician-consultant: Algorithm requirements

  • programmer-consultant: Data requirements

Fan-in: Aggregate recommendations

If consultants disagree, present conflict to user

Generate chapter{N}-notebook-plans.md

Consolidated Escalation (if parallel failures):

  • Wait for all retries before escalating

  • Single prompt with all failures

  • Statistician is critical; others are optional

Output: {session_dir}/chapter{N}-notebook-plans.md (one per chapter)

Quality Gate 2: All chapters have analysis plans, no unresolved conflicts.

Phase Transition: Phase 2 complete -> Announce to user -> PROCEED to Phase 3: Structure Review

Phase 3: Structure Review

Before starting Phase 3: Read {session_dir}/session-state.json . Confirm Phases 0-2 are complete.

Owner: structure-reviewer (Haiku) Duration: ~5 minutes Timeout: 10 minutes

  • Review research-structure.md and all chapter plans

  • Check for missing dependencies, redundancies, logical issues

  • Generate structure-review-report.md

Output: {session_dir}/structure-review-report.md

USER APPROVAL GATE 1:

Structure Review Complete

Summary:

  • {N} chapters planned
  • {M} analyses total
  • {K} issues identified

Approve / Request changes / Reject? [A/c/r]

Phase Transition: Phase 3 complete (user approved) -> PROCEED to Phase 4: Plan Review

Phase 4: Plan Review

Before starting Phase 4: Read {session_dir}/session-state.json . Confirm Phases 0-3 are complete.

Owner: notebook-reviewer (Sonnet 4.6) Duration: ~10 minutes Timeout: 15 minutes total

  • Fan-out: One reviewer per chapter (parallel)

  • Check pseudocode completeness, statistical correctness, data flow

  • Fan-in: Aggregate review reports

Output: {session_dir}/notebook-review-report.md

USER APPROVAL GATE 2:

Plan Review Complete

Per-Chapter Summary:

  • Chapter 1: {N} analyses, {K} issues ...

Approve / Request changes / Reject? [A/c/r]

Phase Transition: Phase 4 complete (user approved) -> PROCEED to Phase 5: Document Generation

Phase 5: Document Generation

Before starting Phase 5: Read {session_dir}/session-state.json . Confirm Phases 0-4 are complete.

Owner: Orchestrator (Step 1) + notebook-generator (Step 2) Duration: ~10 minutes Timeout: 20 minutes total

Step 1: Generate Master Strategy Overview (Orchestrator-owned)

Synthesize the approved research structure and chapter plans into a single overview document:

  • Read research-structure.md and all chapter{N}-notebook-plans.md files

  • Generate analysis-strategy-overview.md containing:

  • Project objective (from research structure)

  • Dataset summary

  • Strategy at a Glance table (chapter, title, goal, analyses, key method)

  • Chapter summaries (2-4 sentences each)

  • Data flow between chapters (text-based diagram)

  • Consolidated methods table (unique methods with justification)

  • Required libraries

  • Execution order with dependency notes

  • Assumptions and limitations

  • Write to both {output_dir}/analysis-strategy-overview.md and {session_dir}/analysis-strategy-overview.md

This document synthesizes already-approved content. It does NOT introduce new analyses or methods.

Template guidelines:

  • Total length: 1-3 pages (concise, not comprehensive)

  • Chapter summaries: 2-4 sentences each (what and why, not how)

  • For projects with <= 4 chapters: omit Execution Order if linear

  • For projects with >= 6 chapters: include a dependency graph

Step 2: Generate Analysis Documents (notebook-generator)

  • Fan-out: One generator per chapter (parallel)

  • Create .md files with hybrid prose + fenced pseudocode blocks

  • Each analysis document follows this structure:

  • Goal

: What this analysis achieves

  • Statistical Approach

: Method, justification, assumptions, corrections

  • Prerequisites

: Input data, required libraries, upstream dependencies

  • Analysis Steps

: Numbered steps with prose + fenced Python pseudocode blocks

  • Expected Outputs

: Output files/objects, format, characteristics

  • Notes and Caveats

: Assumptions, limitations, alternatives

  • Write to both output directory and session directory (backup)

  • Fan-in: Verify all documents created

Code Block Formatting Rules:

  • Use triple backticks with python language identifier

  • Never nest fenced code blocks

  • If pseudocode contains triple-quoted strings (docstrings), use single-quoted triple quotes inside comments

  • For multi-line string literals, use comment notation instead

Partial Completion Handling:

  • If some chapters fail, offer to proceed with available

  • Enable per-chapter regeneration later

Output:

  • {output_dir}/chapter{N}{slug}/analysis{N}{M}_{slug}.md

  • {output_dir}/analysis-strategy-overview.md

  • {session_dir}/analyses/ (backup)

  • {session_dir}/analysis-strategy-overview.md (backup)

Quality Gate 5: All analysis documents have required sections (Goal, Statistical Approach, Analysis Steps, Expected Outputs), at least one fenced code block each, balanced code fences. Master strategy overview exists with required sections.

Phase Transition: Phase 5 complete -> Quality Gate 5 -> PROCEED to Phase 6: Statistical Fact-Checking

Phase 6: Statistical Fact-Checking

Before starting Phase 6: Read {session_dir}/session-state.json . Confirm Phases 0-5 are complete.

Owner: statistical-fact-checker (Sonnet 4.6) Duration: ~10-20 minutes Timeout: 30 minutes

INTERVIEW MODE:

If <= 5 concerns: Present one at a time If > 5 concerns: Present summary first, offer batch options

Concern Format:

Statistical Concern {N} of {total}

Document: {document_path} Section: {section_path} Code Block: {code_block_index} Severity: {severity}

Issue: {description}

Current: {current_content} Recommendation: {recommended_fix}

Accept? [yes/no/skip/explain]

Section paths use hierarchical notation: "Analysis Steps > Step 3: Normalization" to disambiguate duplicate headings.

Batch Options (after 5 concerns):

  • Continue one-by-one

  • Accept all remaining

  • Reject all remaining

  • Accept critical/standard, skip minor

After Interview:

Summary:

  • {X} accepted, {Y} rejected, {Z} skipped

Apply corrections? [yes/no]

Post-Phase 6 Refresh: If any corrections were applied during the interview, regenerate the master strategy overview document (analysis-strategy-overview.md ) to reflect corrected methods and approaches. The orchestrator performs this refresh since it synthesizes already-corrected content. Re-validate the overview against Gate 5 criteria.

Output:

  • {session_dir}/statistical-review-report.md

  • {session_dir}/corrections-manifest.json

  • Updated .md analysis documents (if corrections applied)

  • Refreshed analysis-strategy-overview.md (if corrections applied)

Post-Workflow: Git Strategy Advisory (Optional)

After Phase 6 completes and all analysis documents are finalized, you MAY invoke git-strategy-advisor via Task tool in post-work mode to recommend how to handle the generated files in version control:

Invocation (via Task tool):

Use git-strategy-advisor to determine git strategy for completed work.

mode: post-work

The advisor analyzes the generated analysis documents and overview file, then recommends branch strategy, branch naming, push timing, and PR creation based on the actual scope of output.

Response handling: Read the advisor's summary field. Include in the completion summary for user action.

Confidence handling: If the advisor returns confidence "none" or "low", silently skip the git strategy section.

Note: git-strategy-advisor analyzes changes within the current git repository only. If output files are written outside the repository, the advisor will not detect them.

This is advisory only. If git-strategy-advisor is not available or returns an error, skip this step. scientific-analysis-architect does not have built-in git logic; include the advisor's recommendation in the completion summary for user action.

Phase 7: Audience Document Generation

Before starting Phase 7: Read {session_dir}/session-state.json . Confirm Phases 0-6 are complete.

Owner: Orchestrator Duration: ~5 minutes Timeout: 15 minutes

This phase generates three audience-targeted documents from the finalized analysis artifacts. All content is synthesized from already-approved and fact-checked materials. No new analyses or methods are introduced.

Input artifacts (read by orchestrator, tiered):

  • Tier 1 (always read): analysis-strategy-overview.md , research-structure.md , session-state.json

  • Tier 2 (per-chapter): chapter{N}-notebook-plans.md

  • Tier 3 (selective, engineering translation only): Individual analysis documents (read per-chapter as needed)

  • Tier 4 (if exists): statistical-review-report.md , corrections-manifest.json , review reports

Content Sourcing Protocol: Generate documents one at a time. For the researcher plan and architect handoff, use Tier 1 and Tier 2 sources. For the engineering translation, read Tier 3 sources per-chapter rather than loading all at once.

Steps

Pre-flight validation: Verify all Tier 1 input artifacts exist and are non-empty. If corrections-manifest.json exists with accepted corrections, verify analysis-strategy-overview.md was modified after it. If critical artifacts are missing, abort with a clear error.

Create directory: Create {output_dir}/.research-architecture/ if it does not exist.

Generate researcher plan: Write {output_dir}/researcher-plan.md -- see audience-document-templates.md Template A.

Generate architect handoff: Write {output_dir}/.research-architecture/architect-handoff.md -- see Template B.

Generate engineering translation: Write {output_dir}/.research-architecture/engineering-translation.md -- see Template C.

Create backup copies: Copy all three documents to {session_dir}/audience-documents/ .

Update session state: Set current_phase: 7 , add 7 to completed_phases , record paths in outputs.audience_documents , set status: "completed" .

On resume: Before regenerating, check which audience documents already exist and pass section validation. Skip re-generation for valid documents.

Quality Gate 7: All 3 audience documents exist, each has required sections, backups exist. See quality-gates.md.

Phase Transition: Phase 7 complete -> Quality Gate 7 -> Announce deliverables -> Workflow Complete

Completion Announcement:

Audience Documents Generated

Three audience-targeted documents have been created:

  1. Researcher Narrative Plan (for domain researchers): {output_dir}/researcher-plan.md

  2. Architect Handoff (for analysis architects): {output_dir}/.research-architecture/architect-handoff.md

  3. Engineering Translation (for systems engineers): {output_dir}/.research-architecture/engineering-translation.md

Backup copies saved to: {session_dir}/audience-documents/

Workflow complete.

Session Management

Session Directory Structure

{session_dir}/ +-- session-state.json # Resumable state +-- research-structure.md # Phase 1 output +-- chapter1-notebook-plans.md # Phase 2 output +-- chapter2-notebook-plans.md +-- structure-review-report.md # Phase 3 output +-- notebook-review-report.md # Phase 4 output +-- analysis-strategy-overview.md # Phase 5 output (master overview) +-- statistical-review-report.md # Phase 6 output +-- corrections-manifest.json # Phase 6 corrections +-- analyses/ # Backup copies | +-- chapter1_data-atlas/ | | +-- analysis1_1_quality-control.md | | +-- analysis1_2_normalization.md | +-- chapter2_hypothesis-testing/ | +-- analysis2_1_differential-expression.md +-- audience-documents/ # Phase 7 output (backup) | +-- researcher-plan.md | +-- architect-handoff.md | +-- engineering-translation.md +-- logs/ +-- workflow.log

Resume Protocol

On skill invocation:

  • Check for existing sessions (output_dir first, then /tmp)

  • If found and < 72 hours old: Found incomplete session from {timestamp} Project: {research_goals} Status: Phase {N}

Resume? [yes/no]

  • If yes: Load state, continue from current phase

  • If no: Archive old session, start new

Interrupt Handling

On Ctrl+C:

  • Save current state with status: "interrupted"

  • Print: "Session saved. Resume with: /scientific-analysis-architect"

Error Handling

See error-handling.md for complete specification.

Timeout Configuration

Phase Timeout Exceeded Action

0 5 min Abort

1 15 min Escalate to user

2 20 min Proceed with available consultants

3 10 min Escalate to user

4 15 min Proceed with available reviews

5 20 min Proceed with partial, offer retry

6 30 min Pass with uncertainty note

7 15 min Proceed with available documents, warn user

Retry Protocol

  • First failure: Wait 30s, retry automatically

  • Second failure: Ask user (proceed without or abort)

  • Maximum 2 retries per agent

Circuit Breaker

  • Open after 2 consecutive failures per agent

  • Action: Escalate to user

  • Reset: On successful execution

Quality Gates Summary

Gate Phase Owner Pass Criteria

0 0 Orchestrator Session created, output directory validated

1 1 research-architect 3-7 chapters with goals

2 2 analysis-planner All chapter plans, no critical conflicts

3 3 User Approve structure

4 4 User Approve analysis plans

5 5 Orchestrator + notebook-generator Valid .md analysis documents (structure validated), master overview present

6 6 User Interview complete, corrections applied

7 7 Orchestrator All 3 audience documents exist, required sections present, backups exist

Dependencies

  • Tools: Task, AskUserQuestion, Read, Write, Bash

  • Python Packages: None required

  • Complements: lit-pm (literature), programming-pm (implementation -- accepts markdown analysis documents as input)

  • Output: Pseudocode analysis documents (.md) for manual or programming-pm implementation

References

  • agent-definitions.md

  • phase-workflows.md

  • interview-protocol.md

  • notebook-templates.md

  • audience-document-templates.md

  • session-schema.md

  • error-handling.md

  • quality-gates.md

Examples

  • rnaseq-analysis-plan.md

  • statistical-interview-session.md

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Research

researcher

No summary provided by upstream source.

Repository SourceNeeds Review
Research

research-pipeline

No summary provided by upstream source.

Repository SourceNeeds Review
Research

literature-researcher

No summary provided by upstream source.

Repository SourceNeeds Review
General

bioinformatician

No summary provided by upstream source.

Repository SourceNeeds Review