home / skills / bdambrosio / cognitive_workbench / format-citation

format-citation skill

/src/tools/format-citation

This skill formats academic citations from semantic-scholar notes or collections into BibTeX entries, preserving metadata and generating reusable references.

npx playbooks add skill bdambrosio/cognitive_workbench --skill format-citation

Review the files below or copy the command above to add this skill to your agents.

Files (2)
Skill.md
1.3 KB
---
name: format-citation
type: python
description: "Format paper citations from semantic-scholar Notes/Collections to BibTeX format"
---

# format-citation

Format academic paper citations from semantic-scholar Notes or Collections to BibTeX citation format.

## Input

- `target`: Collection ID, Note ID, or variable containing paper metadata
- `format`: Citation format (default: "bibtex"). Currently supports: "bibtex"

## Output

Success (`status: "success"`):
- `resource_id`: Collection ID (if input was Collection) or Note ID (if input was Note) containing formatted BibTeX citations
- Each output Note contains:
  - `text`: Formatted BibTeX citation string
  - `format`: "citation"
  - `metadata`: Original metadata preserved (if available)

## Behavior

- Processes all Notes in Collection, continuing even if individual Notes fail
- Extracts paper metadata (title, authors, year, venue, DOI) from Note content
- Formats as BibTeX entry with appropriate entry type (@article, @inproceedings, etc.)
- Creates new Notes with formatted citations, preserving original Notes
- Handles missing fields gracefully (omits unavailable fields)

## Examples

```json
{"type":"semantic-scholar","value":"transformer architecture","out":"$papers"}
{"type":"format-citation","target":"$papers","format":"bibtex","out":"$bibtex"}
```

Overview

This skill formats academic paper citations taken from Semantic Scholar Notes or Collections into BibTeX entries. It converts extracted metadata such as title, authors, year, venue, and DOI into appropriate BibTeX entry types while preserving original metadata. It creates new Notes containing the formatted citation and continues processing when individual records fail.

How this skill works

The skill inspects a Collection ID, Note ID, or a variable containing paper metadata and extracts citation fields from each Note. It determines the best BibTeX entry type (for example @article or @inproceedings) and assembles a BibTeX string, omitting fields that are missing. For Collections it processes all Notes, creates new Notes with the formatted citation text and a format tag of "citation", and returns a resource ID that points to the created outputs.

When to use it

  • You need a BibTeX bibliography generated from Semantic Scholar Notes or a Collection.
  • You want a machine-readable BibTeX export for LaTeX or reference managers.
  • You have mixed or incomplete metadata and want graceful handling of missing fields.
  • You want to preserve original Notes while producing separate formatted citation entries.
  • You want batch conversion of many Notes in one operation.

Best practices

  • Pass either a Collection ID or a Note ID, or supply a variable with pre-fetched paper metadata.
  • Verify extracted author names and titles in the source Notes for best formatting results.
  • Use the default "bibtex" format unless a new output format is added later.
  • Check created Notes for special characters that may need LaTeX escaping before importing into a bibliography manager.
  • Run on small batches first to confirm entry types and field mappings if your Notes use custom templates.

Example use cases

  • Convert a search result Collection of AI papers into BibTeX entries for a LaTeX paper bibliography.
  • Turn a single Note containing a paper’s metadata into a ready-to-use @article or @inproceedings BibTeX entry.
  • Batch-process a course reading list stored as a Semantic Scholar Collection to produce a .bib file for students.
  • Preserve original annotation Notes while creating separate citation Notes for sharing or exporting.

FAQ

What citation fields are required?

The skill uses whatever metadata is available. It expects at least title and authors for meaningful entries but will omit unavailable fields without failing.

What happens if a Note has incomplete or malformed metadata?

The skill continues processing other Notes, formats what it can from the problematic Note, and creates an output Note with the partial BibTeX entry. Individual failures do not stop batch processing.