Sketch Assistants
What are Sketch Assistants and how do you use them?
With Sketch 68 comes a revolutionary new addition to design workflow — Sketch Assistants. In a nutshell, Assistants bring document integrity checking to Sketch. They allow you to define rules against which documents will be checked in real-time. Should anything you do to your document violate any rule, the Assistants pane notifies you and gives you an easy means to resolve it (or, indeed, ignore it).
This is a godsend for ever-growing design teams that need more house rules for closer collaboration, more complex UI designs, brand guidelines, and accessibility.
In this article, I shall walk you through getting Sketch Assistants into your designs and show you how they work. It won’t take long, I promise you, before you start whispering “wow” under your breath.
What are Assistants?
Assistants are not plugins, although they are built on similar technology. Better to think of them as document-specific add-ins that check the document against your predetermined rule set. Your rules can be anything you wish (and there is also a repository of prebuilt Assistants, which I’ll get to later).
For example, you may wish to force naming conventions on artboards and/or layers. If ever you have opened a Sketch file sent to you with confusing layer names (copy 23, copy 41, Group 12, Group 53, Rectangle copy 8, etc.) you might already be fidgeting in your seat at the prospect of this alone. But the possibilities are limitless. To give you a flavor, you might want rules that:
- ensure that text layers always have a text style;
- layer and text styles should not be ‘dirty’ (i.e. have a modified, but not updated, style);
- identify (and remove) styles that are included in the document, but not used for any layer;
- assess foreground/background color combinations for accessibility compliance.
You get the idea.
As I mentioned above, Assistants are document-specific. That is, they check the rules applied to a particular document. In turn, that means the desired Assistants must be added to documents individually. That makes sense and allows you flexibility across all your designs or client work.
Adding Assistants to a Document
When you open Sketch you’ll notice that there is a new Assistants button in the toolbar. Clicking the button displays the new Assistants pane.
Clicking Find Assistants takes you to the online Assistants repository, where you can browse for Assistants from Sketch or third parties. Say we wanted to add the Naming Conventions Assistant. Clicking the Add to Sketch link for the Assistant automatically takes you back to Sketch and installs the Assistant for you.
Once an Assistant is installed it is enabled for the current document by default, and thereafter you can attach it to any other document.
You can also install Assistants directly from .tgz package files, meaning your team can store all your Assistants in a shared folder on, say, Dropbox.
Using Assistants
Using Assistants is very intuitive. Assistants work behind the scenes in real-time with errors reported in the Assistants pane. The Naming Conventions Assistant, for example, has a rule that says all artboards must start with a number. So if an artboard does not start with a number it breaches the rule and displayed as an error in the Assistants pane. The number of errors found is notified in a badge in the Sketch toolbar, as well as the Assistants pane itself.
Simply clicking on a reported error navigates you to the offending artboard so you can edit it. Similarly, the Naming Conventions Assistant also has a rule that says groups cannot simply be called ‘Group’ (a particular bugbear of mine). Again, clicking on an error navigates to the group so you can rename it. These processes are shown in the animation below.
You can add as many Assistants to a document as you wish. So, say we want to add the Tidy Assistant using the same process as above. It immediately goes to work and reports that there are more than 99 errors in our example document, as shown in the animation below.
You can right-click any rule and disable it for the current document. With the rule no longer enabled, the number of errors is recalculated and displayed in the badges. You can then set about correcting the errors with the same process we used above. When all errors for all Assistants have been cleared, the badge in the Sketch toolbar changes to a comforting green checkmark.
Managing Assistants
As well as ignoring specific rules within an Assistant, you can disable or enable any installed Assistant for the current document (or uninstall it completely). Simply click on the cogwheel icon in the top-right of the Assistants pane and select Manage Assistants. The checkbox for each Assistant allows for quick enable/disable, and if you right-click an Assistant you have the option to uninstall it.
Distributing Files with Assistants
Once Assistants are added to a document, they are always called for when the document is opened. So if you make a copy of your Sketch file and send it to someone else, the Assistants pane will notify them that they need to add the required Assistants. For all ‘missing’ Assistants, a question mark is displayed in the Assistants pane, in place of the icon for the Assistant itself (see the animation below).
Clicking Install or Manage Assistants allows you to add the required Assistants. As soon as they are added the file is checked against the Assistant rules and any errors reported in the usual manner.
Creating Assistants
If you cannot find an Assistant to meet your specific needs, you can create your own. Creating Assistants for yourself or your enterprise is easy — so long as you know JavaScript, that is. Those that have created a Sketch plugins will find Assistants to be a walk in the park. But anyone who is familiar with scripting should be able to get their head around it quite quickly, not least because there is no UI to code — it is purely a matter of creating the rules and what to display in the event of an error (as well as designing an icon for it).
Sketch Assistants is an open platform, so you can create your own Assistants and post them in the directory for others to browse. Sketch has published developer documentation and you can also view the project on Github. For a jump-start, you can also download an Assistants template.
Summary
Assistants are in their infancy, of course, and there are naturally few to download at the time of writing. But expect that to change quickly once the developer community wades in. The term ‘game-changer’ tends to be overstated on occasion. But when it comes to Sketch Assistants, ‘game-changer’ is, if anything, and understatement. The possibilities are endless and they will revolutionize the way in which individual designers, teams, and digital agencies work.
Get stuck in.
Colin Shanley has been a designer and author for more than 30 years. You can follow his Medium.com articles here, or view his published works on Amazon.