본문으로 건너뛰기
cccskills
무료GitHub에 공개

cite-placement

Place pre-screened literature citations into a LaTeX or Word manuscript, or restyle the citations already in one. Three modes: (1) inline placement — inline \cite{}/\citet{}/\citep{} with a compiled references.bib, for author-date journals (APA, MLA, Harvard, Chicago author-date, IEEE, Vancouver); (2) footnote placement — full formatted \footnote{} or OOXML footnotes for legal and notes styles (Bluebook, OSCOLA, Chicago, APA, McGill) with Id./supra short forms; (3) restyle — convert existing footnote citations from one style to another. This skill is manual-invoke ONLY — trigger ONLY when the user explicitly runs /cite-placement or explicitly names the "cite-placement" skill. Do NOT auto-trigger on general citation, footnote, or reference requests.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구ExcelWord
설치 방법 보기

포함된 파일(44)

  • SKILL.md15.7 KB
  • README.md13.0 KB
  • references/phase-details-footnotes.md69.9 KB
  • references/phase-details-inline.md52.5 KB
  • references/styles/apa.json825 B
  • references/styles/apa.md4.4 KB
  • references/styles/bluebook.json1.0 KB
  • references/styles/bluebook.md4.2 KB
  • references/styles/chicago.json914 B
  • references/styles/chicago.md3.5 KB
  • references/styles/mcgill.json1.0 KB
  • references/styles/mcgill.md4.3 KB
  • references/styles/oscola.json875 B
  • references/styles/oscola.md4.1 KB
  • requirements-docx.txt189 B
  • scripts/core/__init__.py0 B
  • scripts/core/docx_support/__init__.py143 B
  • scripts/core/docx_support/audit_ooxml.py3.8 KB
  • scripts/core/docx_support/converter.py7.8 KB
  • scripts/core/docx_support/extract_text.py5.4 KB
  • scripts/core/docx_support/footnotes.py27.0 KB
  • scripts/core/docx_support/models.py315 B
  • scripts/core/ingest_citations.py17.8 KB
  • scripts/core/verify_citations.py29.6 KB
  • scripts/docx_restyle.py20.8 KB
  • scripts/launcher.py23.1 KB
  • scripts/merge_adjacent_footnotes.py10.3 KB
  • scripts/migrate_markers.py3.2 KB
  • scripts/reorder_crossrefs.py14.0 KB
  • scripts/short_form.py35.3 KB
  • scripts/strip_citations.py3.4 KB
  • scripts/tex_restyle.py8.7 KB
  • tests/docx-restyle-test/conftest.py835 B
  • tests/docx-restyle-test/input.docx35.6 KB
  • tests/docx-restyle-test/make_fixture.py5.5 KB
  • tests/docx-restyle-test/test_extract.py3.1 KB
  • tests/docx-restyle-test/test_insert.py2.4 KB
  • tests/test_core_ingest_verify.py9.9 KB
  • tests/test_merge_styles.py2.8 KB
  • tests/test_short_form_styles.py4.0 KB
  • tools/cite-restyle/build.bat630 B
  • tools/cite-restyle/Citation Restyle Tool.spec839 B
  • tools/cite-restyle/README-dist.txt3.8 KB
  • tools/cite-restyle/restyle_app.py16.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Citation Placement

Unified router for three citation workflows. A single Tkinter launcher collects inputs and writes run_config.json; the "pipeline" value selects one of three modes, each with its own detailed workflow document.

Modes and Routing

Modepipeline valueWhat it doesWorkflow doc
Inline placementinlinePlaces screened citations as inline \cite{} / \citet{} / \citep{} commands with a compiled references.bib. For economics, finance, and social-science journals (APA, MLA, Harvard, Chicago author-date, IEEE, Vancouver). .tex only.references/phase-details-inline.md
Footnote placementfootnotesPlaces screened citations as full formatted \footnote{} (LaTeX) or native OOXML footnotes (Word), with one-click legal/notes style selection (Bluebook, OSCOLA, Chicago notes-bib, APA 7th, McGill) and Id./supra short-form post-processing. .tex or .docx.references/phase-details-footnotes.md
RestylerestyleConverts ALL existing footnote citations (hand-written or pipeline-placed) from one style to another. No spreadsheet required. .tex or .docx.Restyle Pipeline section of references/phase-details-footnotes.md

Read the relevant workflow document at the start of each phase.

