Skip to content

Guide · Agent skill

How to use the usfiscaldata skill for U.S. Treasury data

Updated · written with AI from the project's own documentation and checked against our catalogue data

The usfiscaldata skill is an agent skill that teaches an AI agent how to query the U.S. Treasury Fiscal Data REST API, which publishes official federal finance figures. It is for economists, journalists, students, analysts and developers who want current federal debt, cash or spending numbers without hunting through the Treasury website. After this guide you will know what the skill does, how to install it, how to phrase requests so the agent uses it, and which caveats to check before you rely on the numbers.

U.S. Treasury Fiscal Data QueriesK-Dense-AI/scientific-agent-skills · MIT

Quick start

  1. 1Download the ZIP. Download the usfiscaldata skill ZIP from this page.
  2. 2Unzip into a skills folder. Extract it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder.
  3. 3Or upload in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the skill instead.
  4. 4Install Python dependencies. Run uv pip install requests pandas in the environment where the agent will run code.
  5. 5Ask a natural question. Request a specific Treasury figure, such as the national debt or exchange rates since a date.
  6. 6Check the endpoint and output. Confirm the dataset's endpoint on its API Quick Guide and check units, such as millions for DTS amounts.

What an agent skill is and what usfiscaldata makes the agent do

An agent skill is a folder of instructions and reference files that an AI agent loads when a task matches the skill's description. The usfiscaldata skill covers the U.S. Treasury Fiscal Data API. Once it is loaded, the agent knows the correct endpoints, filter and sort syntax, pagination, and how to read returned values.

The API covers national debt (Debt to the Penny), Daily Treasury Statements, Monthly Treasury Statements, Treasury securities auctions, interest rates, foreign exchange reporting rates, savings bonds, and government revenue and spending statistics. The agent can write and run short Python or R code to fetch and tabulate these figures. The API needs no API key or account.

Install the usfiscaldata skill

Download the ZIP for the skill from this page. Unzip it into your personal skills folder, ~/.claude/skills/, or into a project's .claude/skills/ folder if you want the skill available only in that project.

In the Claude apps, you can instead upload the skill under Settings → Capabilities → Skills.

The skill's own instructions list one dependency install command for the Python examples. Run it in the environment where the agent will execute code.

  • Personal install: ~/.claude/skills/usfiscaldata/
  • Project install: .claude/skills/usfiscaldata/ inside your project
  • Python requirements: Python 3.10+ with requests and pandas
  • R alternative: R with httr and jsonlite for the R examples
  • Network access to api.fiscaldata.treasury.gov is required
uv pip install requests pandas

How to trigger the skill with natural requests

You do not need special syntax. Ask for the Treasury figure you want in plain language, and mention Treasury or federal data so the agent matches the skill. The skill description names the topics it covers: national debt, Daily Treasury Statements, Monthly Treasury Statements, auctions, interest rates, exchange rates, savings bonds, and federal revenue and spending.

Be specific about the period and the output you want. A request that names a date range and a format (table, chart, CSV) gives the agent what it needs to write the query correctly.

  • What is the current national debt from Treasury? Show the date it was recorded.
  • Pull Treasury exchange rates for Canada and Mexico since January 2024 into a table.
  • Get the last 30 days of Treasury Operating Cash Balance and plot it.
  • List upcoming Treasury securities auctions and save them as CSV.

Know the key datasets and what they cover

The skill maps each topic to an endpoint under the base URL https://api.fiscaldata.treasury.gov/services/api/fiscal_service. Debt to the Penny is updated daily, the Daily Treasury Statement tables are updated on business days, and Monthly Treasury Statement tables are monthly. Auction datasets are updated as needed.

Endpoint paths change over time, so check each dataset's API Quick Guide on the Treasury site before you depend on a path. The skill's reference files give table-level detail for debt, fiscal statements, interest rates and securities, and savings bonds.

  • Debt: Debt to the Penny, Historical Debt Outstanding, Schedules of Federal Debt
  • Statements: DTS Operating Cash Balance, DTS Deposits & Withdrawals, Monthly Treasury Statement
  • Rates and exchange: Average Interest Rates, Treasury Reporting Rates of Exchange, Interest Expense on Public Debt
  • Securities: Auctions Data, Upcoming Auctions, Buybacks
  • Savings bonds: I Bonds Interest Rates, Savings Bonds Issues, Redemptions & Maturities

