diff --git a/debian/changelog b/debian/changelog
index 537491e..b132581 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,13 @@
-debhelper (9.20120609) UNRELEASED; urgency=low
+debhelper (9.20120609~local1) UNRELEASED; urgency=low
 
+  [ Joey Hess ]
   * dh_shlibdeps: Warn if -V flag is passed, to avoid it accidentially being
     used here rather than in dh_makeshlibs. Closes: #680339
 
- -- Joey Hess <joeyh@debian.org>  Thu, 05 Jul 2012 08:51:07 -0600
+  [ Niels Thykier ]
+  * Prototype "skip unneeded dh_* commands" test.
+
+ -- Niels Thykier <niels@thykier.net>  Thu, 12 Jul 2012 17:40:55 +0200
 
 debhelper (9.20120608) unstable; urgency=low
 
diff --git a/dh b/dh
index 17919dc..e2ad980 100755
--- a/dh
+++ b/dh
@@ -341,7 +341,22 @@ if ($sequence eq 'debian/rules' ||
 	exit 0;
 }
 
+# Table of dh_<cmd> that can be skipped unless one of the pkgfiles listed are present.
+# - commands are sorted by name
+my %auto_skip = (
+	"dh_bugfiles" => [qw(bug-script bug-control bug-presubj)],
+	"dh_install" => ["install"],
+	"dh_installcron" => [qw(cron.daily cron.weekly cron.monthly cron.hourly cron.d)],
+	"dh_installcatalogs" => ["sgmlcatalogs"],
+	"dh_installemacsen" => [qw(emacsen-install emacsen-remove emacsen-startup)],
+	"dh_installexamples" => ["examples"],
+	"dh_installifupdown" => [qw(if-up if-down if-pre-up if-post-down)],
+	"dh_installinfo" => ["info"],
+	"dh_lintian" => ["lintian-overrides"],
+	"dh_installmenu" => ["menu", "menu-method"],
+	"dh_ucf" => ["ucf"],
 
+);
 # Definitions of sequences.
 my %sequences;
 my @bd_minimal = qw{
@@ -671,13 +686,22 @@ foreach my $i (0..$stoppoint) {
 	# No need to run the command for any packages handled by the
 	# override targets.
 	my %todo=map { $_ => 1 } @todo;
+	my @dfiles = exists $auto_skip{$command} ? @{$auto_skip{$command}} : ();
+	my $skip = scalar @dfiles;
 	foreach my $package (@oldtodo) {
 		if (! $todo{$package}) {
 			push @opts, "-N$package";
 		}
+		if ($skip and (grep { pkgfile($package, $_) } @dfiles)) {
+			$skip = 0;
+		}
 	}
 
-	run($command, @opts);
+	if ($skip) {
+		print "   Skipped $command (nothing to do)\n";
+	} else {
+		run($command, @opts);
+	}
 }
 
 sub run {
