The GitHub Blog 12小时前
GitHub Copilot Spaces: Bring the right context to every suggestion
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

GitHub Copilot Spaces通过允许用户将代码、文档、脚本等相关信息捆绑到一个可重复使用的“空间”中,解决了生成式AI工具在缺乏特定上下文时可能产生的猜测问题。用户可以创建个性化的空间,让Copilot基于这些精心策划的知识提供更准确、更符合组织需求的答案。文章介绍了Copilot Spaces的功能、优势,包括快速入门指南、自定义指令、实际应用案例以及未来的发展方向,旨在提升AI辅助开发效率。

💡 **什么是Copilot Spaces?** 这是一个安全的、可共享的知识容器,其中包含附件(代码文件、文档、脚本等)和行为指令(自定义指令)。它允许Copilot根据你提供的特定上下文信息来生成答案,从而减少错误猜测,提高代码质量。

🚀 **快速入门指南:** 创建空间非常简单,只需在GitHub Copilot Spaces页面点击“创建空间”,命名并添加描述,然后添加相关上下文,例如代码文件、文档或自由文本。最后,编写自定义指令以个性化Copilot的行为,例如设置编码风格或审查标准。

⚙️ **个性化设置:** 通过自定义指令,用户可以定制Copilot的编码风格、团队风格和特定项目的术语。这种个性化设置使得Copilot能够更好地适应团队的工作流程和规范,提供更准确、更符合要求的代码建议。

💡 **实际应用案例:** 文章提供了几个实际应用案例,包括:辅助进行可访问性合规、帮助进行数据查询以及作为入职引导和知识库。这些案例展示了Copilot Spaces在不同场景下的应用,以及如何提高工作效率。

🌐 **协作与权限:** Copilot Spaces遵循与GitHub相同的权限模型,包括个人空间、组织拥有的空间。分享空间就像发送空间URL或将其固定到仓库README一样简单。任何拥有访问权限和Copilot许可证的人都可以立即开始聊天。

When generative AI tools guess what you need, the magic only lasts as long as the guesses are right. Add an unfamiliar codebase, a security checklist your team keeps in a wiki, or a one‑off Slack thread that explains why something matters, and even the most and even the most powerful model may fill in gaps with assumptions rather than having access to your specific context and knowledge.

GitHub Copilot Spaces fixes that problem by letting you bundle the exact context Copilot should read—code, docs, transcripts, sample queries, you name it—into a reusable “space.” Once a space is created, every Copilot chat, completion, or command is grounded in that curated knowledge, producing answers that feel like they came from your organization’s resident expert instead of a generic model. 

In this article, we’ll walk through:

Why context is the new bottleneck for AI‑assisted development

Large language models (LLMs) thrive on patterns, but day‑to‑day engineering work is full of unpatterned edge cases, including:

Without that context, an AI assistant can only guess. But with Copilot Spaces, you choose which files, documents, or free‑text snippets matter, drop them into a space, and let Copilot use that context to answer questions or write code. As Kelly Henckel, PM for GitHub Spaces, said in our GitHub Checkout episode, “Spaces make it easy to organize and share context, so Copilot acts like a subject matter expert.” The result? Fewer wrong guesses, less copy-pasting, and code that’s commit-ready.

What exactly is a Copilot Space?

Think of a space as a secure, shareable container of knowledge plus behavioral instructions:

What it holdsWhy it matters
AttachmentsCode files, entire folders, Markdown docs, transcripts, or any plain text you addGives Copilot the ground truth for answers
Custom instructionsShort system prompts to set tone, coding style, or reviewer expectationsLets Copilot match your house rules
Sharing & permissionsFollows the same role/visibility model you already use on GitHubNo new access control lists to manage
Live updatesFiles stay in sync with the branch you referencedYour space stays up to date with your codebase


Spaces are available to anyone with a Copilot license (Free, Individual, Business, or Enterprise) while the feature is in public preview. Admins can enable it under Settings  > Copilot > Preview features.

TL;DR: A space is like pinning your team’s collective brain to the Copilot sidebar and letting everyone query it in plain language.

Quick-start guide: How to build your first space in 5 minutes

    Navigate to github.com/copilot/spaces and click Create space.Name it clearly. For example, frontend‑styleguide.Add a description so teammates know when—and when not—to use it.Attach context:
    Write custom instructions. A sentence or two is enough:
    Save and test it. You’re done. Ask Copilot a question in the Space chat—e.g., “Refactor this <Button> component to match our accessibility checklist”—and watch it cite files you just attached.

Personalize Copilot’s coding style (and voice, too) 

Custom instructions are the “personality layer” of a space and where spaces shine because they live alongside the attachments. This allows you to do powerful things with a single sentence, including:

During the GitHub Checkout interview, Kelly shared how she built a personal space for a nonprofit side project: She attached only the Vue front‑end folder plus instructions on her preferred conventions, and Copilot delivered commit‑ready code snippets that matched her style guide on the first try.

Automate your workflow: three real‑world recipes

1. Accessibility compliance assistant

Space ingredients

How it helps: Instead of pinging the accessibility lead on Slack, you can use Spaces to ask questions like “What steps are needed for MAS‑C compliance on this new modal?” Copilot summarizes the relevant checkpoints, references the doc anchor, and even suggests ARIA attributes or color‑contrast fixes. GitHub’s own accessibility SME, Katherine, pinned this space in Slack so anyone filing a review gets instant, self‑service guidance.

2. Data‑query helper for complex schemas

Space ingredients

How it helps: Product managers and support engineers who don’t know your database structures can ask, “Average PR review time last 7 days?” Copilot autocompletes a valid KQL query with correct joins and lets them iterate. Result: lets PMs and support self-serve without bugging data science teams.

3. Onboarding Hub and knowledge base in one link

Space ingredients

How it helps: New hires type “How does our auth flow handle SAML?” and get a structured answer with links and diagrams, all without leaving GitHub. Because spaces stay in sync with main, updates to ADRs propagate automatically—no stale wikis.

Collaboration that feels native to GitHub

Spaces respect the same permission model you already use:

Sharing is as simple as sending the space URL or pinning it to a repo README. Anyone with access and a Copilot license can start chatting instantly.

What’s next for Copilot Spaces?

We’re working to bring Copilot Spaces to more of your workflows, and are currently developing:

Your feedback will shape those priorities. Drop your ideas or pain points in the public discussion or, if you’re an enterprise customer, through your account team. 

Get started today

Head to github.com/copilot/spaces, spin up your first space, and let us know how it streamlines your workflow. Here’s how to get it fully set up on your end: 

    Flip the preview toggle: Settings > Copilot  >  Preview features > Enable Copilot Spaces.Create one small, high‑impact space—maybe your team’s code‑review checklist or a set of common data queries.Share the link in Slack or a README and watch the pings to subject‑matter experts drop.Iterate: prune unused attachments, refine instructions, or split a giant space into smaller ones.

Copilot Spaces is free during the public preview and doesn’t count against your Copilot seat entitlements when you use the base model. We can’t wait to see what you build when Copilot has the right context at its fingertips.

The post GitHub Copilot Spaces: Bring the right context to every suggestion appeared first on The GitHub Blog.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

GitHub Copilot AI辅助开发 代码生成 Copilot Spaces
相关文章