Launcher-First Protocol

When the user triggers this skill:

  1. Run the launcher with a 10-minute timeout (the user needs time to browse and configure), using the skill's known absolute directory as [skill-dir], not the current working directory:
    python "[skill-dir]/scripts/launcher.py"
    
    Call it via the Bash tool with timeout: 600000.
  2. The unified GUI presents the file fields and options for all three modes and offers three run buttons — Inline Placement, Footnote Placement, and Restyle — plus a Utilities area (Strip All Citations; Regenerate / Reorder Cross-Refs, with or without an existing registry). On any run button the launcher validates inputs and writes placement/run_config.json in the output file's parent directory, then prints machine-readable status lines to stdout.
  3. Parse the launcher's stdout:
    • LAUNCHER_STATUS: success — proceed. If missing or cancelled, stop.
    • LAUNCHER_CONFIG_PATH: <path> — the absolute path to run_config.json. Use this path for all subsequent phases. All paths inside the config are absolute; do not assume the config lives in the current working directory.
  4. Read run_config.json and route on config["pipeline"]:
    • "inline" → run the inline placement pipeline (references/phase-details-inline.md).
    • "footnotes" → run the footnote placement pipeline (references/phase-details-footnotes.md).
    • "restyle" → run the restyle pipeline (Restyle Pipeline section of references/phase-details-footnotes.md).
  5. Run the selected pipeline end-to-end without asking questions or waiting for confirmation between phases. The only pause is the Phase 4 human-in-the-loop gate in the two placement modes, and only when auto_approve is false.

run_config.json shapes

The config always lives at <output_parent>/placement/run_config.json. The "pipeline" key selects the shape:

// inline
{"pipeline": "inline", "input_format": "tex", "project_folder": "...",
 "input_tex": "...", "input_xlsx": "...", "output_tex": "...",
 "citation_style": "apa|mla|harvard|chicago_author_date|chicago_notes|ieee|vancouver",
 "replan": false, "auto_approve": false, "citation_mode": "selective|comprehensive",
 "insertion_style": "prose|simple", "verify_citations": false}

// footnotes
{"pipeline": "footnotes", "input_format": "tex|docx", "project_folder": "...",
 "input_tex": "...", "input_xlsx": "...", "output_tex": "...",
 "replan": false, "auto_approve": false,
 "citation_style": "bluebook|oscola|chicago|apa|mcgill",
 "citation_mode": "selective|comprehensive", "verify_citations": false}

// restyle
{"pipeline": "restyle", "input_format": "tex|docx", "project_folder": "...",
 "input_tex": "...", "input_xlsx": null, "output_tex": "...",
 "current_style": "...", "target_style": "..."}

Citation slots (% CITE:)

Drafts from the writing-article-plans skill mark where citations belong with typed placeholder slots, and its assemble_manuscript.py normalizes footnote-wrapped slots before handoff. A slot is a % CITE: LaTeX comment carrying a typed hint (e.g. % CITE: meta-analysis on Y). Slots are a .tex convention only — footnotes-mode .docx input has no slot support.

Core rule (both placement modes). If the input manuscript contains % CITE: slots, every slot MUST end the run either filled or explicitly reported as unfilled with a reason. Silent slot survival is a pipeline failure. Slots are author-declared citation demands, so citation_mode: "selective" governs only free placements and never skips a slot.

Three slot forms reach this skill:

  1. Bare comment — % CITE: <hint> on its own line or at the end of a line.
  2. Footnote-wrapped, two-line (\footnote{% / % CITE: <hint> / }) — the normal post-assembly form (brace-safe).
  3. Footnote-wrapped, one-line — \footnote{% CITE: <hint>}; compile-unsafe (the % comments out the closing brace). Recognize it and recommend running writing-article-plans' assemble_manuscript.py first.

% RESULT: slots belong to a different pipeline and MUST never be touched or removed. The contract lives in the phase docs: Phase 1 enumerates slots into citation_slots, Phase 3a fills each or defers it to unfilled_slots, Phase 4 reports the tally, and Phase 5 executes the replacements and runs a deterministic grep closure check. See references/phase-details-inline.md and references/phase-details-footnotes.md.

Inline Mode — Phase Overview (5 phases)

