Article format adjustment

From aipoch/medical-research-skills · View interactive version

Article format adjustment is an AI agent skill from the GitHub repository aipoch/medical-research-skills. Adjust academic paper formatting and convert between DOCX/LaTeX/Markdown when you need to meet a journal or school template requirement.

How to use this skill

Skill file

Source: https://github.com/aipoch/medical-research-skills

Validation Shortcut

Run this minimal command first to verify the supported execution path:

python scripts/format_adjuster.py --help

When to Use

Key Features

Dependencies

Runtime

Python packages (typical)

System tools

Note: Exact package versions depend on requirements.txt in your repository.

Example Usage

1) Apply a built-in journal template (DOCX → formatted DOCX)

python scripts/init_run.py \
  --input paper.docx \
  --journal "Nature" \
  --output paper_formatted.docx

2) Apply a custom configuration (MD → formatted MD)

python scripts/init_run.py \
  --input paper.md \
  --config formats/my_journal.json \
  --output paper_adjusted.md

3) Download a journal template configuration

python scripts/init_run.py \
  --download-template "Science" \
  --output templates/science_format.json

4) Minimal end-to-end runnable Python example (module usage)

from scripts.format_converter import FormatConverter
from scripts.format_adjuster import FormatAdjuster

def run(input_file: str, config: dict, output_file: str):
    converter = FormatConverter()
    adjuster = FormatAdjuster(config)

    # 1) Normalize to Markdown as an intermediate representation
    md = converter.to_markdown(input_file)

    # 2) Apply formatting rules
    formatted_md = adjuster.apply_format(md, config)

    # 3) Validate against the same rules
    ok = adjuster.validate_format(formatted_md, config)
    if not ok:
        raise RuntimeError("Validation failed: output does not meet the configured requirements.")

    # 4) Convert back to the desired output format inferred from output_file
    converter.from_markdown(formatted_md, output_file)

if __name__ == "__main__":
    config = {
        "font": {"body": "Times New Roman", "body_size": 10},
        "spacing": {"line_space": "single", "paragraph_space": 6, "indent": 0.5},
        "margins": {"top": 2.54, "bottom": 2.54, "left": 2.54, "right": 2.54},
        "references": {"style": "Nature", "format": "numbered"},
        "figures": {"caption_position": "below", "font_size": 9},
        "tables": {"caption_position": "above", "font_size": 9, "borders": True},
    }
    run("paper.docx", config, "paper_formatted.docx")

Implementation Details

Processing pipeline

  1. Detect input format (.docx / .md / .tex)
  2. Convert to Markdown as a unified intermediate representation
  3. Apply formatting rules from a selected journal template or custom config
  4. Validate the formatted result against the config
  5. Convert to target format (DOCX/MD/TEX)

Core modules (typical responsibilities)

Configuration schema (key parameters)

A configuration file (JSON/YAML) typically includes:

CLI parameters (behavior)

When Not to Use

Required Inputs

Recommended Workflow

  1. Validate the request against the skill boundary and confirm all required inputs are present.
  2. Select the documented execution path and prefer the simplest supported command or procedure.
  3. Produce the expected output using the documented file format, schema, or narrative structure.
  4. Run a final validation pass for completeness, consistency, and safety before returning the result.

Output Contract

Validation and Safety Rules

Failure Handling

Quick Validation

Run this minimal verification path before full execution when possible:

python scripts/format_adjuster.py --help

Expected output format:

Result file: article_format_adjustment_result.md
Validation summary: PASS/FAIL with brief notes
Assumptions: explicit list if any

Deterministic Output Rules

Completion Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.