Skip to content

Commit ca4e04d

Browse files
Claudenjzjzpre-commit-ci[bot]
authored
feat: Agent Skill (#91)
<!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Create an Agent Skill</issue_title> > <issue_description>Create an Agent Skill under the `skill` directory. The agent is encouraged to use `uvx wenxian` to run `wenxian` (`uv` needs to be installed).</issue_description> > > ## Comments on the Issue (you are @claude[agent] in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes #90 --------- Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com> Co-authored-by: njzjz <9496702+njzjz@users.noreply.github.com> Co-authored-by: Jinzhe Zeng <jinzhe.zeng@ustc.edu.cn> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 445def3 commit ca4e04d

2 files changed

Lines changed: 208 additions & 0 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ uvx wenxian from "Attention is all you need"
3838

3939
It is expected to see a ${\mathrm{B{\scriptstyle{IB}} T_{\displaystyle E} X}}$ entry printed into the standard output.
4040

41+
By default, `wenxian` outputs ${\mathrm{B{\scriptstyle{IB}} T_{\displaystyle E} X}}$ format. You can use the `-t text` or `--type text` option to generate plain text format.
42+
43+
### The Agent Skill (used in OpenClaw or IDEs)
44+
45+
`wenxian` provides an [Agent Skill](https://agentskills.io/) in the [`skill`](./skill/) directory, which has been supported by
46+
[OpenClaw](https://docs.openclaw.ai/tools/skills),
47+
[Claude](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview),
48+
[Codex](https://developers.openai.com/codex/skills/),
49+
and [VS Code](https://code.visualstudio.com/docs/copilot/customization/agent-skills).
50+
51+
For example, you can ask your OpenClaw bot to `install the skill https://github.com/njzjz/wenxian/tree/master/skill`.
52+
After that is done, you can ask the bot to generate the references by sending the bot paper titles or DOIs.
53+
4154
### Use wenxian in a GitHub Actions workflow
4255

4356
You can use `wenxian` in a GitHub Actions workflow, as a bridge between the input identifiers and the output ${\mathrm{B{\scriptstyle{IB}} T_{\displaystyle E} X}}$ entries:

skill/SKILL.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
---
2+
name: wenxian
3+
description: Generate citations from academic paper identifiers (DOI, PMID, arXiv ID, or paper titles) in various formats including BibTeX, plain text, and Markdown. Use this skill when users need to create citations, bibliography entries, or convert paper identifiers to different citation formats.
4+
license: LGPL-3.0
5+
compatibility: Requires Python 3.10+, uv package manager recommended
6+
metadata:
7+
author: njzjz
8+
version: "1.0"
9+
repository: https://github.com/njzjz/wenxian
10+
---
11+
12+
# Wenxian - Citation Generator
13+
14+
## When to use this skill
15+
16+
Use this skill when:
17+
18+
- Users need to generate citations or bibliography entries for academic papers
19+
- Users have DOI, PMID, arXiv ID, or paper titles and need citations
20+
- Users are working on LaTeX documents and need BibTeX entries
21+
- Users need plain text or Markdown formatted citations
22+
- Users mention citations, references, BibTeX, or academic papers
23+
24+
## Overview
25+
26+
Wenxian is a tool that generates citations from various academic paper identifiers in multiple formats (BibTeX, plain text, Markdown). The name "wenxian" (文献) means "literature" or "references" in Chinese.
27+
28+
## Installation and Prerequisites
29+
30+
Wenxian requires Python 3.10+. It's recommended to use `uv` package manager.
31+
32+
If `uv` is not already installed, install it with:
33+
34+
```bash
35+
pip install uv
36+
```
37+
38+
Or, if pip is not available:
39+
40+
```bash
41+
curl -LsSf https://astral.sh/uv/install.sh | sh
42+
```
43+
44+
## How to generate BibTeX entries
45+
46+
### Using DOI (Digital Object Identifier)
47+
48+
```bash
49+
uvx wenxian from 10.1063/5.0155600
50+
```
51+
52+
### Using arXiv ID
53+
54+
```bash
55+
uvx wenxian from 1512.03385
56+
```
57+
58+
### Using PMID (PubMed ID)
59+
60+
```bash
61+
uvx wenxian from 12345678
62+
```
63+
64+
### Using paper title
65+
66+
When the identifier is a text string, wenxian searches by paper title:
67+
68+
```bash
69+
uvx wenxian from "Attention is all you need"
70+
```
71+
72+
Note: Enclose paper titles in quotes if they contain spaces.
73+
74+
### Output formats
75+
76+
By default, wenxian generates BibTeX format. You can specify different output formats using the `-t` or `--type` option:
77+
78+
#### BibTeX format (default)
79+
80+
```bash
81+
uvx wenxian from 1512.03385
82+
```
83+
84+
#### Plain text format
85+
86+
Generate a plain text citation instead of BibTeX:
87+
88+
```bash
89+
uvx wenxian from 1512.03385 -t text
90+
```
91+
92+
Example output: `Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun, Deep Residual Learning for Image Recognition, arXiv, 2015, 1512.03385.`
93+
94+
#### Markdown format
95+
96+
```bash
97+
uvx wenxian from 1512.03385 -t markdown
98+
```
99+
100+
## Expected output
101+
102+
By default, the command will print a BibTeX entry to standard output. For example:
103+
104+
```bibtex
105+
@article{vaswani2017attention,
106+
title={Attention is all you need},
107+
author={Vaswani, Ashish and Shazeer, Noam and ...},
108+
journal={Advances in neural information processing systems},
109+
volume={30},
110+
year={2017}
111+
}
112+
```
113+
114+
## Common use cases
115+
116+
1. **Single citation**: Generate a BibTeX entry for one paper
117+
118+
```bash
119+
uvx wenxian from "10.1038/nature12373"
120+
```
121+
122+
2. **Multiple citations**: Generate entries for multiple papers by running the command multiple times
123+
124+
```bash
125+
uvx wenxian from "10.1038/nature12373"
126+
uvx wenxian from "10.1126/science.1158899"
127+
```
128+
129+
3. **Save to file**: Redirect output to a .bib file
130+
```bash
131+
uvx wenxian from "10.1038/nature12373" >> references.bib
132+
```
133+
134+
## Edge cases and troubleshooting
135+
136+
1. **Invalid identifier**: If the identifier is not recognized, wenxian will return an error. Verify the identifier format.
137+
138+
2. **Network issues**: Wenxian queries external APIs. Network connectivity is required.
139+
140+
3. **Paper title not found**: If searching by title doesn't return results, try:
141+
- Using a more complete or exact title
142+
- Using the DOI or arXiv ID instead
143+
- Checking for typos in the title
144+
145+
4. **Multiple results for title search**: Wenxian will return the best match. If unsure, use a specific identifier like DOI.
146+
147+
5. **Special characters in titles**: Always use quotes around paper titles, especially if they contain spaces or special characters.
148+
149+
## Supported identifier types
150+
151+
- **DOI**: Digital Object Identifier (e.g., 10.1063/5.0155600)
152+
- **arXiv ID**: arXiv preprint identifier (e.g., 1512.03385)
153+
- **PMID**: PubMed identifier (e.g., 12345678)
154+
- **Paper title**: Full or partial paper title as a string (e.g., "Attention is all you need")
155+
156+
## Supported output formats
157+
158+
- **BibTeX** (default): For LaTeX documents and reference managers
159+
- **Plain text**: Human-readable citation format
160+
- **Markdown**: For Markdown documents and wikis
161+
162+
## Integration examples
163+
164+
### In a workflow
165+
166+
When a user asks to "add a citation for DOI 10.1234/example", you should:
167+
168+
1. Run wenxian to generate the BibTeX entry:
169+
170+
```bash
171+
uvx wenxian from 10.1234/example
172+
```
173+
174+
2. Display or save the output to their bibliography file
175+
176+
3. Confirm the citation has been added
177+
178+
### Batch processing
179+
180+
For multiple citations, run wenxian for each identifier and append results:
181+
182+
```bash
183+
uvx wenxian from "10.1038/nature12373" >> references.bib
184+
uvx wenxian from "1512.03385" >> references.bib
185+
uvx wenxian from "Attention is all you need" >> references.bib
186+
```
187+
188+
## Best practices
189+
190+
1. **Prefer specific identifiers**: DOI and arXiv IDs are more reliable than title searches
191+
2. **Quote titles**: Always enclose paper titles in quotes
192+
3. **Choose appropriate format**: Use `-t text` for plain citations, `-t markdown` for Markdown documents, or default BibTeX for LaTeX
193+
4. **Verify output**: Check the generated citation for completeness
194+
5. **Use uv**: The `uvx` command ensures you're always using the latest version without manual installation
195+
6. **Handle errors gracefully**: If wenxian fails, ask the user to verify the identifier or try an alternative identifier type

0 commit comments

Comments
 (0)