Detailed instructions: references/phase-details-inline.md.

  • Phase 1 — Manuscript Mapping. Read the .tex; produce placement/section_map.md and placement/existing_citations.json. Detect the citation package (natbib → \citet/\citep; biblatex → \textcite/\parencite; else basic \cite) and the bibliography backend (bibtex/biber). Cached unless replan is true. Read-only.
  • Phase 1.5 — Existing Citation Verification (optional). Gated on verify_citations. Flags dangling \cite{} keys, hallucinated .bib entries, and spreadsheet overlaps into placement/audit_report.json.
  • Phase 2 — Citation Ingestion. scripts/core/ingest_citations.py turns the .xlsx into citations.json + references_new.bib. Deterministic, no LLM.
  • Phase 3 — Placement Planning (3a → 3b → 3c). 3a assigns each citation to all supporting sections (multi-placement is normal); 3b spawns one general-purpose sub-agent per section to draft anchors and cite commands, keyed to insertion_style (prose default — Types 1/2/3 with sentence rewriting; simple — parenthetical-only, no rewriting); 3c consolidates into placement/placement_plan.md. Cached / incremental: with replan: false, only cite keys absent from the planned_keys header trigger new planning.
  • Phase 4 — HITL Review. Always print the plan. Pause for corrections when auto_approve is false; otherwise continue immediately.
  • Phase 5 — Execution. Copy the .tex to a versioned output, insert cites (parenthetical = insert after anchor; prose/textual = replace anchor), merge references_new.bib, ensure \bibliographystyle{}/\bibliography{} (or \addbibresource/\printbibliography for biblatex), then compile with pdflatex + bibtex/biber + two more pdflatex passes.

Footnote Mode — Phase Overview (6 phases)

