agentleFS
maksutovicmaksutovic/joycraft/.agents/skills/joycraft-research/SKILL.md

joycraft-research

Skill15 starsChanged 54 days agoMITView on GitHub

Invoked by design/decompose or the human directly — produce objective codebase research by isolating question generation from fact-gathering

The file

Show its rules and text

We split this skill into the rules it gives an agent

19 rules. About 0 are common, 8 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Guard clause: If the user doesn't provide a brief path or inline description, ask: "What feature or change are you researching?

    line 12
  2. Distinctive:

    Before generating a single research question, run a bounded grep-first retrieval pass over the durable knowledge layer — a capped lookup, …

    line 17
  3. Distinctive:

    Read at most 5 files/rows total.

    line 21
  4. Distinctive:

    Contradictions: if a retrieved decision or discovery contradicts the brief's direction, surface it explicitly in your handoff — never …

    line 26
  5. Distinctive:

    Read the brief and identify which zones of the codebase are relevant.

    line 32
  6. Very specific:

    If a brief exists at docs/features/<slug>/brief.md, write to docs/features/<slug>/research.md (per-feature layout).

    line 38
  7. Very specific:

    If no brief exists (inline description only), write to docs/research/YYYY-MM-DD-feature-name.md (flat layout).

    line 39
  8. Very specific:

    Write the questions to docs/features/<slug>/.questions-tmp.md.

    line 41
  9. Very specific:

    Write the subagent's response to docs/features/<slug>/research.md, adding a "Prior knowledge reused" section at the top from Step 0's …

    line 82
  10. Distinctive:

    After writing the research document, update the parent brief with a back-reference:

    line 86
  11. Very specific:

    If a > Research: line already exists, replace it — do NOT add a duplicate

    line 90
  12. Distinctive:

    Write the brief back

    line 91
  13. Very specific:

    If the artifact contains any open question, or any load-bearing claim anchored ≤50, invoke $joycraft-decide on it NOW — before presenting.

    line 95
  14. Very specific:

    If the human already answered them in conversation, that counts as termination: stamp the decisions: frontmatter and proceed — no dossier …

    line 100
  15. Very specific:

    Read docs/templates/REVIEW_GATE_TEMPLATE.html.

    line 110
  16. Very specific:

    Write it to docs/features/<slug>/research.html (committed later — the path is already linguist-generated, so PRs collapse it).

    line 114
  17. Very specific:

    When the readout carries two or more questions for the human, the render is an interactive checkpoint instead: build it per …

    line 123
  18. Distinctive:

    Keep it inline here on purpose: inline placement is load-bearing — referenced docs get partially read or skipped at output time (Anthropic …

    line 143
  19. Very specific:

    If you make changes, note them at the bottom of research.md under a "Brief updates" subsection.

    line 184

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

At skill entry, run node docs/.joycraft/check.mjs check --json --session <session-id> once, reusing JOYCRAFT_SESSION_ID if supplied or one ID chosen for this conversation. If the checker is missing or fails, continue the requested skill quietly without retrying setup. Offer updates only for display: true; current, postponed, off, and unknown stay quiet. If automaticUpdate is present, finish this skill, then run its exact command once from the project root: the candidate must verify every safety gate before applying. Other updates require approval. After an offer or automatic attempt, record it with node docs/.joycraft/check.mjs acknowledge <available-version> --session <session-id>. Apply updates only at this workflow boundary; after success, reinvoke the skill or restart the session to load changed instructions.

Research Codebase for a Feature

You are producing objective codebase research to inform a future spec or implementation. The key insight: the researching agent must never see the brief or ticket — only research questions. This prevents opinions from contaminating the facts.

Guard clause: If the user doesn't provide a brief path or inline description, ask: "What feature or change are you researching? Provide a brief path or describe it."

Step 0: Retrieve Before You Reason (PROTOCOL)

Before generating a single research question, run a bounded grep-first retrieval pass over the durable knowledge layer — a capped lookup, not a reading assignment:

  1. Derive 3-6 search terms from the brief's (or inline description's) key concepts.
  2. Grep, in priority order: docs/context/decision-log.md, docs/context/shipped.md, docs/discoveries/, remaining docs/context/*.md.
  3. Read at most 5 files/rows total; if a term returns dozens of hits, read only the newest within the cap and say the result was truncated.
  4. Empty or missing knowledge layer (fresh project): report "nothing to retrieve" in one line and proceed — never block.

Output contract: the research document MUST include a "Prior knowledge reused" section — a list citing each reused doc + row date/heading, or the explicit line "retrieval ran (terms: …), nothing relevant found."

Contradictions: if a retrieved decision or discovery contradicts the brief's direction, surface it explicitly in your handoff — never silently pick a side.


Phase 1: Generate Research Questions

Read the brief and identify which zones of the codebase are relevant. Generate 5-10 research questions that are:

  • Objective and fact-seeking — "How does X work?" not "How should we build X?"
  • Specific to the codebase
  • Answerable by reading code

Output path:

  • If a brief exists at docs/features/<slug>/brief.md, write to docs/features/<slug>/research.md (per-feature layout).
  • If no brief exists (inline description only), write to docs/research/YYYY-MM-DD-feature-name.md (flat layout).

Write the questions to docs/features/<slug>/.questions-tmp.md. Do NOT include any content from the brief.


Phase 2: Spawn Research Subagent

Spawn a subagent to perform the research. Pass ONLY the research questions — never the brief.

Subagent prompt:

You are researching a codebase to answer specific questions. You have NO context about why these questions are being asked.

RULES:
- Answer each question with FACTS ONLY: file paths, function signatures, data flows, patterns, dependencies
- Do NOT recommend, suggest, or opine
- Do NOT speculate about what should be built
- If a question cannot be answered, say "No existing code found for this"
- Search the codebase and read files thoroughly
- Include code snippets only when essential evidence

QUESTIONS:
[INSERT_QUESTIONS_HERE]

OUTPUT FORMAT:

# Codebase Research

**Date:** [today]
**Questions answered:** [N/total]

---

## Q1: [question]
[Facts only]

## Q2: [question]
[Facts only]

Phase 3: Write the Research Document

Write the subagent's response to docs/features/<slug>/research.md, adding a "Prior knowledge reused" section at the top from Step 0's retrieval pass (or the line "retrieval ran (terms: …), nothing relevant found"). Delete the temporary questions file.

Update the Feature Brief

After writing the research document, update the parent brief with a back-reference:

  1. Read docs/features/<slug>/brief.md
  2. In the header blockquote (the > lines at the top), add or update: > **Research:** docs/features/<slug>/research.md
  3. If a > **Research:** line already exists, replace it — do NOT add a duplicate
  4. Write the brief back

Decide first — the pre-presentation rule

If the artifact contains any open question, or any load-bearing claim anchored ≤50, invoke $joycraft-decide on it NOW — before presenting. The Block Rule (docs/context/anchors.md) fires pre-approval, every time; presenting an artifact with open questions asks the human to approve an incomplete artifact. If the human already answered them in conversation, that counts as termination: stamp the decisions: frontmatter and proceed — no dossier required. Zero open questions and no ≤50 claims → the gate passes silently.

Render and open the research

docs/features/<slug>/research.md is written first and stays canonical — agents read the md, never the HTML. The HTML is a render of it and never invents content.

  1. Read docs/templates/REVIEW_GATE_TEMPLATE.html. Fill ONLY the <!-- SLOT:name — … --> regions per each slot's inline guidance; the template's structure, class names, CSS, and theme script stay byte-identical — never generate freeform gate HTML.
  2. Write it to docs/features/<slug>/research.html (committed later — the path is already linguist-generated, so PRs collapse it). Re-running the gate overwrites the same file; the md is the record.
  3. Open it before asking anything: open <path> on darwin, xdg-open <path> otherwise. If both fail, print the absolute path and continue — headless, CI, and isolated mode are a no-op here, never a failure.
  4. Offer — don't push — an optional extra render: "I can also publish this research as a hosted artifact for a shareable link." Only publish if the human says yes; the local file remains the canonical render. If declined, no retry.
  5. When the readout carries two or more questions for the human, the render is an interactive checkpoint instead: build it per docs/templates/reference/interactive-checkpoint.md and read the answers back before stamping. The local file stays the canonical render.

At this gate, your chat message is EXACTLY this template — nothing outside it. The content lives in the artifact, not the chat. Findings go in the research document — never paste them into chat.

**Research complete: <the finding that changes what we build, one line>**
Artifact: <absolute path> (opened) · canonical: docs/features/<slug>/research.md
Decisions needed: <N> — <ids/titles, comma-separated>
<one-line summary per decision, only if N ≤ 4>
Next: <the single action you want from the human>

Ten lines maximum. If you are about to write an eleventh line, the content
belongs in the artifact — move it there.

Keep it inline here on purpose: inline placement is load-bearing — referenced docs get partially read or skipped at output time (Anthropic skill-authoring guidance; observed live 2026-07-29).

The block below is the artifact's content, not your chat message.

Present:

Research complete: docs/features/<slug>/research.md

This document contains objective facts — no opinions or recommendations.

Recommended next step:
- $joycraft-design — translate research findings into architectural decisions before building

If the scope is simple (< 5 files, well-understood area, no architectural decisions):
- $joycraft-decompose — skip design and break directly into atomic specs

Other options:
- $joycraft-new-feature — formalize into a full Feature Brief first
- Read the research and add corrections manually

Phase 4: Reconcile Brief with Findings

You've just written docs/features/<slug>/research.md. Before hand-off, the parent brief at docs/features/<slug>/brief.md may now disagree with what you discovered. Re-read it and check each of these sections:

Brief sectionWhat to look for
VisionDid your findings refine or contradict the framing?
Hard ConstraintsAre any constraints now obsolete, missing, or refined?
Out of ScopeDid your findings push something in or out of scope?
DecompositionAre spec counts, names, or dependencies still accurate?
Test StrategyDo your findings change what or how to test?
Success CriteriaAre the criteria still observable and still match the goal?

For each section, choose one:

  • Edit in place — small, mechanical updates: line-number corrections, clarifications, additions consistent with brief intent. No user approval needed.
  • Diff + stop — non-trivial changes: counts flipping, decomposition restructure, scope changes, contradiction with original brief intent. Present a diff of the proposed change, STOP, and wait for user approval before continuing.

If you make changes, note them at the bottom of research.md under a "Brief updates" subsection. If the brief is already in sync, note: "Reconciliation checked, no changes required." If no parent brief exists (feature was described inline), note that and skip this step.

Why this step exists: the silent-drift gap. Without reconciliation, the brief and downstream artifacts diverge — and later decomposition is sized against the stale brief. This feature ("single-source-skills") hit exactly this: brief said "11 clean / 9 dirty" until the research re-audit forced a re-decomposition. Don't let it happen again.

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.