bond-portfolio-monitor
Skill0 starsChanged 40 days agoMITView on GitHub
Monitor a bond portfolio held on an online bond platform and screen the bonds on sale there. Ingests the platform's holdings report and a capture of its live listings, summarises holdings and cash flows, checks that repayments arrived, shortlists new bonds against the investor's own limits, and gives ENTER / SKIP and HOLD / REVIEW / EXIT verdicts with sources. Use when the user asks about their bonds: what they hold, what is due, whether a bond is still safe, what to buy with money coming back, or whether to exit.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- advance-taxSkill
- dsa-travelSkill
- html-slidesSkill
- itr2-filing-assistantSkill
- mutual-fund-reviewSkill
- my-spendingsSkill
- news-briefingSkill
- pdf-unlockSkill
- portfolio-reviewSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 9 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 49
Run every command from ${CLAUDE_SKILL_DIR}.
- Very specific: line 54
Find WORKROOT: Run python3 scripts/common.py --where.
- Very specific: line 60
rootis null: ask the user where to keep the data. - Very specific: line 65
Never create data/ inside this skill's folder: installed as a plugin, it is replaced on update.
- Distinctive: line 85
Numbers come from scripts: Every figure in a verdict or note is read from a script's output.
- Distinctive: line 86
Do not recompute a share, a YTM, a tax amount or a date difference yourself.
- Very specific: line 104
Holdings: When the request needs a fresh report and there is a browser, ask the user to download the holdings report (data/notes.md says …
- Very specific: line 130
Run the contents of ${CLAUDE_SKILL_DIR}/capture-listings.js in that tab, once.
- Very specific: line 164
Tax on the interest: When the user asks what tax or advance tax the bonds bring, run python3 scripts/fy_interest.py and quote its figures: …
- Very specific: line 195
Ask the user how much they want to deploy and pass it as --cash.
- Very specific: line 236
Write or update data/skill-data/bonds/<issuer-slug>.md from note-template.md (bond facts, credit read, what would change the verdict, …
- Distinctive: line 251
HOLD: no adverse rating action, payments on time, nothing new and material.
- Distinctive: line 261
If there may be no buyer, say so.
- Distinctive: line 269
Update the issuer's note.
- Distinctive: line 273
Do this last, on every run, once the verdicts are in the ledger:
- Distinctive: line 288
if a separate reviewer judged the run, its main findings and what you changed because of them.
- Distinctive: line 304
Every number in what you wrote appears in a script's output from this run.
- Distinctive: line 305
Every ENTER and EXIT has sources you opened, and a ledger entry.
- Very specific: line 307
If a script warned that a config.json entry is old, pass that on: tax rules and the portal's exit terms change, and the entry needs …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Request for this run: $ARGUMENTS
You are helping with a bond portfolio held on an online bond platform. Everything you say is advisory. Never invest, sell, sign Form 121, or change anything on the portal. On the portal you only read pages and run the capture snippet below.
Which platform. This file names none. Read data/notes.md in the working root (Step 0) before Step 1:
it is the user's own, gitignored, and says which platform they use, the address of its listings
page, where its holdings report is downloaded and what the download is called. If it is missing,
ask the user for those four things and write the file before going on. Never copy what it says
into a file outside data/.
Step 0: working folder, cloud copy, browser
Run every command from ${CLAUDE_SKILL_DIR}. Everything personal sits in a working root's data/
folder (WORKROOT below): data/profile.json (the user's limits), data/notes.md, the holdings
reports and listings captures, and data/skill-data/ (everything the scripts write). Paths in this
file that start with data/ are inside WORKROOT.
Find WORKROOT. Run python3 scripts/common.py --where. It prints the root ($BOND_ROOT, else
this skill's folder when its gitignored data/ already exists) and the newest snapshot and listings
capture in it.
rootis set: that is WORKROOT. If it is not this skill's folder, pass--root WORKROOTto every script below.rootis null: ask the user where to keep the data. In Claude Code, any folder (offer to setBOND_ROOTto it in theenvblock of their Claude Code settings); in a desktop app with a folder shared to the session, a folder inside it; otherwise a temporary folder, with the cloud copy as the only lasting one. Pass--root WORKROOTto every script.
Never create data/ inside this skill's folder: installed as a plugin, it is replaced on update.
The scripts refuse to.
Cloud storage. The user can keep a copy of data/ in their cloud file storage, so a session on
another device works from the same data. To sync, read references/cloud_sync.md and follow it.
- A lasting folder: sync when the user asks ("pull" down, "sync" or "push" up), and push up after any run that brought in a new holdings report or listings capture, once the run is saved: new data from the platform goes to the cloud copy so a session without a browser can use it.
- A temporary folder: sync down now, before Step 1; sync up once at the end, after the run is saved.
- No file-storage connector: with a temporary folder, say nothing will outlast the session.
Browser. Fetching anything from the platform needs a browser the session controls, with the
user logged in. Without one (a phone, or a session with no browser extension), do not fetch: work
from the newest snapshot and capture that --where reports (after the pull, with a temporary
folder), and say the date of each beside every figure it drives. If the user drops a new holdings
report into the cloud folder, it comes down with the pull and Step 1 ingests it.
Numbers come from scripts. Every figure in a verdict or note is read from a script's output. Do not recompute a share, a YTM, a tax amount or a date difference yourself.
Route the request
- Nothing named, or "refresh" -> Steps 1 and 2. No research.
- "What should I buy" / money coming back / a named bond on sale -> Steps 1, 2, 3, then 4 for the shortlist.
- A named issuer the user holds, "is X still safe", "should I exit" -> Steps 1, 2, then 5.
- First run (no
data/profile.json) -> copyprofile-template.jsontodata/profile.json, ask the user to set each limit, and only then continue. Do not invent their limits. Offer the optional ones too:total_investable,annual_investment_budgetandmin_ytm_pct. For the tax rates, if the user keeps anadvance-taxprofile, do not ask or work them out: runpython3 scripts/tax_profile.py --tax-profile <their tax-profile.json> --person NAME --write, which sets the slab, the effective rate (slab x surcharge x cess) and the multiplier, and say which person's rates were used.
Step 1: get the data in
Holdings. When the request needs a fresh report and there is a browser, ask the user to
download the holdings report (data/notes.md says where on the portal), then move it into
data/ under a name that carries no phone number or account id, which the download's own name
may. Where the session cannot reach the Downloads folder, ask the user to put it, so named, in the
shared folder or the cloud folder (then pull). Without a browser, the newest report already in
data/ is the one to use; skip to Step 2 unless a new one has come down.
mv ~/Downloads/<the downloaded workbook> WORKROOT/data/holdings-report-$(date +%F).xlsxThen:
python3 scripts/ingest.py reportsA header error means the platform changed the report. Show the user the message; the fix is the named
column in config.json report_columns, never a guess. Do not use the PDF Holding Statement: its
password is the user's PAN.
Listings (only when the request needs them, and only with a browser; without one, use the newest capture and say its date). With the user logged in to the platform in the browser:
- Open the listings page (its address is in
data/notes.md) in a new tab and wait for the cards to load. - Run the contents of
${CLAUDE_SKILL_DIR}/capture-listings.jsin that tab, once. It reads the cards already on the page and savesbond-listings-<time>.jsonto Downloads. mv ~/Downloads/bond-listings-*.json WORKROOT/data/. Where the session cannot reach the Downloads folder, evaluatewindow.__bondListingsCapturein the same tab instead and write the string it returns, unchanged, todata/under thefilename the snippet printed. The checksum in the next step catches any change to it.python3 scripts/ingest.py listings
Limits on what you do in the browser, with no exceptions: read-only; one capture per review; no
loops, polling or scheduling; no calls to the platform's API; never read, print or store a token, cookie
or account detail. If the capture returns far fewer bonds than the page's "Live (N)" or the
checksum fails, the page layout has probably changed (ingest rejects a capture with under 90% of
the stated count; do not pass --allow-partial unless the user asks): tell the user, and fall back to filling
listings-template.json by hand and ingest.py listings --file <it> --no-checksum.
Step 2: the standing picture
python3 scripts/portfolio.py # writes data/skill-data/PORTFOLIO.md
python3 scripts/cashflows.py
python3 scripts/positions.py # writes data/skill-data/POSITIONS.md
python3 scripts/repayment_check.py
python3 scripts/diff_snapshots.pyAlways show the returns-by-bond table from positions.py, one row per bond plus the total
row, whenever the request touches what the user holds or what they have earned. Copy the figures;
do not recompute them. Columns: issuer, rating (say when it is the issuer's and not this bond's)
with outlook, date bought, invested, return_pct and post_tax_return_pct, interest received,
principal still to come, interest still to come, when the principal comes back
(principal_dates), and net_if_all_paid. State basis and return_basis once: the returns
assume every scheduled payment arrives, and the post-tax figure is an approximation. A non-zero
past_due is a payment the report does not show as received; say so beside that row.
Tax on the interest. When the user asks what tax or advance tax the bonds bring, run
python3 scripts/fy_interest.py and quote its figures: gross interest for the financial year
(received plus scheduled) and the TDS on it. Interest is taxed at the slab and TDS covers only
part of it; principal coming back is not income. The script also writes
data/skill-data/bond-interest.json, which syncs with the cloud copy, so a tax tool on another
device can read it there. If data/notes.md names another folder that should get the file, add
--out <that folder>/bond-interest.json. Leave any instalment arithmetic to a tax tool.
Then report, briefly: totals and weighted YTM; any limit breach (issuers in one group are capped
together); what is due in the lookahead window; principal_ahead from cashflows.py (principal
returning over the longer horizon, by month, and its share of the book), since that is the
reinvestment to plan for; unrated holdings; ratings_not_for_this_bond; anything
diff_snapshots.py flags. Say when the book is concentrated in one sector: if every bond on sale
is lender paper, reinvesting there does not diversify it.
repayment_check.pysays "no baseline yet" or "nothing was checkable": say exactly that. It is not a clean result.- Any repayment flag (missing or short) or any
overdueentry -> that holding is REVIEW now. Go to Step 5 for it. An overdue entry can be a late payment or a report that lags the bank, so ask the user to check their bank statement for that credit before you conclude. - Any
held_issuer_signalsentry -> Step 5 for that issuer. - Unrated holdings -> offer to research and record them (Step 5's research, then
bond_facts.py set). An unrated holding is unknown, not safe.
Step 3: screen what is on sale
python3 scripts/screen_listings.py # no cash filter; output shows cash_arriving
python3 scripts/screen_listings.py --cash 50000 # drop bonds whose minimum is above thisAsk the user how much they want to deploy and pass it as --cash; if they have not said, run it
without and report cash_arriving (what comes back within the lookahead window, and by when)
beside the shortlist. Exit code 2 means the capture is stale: recapture (Step 1) and do not pass --allow-stale unless
the user asks, in which case say every figure is stale. Present the shortlist in rank order with
its risk bucket, post-tax YTM, tenure, minimum and max_buy. State post_tax_basis (post-tax
YTM is an approximation) and cap_basis (what the caps are a share of) once, and budget when
the profile sets one: invested so far this financial year and what is left. Pass on every entry in the
output's warnings (for example, unrated holdings that the bucket caps cannot count). The ranking is by risk bucket first;
do not re-sort it by YTM. Mention how many were rejected and the commonest reasons.
Step 4: ENTER or SKIP, for shortlisted bonds only
For each bond you take forward (at most five unless asked for more):
- Read its detail page (
urlin the shortlist): open it and run the contents of${CLAUDE_SKILL_DIR}/read-bond-details.jsin that tab. It opens "Other bond details" and returns the Overview panel: ISIN, rating with outlook, rating agency and date of rating, collateral type, seniority (for example "Senior secured bond"), listed or not, coupon, and maturity date. Never click "Invest Now". Record what you find:python3 scripts/bond_facts.py set --bond-id ID --isin ISIN --issuer NAME --rating R --rating-scope "this bond" --agency A --secured yes|no --seniority senior|subordinated --listed yes|no --source URLThe platform's page is the seller's page: good for the bond's terms, not a source for its credit. It shows one agency's grade and a date; it cannot show a watch, a second agency's view, or asset quality, and its listing cards have been seen to disagree with the agency. Then re-runscreen_listings.py: the recorded facts now go through the hard filters, and a bond the screen rejects on them is SKIP. A bond still "security unconfirmed" cannot get ENTER;rating_ledger.pyrefuses an ENTER whose secured and seniority facts are not recorded. - Research the issuer's credit from primary sources: the rating agency's latest rationale, recent results, exchange filings, and news. Open the rationale itself for every bond you give a verdict on, and say so plainly when you could not. Look specifically for rating actions, which matter more than the grade: rating watch negative, "issuer not cooperating", outlook changes, a downgrade at another agency. Check every agency that rates the issuer, not only the one the platform shows: a Negative outlook at any one of them counts, even if another is Positive. A lead you found and did not follow up is not something to leave out; follow it or report it. For a securitised pool (a PTC), the monthly trustee payout reports on the exchange are the primary source: collections, overdue buckets, and whether the cash collateral was drawn. Also: asset quality trend, capital and liquidity, who lends to them, auditor or regulator trouble. A search summary is a lead, not a source; open the page.
- Decide. ENTER needs: facts confirmed, no adverse rating action, a reason this bond beats
the others in its risk bucket, and a size no larger than
max_buy. Otherwise SKIP. A higher YTM than its bucket peers is a question to answer, not a reason to buy. - Record it, with the script's numbers as inputs:
python3 scripts/rating_ledger.py add --kind listing --issuer NAME --bond-id ID --verdict ENTER --reason "..." --inputs '{"ytm": .., "post_tax_ytm": .., "rating": "..", "risk_bucket": "..", "tenure_months": .., "max_buy": ..}' --source URL --source URL - Write or update
data/skill-data/bonds/<issuer-slug>.mdfromnote-template.md(bond facts, credit read, what would change the verdict, sources).
Step 5: HOLD, REVIEW or EXIT, for a holding
- Find the holding's own bond among the listings if it is still on sale (same issuer and
maturity) and read its detail page as in Step 4.1; the ISIN on the page tells you whether it is
the same bond. Then research the issuer as in Step 4.2 and record what you find with
bond_facts.py set --isin ...:--rating-scope "this bond"only when the agency's own annexure or the bond's page lists this ISIN; otherwiseissueror"sibling bond". A rating that is not this bond's, and security or seniority that is not confirmed for it, are stated in the verdict.--group NAMEwhen the issuer is rated together with a parent or subsidiary (the agency says "consolidated"): they are one credit and share one issuer cap.
- Decide:
- HOLD: no adverse rating action, payments on time, nothing new and material.
- REVIEW: a repayment flag, a negative watch or outlook at any agency (including split outlooks), a held-issuer signal, or material bad news that is not yet a rating change. Say what would settle it and when to look again. "No adverse rating action" is the minimum for HOLD, not the whole case: agencies lag. For BBB-range issuers also weigh, from the rationale, the trend in profit and credit cost and the debt falling due in the next year against the liquidity available to pay it.
- EXIT: credit has deteriorated enough that the remaining payments are in real doubt. Run
python3 scripts/exit_cost.py ISINand quote it as it is: an estimate, conditional on a buyer being found. Tell the user to check the portal's own sell quote for that bond first. If there may be no buyer, say so; an EXIT the user cannot execute is still worth knowing.
- Maturity and reinvestment are not a sale: when
cashflows.pyshows principal coming back, say how much and when, and offer Step 3. - Record it:
python3 scripts/rating_ledger.py add --kind holding --issuer NAME --isin ISIN --verdict HOLD --reason "..." --inputs '{"ytm": .., "rating": "..", "rating_scope": "..", "outlook": "..", "repayment_check": ".."}' --source URLForrepayment_checkwrite what the script actually returned:"clean"only if it checked this bond's dues and found none short, otherwise"no baseline yet","nothing checkable"or the flag itself. Never record an unchecked repayment history as clean. - Update the issuer's note.
Save the run
Do this last, on every run, once the verdicts are in the ledger:
python3 scripts/run_record.py saveIt writes data/skill-data/runs/<date>/ (every script's output as JSON, the newest verdict per
bond, and a generated REVIEW.md) and refreshes the verdict history at the top of each issuer
note from the ledger. Then write data/skill-data/runs/<date>/analysis.md yourself: the reading
of this run that a script cannot produce. Keep it short:
- what changed since the last run, and what you concluded;
- each REVIEW or EXIT, and what would settle it;
- what you could not verify, and which verdicts rest on thin evidence;
- what the user should do or check, most important first;
- if a separate reviewer judged the run, its main findings and what you changed because of them.
Numbers in analysis.md are quoted from the JSON files beside it. If you change a verdict after
saving, record it in the ledger and run run_record.py save again; it rewrites the generated
files and leaves analysis.md alone.
Then sync up if Step 0 says so: a temporary folder, or a run that brought in new data from the platform.
In an issuer note, write below the generated verdict history. Do not write a verdict line of your own there: the history comes from the ledger, so it cannot go stale.
Before you finish
- The run is saved and
analysis.mdis written, and synced up if Step 0 says so. - Every number in what you wrote appears in a script's output from this run.
- Every ENTER and EXIT has sources you opened, and a ledger entry.
- You said plainly what you could not verify.
- If a script warned that a
config.jsonentry is old, pass that on: tax rules and the portal's exit terms change, and the entry needs re-verifying before the numbers that use it are trusted.
Advisory only. Not investment or tax advice.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