Detailed instructions: references/phase-details-footnotes.md. Accepts .tex (LaTeX \footnote{}, compiled with xelatex) or .docx (native OOXML footnotes via scripts/core/docx_support/); for .docx, skip every LaTeX-specific step (no xelatex, no %CITE-PLACED, no \bibliography{}).

  • Phase 1 — Manuscript Mapping. Produce placement/section_map.md and placement/existing_footnotes.json, classifying each footnote (article/book/working_paper/case/legislation/cross_reference/discursive/mixed). Cached unless replan.
  • Phase 1.5 — Existing Citation Audit (optional). Gated on verify_citations; verification cascade (OpenAlex → CrossRef → Google Scholar) into placement/audit_report.json.
  • Phase 2 — Citation Ingestion. scripts/core/ingest_citations.py → citations.json + references_new.bib. Deterministic.
  • Phase 3 — Placement Planning (3a → 3b → 3c). Style-specific rules are read from references/styles/<citation_style>.md and injected into the 3b sub-agent prompts; every placement carries the full citation string (Phase 6 handles repeats). 3c merges same-anchor placements into single multi-citation footnotes. Cached / incremental on the planned_keys header.
  • Phase 4 — HITL Review. Pause when auto_approve is false.
  • Phase 5 — Execution. Copy the manuscript; insert each \footnote{ with an invisible %CITE-PLACED marker immediately after the opening brace; apply Phase 1.5 audit fixes; tag any pre-existing footnotes with %CITE-PLACED; run merge_adjacent_footnotes.py; then Phase 6; then xelatex (one pass, no bibtex/biber).
  • Phase 6 — Short-Form Post-Processing. short_form.py converts repeat citations to the style's short form (Id./ibid/supra/shortened title/author-date) and writes placement/footnote_registry.json for later cross-reference reordering. Runs automatically after Phase 5; compile xelatex twice to settle footnote numbers.

%CITE-PLACED marker rule

Every \footnote{} in a .tex output carries %CITE-PLACED immediately after the opening brace (a LaTeX comment pdflatex ignores, so the PDF is unchanged). The marker lets strip_citations.py cleanly remove all pipeline footnotes for a clean re-run, and it is preserved through merge and short-form rewrites.

Restyle Mode — Overview

Detailed instructions: Restyle Pipeline section of references/phase-details-footnotes.md. Converts every existing footnote citation from current_style to target_style, correcting Id./ibid/supra cross-references and symbol-footnote numbering. The .tex path spawns one sub-agent per section and finishes with merge_adjacent_footnotes.py + short_form.py; the .docx path extracts footnotes via scripts/core/docx_support/, restyles them, and writes back via replace_footnote_text. Standalone drivers: scripts/docx_restyle.py and scripts/tex_restyle.py (each takes --config placement/run_config.json). Case citations, legislation, and discursive footnotes pass through unchanged.

Utilities

The launcher's Utilities area (and the corresponding scripts) support maintenance outside a full run:

  • Strip All Citations — strip_citations.py removes every %CITE-PLACED footnote, yielding a clean manuscript for a from-scratch re-run.
  • Regenerate / Reorder Cross-Refs — reorder_crossrefs.py reverses all short forms to full citations and re-applies them with correct footnote numbering after manual footnotes shift the numbering. Uses placement/footnote_registry.json (created by Phase 6); when the registry is absent it reconstructs from the current full citations.
  • Migrate markers — migrate_markers.py retroactively adds %CITE-PLACED to footnotes in manuscripts produced before the marker convention.

Commands

[skill-dir] is the absolute path to this skill's directory. All paths shown as placement/... are relative to the output file's parent directory.

CommandPurposeInvocation
LauncherCollect inputs, write run_config.jsonpython "[skill-dir]/scripts/launcher.py" (Bash timeout: 600000)
Ingest.xlsx → citations.json + references_new.bib (deterministic)python "[skill-dir]/scripts/core/ingest_citations.py" --input citations.xlsx --output-json citations.json --output-bib references_new.bib [--existing-bib references.bib] [--min-score N]
Verify (inline)Audit existing \cite{} keys vs .bib + APIspython "[skill-dir]/scripts/core/verify_citations.py" --mode inline --citations placement/existing_citations.json --bib references.bib --output placement/audit_report.json [--spreadsheet cites.xlsx]
Verify (footnotes)Audit existing footnote citations vs APIspython "[skill-dir]/scripts/core/verify_citations.py" --mode footnotes --footnotes placement/existing_footnotes.json --output placement/audit_report.json [--spreadsheet cites.xlsx]
Merge adjacent footnotesCombine adjacent \footnote{}...\footnote{} (Phase 5 post-proc)python "[skill-dir]/scripts/merge_adjacent_footnotes.py" --input OUT.tex --output OUT.tex --style <id> --skill-dir "[skill-dir]"
Short formStyle-aware Id./supra/ibid substitution (Phase 6)python "[skill-dir]/scripts/short_form.py" --input OUT.tex --output OUT.tex --style <id> --skill-dir "[skill-dir]" [--plan-dir placement/]
Reorder cross-refsFix supra/Id. after manual footnote editspython "[skill-dir]/scripts/reorder_crossrefs.py" --input OUT.tex [--plan-dir placement/]
Strip citationsRemove all %CITE-PLACED footnotespython "[skill-dir]/scripts/strip_citations.py" input.tex [output.tex]
Migrate markersAdd %CITE-PLACED to legacy footnotespython "[skill-dir]/scripts/migrate_markers.py" input.tex [output.tex]
Restyle (.docx)Standalone restyle driverpython "[skill-dir]/scripts/docx_restyle.py" --config placement/run_config.json
Restyle (.tex)Standalone restyle driverpython "[skill-dir]/scripts/tex_restyle.py" --config placement/run_config.json

The verification report schema is unchanged from the source pipelines: inline mode reports dangling references, per-.bib-entry verification, and spreadsheet overlaps; footnotes mode reports per-citation verification status, Bluebook format issues with corrected strings, and spreadsheet overlaps.

Inline vs. Footnote Mode

The two placement modes differ in output form, compilation, and style set:

AspectInline modeFootnote mode
Citation command\cite{key}, \citep{key}, \citet{key}\footnote{Full formatted citation} (or OOXML footnote)
.bib fileEssential — compiled by LaTeX into the bibliographyVestigial record only; not compiled
Compilationpdflatex + bibtex/biberxelatex only (footnotes are self-contained)
Citation stylesAPA, MLA, Harvard, Chicago author-date, IEEE, VancouverBluebook, OSCOLA, Chicago notes-bib, APA 7th, McGill
Short forms (Id./supra)Not applicable — the bibliography style handles repeatsPhase 6 post-processing (short_form.py)
Phase count5 phases (1–5)6 phases (1–6)
Input format.tex only.tex or .docx

Chicago notes-bib and legal styles belong to footnote mode; the inline mode's chicago_notes option warns and points to footnote mode instead.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Build human adjudication / hand-labeling sheets from LLM-pipeline data without evidence truncation. Use when: (1) preparing a CSV/Excel sheet for a human to rule on cases an LLM classifier or rater panel judged, (2) a labeler reports "there is no information to label from" or cells look empty in Excel, (3) excerpt columns cluster at one exact length (e.g. all 1,500 chars — a hard truncation cap). Covers: full rating-basis recovery, Excel 32,767-char cell cap, multi-line CSV mangling, ruling dropdowns, companion text files.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kennethkhoocy/applied-micro-skills222026년 9월 5일 업데이트

N-round adversarial review pipeline for empirical research output — the chain from data to LaTeX tables to a manuscript that cites them. A Claude drafter proposes minimal diffs, a deterministic mechanical battery gates every diff from a clean state with a regression gate, a Codex reviewer files check-backed critiques, and a blind judge panel decides residual disputes. Manual-invoke ONLY: trigger when the user explicitly runs /adversarial-empirical-review or names 'adversarial-empirical-review' / 'adversarial empirical review'. Do NOT auto-trigger on generic 'review my results', 'check my tables', or manuscript-editing requests. For prose-style refinement use style-emulation instead; this skill AUDITS WHETHER THE TABLES ARE CORRECT — that each number in the tables is what the analysis code computes, reproduces from the data, and is internally consistent. It is an empirical + code review: the manuscript is read only to resolve table numbering, and prose is not examined.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kennethkhoocy/applied-micro-skills222026년 9월 5일 업데이트

Before designing, training, or auditing ANY model that replicates human-annotated labels, audit the annotation protocol's INPUT — the exact document/evidence the human labelers consulted — and give the model that same input. Use when: (1) designing a classifier/LLM extractor whose target is a hand-coded label set, (2) a label-replication model shows low recall concentrated in a label subset and the diagnosis on offer is "the label's information is not in the features", (3) reviewers propose construct splits (e.g. "designation vs record-evident"), adjudication sittings, or per-domain stop rules to explain residual disagreement with gold, (4) validating an extraction pipeline against labels transcribed from a source document. Symptom of the underlying failure: elaborate theory accumulates to explain why gold is "partially unpredictable" when the model was simply never shown the document the annotators read.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kennethkhoocy/applied-micro-skills222026년 9월 5일 업데이트

Raise real concurrency in asyncio LLM batch scorers built on the OpenAI SDK (AsyncOpenAI, including OpenAI-compatible providers like DeepSeek). Use when: (1) raising an asyncio.Semaphore above ~100 produces no throughput gain, (2) a batch pipeline saturates near 100 in-flight requests despite a larger semaphore, (3) planning a high-concurrency campaign against a provider with no hard rate limit (DeepSeek v4-flash tolerates 2000+ in flight). Root cause: AsyncOpenAI's default httpx pool caps max_connections at 100, silently bottlenecking any larger semaphore — you must pass a custom http_client with httpx.Limits sized to the semaphore.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kennethkhoocy/applied-micro-skills222026년 9월 5일 업데이트

Download the actual PDF binary from bot-gated sites (taxpolicycenter.org, urban.org, SSRN-hosted mirrors, think-tank/publisher sites) via the Wayback Machine id_ URL form. Use when: (1) curl/WebFetch of a .pdf URL returns HTML instead of a PDF even with a browser User-Agent, (2) pypdf fails with "invalid pdf header: b'<!DOC'" or "EOF marker not found" on a freshly downloaded file, (3) Firecrawl can parse the PDF to markdown but you need the original file on disk (e.g., filing a reference copy).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kennethkhoocy/applied-micro-skills222026년 9월 5일 업데이트

Complete methodology for computing publication-quality cumulative abnormal returns with proper event-study test statistics, matching the robustness of Kaspereit's eventstudy2 for Stata. Covers dateline construction, event-date mapping, estimation and event windows, thin-trading adjustment, OLS with Theil prediction error correction, abnormal return computation, CAR/CAAR/AAR accumulation, boundary contamination guards, and common tests such as Patell, BMP, Kolari-Pynnonen, generalized sign, Wilcoxon, and GRANK-T. Use when the user mentions abnormal returns, event windows, market-model regressions, CARs, CAAR, AAR, eventstudy2, thin trading, trade-to-trade returns, or event-study test statistics.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

kennethkhoocy/applied-micro-skills222026년 9월 5일 업데이트

kennethkhoocy의 스킬 모두 보기

이 스킬의 문제 신고