Systematically perform grounded theory coding analysis on interview transcripts or other qualitative data. For each interview, sequentially execute open coding and axial coding (five stages automatically executed in sequence), and save as a Markdown file; after multiple interviews have accumulated, proceed to selective coding as needed.
Start: Obtain basic information
When the user triggers this skill, first obtain the following information (if the user has not provided it, proactively ask):
- Qualitative data path: The local file path of the interview transcript/qualitative data uploaded or provided by the user (supports PDF, Word, TXT, and other formats)
- Research field: The user's research field (e.g., education, management, sociology, etc.)
- Research topic: The specific topic the user is researching
- Interviewee information: A description of the interviewee's identity (e.g., "a primary school teacher", "Entrepreneur A", etc.)
- Research issue focus(Optional): The research issue or analytical focus that the user particularly cares about
- Interview number and existing coding table(Key information for constant comparison):
- Which interview is this in your research? (First / Nth)
- If this is the second or later: Can the cumulative coding table from previous interviews be provided?
Please provide the file path, or directly paste the category list, in the following format:
类属1:[类属名称] 包含编码:编码A, 编码B, ... 属性1:[名称](维度:[极端A] ←→ [极端B]) 属性2:[名称](维度:[极端C] ←→ [极端D]) 类属2:... - If this is the first interview, directly begin a completely new construction.
If the user has already provided some information when triggering (such as directly giving the file path and research topic), do not repeatedly ask for known information; only supplement the missing necessary information.
After receiving the basic information and reading the full text of the qualitative data,before entering coding, ask the researcher whether they wish to provide demonstration coding:
"Before formal coding, you may choose: A. Researcher demonstration: You first perform demonstration coding on any short passage of the text (3–5 sentence groups), and the AI will identify your coding style, then complete the subsequent open coding according to your style B. AI direct coding: Skip the demonstration, and the AI will directly begin according to standard principles
Which method? (Choose B or do not respond to begin directly)"
If the researcher chooses A (researcher demonstration):
- Ask the researcher to provide the demonstration passage and its corresponding coding (format:
S1 "原文" → 编码标签) - The AI analyzes the stylistic features of the demonstration coding and clearly states:
- Degree of gerund use: Highly gerundized, or more noun phrases?
- Level of abstraction: Close to the original text (descriptive), or already somewhat theoretically distilled?
- Granularity: One code per sentence group, or are multiple allowed?
- Wording style: Leaning toward localized expression, or theoretical terminology?
- Output style confirmation:
"I understand your coding style to be: [description]. I will complete the subsequent open coding in this style. If there are any deviations, please feel free to correct them."
- Continue executing the five-stage process according to the researcher's style
If the researcher chooses B or does not respond:
Proceed directly to the five stages and code according to standard principles.
Execution process (five stages executed consecutively)
Stage One: Overall thematic overview
After reading all the qualitative data, extract several major thematic directions to provide a global perspective for the subsequent micro-analysis.
Output format:
- List 3-6 major themes, each with a brief explanation (1-2 sentences)
- Explain the approximate distribution and weight of each theme in the data
The purpose of this step is to allow the researcher to have an overall cognitive framework for the data before entering sentence-by-sentence coding. Just as one browses the table of contents before reading a book, the overall thematic overview helps the researcher clarify the direction and focus of the subsequent micro-analysis.
Stage Two: Open coding
Open coding is the foundational stage of grounded theory, with the goal of gradually constructing concepts from the raw data. It includes three consecutive steps, corresponding to a gradual ascent from concrete to abstract:
- Identifying events: Identify items, matters, and affairs in the data one by one and name them (lower level of abstraction)
- Extracting categories: Classify and merge specific events to form concepts (higher level of abstraction)
- Analyzing categories: Define category content, analyze characteristics, and classify properties and dimensions
Step One: Identifying events (sentence-by-sentence micro-analysis)
Conduct sentence-by-sentence micro-analysis of the qualitative data, identify items, matters, and affairs in the data one by one, and name them. This step has a lower level of abstraction and stays close to the raw data—it answers "what is happening here."
Coding principles:
- Sentence-by-sentence coding—Proceed by sentence groups, without omitting any statements.Onlypure single-word responses (standing alone as a sentence, such as only "mm," "yes," or "okay") may be skipped, and must be marked as "skipped" in the coding results. All other statements,regardless of how informative they appear, must be given a code. Whether a sentence is important is the researcher's right to judge, not the AI's; when uncertain, provide a descriptive code (such as "repeats the aforementioned view" or "expresses uncertainty") rather than skipping it
- Prefer gerund forms—The standard format for GT open coding is gerunds (such as "emphasizing autonomy," "avoiding direct conflict," or "rationalizing platform rules"), rather than noun phrases (such as "autonomy," "conflict avoidance," or "rule rationalization"). Gerunds preserve the sense of action and process, consistent with GT's analytical orientation of asking "what is happening." Codes should be concise, usually 4–8 characters, and should not be too long
- Give each sentence group one most appropriate code—The same code may appear repeatedly in different sentence groups (this indicates that the phenomenon is mentioned repeatedly)
- Stay closely tied to the research topic—When coding, focus on content related to the user research theme and research issues
- Do not use neat parallelism—The length and syntactic structure of code labels should be determined by the data content, not by the output form.If the check finds that most coded word counts are similar and the structures are the same (for example, all are four-character gerund phrases), it indicates that the form is being optimized rather than remaining faithful to the data, and this sense of uniformity must be actively broken. Some codes are naturally longer, some shorter; some are gerund forms of respondents' original words, and some are descriptive process short sentences. Only diverse forms meet GT's fine-grained requirements
During the coding process, use "S+number" to mark each sentence group (such as S1, S2, S3...), to facilitate later citation and tracing.
Output data structure:
句群序号 | 原文内容 | 事件命名(编码)
S1 | 原文... | 编码A
S2 | 原文... | 编码B
...
Step 2: Refine categories (including constant comparison across texts)
Classify and merge the specific events identified in Step 1 to form concepts at a higher level of abstraction (categories). This is the key leap from "description" to "conceptualization".
Constant Comparison is the core operation of this step. S&C's constant comparison requires: each new code must be compared with all existing codes/categories, rather than constructing categories in isolation from a single text.
Case A: The first interview (no existing coding table)
Proceed normally with category refinement.
Merging principles:
- Do not omit any code—every event name must be assigned to some category
- A moderate number of categories—usually 5-10 categories; too many loses the meaning of merging, too few loses information
- Category naming requirements:
- Have a certain degree of abstraction—higher than the level of generalization of event names
- Demonstrate theoretical sensitivity—able to inspire theoretical thinking
- Also accommodate localization—there is no need to force Western concepts, and characteristics of the data itself may be reflected
- But also do not be constrained by existing theories—let categories emerge naturally from the data
Case B: The second and subsequent interviews (with an existing coding table)
Constant comparison proceeds in three steps:
Comparison Step 1: For each new code, first try to assign it to an existing category
Check one by one: does this new code describe an experience or phenomenon already present in an existing category?
- Yes → assign it to the existing category, and also record whether the code provides new information on attributes or dimensions (attribute expansion or new evidence of extreme dimensions)
- No → temporarily mark it as "to be determined—possibly a new category"
Comparison Step 2: For "to be determined" codes, judge whether they constitute a new category
Check all "to be determined" codes:
- Is there a common abstract orientation among them?
- Do the phenomena they describe differ essentially from all existing categories?
- If yes → establish a new category, name it, and explain how it differs from existing categories
- If no → re-examine to see whether they can be assigned to a revised existing category
Comparison Step 3: Check whether existing categories need revision
- Does the new text make the boundary of an existing category blurred? (Does it need to be split?)
- Does the new text reveal that two existing categories are actually different sides of the same phenomenon? (Do they need to be merged?)
- Does the new text make the name of a category no longer accurate? (Does it need to be renamed?)
Output data structure:
句群序号 | 原文内容 | 事件命名(编码) | 类属 | 类属状态(既有/新增/修订)
S1 | 原文... | 编码A | 类属X | 既有
S2 | 原文... | 编码B | 类属X | 既有(属性扩展:新的维度极端证据)
S3 | 原文... | 编码C | 类属Z | 新增
S4 | 原文... | 编码D | 类属X→类属X' | 修订(类属X因本次材料重命名为类属X')
...
Step 3: Analyze categories (attributes and dimensions)
ForeachDefine its content, analyze its characteristics, and classify it. This is the concluding work of open coding, turning a category from a "label" into a "concept with substance".
Concept definition:
- Property: Certain important characteristics of a category that distinguish it from other categories
- Dimension: The degree of variation of a property, usually expressed as a continuum of a pair of opposing concepts (such as strong—weak, more—less, active—passive, positive—negative)
Analysis requirements:
- For each category, distill2 properties
- Each property has2 dimensions(that is, two poles)
- Formfour quadrantsof ideal-type classification (2 properties x 2 extreme dimension values = 4 types)
- Determine properties and dimensions in conjunction with specific descriptions in the original data to ensure they are grounded in evidence
- Try to give a short type name for each of the four quadrants
Output format (for each category):
类属名称:XXX
属性1:[属性名称]
维度:[极端A] ←————→ [极端B]
属性2:[属性名称]
维度:[极端C] ←————→ [极端D]
四象限分类:
属性2-极端C 属性2-极端D
属性1-极端A 类型I名称 类型II名称
属性1-极端B 类型III名称 类型IV名称
Memo prompt (optional): During the property-dimension analysis, if a category triggers an urge to theorize—feeling that "there is something here"—now is a good time to write a memo. Simply say "memo" or describe your thoughts to start
memo-coach. The momentum of analysis is fleeting; do not wait until all coding is complete to recall it.
Phase Three: Axial Coding (Paradigm Model Relationship Analysis)
The core task of axial coding is to use the **Paradigm Model** to logically connect the relationships among categories and form theoretical statements. This is the key step from "describing phenomena" to "explaining mechanisms".
Paradigm Model framework (Strauss & Corbin):
因果条件(Causal Conditions)
↓ 触发
现象(Phenomenon)——核心关注的类属
↓ 发生在
情境脉络(Context)
↓ 受到
中介条件(Intervening Conditions)影响
↓ 行动者采取
行动/互动策略(Action/Interaction Strategies)
↓ 导致
结果(Consequences)
Operational steps
Step 1: Label category roles
Review each category distilled in Phase Two one by one, and determine the role it may play in the Paradigm Model. Note: a category may play different roles in different contexts (for example, a category may be a "condition" in one set of relationships and an "outcome" in another).
Step 2: Establish relational propositions
Try to use the logic of the Paradigm Model to write the relationships among categories, in the format:
When [causal condition], against the background of [context], under the influence of [intervening condition], [actors] respond to [phenomenon] by adopting [action/strategy], leading to [outcome].
Do not strive to write a complete proposition in one go—some positions may temporarily be blank; simply mark them as "to be supplemented by subsequent data".
Step 3: Label certainty
Label each relationship with a level of certainty:
- Evidenced: directly supported by multiple sentence clusters (label the supporting sentence cluster numbers)
- Emerging: supported by only 1–2 sentence clusters, requiring verification in subsequent interviews
- Speculative: based on analytical intuition, with no direct evidence yet
Evolution across interviews
- First interview: the Paradigm Model is preliminary and tentative, and many relationships are labeled "emerging" or "speculative"; this is normal
- Subsequent interviews: after completing open coding for each new interview, re-examine the Paradigm Model:
- Which "emerging" relationships have gained support from new evidence? (Upgrade them to "evidenced")
- Which relationships are challenged by new evidence? (Requires revision direction or downgrading)
- Have new relationship paths emerged?
- Does the overall structure of the paradigm model need adjustment?
Output format:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
典范模型关系分析
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
现象:[类属名称]
因果条件:
- [类属名] → [现象]:[关系说明](确定性:有据/初现/推测,证据:Sx, Sy)
情境脉络:
- [类属名]:[如何构成背景条件](确定性:...)
中介条件:
- [类属名]:[如何影响行动策略](确定性:...)
行动/互动策略:
- [类属名]:[行动者如何应对](确定性:...)
结果:
- [类属名]:[产生什么后果](确定性:...)
关系命题(暂定):
"当 [因果条件] 时,在 [情境脉络] 的背景下,受 [中介条件] 影响,
[行动者] 采取 [策略] 应对 [现象],导致 [结果]。"
未归位类属:
- [类属名]:暂无法在典范模型中定位,待后续数据
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Memo prompt (optional): During the process of establishing relationships in the paradigm model, if you find the role of a certain category surprising—for example, a category you originally thought was a "result" might, from another angle, be a "condition"—this moment of repositioning is exactly when memos are most valuable. Simply say "memo" or describe your thoughts to start
memo-coach。
Phase 4: Coding Statistics Summary and Category Evolution Record
Perform quantitative statistics on the coding results to help researchers understand the data structure from a numerical perspective:
- Total number of sentence groups
- Total number of event names (codes) (after deduplication)
- Total number of categories
- Number and proportion of codes contained in each category
- Top 5 codes with the highest occurrence frequency
If this is the second or later interview, additionally output a "Category Evolution Summary":
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
类属演化摘要(本次持续比较结果)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【新增类属】(本份访谈中出现、既有编码表中没有的)
- [类属名]:[简要说明这个类属在本份材料中的表现]
【修订类属】(命名调整、拆分、合并)
- [旧类属名] → [新类属名]:[修订理由]
【属性维度扩展】(既有类属中出现了新的维度极端证据)
- [类属名] / [属性名]:新发现 [极端B] 方向的例证 [Sx]
【典范模型关系更新】
- [关系描述]:确定性从 [旧] → [新](新证据:Sx)
- 新增关系路径:[描述]
【未见证据的类属】(既有类属在本份材料中缺席)
- [类属名]:本份访谈中无对应编码(可能是被访者特殊性,或趋近饱和)
【饱和度初步判断】
本份访谈中,新增类属 [N] 个,修订类属 [M] 个,新增关系路径 [K] 条。
[若新增/修订极少,可注明:核心类属已趋于饱和,建议进行理论抽样以检验薄弱环节]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━
This summary is an important basis for researchers to decide whether to continue interviewing (theoretical saturation), and also a prompt for the direction of theoretical sampling.
Memo prompt (optional): If unexpected changes appear in the category evolution summary—an existing category is forced to be revised, or a new category suddenly appears—this kind of "unexpectedness" is exactly the moment memos most need to capture. Say it directly,
memo-coachand it can help you develop it into a theoretical proposition.
Phase 5: Save coding results to a Markdown file (mandatory, cannot be skipped)
After Phase 4 is completed,you must immediately call the Write toolto write the complete coding results of this interview into a Markdown file. It must not be output only in the conversation without writing the file.
File naming rule:coding_GT_[被访者编号或简称].md
(e.g., coding_GT_A.md、coding_GT_P1.md)
Save path: current working directory (i.e., the project directory root)
File content format:
# 扎根编码:【被访者编号/简称】
编码日期:[日期]
研究主题:[研究主题]
## 一、整体主题概览
[第一阶段输出]
## 二、开放编码表
| 句群序号 | 原文内容 | 事件命名(编码) | 类属 |
|---------|---------|----------------|------|
| S1 | ... | ... | ... |
## 三、属性与维度分析
[每个类属的属性、维度、四象限]
## 四、典范模型关系分析
[第三阶段输出]
## 五、编码统计摘要
[第四阶段统计输出]
## 六、类属演化摘要(如适用)
[第四阶段演化摘要输出]
After the Write tool call is completed, inform the researcher:
"This coding has been saved via the Write tool to
coding_GT_[被访者编号].md. If you need to continue with the next interview, please provide the text; if all interviews are completed, enter "Generate Excel" to generate the complete coding table."
Final output: Generate complete Excel (on demand, after all interviews are completed)
Execute this step only when the researcher says "Generate Excel", "all interviews completed", or actively requests it.
Integrate the data of all coding_GT_*.md files in the current project directory to generate an Excel file summarizing all interviews.
Use the scripts/export_coding.py script to generate it. First construct the coding data as JSON, write it to a temporary file, then call the script.
Excel file structure (5 worksheets):
Sheet 1: Complete coding table(all interviews merged)
| Interview number | Sentence group number | Original text content | Event name (code) | Category |
|---|
Sheet 2: Code-Category Summary
| Category | Included codes | Number of codes |
|---|
Sheet 3: Attributes and Dimensions
| Category | Attribute 1 | Attribute 1 dimension | Attribute 2 | Attribute 2 dimension | Four-quadrant classification |
|---|
Sheet 4: Paradigm Model
| Phenomenon | Causal conditions | Context | Intervening conditions | Action/interaction strategies | Consequences | Relational propositions | Certainty |
|---|
Sheet 5: Coding Statistics Contains summary statistics across interviews
Generation command:
python3 <skill_path>/scripts/export_coding.py --output "<项目目录>/扎根编码_汇总.xlsx" --json-file /tmp/_grounded_coding_data.json
Selective coding (as needed, after the core category emerges)
When the researcher says "enter selective coding," "begin integrating the theory," or "determine the core category," execute this stage.
Prerequisite: Open coding and axial coding of at least 3–4 interviews have been completed, with sufficient accumulation of categories and a foundation of paradigm model relationships.
Selective coding is a key step in constructing theory in grounded theory. The goal is to determine the core category, integrate all categories around it, pose the research question, construct a storyline, and engage in dialogue with existing theories.
Step 1: Determine the core category
From all accumulated categories, select an existing category as the core category, or construct a shared higher-level concept as the core category.
Criteria for judging the core category (S&C):
- High frequency of occurrence: Appears repeatedly across multiple interviews
- Strong relatedness: Has substantive connections with most other categories (occupies a pivotal position in the paradigm model)
- Strong explanatory power: Can encompass other categories and explain "what the core phenomenon here is"
- Conceptual richness: Its properties and dimensions already have sufficient data support
Two ways of determining it:
- Select an existing category: Select the one with the greatest encompassing power from existing categories, and explain the reason
- Construct a higher-level concept: If no single category can encompass the whole, a concept at a higher level of abstraction can be constructed above the existing categories as the core category, explaining how it integrates multiple categories
Output candidate core categories (1–3), and explain the reason and determination method for each.
Step 2: Pose the research question based on the core category
After the core category is determined, clarify or revise the research question around it. In grounded theory, the research question is not given in advance but gradually focused during the analysis process.
Operations:
- Based on the core category, state in one sentence "what question this study is ultimately answering"
- Compare with the researcher's initial broad entry point, and explain how the research question has focused from the initial open exploration to the current theoretical focus
- Check whether the research question is aprocess question("how..." "in what way..." "under what conditions..."), rather than a static descriptive question
Output format:
核心类属:[名称]
研究问题(聚焦后):
[一句话陈述]
聚焦路径:
初始切入点:[研究者最初的宽泛问题]
→ 开放编码发现:[关键发现]
→ 主轴编码揭示:[核心关系]
→ 最终聚焦:[当前研究问题]
Step 3: Construct the storyline (Storyline)
Around the core category, integrate all categories into a coherent theoretical narrative according to the paradigm model framework.
核心类属(Central Category):[名称]
因果条件(Causal Conditions):[触发核心现象的类属]
情境脉络(Context):[背景性条件类属]
中介条件(Intervening Conditions):[影响行动策略的类属]
行动/互动策略(Action/Interaction Strategies):[应对核心现象的类属]
结果(Consequences):[行动带来的结果类属]
Write the analytical storyline in 1–2 paragraphs:
"In this study, the core phenomenon is [core category]. Its occurrence is influenced by [causal conditions] and takes place against the background of [contextual categories]. Actors respond through [action/interaction strategy categories], ultimately producing the outcome of [consequence categories]."
For categories whose placement is uncertain, label them "placement pending researcher judgment."
Step 4: Theoretical Dialogue
Engage the emergent theory in dialogue with existing literature to clearly position the theoretical contribution of this study.
Operations:
- Identify dialogue partners: Which existing theoretical concepts or frameworks are closest to the core categories and relational propositions? List the 2–3 most relevant theories
- Compare similarities and differences: In what respects is the emergent theory of this study consistent with these existing theories? In what respects does it differ from or advance them?
- Position the contribution: What is the contribution of this study's theoretical findings to the existing body of knowledge—is it verification, revision, extension, or challenge?
- Note limitations: Honestly note the uncertainties in the theoretical dialogue—which dialogues require more data support
Note: The literature involved in the theoretical dialogue must actually exist. If you are uncertain whether a reference actually exists, you must clearly state "this reference needs to be verified by you yourself."
Step 5: Draft Theoretical Propositions
Based on the paradigm model and story line, propose 3–5 theoretical propositions that can be tested by subsequent data, in the format:
Proposition N: When [conditions], [actors] tend to adopt [strategies], thereby leading to [outcomes].
Each proposition is accompanied by an explanation: what data currently support it, and which dimensions still await additional evidence.
Handover statement: The determination of core categories and the selection of propositions in selective coding are the researcher's theoretical judgments; the above results are for reference only. After determining the core categories, it is recommended to use
negative-case-finderto stress-test the propositions with counterexamples.
Dialogue output during the process
Although the coding process is executed automatically and continuously, the analysis process and intermediate results still need to be presented step by step in the dialogue so that users can track the progress of the analysis. Specifically:
- After Phase 1 is completed: Output a textual description of the thematic overview
- After Phase 2 is completed: Output in sequence the event naming table → the coding table with category columns → the attribute and dimension analysis of each category
- After Phase 3 is completed: Output the paradigm model relationship analysis
- After Phase 4 is completed: Output the coding statistics summary (including the category evolution summary and the paradigm model relationship update)
- After Phase 5 is completed: Inform the user of the save path of the Markdown file
Coding Quality Principles
Always follow these principles during the coding process:
- Be faithful to the original materials—coding must be based on the original text and must not be fabricated out of thin air
- Maintain openness—do not preset a theoretical framework; let concepts emerge from the materials
- Continuous comparison—each time a new code is processed, it must be compared withexisting codes and categoriesCompare: Has this phenomenon appeared in previous interviews? Are the attributes consistent? Is it necessary to revise the category boundaries? This is a cross-text comparison, not a consistency check within a single text.
- Theoretical sensitivity—Remain sensitive to the concepts and relationships implicit in the data, but do not be constrained by existing theories.
- Saturation check—If certain codes are found to recur repeatedly and no longer generate new attributes or dimensions, note in the statistical summary that theoretical saturation may have been reached.
- Three-stage progression—Open coding constructs concepts (what it is), axial coding establishes relationships (how they are connected), and selective coding integrates the theory (what the core is and how to explain it). The level of abstraction in the three stages increases progressively and cannot be skipped.
Language
- By default, use Chinese for coding and output.
- If the qualitative data is in English, use English for coding terms, but still use Chinese for the analysis explanation (unless the user requests English output).
- Keep coding terms as concise as possible, mainly in gerund form.