agentleFS
TyrealQTyrealQ/q-skills/skills/q-scholar/q-tf/SKILL.md

q-tf

Skill108 starsChanged 2 months agoMITView on GitHub

Consolidate topic modeling outputs (BERTopic, LDA, NMF) into theory-driven classification frameworks. Use for topic finetuning, topic consolidation, reclassification, outlier handling, or updating Excel labels from topic models.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All non-outlier topics must be assigned to at least one category

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Q-TF

Fine-tune topic modeling outputs into consolidated, theory-driven topic frameworks for academic manuscripts.

If in plan mode: write a brief plan — "Run q-tf skill: load topic model output, define final topic structure with theoretical framework, generate implementation plan, update Excel with labels." — then exit plan mode immediately. Do NOT attempt topic analysis, script execution, or Excel updates while plan mode is active.

Script Directory

Agent execution instructions:

  1. Determine this SKILL.md file's directory path as SKILL_DIR.
  2. Script path = ${SKILL_DIR}/scripts/<script-name>.
  3. Reference path = ${SKILL_DIR}/references/<ref-name>.

Dependencies

pandas
openpyxl          # required for .xlsx input/output
google-genai      # required for outlier classification via Gemini

Install: pip install pandas openpyxl google-genai

Environment variables: GEMINI_API_KEY (for outlier classification only), GEMINI_MODEL (optional model override).

References

  • references/preservation_rules.md — domain preservation rules, theoretical framework template, multi-category handling
  • references/code_patterns.md — four Python patterns: topic definition, assignment mapping, overlap calculation, Excel update
  • references/outlier_workflow.md — foundation model outlier classification workflow
  • references/esports_ugc_example.md — worked example
  • references/SP_OUTLIER_TEMPLATE.txt — outlier classification prompt template

Core Principles

  • Preserve domain-specific distinctions (entity, event, geography, stakeholder) — see references/preservation_rules.md
  • Theory-driven classification using a customizable framework template
  • Track multi-category topics explicitly; calculate overlap for reconciliation
  • All non-outlier topics must be assigned to at least one category

Workflow

StepActionReference
1Load & analyze topics — identify overlaps, unassigned—
2Define final topic structure (FINAL_TOPICS dictionary)references/code_patterns.md
3Apply theoretical framework — classify each topicreferences/preservation_rules.md
4Generate implementation plan (MD)scripts/generate_implementation_plan.py
5Update source data with labels (Excel)scripts/update_excel_with_labels.py
6Reclassify outliers via foundation modelreferences/outlier_workflow.md

Required Inputs

  1. Topic model output (Excel/CSV) — Topic ID, Count, Name/Label, Keywords, Representative_Docs (optional)
  2. Merge recommendations (optional) — Sheets: MERGE_GROUPS, INDEPENDENT_TOPICS
  3. Document data (for label updates) — individual documents with Topic ID column

Script Invocation

python "${SKILL_DIR}/scripts/generate_implementation_plan.py" --input topic_model_output.xlsx --output implementation_plan.md
python "${SKILL_DIR}/scripts/update_excel_with_labels.py" --input document_data.xlsx --output document_data_labeled.xlsx

Adapt scripts by updating FINAL_TOPICS, FINAL_LABELS, and theme categories. See references/code_patterns.md. For a worked example, see references/esports_ugc_example.md.

Expected Outputs

OutputDescription
implementation_plan.mdFull classification plan with topic mappings and reconciliation
*_labeled.xlsxSource data with Final_Topic_Code, Final_Topic_Label, Category_Theme columns
Outlier results (optional)Updated Final_Topic_Label, classification_confidence, key_phrases columns

Scope

Include: Topic consolidation, theoretical classification, Excel label updates, outlier reclassification. Exclude: Topic modeling itself (BERTopic/LDA/NMF execution), visualization, statistical analysis.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.