Read the values correctly: strings, millions and exchange rates

Data-row values come back as strings, so the agent converts them with float() or pd.to_datetime(). Null values appear as the string "null". Metadata counts are normal JSON numbers.

DTS amounts are in millions. For the Treasury General Account closing balance, the skill reads the open_today_bal field because close_today_bal is null in current data. Treasury reporting rates are foreign-currency units per USD, so you divide a foreign amount by the rate to get USD. These are government reporting rates, not live quotes.

Interest expense has month and fiscal-year-to-date fields, so never sum FYTD values across months. Auctions use auction_date for event timing, while record_date is the publication date.

Run a first query yourself

To check that the setup works, ask the agent for the current national debt. The skill's quick start requests the latest row of Debt to the Penny, sorted by record_date in descending order, with a page size of 1, and prints the tot_pub_debt_out_amt value.

The API has no key, so a failure is usually a network or path problem. Check that the sandbox or machine can reach api.fiscaldata.treasury.gov, then confirm the endpoint on the dataset's API Quick Guide.

  • Parameters: fields=, filter=, sort=, format= (json, csv or xml), page[size]= (default 100), page[number]= (starts at 1)
  • Filter operators: lt, lte, gt, gte, eq, in
  • Multiple filters are separated by commas
https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v2/accounting/od/debt_to_penny?sort=-record_date&page[size]=1

Safety notes: scripts and network access

This skill runs scripts and uses the network. The agent executes Python or R code that calls api.fiscaldata.treasury.gov, and its declared tools include Read, Write, Edit and Bash. Review the code the agent writes before running it, especially if you run it on a machine with sensitive files.

The skill needs no credentials. Do not paste API keys or passwords into prompts for this skill, because none are used. The API is open and free for commercial and non-commercial use, according to the reference notes.

  • Network: only api.fiscaldata.treasury.gov is needed for these queries
  • Tools declared: Read, Write, Edit, Bash
  • No credentials are required

What people use it for

  • Track the current national debt from Debt to the Penny for a news story or report.
  • Compare Treasury Reporting Rates of Exchange across several currencies for a quarterly analysis.
  • Chart Daily Treasury Statement operating cash balances over a chosen period.
  • Build a table of Treasury securities auctions, using auction_date for event timing.
  • Start a Python or R script that calls the Fiscal Data API for a class project.

Frequently asked questions

How do I install the usfiscaldata skill?

Download the skill ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder. In the Claude apps you can instead upload it under Settings → Capabilities → Skills. The Python examples also need requests and pandas, installed with uv pip install requests pandas.

Does the usfiscaldata skill need an API key?

No. The Treasury Fiscal Data API is open and needs no API key, registration or account. The skill's metadata says it requires network access and no credentials.

Is the usfiscaldata skill free?

The skill is published under the MIT licence. The Treasury API is described as open data, free for commercial and non-commercial use.

What do I need to run the skill?

You need Python 3.10+ with requests and pandas, or R with httr and jsonlite for the R examples. You also need network access to api.fiscaldata.treasury.gov.

Are the exchange rates real-time market prices?

No. The Treasury Reporting Rates of Exchange are quarterly government reporting rates, not live trading quotes. The skill does not give investment advice, so do not use these rates for trading decisions.

Why does the agent's output show numbers as text or in millions?

The API returns data-row values as strings, so they need conversion before arithmetic. DTS amounts are in millions, so check the scale before you compare them with other figures.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use usfiscaldata if you need official U.S. federal finance figures from Treasury, such as debt, cash statements, auctions or reporting exchange rates, and you are comfortable reviewing agent-written code. Pick another source if you need live market quotes, investment advice, or data outside the Treasury Fiscal Data API.

Download the skill