Skip to content

xinetzone/SpecWeave / .agents/skills/doc-page

Doc Page

Verified

Create polished printable document pages for reports, forms, schedules, resumes, memos, and records, with clean A4 layout and optional PDF or DOCX export when needed.

assets/paged-report-template.html

View on GitHub
<!-- Generated by Trae Work -->
<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{{REPORT_TITLE}}</title>
  <style>
    :root {
      --ink: #252525;
      --muted: #666;
      --paper: #fff;
      --bg: #eeeeee;
      --accent: #17227d;
      --accent-2: #4267a5;
      --accent-3: #8b5e34;
      --table-head: var(--accent);
      --rule: #b7bce8;
      --line: #d8d8d8;
      --soft: #f5f5f7;
      --callout-bg: #f6f7fc;
      --chart-1: #17227d;
      --chart-2: #4f78b6;
      --chart-3: #7a9cc6;
      --chart-4: #9b6b43;
      --chart-5: #6f7d3c;
      --chart-6: #7b6f8f;
      --blue: var(--accent);
      --page-w: 210mm;
      --page-h: 297mm;
      --page-pad-top: 23mm;
      --page-pad-x: 24mm;
      --page-pad-bottom: 20mm;
      --content-w: calc(var(--page-w) - var(--page-pad-x) * 2);
      --content-h: calc(var(--page-h) - var(--page-pad-top) - var(--page-pad-bottom));
      --column-gap: 36px;
    }

    body[data-theme="life-science"] {
      --accent: #0072b2;
      --accent-2: #009e73;
      --accent-3: #e69f00;
      --table-head: #00669f;
      --rule: #b7d7d0;
      --soft: #f3f8f6;
      --callout-bg: #f1f8f5;
      --chart-1: #0072b2;
      --chart-2: #009e73;
      --chart-3: #e69f00;
      --chart-4: #cc79a7;
      --chart-5: #56b4e9;
      --chart-6: #d55e00;
    }

    body[data-theme="earth-science"] {
      --accent: #244f5f;
      --accent-2: #4f7f6f;
      --accent-3: #b48a2c;
      --table-head: #244f5f;
      --rule: #b8c9c7;
      --soft: #f3f6f2;
      --callout-bg: #f2f6f4;
      --chart-1: #244f5f;
      --chart-2: #4f7f6f;
      --chart-3: #8aa07a;
      --chart-4: #c2a35a;
      --chart-5: #7c6b5a;
      --chart-6: #5f6f8f;
    }

    body[data-theme="clinical"] {
      --accent: #245a7a;
      --accent-2: #4f7f9f;
      --accent-3: #b04a4a;
      --table-head: #245a7a;
      --rule: #b7cad5;
      --soft: #f3f7f9;
      --callout-bg: #f2f7fa;
      --chart-1: #245a7a;
      --chart-2: #6f9fbd;
      --chart-3: #94b8c9;
      --chart-4: #b04a4a;
      --chart-5: #d28b7c;
      --chart-6: #7c6f9f;
    }

    body[data-theme="social-policy"] {
      --accent: #2f4b7c;
      --accent-2: #4b7a9f;
      --accent-3: #a64b4b;
      --table-head: #2f4b7c;
      --rule: #bac7d8;
      --soft: #f5f7fa;
      --callout-bg: #f4f7fb;
      --chart-1: #2f4b7c;
      --chart-2: #6c8fb3;
      --chart-3: #b7c7d8;
      --chart-4: #c9b16d;
      --chart-5: #a64b4b;
      --chart-6: #7f6a93;
    }

    body[data-theme="engineering"] {
      --accent: #264653;
      --accent-2: #2a9d8f;
      --accent-3: #e9c46a;
      --table-head: #264653;
      --rule: #b8c9c8;
      --soft: #f3f7f7;
      --callout-bg: #f2f8f7;
      --chart-1: #264653;
      --chart-2: #2a9d8f;
      --chart-3: #3a86a8;
      --chart-4: #83b97f;
      --chart-5: #e9c46a;
      --chart-6: #b56576;
    }

    body[data-theme="humanities"] {
      --accent: #4a2f35;
      --accent-2: #7a5c4f;
      --accent-3: #9a5b45;
      --table-head: #4a2f35;
      --rule: #d0c0b7;
      --soft: #f8f6f4;
      --callout-bg: #f8f5f2;
      --chart-1: #4a2f35;
      --chart-2: #7a5c4f;
      --chart-3: #9a5b45;
      --chart-4: #5f6f52;
      --chart-5: #6d7188;
      --chart-6: #b08a5a;
    }

    * { box-sizing: border-box; }
    html, body {
      margin: 0;
      background: var(--bg);
      color: var(--ink);
      font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
      font-size: 10.5pt;
      line-height: 1.72;
    }
    body { padding: 14px 0 18px; overflow-x: hidden; }
    #source {
      position: fixed;
      left: -99999px;
      top: 0;
      width: var(--content-w);
      visibility: hidden;
      pointer-events: none;
    }
    #cover-source {
      position: fixed;
      left: -99999px;
      top: 0;
      width: var(--page-w);
      height: var(--page-h);
      visibility: hidden;
      pointer-events: none;
    }
    #pages {
      counter-reset: source-item;
      display: grid;
      grid-template-columns: repeat(var(--page-columns, 1), max-content);
      justify-content: center;
      align-items: start;
      gap: 14px 18px;
      padding: 0 12px;
    }
    .viewer-tools {
      position: fixed;
      top: 10px;
      left: 50%;
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      width: max-content;
      margin: 0;
      padding: 3px;
      background: rgba(255, 255, 255, .9);
      border: 1px solid #d7dce5;
      border-radius: 5px;
      box-shadow: 0 4px 14px rgba(0, 0, 0, .1);
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      opacity: 0;
      pointer-events: none;
      transform: translateX(-50%) translateY(-8px);
      transition: opacity .16s ease, transform .16s ease;
    }
    .viewer-tools.is-visible {
      opacity: 1;
      pointer-events: auto;
      transform: translateX(-50%) translateY(0);
    }
    .viewer-tools button {
      width: 22px;
      height: 22px;
      padding: 0;
      border: 1px solid #c6cfdd;
      border-radius: 4px;
      background: #fff;
      color: var(--accent);
      font-size: 14px;
      line-height: 1;
      cursor: pointer;
    }
    .viewer-tools button:hover { background: var(--soft); }
    .viewer-tools output {
      min-width: 38px;
      color: #303846;
      font-size: 11px;
      text-align: center;
      font-variant-numeric: tabular-nums;
    }
    .page-frame { width: var(--page-w); height: var(--page-h); margin: 0; }
    .page {
      width: var(--page-w);
      height: var(--page-h);
      margin: 0;
      padding: var(--page-pad-top) var(--page-pad-x) var(--page-pad-bottom);
      background: var(--paper);
      border: 1px solid #dedede;
      box-shadow: 0 1px 1px rgba(0,0,0,.05), 0 10px 34px rgba(0,0,0,.14);
      position: relative;
      overflow: hidden;
      transform: scale(var(--page-scale, 1));
      transform-origin: top left;
    }
    .cover-frame .page {
      padding: 0;
    }
    .cover-page {
      width: var(--page-w);
      height: var(--page-h);
      overflow: hidden;
      background: var(--paper);
      color: var(--ink);
    }
    .cover-page.cover-visual {
      display: grid;
      grid-template-rows: 1fr auto;
    }
    .cover-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .cover-title-panel {
      padding: 20mm 24mm 22mm;
      border-top: 5mm solid var(--accent);
      background: var(--paper);
    }
    .cover-kicker {
      margin: 0 0 4mm;
      color: var(--accent-2);
      font-size: 9pt;
      font-weight: 700;
    }
    .cover-title {
      margin: 0 0 5mm;
      color: var(--accent);
      font-size: 30pt;
      line-height: 1.18;
    }
    .cover-subtitle {
      margin: 0 0 8mm;
      max-width: 142mm;
      color: #444;
      font-size: 13pt;
      line-height: 1.5;
      text-align: left;
    }
    .cover-meta {
      color: var(--muted);
      font-size: 9.5pt;
      line-height: 1.6;
    }
    .page-content {
      width: var(--content-w);
      height: var(--content-h);
      overflow: hidden;
    }
    .folio {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 9mm;
      color: #888;
      font-size: 9pt;
      text-align: center;
    }
    .doc-flow {
      width: var(--content-w);
      background: var(--paper);
      counter-reset: source-item;
    }
    .column-flow {
      height: var(--content-h);
      column-width: var(--content-w);
      column-gap: var(--column-gap);
      column-fill: auto;
    }
    .measure-flow {
      position: fixed;
      left: -99999px;
      top: 0;
      visibility: hidden;
      pointer-events: none;
    }
    .page-slice {
      transform: translateX(calc(var(--slice-index) * -1 * (var(--content-w) + var(--column-gap))));
      transform-origin: top left;
    }
    h1, h2, h3 {
      color: var(--blue);
      line-height: 1.28;
      margin: 0;
      font-weight: 700;
      letter-spacing: 0;
    }
    h1 { font-size: 23pt; margin: 1mm 0 2.5mm; }
    h2 { font-size: 16pt; padding-bottom: 4pt; border-bottom: 1px solid var(--rule); margin: 9mm 0 6mm; }
    h3 { font-size: 12.5pt; margin: 7mm 0 3mm; }
    .doc-flow > .flow-block:first-child h2,
    .doc-flow > .flow-block:first-child h3 { margin-top: 0; }
    p { margin: 0 0 4.5mm; text-align: justify; text-justify: inter-ideograph; }
    ul, ol { margin: 2mm 0 5mm 0; padding-left: 16pt; }
    li { margin: 0 0 2.5mm; }
    table { width: 100%; border-collapse: collapse; margin: 4mm 0 5mm; font-size: 9.3pt; line-height: 1.55; break-inside: auto; page-break-inside: auto; }
    thead { display: table-header-group; }
    tfoot { display: table-footer-group; }
    tr { break-inside: avoid; page-break-inside: avoid; }
    th { background: var(--table-head); color: #fff; text-align: left; font-weight: 700; padding: 3.1mm 2.6mm; }
    td { padding: 2.8mm 2.6mm; vertical-align: top; border-bottom: 1px solid #e7e7e7; }
    tbody tr:nth-child(even) td { background: var(--soft); }
    tbody tr:last-child td { border-bottom: 1.4px solid #303030; }
    caption {
      caption-side: bottom;
      color: var(--muted);
      font-size: 8.8pt;
      padding-top: 1.5mm;
      text-align: left;
    }
    .title-block { border-top: 2px solid var(--accent-2); padding-top: 4mm; margin-bottom: 1mm; }
    .report-kicker { color: var(--accent-2); font-size: 8.8pt; font-weight: 700; margin-bottom: 1mm; }
    .title-rule { display: none; }
    .subtitle { color: var(--blue); font-size: 14pt; font-weight: 700; line-height: 1.38; margin: 0 0 3.2mm; max-width: 145mm; }
    .meta {
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      color: #444;
      display: grid;
      font-size: 9pt;
      gap: 2mm;
      grid-template-columns: 1fr 1fr;
      margin: 0;
      padding: 2.2mm 0;
      text-align: left;
    }
    .lead { font-size: 11.2pt; line-height: 1.78; }
    .callout { border-left: 3px solid var(--blue); background: var(--callout-bg); padding: 4mm 5mm; margin: 5mm 0; }
    figure { margin: 4mm 0 5mm; }
    .figure-block img {
      display: block;
      max-width: 100%;
      height: auto;
      border: 1px solid var(--line);
      background: #f7f7f7;
    }
    .figure-pair {
      align-items: stretch;
      border: 1px solid var(--line);
      display: grid;
      gap: 4mm;
      grid-template-columns: minmax(54mm, 78mm) 1fr;
      padding: 3mm;
      background: #fbfcfc;
    }
    .figure-pair img {
      width: 100%;
      height: 48mm;
      object-fit: cover;
      object-position: center center;
      border: 1px solid var(--line);
      background: #f7f7f7;
    }
    .caption, figcaption { color: var(--muted); font-size: 8.8pt; margin-top: 1.5mm; margin-bottom: 5mm; }
    .figure-pair figcaption {
      align-self: center;
      line-height: 1.52;
      margin: 0;
      text-align: left;
    }
    .figure-pair figcaption strong {
      color: var(--blue);
      display: block;
      font-size: 10pt;
      margin-bottom: 1.4mm;
    }
    .small { font-size: 9.2pt; color: var(--muted); }
    .source-item { counter-increment: source-item; color: #444; font-size: 8.8pt; line-height: 1.55; margin: 0 0 4mm; padding-left: 16pt; position: relative; }
    .source-item::before { content: counter(source-item) "."; position: absolute; left: 0; top: 0; }
    a { color: var(--blue); text-decoration: none; }

    @page { size: A4; margin: var(--page-pad-top) var(--page-pad-x) var(--page-pad-bottom); }
    @page cover { size: A4; margin: 0; }
    @media print {
      html, body { padding: 0; background: white; }
      .viewer-tools { display: none; }
      #pages { display: none !important; }
      #cover-source.has-cover {
        position: static;
        visibility: visible;
        pointer-events: auto;
        width: var(--page-w);
        height: var(--page-h);
        page: cover;
        break-after: page;
      }
      #source {
        position: static;
        visibility: visible;
        pointer-events: auto;
        width: auto;
      }
    }
  </style>
</head>
<body data-theme="{{REPORT_THEME}}">
  <section id="cover-source" aria-hidden="true">
    <div class="cover-page cover-visual">
      <!-- Add class="has-cover" to #cover-source when the document needs an unnumbered cover page. -->
      <img class="cover-image" src="{{COVER_IMAGE_SRC}}" alt="{{COVER_IMAGE_ALT}}">
      <div class="cover-title-panel">
        <p class="cover-kicker">{{REPORT_KICKER}}</p>
        <h1 class="cover-title">{{REPORT_TITLE}}</h1>
        <p class="cover-subtitle">{{REPORT_SUBTITLE}}</p>
        <div class="cover-meta">{{REPORT_META}}</div>
      </div>
    </div>
  </section>

  <main id="source" class="doc-flow" aria-hidden="true">
    <!--
      Compose this source as the document requires; this starter block only demonstrates
      the continuous #source structure used by the paginator.
    -->
    <section class="flow-block title-block">
      <h1>{{REPORT_TITLE}}</h1>
      <hr class="title-rule">
      <p class="lead">{{OPENING_PARAGRAPH}}</p>
    </section>

    <section class="flow-block">
      <h2>{{SECTION_TITLE}}</h2>
      <p>{{SECTION_BODY}}</p>
    </section>
  </main>

  <nav class="viewer-tools" aria-label="预览缩放">
    <button type="button" data-zoom="out" title="缩小" aria-label="缩小">−</button>
    <output id="zoom-value" aria-live="polite">100%</output>
    <button type="button" data-zoom="in" title="放大" aria-label="放大">+</button>
    <button type="button" data-zoom="reset" title="适合宽度" aria-label="适合宽度">↺</button>
  </nav>
  <div id="pages" aria-label="分页文档"></div>

  <script>
    (() => {
      const BASE_WIDTH = 794;
      const BASE_HEIGHT = 1123;
      const SIDE_GAP = 28;
      const MIN_SCALE = 0.58;
      const MAX_SCALE = 1.28;
      const TWO_COLUMN_SCALE = 0.74;
      const source = document.getElementById("source");
      const coverSource = document.getElementById("cover-source");
      const pages = document.getElementById("pages");
      const viewerTools = document.querySelector(".viewer-tools");
      const zoomValue = document.getElementById("zoom-value");
      let userScale = null;
      let zoomToolsTimer = 0;

      function hasCover() {
        return Boolean(coverSource?.classList.contains("has-cover") && coverSource.innerHTML.trim());
      }

      function createCover() {
        if (!hasCover()) return;
        const frame = document.createElement("div");
        frame.className = "page-frame cover-frame";
        const page = document.createElement("article");
        page.className = "page";
        page.innerHTML = coverSource.innerHTML;
        frame.appendChild(page);
        pages.appendChild(frame);
      }

      function createPage(index) {
        const frame = document.createElement("div");
        frame.className = "page-frame";
        const page = document.createElement("article");
        page.className = "page";
        const content = document.createElement("div");
        content.className = "page-content";
        const slice = document.createElement("div");
        slice.className = "doc-flow column-flow page-slice";
        slice.style.setProperty("--slice-index", index);
        slice.innerHTML = source.innerHTML;
        const folio = document.createElement("div");
        folio.className = "folio";
        folio.textContent = String(index + 1);
        content.appendChild(slice);
        page.append(content, folio);
        frame.appendChild(page);
        pages.appendChild(frame);
      }

      function createMeasure() {
        const measure = document.createElement("div");
        measure.className = "doc-flow column-flow measure-flow";
        measure.innerHTML = source.innerHTML;
        document.body.appendChild(measure);
        return measure;
      }

      function pageCountFor(measure) {
        const contentHeight = document.querySelector(".page-content")?.clientHeight || measure.clientHeight;
        const sourceHeight = source.scrollHeight;
        return Math.max(1, Math.ceil(sourceHeight / contentHeight));
      }

      function paginate() {
        pages.innerHTML = "";
        createCover();
        const measure = createMeasure();
        const count = pageCountFor(measure);
        measure.remove();
        for (let index = 0; index < count; index += 1) createPage(index);
      }

      function clamp(value, min, max) {
        return Math.min(max, Math.max(min, value));
      }

      function fitScale() {
        return Math.min(1, Math.max(MIN_SCALE, (window.innerWidth - SIDE_GAP) / BASE_WIDTH));
      }

      function pageColumns(scale) {
        const twoColumnWidth = BASE_WIDTH * scale * 2 + 18 + SIDE_GAP;
        return scale <= TWO_COLUMN_SCALE && pages.children.length > 1 && window.innerWidth >= twoColumnWidth ? 2 : 1;
      }

      function applyScale(scale) {
        document.documentElement.style.setProperty("--page-scale", scale.toFixed(4));
        document.documentElement.style.setProperty("--page-columns", pageColumns(scale));
        document.querySelectorAll(".page-frame").forEach((frame) => {
          frame.style.width = `${BASE_WIDTH * scale}px`;
          frame.style.height = `${BASE_HEIGHT * scale}px`;
        });
        zoomValue.textContent = `${Math.round(scale * 100)}%`;
      }

      function fitPages() {
        applyScale(userScale ?? fitScale());
      }

      function showZoomTools() {
        viewerTools.classList.add("is-visible");
        clearTimeout(zoomToolsTimer);
        zoomToolsTimer = setTimeout(() => {
          viewerTools.classList.remove("is-visible");
        }, 1050);
      }

      function zoomBy(delta) {
        const current = userScale ?? fitScale();
        userScale = clamp(current + delta, MIN_SCALE, MAX_SCALE);
        applyScale(userScale);
        showZoomTools();
      }

      function resetZoom() {
        userScale = null;
        fitPages();
        showZoomTools();
      }

      paginate();
      fitPages();
      window.addEventListener("resize", fitPages);
      window.addEventListener("wheel", (event) => {
        if (!event.ctrlKey && !event.metaKey) return;
        event.preventDefault();
        zoomBy(event.deltaY > 0 ? -0.04 : 0.04);
      }, { passive: false });
      window.addEventListener("keydown", (event) => {
        if (!event.ctrlKey && !event.metaKey) return;
        if (event.key === "+" || event.key === "=") {
          event.preventDefault();
          zoomBy(0.08);
        }
        if (event.key === "-" || event.key === "_") {
          event.preventDefault();
          zoomBy(-0.08);
        }
        if (event.key === "0") {
          event.preventDefault();
          resetZoom();
        }
      });
      viewerTools.addEventListener("click", (event) => {
        const action = event.target?.dataset?.zoom;
        if (action === "in") zoomBy(0.08);
        if (action === "out") zoomBy(-0.08);
        if (action === "reset") resetZoom();
        event.target?.blur?.();
      });
      window.addEventListener("beforeprint", () => {
        document.documentElement.style.setProperty("--page-scale", "1");
        document.documentElement.style.setProperty("--page-columns", "1");
        document.querySelectorAll(".page-frame").forEach((frame) => {
          frame.style.width = "";
          frame.style.height = "";
        });
      });
      window.addEventListener("afterprint", fitPages);
    })();
  </script>
</body>
</html>
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall