
citation-fixer
Audit and fix citation formatting across brain pages. Ensures every fact has an inline [Source: ...] citation matching the standard format. Extended in v0.25.1: scans for broken tweet/post references that lack actual URLs and resolves them via the host's X / Twitter API integration.
- Installs
- 245
- Last 24h
- +9
- Trending rank
- #9255
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/garrytan/gbrain --skill citation-fixer- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads citation-fixer automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Citation Fixer Skill
Convention: see conventions/quality.md for the canonical citation format every fix should match.
Output rule: all links MUST be deterministic (built from API data, not composed by LLM). See _output-rules.md.
Contract
This skill guarantees:
- Every brain page is scanned for citation compliance.
- Missing citations are flagged with specific location.
- Malformed citations are fixed to match the standard format.
- (v0.25.1) Tweet / post references without URLs are resolved via
X API and patched with deterministic
https://x.com/<handle>/status/<id>links. - Results reported with counts (scanned, fixed, remaining).
Phases
- Scan pages. List pages and read each one, checking for inline
[Source: ...]citations. - Identify issues:
- Facts without any citation
- Citations missing date
- Citations missing source type
- Citations with wrong format
- (v0.25.1) Tweet references without
x.comURLs
- Fix format issues. Rewrite malformed citations to match
conventions/quality.md. - (v0.25.1) Resolve tweet references via the X API integration.
- Report results. Count: pages scanned, citations found, issues fixed, tweets resolved, remaining gaps.
Tweet resolution pipeline (v0.25.1 extension)
For each broken tweet reference, follow this chain. The actual API call
goes through whatever X integration the host has configured (typical
shape: a recipe under recipes/x-api/ with handle / search-all
endpoints).
Step 1: Identify broken references
Scan the page for patterns that indicate tweet references without URLs:
- Contains words like
tweeted,posted,said on X,RT,retweet,X post - Contains quoted text that looks like a tweet (short, punchy, often starts with a quote)
- Has
[Source: ... X/Twitter ...]without anx.comURL - References engagement metrics (likes, impressions) without a link
Step 2: Extract searchable content
From each broken reference, extract:
- The handle (if mentioned:
@<username>) - The quoted text (if available)
- The approximate date (often present in surrounding timeline entries)
Step 3: Search for the actual tweet
Use the host's X API integration. Query patterns:
# Handle + quoted text:
from:<handle> "<exact quote fragment>"
# Quoted text only:
"<exact quote fragment>"
# Original of a retweet:
"<exact quote>" -is:retweet
Step 4: Verify and extract metadata
Once a candidate is found:
- Confirm the text matches the quoted fragment.
- Pull the tweet id, author handle, engagement metrics (likes / RTs / impressions).
- Construct the URL:
https://x.com/<handle>/status/<tweet_id>.
Step 5: Patch the brain page
Replace the broken citation with a proper one:
Before:
"<quote fragment>" [Source: <some hand-wavy attribution>]
After:
"<full verified quote>" — <N> likes, <N> RTs, <N> impressions
[Source: [X/<handle>, YYYY-MM-DD](https://x.com/<handle>/status/<tweet_id>)]
Batch mode
When sweeping many pages:
Find candidate pages
# Pages mentioning tweets but with no x.com links
for f in $(find . -name "*.md" -not -path "./node_modules/*"); do
refs=$(grep -ci "tweet\|posted\|x post\|RT\|retweet\|said on X" "$f")
links=$(grep -c "x.com/.*/status/" "$f")
if [ "$refs" -gt 2 ] && [ "$links" -eq 0 ]; then
echo "$f"
fi
done
Priority order
- Recently created / updated pages — fresh broken refs are easiest to resolve while context is fresh.
- High-traffic pages (frequent reads / writes from other skills).
- Everything else — bulk cleanup over time.
Rate limiting
- X API: respect the host's tier limits; don't hammer.
- Target ~50 pages per batch run.
- 1-3 API calls per page (search + verify).
- Batch-commit every 10-20 pages so a partial failure doesn't lose progress.
Output format
Citation Audit Report
=====================
Pages scanned: N
Citations found: N
Issues fixed: N
Tweet links resolved: N
Remaining gaps: N (pages with uncitable facts)
When it fails
Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:
put_pagereturnsrevision_conflictmid-batch: re-read that page, re-apply only the citation fix, and continue; never overwrite with the copy you read earlier.get_pagereturnspage_not_foundfor a cited source: mark the citation unresolvable in the report instead of rewriting it to a guessed slug.- A batch commit is interrupted: already-committed pages stay fixed; resume from the last committed page rather than starting over.
Anti-Patterns
- ❌ Inventing citations for facts that have no source. Flag them.
- ❌ Removing facts that lack citations (flag them; don't delete).
- ❌ Fixing citations without reading the full page context.
- ❌ Batch-fixing without checking quality on a sample first
(see
conventions/test-before-bulk.md). - ❌ Composing tweet URLs by guessing the tweet id. Always go through the X API; deterministic links only.
Integration
This skill can be called:
- Manually — "fix citations on this page"
- As a batch cron — weekly sweep of pages with broken refs
- By other skills —
enrichormedia-ingestcan call citation-fixer before commit to validate output
Metrics
If running as a recurring batch, track state in a small JSON file under
~/.gbrain/citation-fixer-state.json:
{
"last_run": "2026-04-15T...",
"pages_scanned": 0,
"citations_fixed": 0,
"tweet_links_resolved": 0,
"citations_unresolvable": 0,
"pages_remaining": 1424
}
Output Format
The skill's output shape is documented inline in the body sections above (see "Output", "Brain page format", or equivalent). The literal section header here exists for the conformance test (test/skills-conformance.test.ts).
FAQ
What does the citation-fixer skill do?
Audit and fix citation formatting across brain pages. Ensures every fact has an inline [Source: ...] citation matching the standard format. Extended in v0.25.1: scans for broken tweet/post references that lack actual URLs and resolves them via the host's X / Twitter API integration.
How do I install citation-fixer?
Run npx skills add https://github.com/garrytan/gbrain --skill citation-fixer in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/citation-fixer/ (personal) or .claude/skills/citation-fixer/ (project).
Which AI agents can use citation-fixer?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is citation-fixer safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains citation-fixer?
It is published by garrytan in garrytan/gbrain. It has 245 recorded installs.
More from garrytan/gbrain
brain-ops
garrytan/gbrain
Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking. Read this before any brain interaction.
query
garrytan/gbrain
Answer questions using the brain's knowledge with 3-layer search, synthesis, and citation propagation. Use when the user asks a question, wants a lookup, or needs information from the brain.
maintain
garrytan/gbrain
Brain health checks: back-link enforcement, citation audit, filing validation, stale info detection, orphan pages, and benchmarks. Use when asked to check brain health, run maintenance, or audit quality.
idea-ingest
garrytan/gbrain
Ingest links, articles, tweets, and ideas into the brain. Fetch content, save to brain with analysis, credit the author (people page only when they pass the notability gate), and cross-link. Use when the user shares a link or says "read this", "save this", "think about this".
enrich
garrytan/gbrain
Enrich brain pages with tiered enrichment protocol. Creates and updates person/company pages with compiled truth, timeline, and cross-links. Use when a new entity is mentioned or an existing page needs updating.
meeting-ingestion
garrytan/gbrain
Ingest meeting transcripts from ANY meeting recorder into brain pages with attendee enrichment, entity propagation, and timeline merge. One unified pipeline: normalize the source into a standard transcript record, split multi-meeting recordings, resolve speakers by evidence, create the page, pass every surprising claim through the consistency check (transcript + brain + plausibility), enrich every entity, then run the verification checklist — substance AND sequence. A meeting is NOT fully ingested until the enrich skill has processed every entity AND the verification checklist passes, including the sequence verify (PASS or explicit user waive).
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.